keys

package
v0.0.0-...-4ae6852 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2025 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const APIName = "gram"

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

View Source
const APIVersion = "0.0.1"

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

View Source
const ServiceName = "keys"

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{"createKey", "listKeys", "revokeKey", "verifyKey"}

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 MakeBadRequest

func MakeBadRequest(err error) *goa.ServiceError

MakeBadRequest builds a goa.ServiceError from an error.

func MakeConflict

func MakeConflict(err error) *goa.ServiceError

MakeConflict builds a goa.ServiceError from an error.

func MakeForbidden

func MakeForbidden(err error) *goa.ServiceError

MakeForbidden builds a goa.ServiceError from an error.

func MakeGatewayError

func MakeGatewayError(err error) *goa.ServiceError

MakeGatewayError builds a goa.ServiceError from an error.

func MakeInvalid

func MakeInvalid(err error) *goa.ServiceError

MakeInvalid builds a goa.ServiceError from an error.

func MakeInvariantViolation

func MakeInvariantViolation(err error) *goa.ServiceError

MakeInvariantViolation builds a goa.ServiceError from an error.

func MakeNotFound

func MakeNotFound(err error) *goa.ServiceError

MakeNotFound builds a goa.ServiceError from an error.

func MakeUnauthorized

func MakeUnauthorized(err error) *goa.ServiceError

MakeUnauthorized builds a goa.ServiceError from an error.

func MakeUnexpected

func MakeUnexpected(err error) *goa.ServiceError

MakeUnexpected builds a goa.ServiceError from an error.

func MakeUnsupportedMedia

func MakeUnsupportedMedia(err error) *goa.ServiceError

MakeUnsupportedMedia builds a goa.ServiceError from an error.

func NewCreateKeyEndpoint

func NewCreateKeyEndpoint(s Service, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint

NewCreateKeyEndpoint returns an endpoint function that calls the method "createKey" of service "keys".

func NewListKeysEndpoint

func NewListKeysEndpoint(s Service, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint

NewListKeysEndpoint returns an endpoint function that calls the method "listKeys" of service "keys".

func NewRevokeKeyEndpoint

func NewRevokeKeyEndpoint(s Service, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint

NewRevokeKeyEndpoint returns an endpoint function that calls the method "revokeKey" of service "keys".

func NewVerifyKeyEndpoint

func NewVerifyKeyEndpoint(s Service, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint

NewVerifyKeyEndpoint returns an endpoint function that calls the method "verifyKey" of service "keys".

Types

type Auther

type Auther interface {
	// APIKeyAuth implements the authorization logic for the APIKey security scheme.
	APIKeyAuth(ctx context.Context, key string, schema *security.APIKeyScheme) (context.Context, error)
}

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

type Client

type Client struct {
	CreateKeyEndpoint goa.Endpoint
	ListKeysEndpoint  goa.Endpoint
	RevokeKeyEndpoint goa.Endpoint
	VerifyKeyEndpoint goa.Endpoint
}

Client is the "keys" service client.

func NewClient

func NewClient(createKey, listKeys, revokeKey, verifyKey goa.Endpoint) *Client

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

func (*Client) CreateKey

func (c *Client) CreateKey(ctx context.Context, p *CreateKeyPayload) (res *Key, err error)

CreateKey calls the "createKey" endpoint of the "keys" service. CreateKey may return the following errors:

  • "unauthorized" (type *goa.ServiceError): unauthorized access
  • "forbidden" (type *goa.ServiceError): permission denied
  • "bad_request" (type *goa.ServiceError): request is invalid
  • "not_found" (type *goa.ServiceError): resource not found
  • "conflict" (type *goa.ServiceError): resource already exists
  • "unsupported_media" (type *goa.ServiceError): unsupported media type
  • "invalid" (type *goa.ServiceError): request contains one or more invalidation fields
  • "invariant_violation" (type *goa.ServiceError): an unexpected error occurred
  • "unexpected" (type *goa.ServiceError): an unexpected error occurred
  • "gateway_error" (type *goa.ServiceError): an unexpected error occurred
  • error: internal error

func (*Client) ListKeys

func (c *Client) ListKeys(ctx context.Context, p *ListKeysPayload) (res *ListKeysResult, err error)

ListKeys calls the "listKeys" endpoint of the "keys" service. ListKeys may return the following errors:

  • "unauthorized" (type *goa.ServiceError): unauthorized access
  • "forbidden" (type *goa.ServiceError): permission denied
  • "bad_request" (type *goa.ServiceError): request is invalid
  • "not_found" (type *goa.ServiceError): resource not found
  • "conflict" (type *goa.ServiceError): resource already exists
  • "unsupported_media" (type *goa.ServiceError): unsupported media type
  • "invalid" (type *goa.ServiceError): request contains one or more invalidation fields
  • "invariant_violation" (type *goa.ServiceError): an unexpected error occurred
  • "unexpected" (type *goa.ServiceError): an unexpected error occurred
  • "gateway_error" (type *goa.ServiceError): an unexpected error occurred
  • error: internal error

func (*Client) RevokeKey

func (c *Client) RevokeKey(ctx context.Context, p *RevokeKeyPayload) (err error)

RevokeKey calls the "revokeKey" endpoint of the "keys" service. RevokeKey may return the following errors:

  • "unauthorized" (type *goa.ServiceError): unauthorized access
  • "forbidden" (type *goa.ServiceError): permission denied
  • "bad_request" (type *goa.ServiceError): request is invalid
  • "not_found" (type *goa.ServiceError): resource not found
  • "conflict" (type *goa.ServiceError): resource already exists
  • "unsupported_media" (type *goa.ServiceError): unsupported media type
  • "invalid" (type *goa.ServiceError): request contains one or more invalidation fields
  • "invariant_violation" (type *goa.ServiceError): an unexpected error occurred
  • "unexpected" (type *goa.ServiceError): an unexpected error occurred
  • "gateway_error" (type *goa.ServiceError): an unexpected error occurred
  • error: internal error

func (*Client) VerifyKey

func (c *Client) VerifyKey(ctx context.Context, p *VerifyKeyPayload) (res *ValidateKeyResult, err error)

VerifyKey calls the "verifyKey" endpoint of the "keys" service. VerifyKey may return the following errors:

  • "unauthorized" (type *goa.ServiceError): unauthorized access
  • "forbidden" (type *goa.ServiceError): permission denied
  • "bad_request" (type *goa.ServiceError): request is invalid
  • "not_found" (type *goa.ServiceError): resource not found
  • "conflict" (type *goa.ServiceError): resource already exists
  • "unsupported_media" (type *goa.ServiceError): unsupported media type
  • "invalid" (type *goa.ServiceError): request contains one or more invalidation fields
  • "invariant_violation" (type *goa.ServiceError): an unexpected error occurred
  • "unexpected" (type *goa.ServiceError): an unexpected error occurred
  • "gateway_error" (type *goa.ServiceError): an unexpected error occurred
  • error: internal error

type CreateKeyPayload

type CreateKeyPayload struct {
	SessionToken *string
	// The name of the key
	Name string
	// The scopes of the key that determines its permissions.
	Scopes []string
}

CreateKeyPayload is the payload type of the keys service createKey method.

type Endpoints

type Endpoints struct {
	CreateKey goa.Endpoint
	ListKeys  goa.Endpoint
	RevokeKey goa.Endpoint
	VerifyKey goa.Endpoint
}

Endpoints wraps the "keys" service endpoints.

func NewEndpoints

func NewEndpoints(s Service) *Endpoints

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

func (*Endpoints) Use

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

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

type Key

type Key struct {
	// The ID of the key
	ID string
	// The organization ID this key belongs to
	OrganizationID string
	// The optional project ID this key is scoped to
	ProjectID *string
	// The ID of the user who created this key
	CreatedByUserID string
	// The name of the key
	Name string
	// The store prefix of the api key for recognition
	KeyPrefix string
	// The token of the api key (only returned on key creation)
	Key *string
	// List of permission scopes for this key
	Scopes []string
	// The creation date of the key.
	CreatedAt string
	// When the key was last updated.
	UpdatedAt string
}

Key is the result type of the keys service createKey method.

type ListKeysPayload

type ListKeysPayload struct {
	SessionToken *string
}

ListKeysPayload is the payload type of the keys service listKeys method.

type ListKeysResult

type ListKeysResult struct {
	Keys []*Key
}

ListKeysResult is the result type of the keys service listKeys method.

type RevokeKeyPayload

type RevokeKeyPayload struct {
	// The ID of the key to revoke
	ID           string
	SessionToken *string
}

RevokeKeyPayload is the payload type of the keys service revokeKey method.

type Service

type Service interface {
	// Create a new api key
	CreateKey(context.Context, *CreateKeyPayload) (res *Key, err error)
	// List all api keys for an organization
	ListKeys(context.Context, *ListKeysPayload) (res *ListKeysResult, err error)
	// Revoke a api key
	RevokeKey(context.Context, *RevokeKeyPayload) (err error)
	// Verify an api key
	VerifyKey(context.Context, *VerifyKeyPayload) (res *ValidateKeyResult, err error)
}

Managing system api keys.

type ValidateKeyOrganization

type ValidateKeyOrganization struct {
	// The ID of the organization
	ID string
	// The name of the organization
	Name string
	// The slug of the organization
	Slug string
}

type ValidateKeyProject

type ValidateKeyProject struct {
	// The ID of the project
	ID string
	// The name of the project
	Name string
	// The slug of the project
	Slug string
}

type ValidateKeyResult

type ValidateKeyResult struct {
	// The organization the key belongs to
	Organization *ValidateKeyOrganization
	// The projects accessible with this key
	Projects []*ValidateKeyProject
	// List of permission scopes for this key
	Scopes []string
}

ValidateKeyResult is the result type of the keys service verifyKey method.

type VerifyKeyPayload

type VerifyKeyPayload struct {
	ApikeyToken *string
}

VerifyKeyPayload is the payload type of the keys service verifyKey method.

Jump to

Keyboard shortcuts

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