client

package
v0.0.0-...-0a377e8 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CloudControlApiClient

type CloudControlApiClient interface {
	// CreateResource creates a resource of the specified type with the desired state.
	// It returns a ProgressEvent which is the initial progress returned directly from the API call,
	// without awaiting any long-running operations.
	CreateResource(ctx context.Context, cfType, desiredState string) (*types.ProgressEvent, error)

	// UpdateResource updates a resource of the specified type with the specified changeset.
	// It returns a ProgressEvent which is the initial progress returned directly from the API call,
	// without awaiting any long-running operations.
	// The changes to be applied are expressed as a list of JSON patch operations.
	UpdateResource(ctx context.Context, cfType, id string, patches []jsonpatch.JsonPatchOperation) (*types.ProgressEvent, error)

	// DeleteResource deletes a resource of the specified type with the given identifier.
	// It returns a ProgressEvent which is the initial progress returned directly from the API call,
	// without awaiting any long-running operations.
	DeleteResource(ctx context.Context, cfType, id string) (*types.ProgressEvent, error)

	// GetResource returns information about the current state of the specified resource. It deserializes
	// the response from the service into a map of untyped values.
	GetResource(ctx context.Context, typeName, identifier string) (map[string]interface{}, error)

	// GetResourceRequestStatus returns the current status of a resource operation request.
	GetResourceRequestStatus(ctx context.Context, requestToken string) (*types.ProgressEvent, error)
}

CloudControlApiClient is an interface that wraps around the AWS Cloud Control API.

func NewCloudControlApiClient

func NewCloudControlApiClient(cctl *cloudcontrol.Client, roleArn *string) CloudControlApiClient

NewCloudControlApiClient creates a wrapper around the AWS SDK's Cloud Control client.

type CloudControlAwaiter

type CloudControlAwaiter interface {
	// WaitForResourceOpCompletion keeps polling Cloud Control API until a long-running operation defined by
	// the input progress event resolved to completion or failre. It then returns the last progress event
	// that signifies the final status of the resource operation.
	WaitForResourceOpCompletion(ctx context.Context, pi *types.ProgressEvent) (*types.ProgressEvent, error)
}

CloudControlAwaiter provides a mechanism to poll long-running Cloud Control operations until they resolve to completion or failure.

func NewCloudControlAwaiter

func NewCloudControlAwaiter(client CloudControlApiClient) CloudControlAwaiter

type CloudControlClient

type CloudControlClient interface {
	// Create creates a resource of the specified type with the desired state.
	// It awaits the operation until completion and returns a map of output property values.
	Create(ctx context.Context, typeName string, desiredState map[string]any) (identifier *string, resourceState map[string]any, err error)

	// Read returns the current state of the specified resource. It deserializes
	// the response from the service into a map of untyped values.
	// If the resource does not exist, no error is returned but the flag exists is set to false.
	Read(ctx context.Context, typeName, identifier string) (resourceState map[string]interface{}, exists bool, err error)

	// Update updates a resource of the specified type with the specified changeset.
	// It awaits the operation until completion and returns a map of output property values.
	Update(ctx context.Context, typeName, identifier string, patches []jsonpatch.JsonPatchOperation) (map[string]interface{}, error)

	// Delete deletes a resource of the specified type with the given identifier.
	// It awaits the operation until completion.
	Delete(ctx context.Context, typeName, identifier string) error
}

CloudControlApiClient providers CRUD operations around Cloud Control API, with the mechanics of API calls abstracted away. For instance, it serializes and deserializes wire data and follows the protocol of long-running operations.

func NewCloudControlClient

func NewCloudControlClient(cctl *cloudcontrol.Client, roleArn *string) CloudControlClient

Jump to

Keyboard shortcuts

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