handler

package
Version: v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2020 License: Apache-2.0 Imports: 4 Imported by: 28

Documentation

Overview

Package handler contains types that are passed into and out of a resource provider's CRUDL functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ProgressEvent

type ProgressEvent struct {
	// OperationStatus indicates whether the handler has reached a terminal state or is
	// still computing and requires more time to complete.
	OperationStatus Status `json:"status,omitempty"`

	// HandlerErrorCode should be provided when OperationStatus is FAILED or IN_PROGRESS.
	HandlerErrorCode string `json:"errorCode,omitempty"`

	// Message which can be shown to callers to indicate the
	//nature of a progress transition or callback delay; for example a message
	//indicating "propagating to edge."
	Message string `json:"message,omitempty"`

	// CallbackContext is an arbitrary datum which the handler can return in an
	// IN_PROGRESS event to allow the passing through of additional state or
	// metadata between subsequent retries; for example to pass through a Resource
	// identifier which can be used to continue polling for stabilization
	CallbackContext map[string]interface{} `json:"callbackContext,omitempty"`

	// CallbackDelaySeconds will be scheduled with an initial delay of no less than the number
	// of seconds specified in the progress event. Set this value to <= 0 to
	// indicate no callback should be made.
	CallbackDelaySeconds int64 `json:"callbackDelaySeconds,omitempty"`

	// ResourceModel is the output resource instance populated by a READ/LIST for synchronous results
	// and by CREATE/UPDATE/DELETE for final response validation/confirmation
	ResourceModel interface{} `json:"resourceModel,omitempty"`

	// ResourceModels is the output resource instances populated by a LIST for
	// synchronous results. ResourceModels must be returned by LIST so it's
	// always included in the response. When ResourceModels is not set, null is
	// returned.
	ResourceModels []interface{} `json:"resourceModels"`

	// NextToken is the token used to request additional pages of resources for a LIST operation
	NextToken string `json:"nextToken,omitempty"`
}

ProgressEvent represent the progress of CRUD handlers.

func NewFailedEvent

func NewFailedEvent(err error) ProgressEvent

NewFailedEvent creates a generic failure progress event based on the error passed in.

func NewProgressEvent

func NewProgressEvent() ProgressEvent

NewProgressEvent creates a new event with a default OperationStatus of Unkown

type Request

type Request struct {
	// The logical ID of the resource in the CloudFormation stack
	LogicalResourceID string

	// The callback context is an arbitrary datum which the handler can return in an
	// IN_PROGRESS event to allow the passing through of additional state or
	// metadata between subsequent retries; for example to pass through a Resource
	// identifier which can be used to continue polling for stabilization
	CallbackContext map[string]interface{}

	// The RequestContext is information about the current
	// invocation.
	RequestContext RequestContext

	// An authenticated AWS session that can be used with the AWS Go SDK
	Session *session.Session
	// contains filtered or unexported fields
}

Request is passed to actions with customer related data such as resource states

func NewRequest

func NewRequest(id string, ctx map[string]interface{}, requestCTX RequestContext, sess *session.Session, previousBody, body []byte) Request

NewRequest returns a new Request based on the provided parameters

func (*Request) Unmarshal

func (r *Request) Unmarshal(v interface{}) error

Unmarshal populates the provided interface with the current properties of the resource

func (*Request) UnmarshalPrevious

func (r *Request) UnmarshalPrevious(v interface{}) error

UnmarshalPrevious populates the provided interface with the previous properties of the resource

type RequestContext added in v1.0.1

type RequestContext struct {
	// The stack ID of the CloudFormation stack
	StackID string

	// The Region of the requester
	Region string

	// The Account ID of the requester
	AccountID string

	// The stack tags associated with the cloudformation stack
	StackTags map[string]string

	// The SystemTags associated with the request
	SystemTags map[string]string

	// The NextToken provided in the request
	NextToken string
}

RequestContext represents information about the current invocation request of the handler.

type Status

type Status string

Status represents the status of the handler.

const (
	// UnknownStatus represents all states that aren't covered
	// elsewhere
	UnknownStatus Status = "UNKNOWN"

	// InProgress should be returned when a resource provider
	// is in the process of being operated on.
	InProgress Status = "IN_PROGRESS"

	// Success should be returned when the resource provider
	// has finished it's operation.
	Success Status = "SUCCESS"

	// Failed should be returned when the resource provider
	// has failed
	Failed Status = "FAILED"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL