Documentation ¶
Overview ¶
Package ramiface provides an interface to enable mocking the AWS Resource Access Manager service client for testing your code.
It is important to note that this interface will have breaking changes when the service model is updated and adds new API operations, paginators, and waiters.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RAMAPI ¶
type RAMAPI interface { EnableSharingWithAwsOrganization(*ram.EnableSharingWithAwsOrganizationInput) (*ram.EnableSharingWithAwsOrganizationOutput, error) EnableSharingWithAwsOrganizationWithContext(aws.Context, *ram.EnableSharingWithAwsOrganizationInput, ...request.Option) (*ram.EnableSharingWithAwsOrganizationOutput, error) EnableSharingWithAwsOrganizationRequest(*ram.EnableSharingWithAwsOrganizationInput) (*request.Request, *ram.EnableSharingWithAwsOrganizationOutput) GetPermission(*ram.GetPermissionInput) (*ram.GetPermissionOutput, error) GetPermissionWithContext(aws.Context, *ram.GetPermissionInput, ...request.Option) (*ram.GetPermissionOutput, error) GetPermissionRequest(*ram.GetPermissionInput) (*request.Request, *ram.GetPermissionOutput) GetResourcePolicies(*ram.GetResourcePoliciesInput) (*ram.GetResourcePoliciesOutput, error) GetResourcePoliciesWithContext(aws.Context, *ram.GetResourcePoliciesInput, ...request.Option) (*ram.GetResourcePoliciesOutput, error) GetResourcePoliciesRequest(*ram.GetResourcePoliciesInput) (*request.Request, *ram.GetResourcePoliciesOutput) GetResourcePoliciesPages(*ram.GetResourcePoliciesInput, func(*ram.GetResourcePoliciesOutput, bool) bool) error GetResourcePoliciesPagesWithContext(aws.Context, *ram.GetResourcePoliciesInput, func(*ram.GetResourcePoliciesOutput, bool) bool, ...request.Option) error ListPendingInvitationResources(*ram.ListPendingInvitationResourcesInput) (*ram.ListPendingInvitationResourcesOutput, error) ListPendingInvitationResourcesWithContext(aws.Context, *ram.ListPendingInvitationResourcesInput, ...request.Option) (*ram.ListPendingInvitationResourcesOutput, error) ListPendingInvitationResourcesRequest(*ram.ListPendingInvitationResourcesInput) (*request.Request, *ram.ListPendingInvitationResourcesOutput) ListPendingInvitationResourcesPages(*ram.ListPendingInvitationResourcesInput, func(*ram.ListPendingInvitationResourcesOutput, bool) bool) error ListPendingInvitationResourcesPagesWithContext(aws.Context, *ram.ListPendingInvitationResourcesInput, func(*ram.ListPendingInvitationResourcesOutput, bool) bool, ...request.Option) error ListPermissions(*ram.ListPermissionsInput) (*ram.ListPermissionsOutput, error) ListPermissionsWithContext(aws.Context, *ram.ListPermissionsInput, ...request.Option) (*ram.ListPermissionsOutput, error) ListPermissionsRequest(*ram.ListPermissionsInput) (*request.Request, *ram.ListPermissionsOutput) ListPrincipals(*ram.ListPrincipalsInput) (*ram.ListPrincipalsOutput, error) ListPrincipalsWithContext(aws.Context, *ram.ListPrincipalsInput, ...request.Option) (*ram.ListPrincipalsOutput, error) ListPrincipalsRequest(*ram.ListPrincipalsInput) (*request.Request, *ram.ListPrincipalsOutput) ListPrincipalsPages(*ram.ListPrincipalsInput, func(*ram.ListPrincipalsOutput, bool) bool) error ListPrincipalsPagesWithContext(aws.Context, *ram.ListPrincipalsInput, func(*ram.ListPrincipalsOutput, bool) bool, ...request.Option) error ListResources(*ram.ListResourcesInput) (*ram.ListResourcesOutput, error) ListResourcesWithContext(aws.Context, *ram.ListResourcesInput, ...request.Option) (*ram.ListResourcesOutput, error) ListResourcesRequest(*ram.ListResourcesInput) (*request.Request, *ram.ListResourcesOutput) ListResourcesPages(*ram.ListResourcesInput, func(*ram.ListResourcesOutput, bool) bool) error ListResourcesPagesWithContext(aws.Context, *ram.ListResourcesInput, func(*ram.ListResourcesOutput, bool) bool, ...request.Option) error TagResource(*ram.TagResourceInput) (*ram.TagResourceOutput, error) TagResourceWithContext(aws.Context, *ram.TagResourceInput, ...request.Option) (*ram.TagResourceOutput, error) TagResourceRequest(*ram.TagResourceInput) (*request.Request, *ram.TagResourceOutput) UntagResource(*ram.UntagResourceInput) (*ram.UntagResourceOutput, error) UntagResourceWithContext(aws.Context, *ram.UntagResourceInput, ...request.Option) (*ram.UntagResourceOutput, error) UntagResourceRequest(*ram.UntagResourceInput) (*request.Request, *ram.UntagResourceOutput) }
RAMAPI provides an interface to enable mocking the ram.RAM service client's API operation, paginators, and waiters. This make unit testing your code that calls out to the SDK's service client's calls easier.
The best way to use this interface is so the SDK's service client's calls can be stubbed out for unit testing your code with the SDK without needing to inject custom request handlers into the SDK's request pipeline.
// myFunc uses an SDK service client to make a request to // AWS Resource Access Manager. func myFunc(svc ramiface.RAMAPI) bool { // Make svc.AcceptResourceShareInvitation request } func main() { sess := session.New() svc := ram.New(sess) myFunc(svc) }
In your _test.go file:
// Define a mock struct to be used in your unit tests of myFunc. type mockRAMClient struct { ramiface.RAMAPI } func (m *mockRAMClient) AcceptResourceShareInvitation(input *ram.AcceptResourceShareInvitationInput) (*ram.AcceptResourceShareInvitationOutput, error) { // mock response/functionality } func TestMyFunc(t *testing.T) { // Setup Test mockSvc := &mockRAMClient{} myfunc(mockSvc) // Verify myFunc's functionality }
It is important to note that this interface will have breaking changes when the service model is updated and adds new API operations, paginators, and waiters. Its suggested to use the pattern above for testing, or using tooling to generate mocks to satisfy the interfaces.