admin

package
v0.0.0-...-520f1c6 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const ServiceName = "admin"

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 = [2]string{"UpdateAgent", "RefreshConfig"}

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 MakeInternalError

func MakeInternalError(err error) *goa.ServiceError

MakeInternalError builds a goa.ServiceError from an error.

func MakeInvalidPayload

func MakeInvalidPayload(err error) *goa.ServiceError

MakeInvalidPayload builds a goa.ServiceError from an error.

func MakeInvalidScopes

func MakeInvalidScopes(err error) *goa.ServiceError

MakeInvalidScopes builds a goa.ServiceError from an error.

func MakeInvalidToken

func MakeInvalidToken(err error) *goa.ServiceError

MakeInvalidToken builds a goa.ServiceError from an error.

func NewRefreshConfigEndpoint

func NewRefreshConfigEndpoint(s Service, authJWTFn security.AuthJWTFunc) goa.Endpoint

NewRefreshConfigEndpoint returns an endpoint function that calls the method "RefreshConfig" of service "admin".

func NewUpdateAgentEndpoint

func NewUpdateAgentEndpoint(s Service, authJWTFn security.AuthJWTFunc) goa.Endpoint

NewUpdateAgentEndpoint returns an endpoint function that calls the method "UpdateAgent" of service "admin".

Types

type Auther

type Auther interface {
	// JWTAuth implements the authorization logic for the JWT security scheme.
	JWTAuth(ctx context.Context, token string, schema *security.JWTScheme) (context.Context, error)
}

Auther defines the authorization functions to be implemented by the service.

type Client

type Client struct {
	UpdateAgentEndpoint   goa.Endpoint
	RefreshConfigEndpoint goa.Endpoint
}

Client is the "admin" service client.

func NewClient

func NewClient(updateAgent, refreshConfig goa.Endpoint) *Client

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

func (*Client) RefreshConfig

func (c *Client) RefreshConfig(ctx context.Context, p *RefreshConfigPayload) (res *RefreshConfigResult, err error)

RefreshConfig calls the "RefreshConfig" endpoint of the "admin" service.

func (*Client) UpdateAgent

func (c *Client) UpdateAgent(ctx context.Context, p *UpdateAgentPayload) (res *UpdateAgentResult, err error)

UpdateAgent calls the "UpdateAgent" endpoint of the "admin" service.

type Endpoints

type Endpoints struct {
	UpdateAgent   goa.Endpoint
	RefreshConfig goa.Endpoint
}

Endpoints wraps the "admin" service endpoints.

func NewEndpoints

func NewEndpoints(s Service) *Endpoints

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

func (*Endpoints) Use

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

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

type RefreshConfigPayload

type RefreshConfigPayload struct {
	// User JWT
	Token string
}

RefreshConfigPayload is the payload type of the admin service RefreshConfig method.

type RefreshConfigResult

type RefreshConfigResult struct {
	// Config file checksum
	Checksum string
}

RefreshConfigResult is the result type of the admin service RefreshConfig method.

type Service

type Service interface {
	// Create or Update an agent user with required scopes
	UpdateAgent(context.Context, *UpdateAgentPayload) (res *UpdateAgentResult, err error)
	// Refresh the changes in config file
	RefreshConfig(context.Context, *RefreshConfigPayload) (res *RefreshConfigResult, err error)
}

Admin service

type UpdateAgentPayload

type UpdateAgentPayload struct {
	// User JWT
	Token string
	// Name of Agent
	Name string
	// Scopes required for Agent
	Scopes []string
}

UpdateAgentPayload is the payload type of the admin service UpdateAgent method.

type UpdateAgentResult

type UpdateAgentResult struct {
	// Agent JWT
	Token string
}

UpdateAgentResult is the result type of the admin service UpdateAgent method.

Jump to

Keyboard shortcuts

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