Documentation ¶
Overview ¶
Copyright 2023 The Radius Authors.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Package aws is a generated GoMock package.
Package aws is a generated GoMock package.
Index ¶
- Constants
- func HandleAWSError(err error) (armrpc_rest.Response, error)
- func IsAWSResourceNotFoundError(err error) bool
- type AWSCloudControlClient
- type AWSCloudFormationClient
- type AWSMissingPropertyError
- type Clients
- type MockAWSCloudControlClient
- func (m *MockAWSCloudControlClient) CancelResourceRequest(arg0 context.Context, arg1 *cloudcontrol.CancelResourceRequestInput, ...) (*cloudcontrol.CancelResourceRequestOutput, error)
- func (m *MockAWSCloudControlClient) CreateResource(arg0 context.Context, arg1 *cloudcontrol.CreateResourceInput, ...) (*cloudcontrol.CreateResourceOutput, error)
- func (m *MockAWSCloudControlClient) DeleteResource(arg0 context.Context, arg1 *cloudcontrol.DeleteResourceInput, ...) (*cloudcontrol.DeleteResourceOutput, error)
- func (m *MockAWSCloudControlClient) EXPECT() *MockAWSCloudControlClientMockRecorder
- func (m *MockAWSCloudControlClient) GetResource(arg0 context.Context, arg1 *cloudcontrol.GetResourceInput, ...) (*cloudcontrol.GetResourceOutput, error)
- func (m *MockAWSCloudControlClient) GetResourceRequestStatus(arg0 context.Context, arg1 *cloudcontrol.GetResourceRequestStatusInput, ...) (*cloudcontrol.GetResourceRequestStatusOutput, error)
- func (m *MockAWSCloudControlClient) ListResourceRequests(arg0 context.Context, arg1 *cloudcontrol.ListResourceRequestsInput, ...) (*cloudcontrol.ListResourceRequestsOutput, error)
- func (m *MockAWSCloudControlClient) ListResources(arg0 context.Context, arg1 *cloudcontrol.ListResourcesInput, ...) (*cloudcontrol.ListResourcesOutput, error)
- func (m *MockAWSCloudControlClient) UpdateResource(arg0 context.Context, arg1 *cloudcontrol.UpdateResourceInput, ...) (*cloudcontrol.UpdateResourceOutput, error)
- type MockAWSCloudControlClientMockRecorder
- func (mr *MockAWSCloudControlClientMockRecorder) CancelResourceRequest(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call
- func (mr *MockAWSCloudControlClientMockRecorder) CreateResource(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call
- func (mr *MockAWSCloudControlClientMockRecorder) DeleteResource(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call
- func (mr *MockAWSCloudControlClientMockRecorder) GetResource(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call
- func (mr *MockAWSCloudControlClientMockRecorder) GetResourceRequestStatus(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call
- func (mr *MockAWSCloudControlClientMockRecorder) ListResourceRequests(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call
- func (mr *MockAWSCloudControlClientMockRecorder) ListResources(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call
- func (mr *MockAWSCloudControlClientMockRecorder) UpdateResource(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call
- type MockAWSCloudFormationClient
- type MockAWSCloudFormationClientMockRecorder
- type UCPCredentialOptions
- type UCPCredentialProvider
Constants ¶
const ( // DefaultExpireDuration is the default access key expiry duration. DefaultExpireDuration = time.Minute * time.Duration(15) )
Variables ¶
This section is empty.
Functions ¶
func HandleAWSError ¶
func HandleAWSError(err error) (armrpc_rest.Response, error)
HandleAWSError takes in an error and returns an ARMResponse and an error. It checks the error type and returns an appropriate response based on the error code and message. If the error is a client fault, it returns a BadRequestARMResponse, otherwise it returns an InternalServerErrorARMResponse.
func IsAWSResourceNotFoundError ¶
Checks if the given error is an AWS ResourceNotFoundException error. If so, it returns true, otherwise false.
Types ¶
type AWSCloudControlClient ¶
type AWSCloudControlClient interface { GetResource(ctx context.Context, params *cloudcontrol.GetResourceInput, optFns ...func(*cloudcontrol.Options)) (*cloudcontrol.GetResourceOutput, error) ListResources(ctx context.Context, params *cloudcontrol.ListResourcesInput, optFns ...func(*cloudcontrol.Options)) (*cloudcontrol.ListResourcesOutput, error) DeleteResource(ctx context.Context, params *cloudcontrol.DeleteResourceInput, optFns ...func(*cloudcontrol.Options)) (*cloudcontrol.DeleteResourceOutput, error) UpdateResource(ctx context.Context, params *cloudcontrol.UpdateResourceInput, optFns ...func(*cloudcontrol.Options)) (*cloudcontrol.UpdateResourceOutput, error) CreateResource(ctx context.Context, params *cloudcontrol.CreateResourceInput, optFns ...func(*cloudcontrol.Options)) (*cloudcontrol.CreateResourceOutput, error) GetResourceRequestStatus(ctx context.Context, params *cloudcontrol.GetResourceRequestStatusInput, optFns ...func(*cloudcontrol.Options)) (*cloudcontrol.GetResourceRequestStatusOutput, error) CancelResourceRequest(ctx context.Context, params *cloudcontrol.CancelResourceRequestInput, optFns ...func(*cloudcontrol.Options)) (*cloudcontrol.CancelResourceRequestOutput, error) ListResourceRequests(ctx context.Context, params *cloudcontrol.ListResourceRequestsInput, optFns ...func(*cloudcontrol.Options)) (*cloudcontrol.ListResourceRequestsOutput, error) }
Didn't see an interface for aws-sdk-go-v2, v1 had: https://pkg.go.dev/github.com/aws/aws-sdk-go/service/cloudcontrolapi/cloudcontrolapiiface This is most likely due to using json schemas to define types rather than crafting by hand. There are significantly less functions in v2, so a small mock.
type AWSCloudFormationClient ¶
type AWSCloudFormationClient interface {
DescribeType(ctx context.Context, params *cloudformation.DescribeTypeInput, optFns ...func(*cloudformation.Options)) (*cloudformation.DescribeTypeOutput, error)
}
type AWSMissingPropertyError ¶
type AWSMissingPropertyError struct {
PropertyName string
}
AWSMissingPropertyError is an error type to be returned when the call to UCP CreateWithPost is missing values for one of the expected primary identifier properties
func (*AWSMissingPropertyError) Error ¶
func (e *AWSMissingPropertyError) Error() string
Error returns a string containing the name of the missing property for an AWSMissingPropertyError.
func (*AWSMissingPropertyError) Is ¶
func (e *AWSMissingPropertyError) Is(target error) bool
Is checks if the target error is of type AWSMissingPropertyError and returns a boolean value indicating the result.
type Clients ¶
type Clients struct { // CloudControl is the AWS Cloud Control client. CloudControl AWSCloudControlClient // CloudFormation is the AWS Cloud Formation client. CloudFormation AWSCloudFormationClient }
Clients contains the AWS clients.
type MockAWSCloudControlClient ¶
type MockAWSCloudControlClient struct {
// contains filtered or unexported fields
}
MockAWSCloudControlClient is a mock of AWSCloudControlClient interface.
func NewMockAWSCloudControlClient ¶
func NewMockAWSCloudControlClient(ctrl *gomock.Controller) *MockAWSCloudControlClient
NewMockAWSCloudControlClient creates a new mock instance.
func (*MockAWSCloudControlClient) CancelResourceRequest ¶
func (m *MockAWSCloudControlClient) CancelResourceRequest(arg0 context.Context, arg1 *cloudcontrol.CancelResourceRequestInput, arg2 ...func(*cloudcontrol.Options)) (*cloudcontrol.CancelResourceRequestOutput, error)
CancelResourceRequest mocks base method.
func (*MockAWSCloudControlClient) CreateResource ¶
func (m *MockAWSCloudControlClient) CreateResource(arg0 context.Context, arg1 *cloudcontrol.CreateResourceInput, arg2 ...func(*cloudcontrol.Options)) (*cloudcontrol.CreateResourceOutput, error)
CreateResource mocks base method.
func (*MockAWSCloudControlClient) DeleteResource ¶
func (m *MockAWSCloudControlClient) DeleteResource(arg0 context.Context, arg1 *cloudcontrol.DeleteResourceInput, arg2 ...func(*cloudcontrol.Options)) (*cloudcontrol.DeleteResourceOutput, error)
DeleteResource mocks base method.
func (*MockAWSCloudControlClient) EXPECT ¶
func (m *MockAWSCloudControlClient) EXPECT() *MockAWSCloudControlClientMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockAWSCloudControlClient) GetResource ¶
func (m *MockAWSCloudControlClient) GetResource(arg0 context.Context, arg1 *cloudcontrol.GetResourceInput, arg2 ...func(*cloudcontrol.Options)) (*cloudcontrol.GetResourceOutput, error)
GetResource mocks base method.
func (*MockAWSCloudControlClient) GetResourceRequestStatus ¶
func (m *MockAWSCloudControlClient) GetResourceRequestStatus(arg0 context.Context, arg1 *cloudcontrol.GetResourceRequestStatusInput, arg2 ...func(*cloudcontrol.Options)) (*cloudcontrol.GetResourceRequestStatusOutput, error)
GetResourceRequestStatus mocks base method.
func (*MockAWSCloudControlClient) ListResourceRequests ¶
func (m *MockAWSCloudControlClient) ListResourceRequests(arg0 context.Context, arg1 *cloudcontrol.ListResourceRequestsInput, arg2 ...func(*cloudcontrol.Options)) (*cloudcontrol.ListResourceRequestsOutput, error)
ListResourceRequests mocks base method.
func (*MockAWSCloudControlClient) ListResources ¶
func (m *MockAWSCloudControlClient) ListResources(arg0 context.Context, arg1 *cloudcontrol.ListResourcesInput, arg2 ...func(*cloudcontrol.Options)) (*cloudcontrol.ListResourcesOutput, error)
ListResources mocks base method.
func (*MockAWSCloudControlClient) UpdateResource ¶
func (m *MockAWSCloudControlClient) UpdateResource(arg0 context.Context, arg1 *cloudcontrol.UpdateResourceInput, arg2 ...func(*cloudcontrol.Options)) (*cloudcontrol.UpdateResourceOutput, error)
UpdateResource mocks base method.
type MockAWSCloudControlClientMockRecorder ¶
type MockAWSCloudControlClientMockRecorder struct {
// contains filtered or unexported fields
}
MockAWSCloudControlClientMockRecorder is the mock recorder for MockAWSCloudControlClient.
func (*MockAWSCloudControlClientMockRecorder) CancelResourceRequest ¶
func (mr *MockAWSCloudControlClientMockRecorder) CancelResourceRequest(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call
CancelResourceRequest indicates an expected call of CancelResourceRequest.
func (*MockAWSCloudControlClientMockRecorder) CreateResource ¶
func (mr *MockAWSCloudControlClientMockRecorder) CreateResource(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call
CreateResource indicates an expected call of CreateResource.
func (*MockAWSCloudControlClientMockRecorder) DeleteResource ¶
func (mr *MockAWSCloudControlClientMockRecorder) DeleteResource(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call
DeleteResource indicates an expected call of DeleteResource.
func (*MockAWSCloudControlClientMockRecorder) GetResource ¶
func (mr *MockAWSCloudControlClientMockRecorder) GetResource(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call
GetResource indicates an expected call of GetResource.
func (*MockAWSCloudControlClientMockRecorder) GetResourceRequestStatus ¶
func (mr *MockAWSCloudControlClientMockRecorder) GetResourceRequestStatus(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call
GetResourceRequestStatus indicates an expected call of GetResourceRequestStatus.
func (*MockAWSCloudControlClientMockRecorder) ListResourceRequests ¶
func (mr *MockAWSCloudControlClientMockRecorder) ListResourceRequests(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call
ListResourceRequests indicates an expected call of ListResourceRequests.
func (*MockAWSCloudControlClientMockRecorder) ListResources ¶
func (mr *MockAWSCloudControlClientMockRecorder) ListResources(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call
ListResources indicates an expected call of ListResources.
func (*MockAWSCloudControlClientMockRecorder) UpdateResource ¶
func (mr *MockAWSCloudControlClientMockRecorder) UpdateResource(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call
UpdateResource indicates an expected call of UpdateResource.
type MockAWSCloudFormationClient ¶
type MockAWSCloudFormationClient struct {
// contains filtered or unexported fields
}
MockAWSCloudFormationClient is a mock of AWSCloudFormationClient interface.
func NewMockAWSCloudFormationClient ¶
func NewMockAWSCloudFormationClient(ctrl *gomock.Controller) *MockAWSCloudFormationClient
NewMockAWSCloudFormationClient creates a new mock instance.
func (*MockAWSCloudFormationClient) DescribeType ¶
func (m *MockAWSCloudFormationClient) DescribeType(arg0 context.Context, arg1 *cloudformation.DescribeTypeInput, arg2 ...func(*cloudformation.Options)) (*cloudformation.DescribeTypeOutput, error)
DescribeType mocks base method.
func (*MockAWSCloudFormationClient) EXPECT ¶
func (m *MockAWSCloudFormationClient) EXPECT() *MockAWSCloudFormationClientMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockAWSCloudFormationClientMockRecorder ¶
type MockAWSCloudFormationClientMockRecorder struct {
// contains filtered or unexported fields
}
MockAWSCloudFormationClientMockRecorder is the mock recorder for MockAWSCloudFormationClient.
func (*MockAWSCloudFormationClientMockRecorder) DescribeType ¶
func (mr *MockAWSCloudFormationClientMockRecorder) DescribeType(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call
DescribeType indicates an expected call of DescribeType.
type UCPCredentialOptions ¶
type UCPCredentialOptions struct { // Provider is an UCP credential provider. Provider sdk_cred.CredentialProvider[sdk_cred.AWSCredential] // Duration is the duration for the secret keys. Duration time.Duration }
UCPCredentialOptions is a configuration for UCPCredentialProvider.
type UCPCredentialProvider ¶
type UCPCredentialProvider struct {
// contains filtered or unexported fields
}
UCPCredentialProvider is the implementation of aws.CredentialsProvider to retrieve credentials for AWS SDK via UCP credentials.
func NewUCPCredentialProvider ¶
func NewUCPCredentialProvider(provider sdk_cred.CredentialProvider[sdk_cred.AWSCredential], expireDuration time.Duration) *UCPCredentialProvider
NewUCPCredentialProvider creates UCPCredentialProvider provider to fetch Secret Access key using UCP credential APIs.
func (*UCPCredentialProvider) Retrieve ¶
func (c *UCPCredentialProvider) Retrieve(ctx context.Context) (aws.Credentials, error)
Retrieve fetches credentials from an external provider, checks if they are valid, logs the AccessKeyID, and returns the credentials with an expiration time set. If the credentials are invalid, an error is returned.