account

package
v0.0.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const ServiceName = "account"

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 = [6]string{"create", "get", "update", "delete", "groupAdd", "groupRemove"}

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 MakeNotImplemented

func MakeNotImplemented(err error) *goa.ServiceError

MakeNotImplemented builds a goa.ServiceError from an error.

func NewCreateEndpoint

func NewCreateEndpoint(s Service, authBasicFn security.AuthBasicFunc) goa.Endpoint

NewCreateEndpoint returns an endpoint function that calls the method "create" of service "account".

func NewDeleteEndpoint

func NewDeleteEndpoint(s Service, authBasicFn security.AuthBasicFunc) goa.Endpoint

NewDeleteEndpoint returns an endpoint function that calls the method "delete" of service "account".

func NewGetEndpoint

func NewGetEndpoint(s Service, authBasicFn security.AuthBasicFunc) goa.Endpoint

NewGetEndpoint returns an endpoint function that calls the method "get" of service "account".

func NewGroupAddEndpoint

func NewGroupAddEndpoint(s Service, authBasicFn security.AuthBasicFunc) goa.Endpoint

NewGroupAddEndpoint returns an endpoint function that calls the method "groupAdd" of service "account".

func NewGroupRemoveEndpoint

func NewGroupRemoveEndpoint(s Service, authBasicFn security.AuthBasicFunc) goa.Endpoint

NewGroupRemoveEndpoint returns an endpoint function that calls the method "groupRemove" of service "account".

func NewUpdateEndpoint

func NewUpdateEndpoint(s Service, authBasicFn security.AuthBasicFunc) goa.Endpoint

NewUpdateEndpoint returns an endpoint function that calls the method "update" of service "account".

Types

type Account

type Account struct {
	// Temporary account identifier
	ID *int64 `gorm:"autoIncrement" json:"id,omitempty"`
	// IDP account identifier
	GUID *string `json:"guid,omitempty"`
	// Name of user
	Name string
	// Login of user
	Login string `gorm:"uniqueIndex" json:"login"`
	// Email of user
	Email string
	// Status of account
	Status *string
}

Account is the result type of the account service create method.

type Auther

type Auther interface {
	// BasicAuth implements the authorization logic for the Basic security scheme.
	BasicAuth(ctx context.Context, user, pass string, schema *security.BasicScheme) (context.Context, error)
}

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

type Client

type Client struct {
	CreateEndpoint      goa.Endpoint
	GetEndpoint         goa.Endpoint
	UpdateEndpoint      goa.Endpoint
	DeleteEndpoint      goa.Endpoint
	GroupAddEndpoint    goa.Endpoint
	GroupRemoveEndpoint goa.Endpoint
}

Client is the "account" service client.

func NewClient

func NewClient(create, get, update, delete_, groupAdd, groupRemove goa.Endpoint) *Client

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

func (*Client) Create

func (c *Client) Create(ctx context.Context, p *CreatePayload) (res *Account, err error)

Create calls the "create" endpoint of the "account" service.

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, p *DeletePayload) (err error)

Delete calls the "delete" endpoint of the "account" service.

func (*Client) Get

func (c *Client) Get(ctx context.Context, p *GetPayload) (res *Account, err error)

Get calls the "get" endpoint of the "account" service.

func (*Client) GroupAdd

func (c *Client) GroupAdd(ctx context.Context, p *GroupAddPayload) (err error)

GroupAdd calls the "groupAdd" endpoint of the "account" service.

func (*Client) GroupRemove

func (c *Client) GroupRemove(ctx context.Context, p *GroupRemovePayload) (err error)

GroupRemove calls the "groupRemove" endpoint of the "account" service.

func (*Client) Update

func (c *Client) Update(ctx context.Context, p *UpdatePayload) (res *Account, err error)

Update calls the "update" endpoint of the "account" service. Update may return the following errors:

  • "NotImplemented" (type *goa.ServiceError)
  • error: internal error

type CreateAccount

type CreateAccount struct {
	// Name of user
	Name string
	// Login of user
	Login string
	// Email of user
	Email string
}

type CreatePayload

type CreatePayload struct {
	Username string
	Password string
	Account  *CreateAccount
}

CreatePayload is the payload type of the account service create method.

type DeletePayload

type DeletePayload struct {
	Username string
	Password string
	// Account ID
	AccountID string
}

DeletePayload is the payload type of the account service delete method.

type Endpoints

type Endpoints struct {
	Create      goa.Endpoint
	Get         goa.Endpoint
	Update      goa.Endpoint
	Delete      goa.Endpoint
	GroupAdd    goa.Endpoint
	GroupRemove goa.Endpoint
}

Endpoints wraps the "account" service endpoints.

func NewEndpoints

func NewEndpoints(s Service) *Endpoints

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

func (*Endpoints) Use

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

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

type GetPayload

type GetPayload struct {
	// Username
	Username string
	// Password
	Password string
	// Account ID
	AccountID string
}

GetPayload is the payload type of the account service get method.

type GroupAddPayload

type GroupAddPayload struct {
	Username string
	Password string
	// Account ID
	AccountID string
	// Group ID
	GroupID string
}

GroupAddPayload is the payload type of the account service groupAdd method.

type GroupRemovePayload

type GroupRemovePayload struct {
	Username string
	Password string
	// Account ID
	AccountID string
	// Group ID
	GroupID string
}

GroupRemovePayload is the payload type of the account service groupRemove method.

type Service

type Service interface {
	// Creates an account. Note that the client may choose to create a shadow
	// account or hold the account in a temporary store until the actual account
	// materializes.
	Create(context.Context, *CreatePayload) (res *Account, err error)
	// Get account details
	Get(context.Context, *GetPayload) (res *Account, err error)
	// Update account details
	Update(context.Context, *UpdatePayload) (res *Account, err error)
	// Delete an account
	Delete(context.Context, *DeletePayload) (err error)
	// Add an account to a group
	GroupAdd(context.Context, *GroupAddPayload) (err error)
	// Remove an account from a group
	GroupRemove(context.Context, *GroupRemovePayload) (err error)
}

Accounts APIs

type UpdateAccount

type UpdateAccount struct {
	// Status of user
	Status string
}

type UpdatePayload

type UpdatePayload struct {
	// Username
	Username string
	// Password
	Password string
	// Account ID
	AccountID string
	Account   *UpdateAccount
}

UpdatePayload is the payload type of the account service update method.

Jump to

Keyboard shortcuts

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