client

package
v1.11.0 Latest Latest
Warning

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

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

Documentation

Overview

Package client is a generated GoMock package.

Package client is a generated GoMock package.

Package client is a generated GoMock package.

Index

Constants

View Source
const DefaultFunctionActivationTimeout = 5 * time.Minute

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

type LambdaApi

type LambdaApi interface {
	Invoke(ctx context.Context, params *lambda.InvokeInput, optFns ...func(*lambda.Options)) (*lambda.InvokeOutput, error)
	GetFunction(context.Context, *lambda.GetFunctionInput, ...func(*lambda.Options)) (*lambda.GetFunctionOutput, error)
}

type LambdaClient

type LambdaClient interface {
	// InvokeAsync invokes the given Lambda function with the 'Event' invocation type. This means that the function
	// will be invoked asynchronously and no response will be returned. If the function is not ready to be invoked yet,
	// this method will wait for the function to become active before invoking it.
	InvokeAsync(ctx context.Context, functionName string, payload []byte) error
}

func NewLambdaClient

func NewLambdaClient(api LambdaApi) LambdaClient

type MockCloudControlClient

type MockCloudControlClient struct {
	// contains filtered or unexported fields
}

MockCloudControlClient is a mock of CloudControlClient interface.

func NewMockCloudControlClient

func NewMockCloudControlClient(ctrl *gomock.Controller) *MockCloudControlClient

NewMockCloudControlClient creates a new mock instance.

func (*MockCloudControlClient) Create

func (m *MockCloudControlClient) Create(ctx context.Context, typeName string, desiredState map[string]any) (*string, map[string]any, error)

Create mocks base method.

func (*MockCloudControlClient) Delete

func (m *MockCloudControlClient) Delete(ctx context.Context, typeName, identifier string) error

Delete mocks base method.

func (*MockCloudControlClient) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockCloudControlClient) Read

func (m *MockCloudControlClient) Read(ctx context.Context, typeName, identifier string) (map[string]any, bool, error)

Read mocks base method.

func (*MockCloudControlClient) Update

func (m *MockCloudControlClient) Update(ctx context.Context, typeName, identifier string, patches []jsonpatch.JsonPatchOperation) (map[string]any, error)

Update mocks base method.

type MockCloudControlClientMockRecorder

type MockCloudControlClientMockRecorder struct {
	// contains filtered or unexported fields
}

MockCloudControlClientMockRecorder is the mock recorder for MockCloudControlClient.

func (*MockCloudControlClientMockRecorder) Create

func (mr *MockCloudControlClientMockRecorder) Create(ctx, typeName, desiredState any) *gomock.Call

Create indicates an expected call of Create.

func (*MockCloudControlClientMockRecorder) Delete

func (mr *MockCloudControlClientMockRecorder) Delete(ctx, typeName, identifier any) *gomock.Call

Delete indicates an expected call of Delete.

func (*MockCloudControlClientMockRecorder) Read

func (mr *MockCloudControlClientMockRecorder) Read(ctx, typeName, identifier any) *gomock.Call

Read indicates an expected call of Read.

func (*MockCloudControlClientMockRecorder) Update

func (mr *MockCloudControlClientMockRecorder) Update(ctx, typeName, identifier, patches any) *gomock.Call

Update indicates an expected call of Update.

type MockLambdaApi

type MockLambdaApi struct {
	// contains filtered or unexported fields
}

MockLambdaApi is a mock of LambdaApi interface.

func NewMockLambdaApi

func NewMockLambdaApi(ctrl *gomock.Controller) *MockLambdaApi

NewMockLambdaApi creates a new mock instance.

func (*MockLambdaApi) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockLambdaApi) GetFunction

func (m *MockLambdaApi) GetFunction(arg0 context.Context, arg1 *lambda.GetFunctionInput, arg2 ...func(*lambda.Options)) (*lambda.GetFunctionOutput, error)

GetFunction mocks base method.

func (*MockLambdaApi) Invoke

func (m *MockLambdaApi) Invoke(ctx context.Context, params *lambda.InvokeInput, optFns ...func(*lambda.Options)) (*lambda.InvokeOutput, error)

Invoke mocks base method.

type MockLambdaApiMockRecorder

type MockLambdaApiMockRecorder struct {
	// contains filtered or unexported fields
}

MockLambdaApiMockRecorder is the mock recorder for MockLambdaApi.

func (*MockLambdaApiMockRecorder) GetFunction

func (mr *MockLambdaApiMockRecorder) GetFunction(arg0, arg1 any, arg2 ...any) *gomock.Call

GetFunction indicates an expected call of GetFunction.

func (*MockLambdaApiMockRecorder) Invoke

func (mr *MockLambdaApiMockRecorder) Invoke(ctx, params any, optFns ...any) *gomock.Call

Invoke indicates an expected call of Invoke.

type MockLambdaClient

type MockLambdaClient struct {
	// contains filtered or unexported fields
}

MockLambdaClient is a mock of LambdaClient interface.

func NewMockLambdaClient

func NewMockLambdaClient(ctrl *gomock.Controller) *MockLambdaClient

NewMockLambdaClient creates a new mock instance.

func (*MockLambdaClient) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockLambdaClient) InvokeAsync

func (m *MockLambdaClient) InvokeAsync(ctx context.Context, functionName string, payload []byte) error

InvokeAsync mocks base method.

type MockLambdaClientMockRecorder

type MockLambdaClientMockRecorder struct {
	// contains filtered or unexported fields
}

MockLambdaClientMockRecorder is the mock recorder for MockLambdaClient.

func (*MockLambdaClientMockRecorder) InvokeAsync

func (mr *MockLambdaClientMockRecorder) InvokeAsync(ctx, functionName, payload any) *gomock.Call

InvokeAsync indicates an expected call of InvokeAsync.

type MockS3Api

type MockS3Api struct {
	// contains filtered or unexported fields
}

MockS3Api is a mock of S3Api interface.

func NewMockS3Api

func NewMockS3Api(ctrl *gomock.Controller) *MockS3Api

NewMockS3Api creates a new mock instance.

func (*MockS3Api) EXPECT

func (m *MockS3Api) EXPECT() *MockS3ApiMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockS3Api) GetObject

func (m *MockS3Api) GetObject(ctx context.Context, params *s3.GetObjectInput, optFns ...func(*s3.Options)) (*s3.GetObjectOutput, error)

GetObject mocks base method.

func (*MockS3Api) HeadObject

func (m *MockS3Api) HeadObject(arg0 context.Context, arg1 *s3.HeadObjectInput, arg2 ...func(*s3.Options)) (*s3.HeadObjectOutput, error)

HeadObject mocks base method.

type MockS3ApiMockRecorder

type MockS3ApiMockRecorder struct {
	// contains filtered or unexported fields
}

MockS3ApiMockRecorder is the mock recorder for MockS3Api.

func (*MockS3ApiMockRecorder) GetObject

func (mr *MockS3ApiMockRecorder) GetObject(ctx, params any, optFns ...any) *gomock.Call

GetObject indicates an expected call of GetObject.

func (*MockS3ApiMockRecorder) HeadObject

func (mr *MockS3ApiMockRecorder) HeadObject(arg0, arg1 any, arg2 ...any) *gomock.Call

HeadObject indicates an expected call of HeadObject.

type MockS3Client

type MockS3Client struct {
	// contains filtered or unexported fields
}

MockS3Client is a mock of S3Client interface.

func NewMockS3Client

func NewMockS3Client(ctrl *gomock.Controller) *MockS3Client

NewMockS3Client creates a new mock instance.

func (*MockS3Client) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockS3Client) PresignPutObject

func (m *MockS3Client) PresignPutObject(ctx context.Context, bucket, key string, expiration time.Duration) (string, error)

PresignPutObject mocks base method.

func (*MockS3Client) WaitForObject

func (m *MockS3Client) WaitForObject(ctx context.Context, bucket, key string, timeout time.Duration) (io.ReadCloser, error)

WaitForObject mocks base method.

type MockS3ClientMockRecorder

type MockS3ClientMockRecorder struct {
	// contains filtered or unexported fields
}

MockS3ClientMockRecorder is the mock recorder for MockS3Client.

func (*MockS3ClientMockRecorder) PresignPutObject

func (mr *MockS3ClientMockRecorder) PresignPutObject(ctx, bucket, key, expiration any) *gomock.Call

PresignPutObject indicates an expected call of PresignPutObject.

func (*MockS3ClientMockRecorder) WaitForObject

func (mr *MockS3ClientMockRecorder) WaitForObject(ctx, bucket, key, timeout any) *gomock.Call

WaitForObject indicates an expected call of WaitForObject.

type MockS3PresignApi

type MockS3PresignApi struct {
	// contains filtered or unexported fields
}

MockS3PresignApi is a mock of S3PresignApi interface.

func NewMockS3PresignApi

func NewMockS3PresignApi(ctrl *gomock.Controller) *MockS3PresignApi

NewMockS3PresignApi creates a new mock instance.

func (*MockS3PresignApi) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockS3PresignApi) PresignPutObject

func (m *MockS3PresignApi) PresignPutObject(ctx context.Context, params *s3.PutObjectInput, optFns ...func(*s3.PresignOptions)) (*v4.PresignedHTTPRequest, error)

PresignPutObject mocks base method.

type MockS3PresignApiMockRecorder

type MockS3PresignApiMockRecorder struct {
	// contains filtered or unexported fields
}

MockS3PresignApiMockRecorder is the mock recorder for MockS3PresignApi.

func (*MockS3PresignApiMockRecorder) PresignPutObject

func (mr *MockS3PresignApiMockRecorder) PresignPutObject(ctx, params any, optFns ...any) *gomock.Call

PresignPutObject indicates an expected call of PresignPutObject.

type S3Api

type S3Api interface {
	HeadObject(context.Context, *s3.HeadObjectInput, ...func(*s3.Options)) (*s3.HeadObjectOutput, error)
	GetObject(ctx context.Context, params *s3.GetObjectInput, optFns ...func(*s3.Options)) (*s3.GetObjectOutput, error)
}

type S3Client

type S3Client interface {
	// PresignPutObject generates a pre-signed URL for uploading an object to an S3 bucket.
	// The URL will be valid for the specified expiration duration.
	PresignPutObject(ctx context.Context, bucket, key string, expiration time.Duration) (string, error)

	// WaitForObject waits for an object to exist in an S3 bucket and returns a reader for the object.
	// The function will block until the object exists or the timeout is reached.
	// If the object does not exist after the timeout, an error will be returned.
	// The caller is responsible for closing the reader when done.
	WaitForObject(ctx context.Context, bucket string, key string, timeout time.Duration) (io.ReadCloser, error)
}

func NewS3Client

func NewS3Client(api S3Api, presignApi S3PresignApi) S3Client

type S3PresignApi

type S3PresignApi interface {
	PresignPutObject(ctx context.Context, params *s3.PutObjectInput, optFns ...func(*s3.PresignOptions)) (*signerV4.PresignedHTTPRequest, error)
}

Jump to

Keyboard shortcuts

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