Help us shape the future of Go! Take the 2026 Go Developer Survey

agent

package
v0.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 25, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const APIName = "kube-workspaces"

APIName is the name of the API as defined in the design.

View Source
const APIVersion = "1.0.0"

APIVersion is the version of the API as defined in the design.

View Source
const ServiceName = "agent"

ServiceName is the name of the service as defined in the design. This is the same value that is set in the endpoint request contexts under the ServiceKey key.

Variables

View Source
var MethodNames = [4]string{"attach", "renew", "status", "release"}

MethodNames lists the service method names as defined in the design. These are the same values that are set in the endpoint request contexts under the MethodKey key.

Functions

func NewAttachEndpoint

func NewAttachEndpoint(s Service) goa.Endpoint

NewAttachEndpoint returns an endpoint function that calls the method "attach" of service "agent".

func NewReleaseEndpoint

func NewReleaseEndpoint(s Service) goa.Endpoint

NewReleaseEndpoint returns an endpoint function that calls the method "release" of service "agent".

func NewRenewEndpoint

func NewRenewEndpoint(s Service) goa.Endpoint

NewRenewEndpoint returns an endpoint function that calls the method "renew" of service "agent".

func NewStatusEndpoint

func NewStatusEndpoint(s Service) goa.Endpoint

NewStatusEndpoint returns an endpoint function that calls the method "status" of service "agent".

func NewViewedAgentRelease

func NewViewedAgentRelease(res *AgentRelease, view string) *agentviews.AgentRelease

NewViewedAgentRelease initializes viewed result type AgentRelease from result type AgentRelease using the given view.

func NewViewedAgentRenew

func NewViewedAgentRenew(res *AgentRenew, view string) *agentviews.AgentRenew

NewViewedAgentRenew initializes viewed result type AgentRenew from result type AgentRenew using the given view.

func NewViewedAgentStatus

func NewViewedAgentStatus(res *AgentStatus, view string) *agentviews.AgentStatus

NewViewedAgentStatus initializes viewed result type AgentStatus from result type AgentStatus using the given view.

func NewViewedAgentTicket

func NewViewedAgentTicket(res *AgentTicket, view string) *agentviews.AgentTicket

NewViewedAgentTicket initializes viewed result type AgentTicket from result type AgentTicket using the given view.

Types

type AgentAttachPayload

type AgentAttachPayload struct {
	// Workspace namespace
	Namespace string
	// Workspace name
	Name string
	// Viewer-chosen participant label, echoed in session records. Not an
	// authorization boundary
	Participant *string
}

AgentAttachPayload is the payload type of the agent service attach method.

type AgentRelease

type AgentRelease struct {
	// Whether the session is gone (unknown ids report ok: best-effort release)
	OK bool
}

AgentRelease is the result type of the agent service release method.

func NewAgentRelease

func NewAgentRelease(vres *agentviews.AgentRelease) *AgentRelease

NewAgentRelease initializes result type AgentRelease from viewed result type AgentRelease.

type AgentRenew

type AgentRenew struct {
	// Renewed lifetime in milliseconds
	TTLMs int
	// Agent ticket/API revision
	Protocol int
}

AgentRenew is the result type of the agent service renew method.

func NewAgentRenew

func NewAgentRenew(vres *agentviews.AgentRenew) *AgentRenew

NewAgentRenew initializes result type AgentRenew from viewed result type AgentRenew.

type AgentStatus

type AgentStatus struct {
	// Whether at least one live agent session is bound to this workspace
	Active bool
	// Live (unexpired) session count for this workspace
	Sessions int
	// Agent ticket/API revision
	Protocol int
}

AgentStatus is the result type of the agent service status method.

func NewAgentStatus

func NewAgentStatus(vres *agentviews.AgentStatus) *AgentStatus

NewAgentStatus initializes result type AgentStatus from viewed result type AgentStatus.

type AgentTicket

type AgentTicket struct {
	// Opaque server-side session identifier for renew/release correlation. Never
	// sent to the guest
	ID string
	// Signed bearer ticket (id.payload.signature) to present in the agent attach
	// message
	Ticket string
	// Ticket/session lifetime in milliseconds; renew at half of it
	TTLMs int
	// Agent ticket/API revision
	Protocol int
}

AgentTicket is the result type of the agent service attach method.

func NewAgentTicket

func NewAgentTicket(vres *agentviews.AgentTicket) *AgentTicket

NewAgentTicket initializes result type AgentTicket from viewed result type AgentTicket.

type Client

type Client struct {
	AttachEndpoint  goa.Endpoint
	RenewEndpoint   goa.Endpoint
	StatusEndpoint  goa.Endpoint
	ReleaseEndpoint goa.Endpoint
}

Client is the "agent" service client.

func NewClient

func NewClient(attach, renew, status, release goa.Endpoint) *Client

NewClient initializes a "agent" service client given the endpoints.

func (*Client) Attach

func (c *Client) Attach(ctx context.Context, p *AgentAttachPayload) (res *AgentTicket, err error)

Attach calls the "attach" endpoint of the "agent" service. Attach may return the following errors:

  • "unauthorized" (type Unauthorized)
  • "forbidden" (type Forbidden)
  • "not_found" (type NotFound)
  • "invalid" (type Invalid)
  • error: internal error

func (*Client) Release

func (c *Client) Release(ctx context.Context, p *ReleasePayload) (res *AgentRelease, err error)

Release calls the "release" endpoint of the "agent" service. Release may return the following errors:

  • "unauthorized" (type Unauthorized)
  • "forbidden" (type Forbidden)
  • "not_found" (type NotFound)
  • error: internal error

func (*Client) Renew

func (c *Client) Renew(ctx context.Context, p *RenewPayload) (res *AgentRenew, err error)

Renew calls the "renew" endpoint of the "agent" service. Renew may return the following errors:

  • "unauthorized" (type Unauthorized)
  • "forbidden" (type Forbidden)
  • "not_found" (type NotFound)
  • error: internal error

func (*Client) Status

func (c *Client) Status(ctx context.Context, p *StatusPayload) (res *AgentStatus, err error)

Status calls the "status" endpoint of the "agent" service. Status may return the following errors:

  • "unauthorized" (type Unauthorized)
  • "forbidden" (type Forbidden)
  • "not_found" (type NotFound)
  • error: internal error

type Endpoints

type Endpoints struct {
	Attach  goa.Endpoint
	Renew   goa.Endpoint
	Status  goa.Endpoint
	Release goa.Endpoint
}

Endpoints wraps the "agent" service endpoints.

func NewEndpoints

func NewEndpoints(s Service) *Endpoints

NewEndpoints wraps the methods of the "agent" service with endpoints.

func (*Endpoints) Use

func (e *Endpoints) Use(m func(goa.Endpoint) goa.Endpoint)

Use applies the given middleware to all the "agent" service endpoints.

type Forbidden

type Forbidden string

Editor or admin role with workspace namespace access is required

func (Forbidden) Error

func (e Forbidden) Error() string

Error returns an error description.

func (Forbidden) ErrorName deprecated

func (e Forbidden) ErrorName() string

ErrorName returns the error name.

Deprecated: Use GoaErrorName - https://github.com/goadesign/goa/issues/3105

func (Forbidden) GoaErrorName

func (e Forbidden) GoaErrorName() string

GoaErrorName returns the error name.

type Invalid

type Invalid string

Invalid attach request

func (Invalid) Error

func (e Invalid) Error() string

Error returns an error description.

func (Invalid) ErrorName deprecated

func (e Invalid) ErrorName() string

ErrorName returns the error name.

Deprecated: Use GoaErrorName - https://github.com/goadesign/goa/issues/3105

func (Invalid) GoaErrorName

func (e Invalid) GoaErrorName() string

GoaErrorName returns the error name.

type NotFound

type NotFound string

Workspace not found

func (NotFound) Error

func (e NotFound) Error() string

Error returns an error description.

func (NotFound) ErrorName deprecated

func (e NotFound) ErrorName() string

ErrorName returns the error name.

Deprecated: Use GoaErrorName - https://github.com/goadesign/goa/issues/3105

func (NotFound) GoaErrorName

func (e NotFound) GoaErrorName() string

GoaErrorName returns the error name.

type ReleasePayload

type ReleasePayload struct {
	// Workspace namespace
	Namespace string
	// Workspace name
	Name string
	// Server-side session identifier from attach
	SessionID string
}

ReleasePayload is the payload type of the agent service release method.

type RenewPayload

type RenewPayload struct {
	// Workspace namespace
	Namespace string
	// Workspace name
	Name string
	// Server-side session identifier from attach
	SessionID string
}

RenewPayload is the payload type of the agent service renew method.

type Service

type Service interface {
	// Attach a controller to a workspace's guest agent session, minting a
	// short-lived ticket
	Attach(context.Context, *AgentAttachPayload) (res *AgentTicket, err error)
	// Renew a workspace guest agent session by its server-side id
	// (X-KW-Agent-Session header)
	Renew(context.Context, *RenewPayload) (res *AgentRenew, err error)
	// Report live agent session state for a workspace
	Status(context.Context, *StatusPayload) (res *AgentStatus, err error)
	// Release a workspace guest agent session by its server-side id (best-effort;
	// unknown ids report ok)
	Release(context.Context, *ReleasePayload) (res *AgentRelease, err error)
}

Workspace guest agent sessions: short-lived attach tickets with renew/release for the proxy bridge

type StatusPayload

type StatusPayload struct {
	// Workspace namespace
	Namespace string
	// Workspace name
	Name string
}

StatusPayload is the payload type of the agent service status method.

type Unauthorized

type Unauthorized string

Authentication required

func (Unauthorized) Error

func (e Unauthorized) Error() string

Error returns an error description.

func (Unauthorized) ErrorName deprecated

func (e Unauthorized) ErrorName() string

ErrorName returns the error name.

Deprecated: Use GoaErrorName - https://github.com/goadesign/goa/issues/3105

func (Unauthorized) GoaErrorName

func (e Unauthorized) GoaErrorName() string

GoaErrorName returns the error name.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL