approval

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2022 License: MIT Imports: 4 Imported by: 2

Documentation

Index

Constants

View Source
const ServiceName = "Approval"

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{"show", "index", "approve", "deny"}

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 MakeBadGateway

func MakeBadGateway(err error) *goa.ServiceError

MakeBadGateway builds a goa.ServiceError from an error.

func MakeBadRequest

func MakeBadRequest(err error) *goa.ServiceError

MakeBadRequest builds a goa.ServiceError from an error.

func MakeForbidden

func MakeForbidden(err error) *goa.ServiceError

MakeForbidden builds a goa.ServiceError from an error.

func MakeInternalError

func MakeInternalError(err error) *goa.ServiceError

MakeInternalError 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 NewApproveEndpoint

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

NewApproveEndpoint returns an endpoint function that calls the method "approve" of service "Approval".

func NewDenyEndpoint

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

NewDenyEndpoint returns an endpoint function that calls the method "deny" of service "Approval".

func NewIndexEndpoint

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

NewIndexEndpoint returns an endpoint function that calls the method "index" of service "Approval".

func NewShowEndpoint

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

NewShowEndpoint returns an endpoint function that calls the method "show" of service "Approval".

func NewViewedApprovalRequest

func NewViewedApprovalRequest(res *ApprovalRequest, view string) *approvalviews.ApprovalRequest

NewViewedApprovalRequest initializes viewed result type ApprovalRequest from result type ApprovalRequest using the given view.

func NewViewedApprovalRequestList

func NewViewedApprovalRequestList(res *ApprovalRequestList, view string) *approvalviews.ApprovalRequestList

NewViewedApprovalRequestList initializes viewed result type ApprovalRequestList from result type ApprovalRequestList using the given view.

Types

type ApprovalRequest

type ApprovalRequest struct {
	// id identifies an approval request by ID.
	ID string
	// project_id is the ID of the project where this approval request is created.
	ProjectID uint
	// href is the href of the approval request
	Href string
	// label is a short title for this approval request
	Label *string
	// description describes the details for this approval request.
	Description *string
	// subject is the subject of the approval.
	Subject *ApprovalSubject
	// created_at is the approval request creation timestamp in RFC3339 format.
	CreatedAt *string
	// updated_at is the last update timestamp in RFC3339 format.
	UpdatedAt *string
	// parameters is a list of parameters required for approval request.
	Parameters map[string]*Parameter
	// status is the status of this approval request.
	Status *string
	// options lists the configuration options used to parameterize the approval
	// request.
	Options []*ConfigurationOption
	// approved_by is the RightScale user that approved this approval request.
	ApprovedBy *User
	// approved_at is the approval timestamp in RFC3339 format.
	ApprovedAt *string
	// denial_comment is a comment that explains the reason for denial, if relevant.
	DenialComment *string
	// denied_by is the RightScale user that denied this approval request.
	DeniedBy *User
	// denied_at is the denial timestamp in RFC3339 format.
	DeniedAt *string
	// kind is "gov#approval_request".
	Kind string
}

ApprovalRequest is the result type of the Approval service show method.

func NewApprovalRequest

func NewApprovalRequest(vres *approvalviews.ApprovalRequest) *ApprovalRequest

NewApprovalRequest initializes result type ApprovalRequest from viewed result type ApprovalRequest.

type ApprovalRequestCollection

type ApprovalRequestCollection []*ApprovalRequest

type ApprovalRequestList

type ApprovalRequestList struct {
	// count is the number of approval requests in the list
	Count *uint
	// etag is a HTTP ETag for the list.
	Etag string
	// items is the array of approval requests.
	Items ApprovalRequestCollection
	// not_modified is a flag used internally that indicates how to encode the HTTP
	// response (i.e. 200 or 304).
	NotModified *string
	// kind is "gov#approval_request_list".
	Kind string
}

ApprovalRequestList is the result type of the Approval service index method.

func NewApprovalRequestList

func NewApprovalRequestList(vres *approvalviews.ApprovalRequestList) *ApprovalRequestList

NewApprovalRequestList initializes result type ApprovalRequestList from viewed result type ApprovalRequestList.

type ApprovalSubject

type ApprovalSubject struct {
	// kind is the kind of subject
	Kind string
	// href is the href of the subject.
	Href string
}

ApprovalSubject is the subject of an approval.

type ApprovePayload

type ApprovePayload struct {
	// project_id identifies a project by ID.
	ProjectID uint
	// approval_request_id identifes an approval request by its ID.
	ApprovalRequestID string
	// options lists the configuration options used to parameterize the approval.
	Options []*ConfigurationOptionCreateType
	// JWT token used to perform authorization
	Token *string
	// API Version, must be specified using this header
	APIVersion string
}

ApprovePayload is the payload type of the Approval service approve method.

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 {
	ShowEndpoint    goa.Endpoint
	IndexEndpoint   goa.Endpoint
	ApproveEndpoint goa.Endpoint
	DenyEndpoint    goa.Endpoint
}

Client is the "Approval" service client.

func NewClient

func NewClient(show, index, approve, deny goa.Endpoint) *Client

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

func (*Client) Approve

func (c *Client) Approve(ctx context.Context, p *ApprovePayload) (err error)

Approve calls the "approve" endpoint of the "Approval" service. Approve may return the following errors:

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

func (*Client) Deny

func (c *Client) Deny(ctx context.Context, p *DenyPayload) (err error)

Deny calls the "deny" endpoint of the "Approval" service. Deny may return the following errors:

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

func (*Client) Index

func (c *Client) Index(ctx context.Context, p *IndexPayload) (res *ApprovalRequestList, err error)

Index calls the "index" endpoint of the "Approval" service.

func (*Client) Show

func (c *Client) Show(ctx context.Context, p *ShowPayload) (res *ApprovalRequest, err error)

Show calls the "show" endpoint of the "Approval" service. Show may return the following errors:

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

type ConfigurationOption

type ConfigurationOption struct {
	// name of option
	Name string
	// label of option
	Label string
	// type of option
	Type string
	// value of option
	Value interface{}
	// no_echo determines whether the value of the configuration option should be
	// hidden in UIs and API responses.
	NoEcho bool
}

ConfigurationOption describes a single parameter value used to configure an applied policy.

type ConfigurationOptionCreateType

type ConfigurationOptionCreateType struct {
	// name of option
	Name string
	// value of option
	Value interface{}
}

ConfigurationOptionCreateType is the payload for creating a single parameter value used to configure an applied policy.

type DenyPayload

type DenyPayload struct {
	// project_id identifies a project by ID.
	ProjectID uint
	// approval_request_id identifes an approval request by its ID.
	ApprovalRequestID string
	// A comment that explains the reason for denial
	Comment *string
	// JWT token used to perform authorization
	Token *string
	// API Version, must be specified using this header
	APIVersion string
}

DenyPayload is the payload type of the Approval service deny method.

type Endpoints

type Endpoints struct {
	Show    goa.Endpoint
	Index   goa.Endpoint
	Approve goa.Endpoint
	Deny    goa.Endpoint
}

Endpoints wraps the "Approval" service endpoints.

func NewEndpoints

func NewEndpoints(s Service) *Endpoints

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

func (*Endpoints) Use

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

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

type IndexPayload

type IndexPayload struct {
	// project_id identifies a project by ID.
	ProjectID uint
	// Optional resource ID to filter. Multiple may be specified.
	ID []string
	// Subject kind to filter on.
	SubjectKind *string
	// Subject HREF to filter on.
	SubjectHref *string
	// Status of the approval to filter on. Multiple may be specified.
	Status []string
	// Previous ETag value retrieved by client if any. Service returns an empty
	// response with HTTP status code 304 Not Modified if value matches current
	// value server side.
	Etag *string
	// View used to render approval requests.
	View *string
	// JWT token used to perform authorization
	Token *string
	// API Version, must be specified using this header
	APIVersion string
}

IndexPayload is the payload type of the Approval service index method.

type Parameter

type Parameter struct {
	// Name of the parameter
	Name string `json:"name"`
	// Type of the parameter
	Type string `json:"type"`
	// Label to show in the UI
	Label string `json:"label"`
	// The index of this parameter in the list
	Index uint `json:"index"`
	// The category used to group parameters
	Category *string `json:"category"`
	// Description of the parameter
	Description *string `json:"description"`
	// The default value for the parameter
	Default interface{} `json:"default"`
	// no_echo determines whether the value of the parameter should be hidden in
	// UIs and API responses.
	NoEcho bool `json:"no_echo"`
	// List of values allowed for this parameter
	AllowedValues []interface{} `json:"allowed_values"`
	// The minimum length of a string parameter
	MinLength *uint `json:"min_length"`
	// The maximum length of a string parameter
	MaxLength *uint `json:"max_length"`
	// The minimum value of a number parmameter
	MinValue *float64 `json:"min_value"`
	// The maximum value of a number parameter
	MaxValue *float64 `json:"max_value"`
	// The regular expression pattern used to validate a string parameter
	AllowedPattern *Regexp `json:"allowed_pattern"`
	// The description used for constraints
	ConstraintDescription *string `json:"constraint_description"`
}

Parameter defines a parameter given as input to a Policy

type Regexp

type Regexp struct {
	// Pattern is the regular expression pattern.
	Pattern string `json:"pattern"`
	// Options are the regular expression options. Options i (case insensitve) and
	// m (match over newlines) supported.
	Options *string `json:"options"`
}

Regular expression

type Service

type Service interface {
	// Show retrieves the details of an approval request.
	// The "view" return value must have one of the following views
	//	- "default"
	//	- "extended"
	Show(context.Context, *ShowPayload) (res *ApprovalRequest, view string, err error)
	// Index retrieves the list of approval requests in a project.
	// The "view" return value must have one of the following views
	//	- "default"
	//	- "extended"
	Index(context.Context, *IndexPayload) (res *ApprovalRequestList, view string, err error)
	// Approve approves a single approval request.
	Approve(context.Context, *ApprovePayload) (err error)
	// Deny denies a single approval request.
	Deny(context.Context, *DenyPayload) (err error)
}

Service is the Approval service interface.

type ShowPayload

type ShowPayload struct {
	// project_id identifies a project by ID.
	ProjectID uint
	// approval_request_id identifes an approval by its ID.
	ApprovalRequestID string
	// View used to render approval request.
	View *string
	// JWT token used to perform authorization
	Token *string
	// API Version, must be specified using this header
	APIVersion string
}

ShowPayload is the payload type of the Approval service show method.

type User

type User struct {
	// ID of user
	ID uint
	// email of user
	Email string
	// name of user, usually of the form 'First Last'
	Name string
}

User represents a registered RightScale user.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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