Update Go AWS SDK to the latest version

This commit is contained in:
Andrey Smirnov
2019-07-13 00:03:55 +03:00
committed by Andrey Smirnov
parent d08be990ef
commit 94a72b23ff
2183 changed files with 885887 additions and 228114 deletions
File diff suppressed because it is too large Load Diff
+29
View File
@@ -0,0 +1,29 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
// Package fsx provides the client and types for making API
// requests to Amazon FSx.
//
// Amazon FSx is a fully managed service that makes it easy for storage and
// application administrators to launch and use shared file storage.
//
// See https://docs.aws.amazon.com/goto/WebAPI/fsx-2018-03-01 for more information on this service.
//
// See fsx package documentation for more information.
// https://docs.aws.amazon.com/sdk-for-go/api/service/fsx/
//
// Using the Client
//
// To contact Amazon FSx with the SDK use the New function to create
// a new service client. With that client you can make API requests to the service.
// These clients are safe to use concurrently.
//
// See the SDK's documentation for more information on how to use the SDK.
// https://docs.aws.amazon.com/sdk-for-go/api/
//
// See aws.Config documentation for more information on configuring SDK clients.
// https://docs.aws.amazon.com/sdk-for-go/api/aws/#Config
//
// See the Amazon FSx client FSx for more
// information on creating client for this service.
// https://docs.aws.amazon.com/sdk-for-go/api/service/fsx/#New
package fsx
+118
View File
@@ -0,0 +1,118 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package fsx
const (
// ErrCodeActiveDirectoryError for service response error code
// "ActiveDirectoryError".
//
// An Active Directory error.
ErrCodeActiveDirectoryError = "ActiveDirectoryError"
// ErrCodeBackupInProgress for service response error code
// "BackupInProgress".
//
// Another backup is already under way. Wait for completion before initiating
// additional backups of this file system.
ErrCodeBackupInProgress = "BackupInProgress"
// ErrCodeBackupNotFound for service response error code
// "BackupNotFound".
//
// No Amazon FSx backups were found based upon the supplied parameters.
ErrCodeBackupNotFound = "BackupNotFound"
// ErrCodeBackupRestoring for service response error code
// "BackupRestoring".
//
// You can't delete a backup while it's being used to restore a file system.
ErrCodeBackupRestoring = "BackupRestoring"
// ErrCodeBadRequest for service response error code
// "BadRequest".
//
// A generic error indicating a failure with a client request.
ErrCodeBadRequest = "BadRequest"
// ErrCodeFileSystemNotFound for service response error code
// "FileSystemNotFound".
//
// No Amazon FSx file systems were found based upon supplied parameters.
ErrCodeFileSystemNotFound = "FileSystemNotFound"
// ErrCodeIncompatibleParameterError for service response error code
// "IncompatibleParameterError".
//
// The error returned when a second request is received with the same client
// request token but different parameters settings. A client request token should
// always uniquely identify a single request.
ErrCodeIncompatibleParameterError = "IncompatibleParameterError"
// ErrCodeInternalServerError for service response error code
// "InternalServerError".
//
// A generic error indicating a server-side failure.
ErrCodeInternalServerError = "InternalServerError"
// ErrCodeInvalidExportPath for service response error code
// "InvalidExportPath".
//
// The path provided for data repository export isn't valid.
ErrCodeInvalidExportPath = "InvalidExportPath"
// ErrCodeInvalidImportPath for service response error code
// "InvalidImportPath".
//
// The path provided for data repository import isn't valid.
ErrCodeInvalidImportPath = "InvalidImportPath"
// ErrCodeInvalidNetworkSettings for service response error code
// "InvalidNetworkSettings".
//
// One or more network settings specified in the request are invalid. InvalidVpcId
// means that the ID passed for the virtual private cloud (VPC) is invalid.
// InvalidSubnetIds returns the list of IDs for subnets that are either invalid
// or not part of the VPC specified. InvalidSecurityGroupIds returns the list
// of IDs for security groups that are either invalid or not part of the VPC
// specified.
ErrCodeInvalidNetworkSettings = "InvalidNetworkSettings"
// ErrCodeMissingFileSystemConfiguration for service response error code
// "MissingFileSystemConfiguration".
//
// File system configuration is required for this operation.
ErrCodeMissingFileSystemConfiguration = "MissingFileSystemConfiguration"
// ErrCodeNotServiceResourceError for service response error code
// "NotServiceResourceError".
//
// The resource specified for the tagging operation is not a resource type owned
// by Amazon FSx. Use the API of the relevant service to perform the operation.
ErrCodeNotServiceResourceError = "NotServiceResourceError"
// ErrCodeResourceDoesNotSupportTagging for service response error code
// "ResourceDoesNotSupportTagging".
//
// The resource specified does not support tagging.
ErrCodeResourceDoesNotSupportTagging = "ResourceDoesNotSupportTagging"
// ErrCodeResourceNotFound for service response error code
// "ResourceNotFound".
//
// The resource specified by the Amazon Resource Name (ARN) can't be found.
ErrCodeResourceNotFound = "ResourceNotFound"
// ErrCodeServiceLimitExceeded for service response error code
// "ServiceLimitExceeded".
//
// An error indicating that a particular service limit was exceeded. You can
// increase some service limits by contacting AWS Support.
ErrCodeServiceLimitExceeded = "ServiceLimitExceeded"
// ErrCodeUnsupportedOperation for service response error code
// "UnsupportedOperation".
//
// An error occured.
ErrCodeUnsupportedOperation = "UnsupportedOperation"
)
+503
View File
@@ -0,0 +1,503 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package fsx_test
import (
"fmt"
"strings"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/fsx"
)
var _ time.Duration
var _ strings.Reader
var _ aws.Config
func parseTime(layout, value string) *time.Time {
t, err := time.Parse(layout, value)
if err != nil {
panic(err)
}
return &t
}
// To create a new backup
//
// This operation creates a new backup.
func ExampleFSx_CreateBackup_shared00() {
svc := fsx.New(session.New())
input := &fsx.CreateBackupInput{
FileSystemId: aws.String("fs-0498eed5fe91001ec"),
Tags: []*fsx.Tag{
{
Key: aws.String("Name"),
Value: aws.String("MyBackup"),
},
},
}
result, err := svc.CreateBackup(input)
if err != nil {
if aerr, ok := err.(awserr.Error); ok {
switch aerr.Code() {
case fsx.ErrCodeBadRequest:
fmt.Println(fsx.ErrCodeBadRequest, aerr.Error())
case fsx.ErrCodeUnsupportedOperation:
fmt.Println(fsx.ErrCodeUnsupportedOperation, aerr.Error())
case fsx.ErrCodeFileSystemNotFound:
fmt.Println(fsx.ErrCodeFileSystemNotFound, aerr.Error())
case fsx.ErrCodeBackupInProgress:
fmt.Println(fsx.ErrCodeBackupInProgress, aerr.Error())
case fsx.ErrCodeIncompatibleParameterError:
fmt.Println(fsx.ErrCodeIncompatibleParameterError, aerr.Error())
case fsx.ErrCodeServiceLimitExceeded:
fmt.Println(fsx.ErrCodeServiceLimitExceeded, aerr.Error())
case fsx.ErrCodeInternalServerError:
fmt.Println(fsx.ErrCodeInternalServerError, aerr.Error())
default:
fmt.Println(aerr.Error())
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
}
return
}
fmt.Println(result)
}
// To create a new file system
//
// This operation creates a new file system.
func ExampleFSx_CreateFileSystem_shared00() {
svc := fsx.New(session.New())
input := &fsx.CreateFileSystemInput{
ClientRequestToken: aws.String("a8ca07e4-61ec-4399-99f4-19853801bcd5"),
FileSystemType: aws.String("WINDOWS"),
KmsKeyId: aws.String("arn:aws:kms:us-east-1:012345678912:key/0ff3ea8d-130e-4133-877f-93908b6fdbd6"),
SecurityGroupIds: []*string{
aws.String("sg-edcd9784"),
},
StorageCapacity: aws.Int64(300),
SubnetIds: []*string{
aws.String("subnet-1234abcd"),
},
Tags: []*fsx.Tag{
{
Key: aws.String("Name"),
Value: aws.String("MyFileSystem"),
},
},
WindowsConfiguration: &fsx.CreateFileSystemWindowsConfiguration{
ActiveDirectoryId: aws.String("d-1234abcd12"),
AutomaticBackupRetentionDays: aws.Int64(30),
DailyAutomaticBackupStartTime: aws.String("05:00"),
ThroughputCapacity: aws.Int64(8),
WeeklyMaintenanceStartTime: aws.String("1:05:00"),
},
}
result, err := svc.CreateFileSystem(input)
if err != nil {
if aerr, ok := err.(awserr.Error); ok {
switch aerr.Code() {
case fsx.ErrCodeBadRequest:
fmt.Println(fsx.ErrCodeBadRequest, aerr.Error())
case fsx.ErrCodeActiveDirectoryError:
fmt.Println(fsx.ErrCodeActiveDirectoryError, aerr.Error())
case fsx.ErrCodeIncompatibleParameterError:
fmt.Println(fsx.ErrCodeIncompatibleParameterError, aerr.Error())
case fsx.ErrCodeInvalidImportPath:
fmt.Println(fsx.ErrCodeInvalidImportPath, aerr.Error())
case fsx.ErrCodeInvalidExportPath:
fmt.Println(fsx.ErrCodeInvalidExportPath, aerr.Error())
case fsx.ErrCodeInvalidNetworkSettings:
fmt.Println(fsx.ErrCodeInvalidNetworkSettings, aerr.Error())
case fsx.ErrCodeServiceLimitExceeded:
fmt.Println(fsx.ErrCodeServiceLimitExceeded, aerr.Error())
case fsx.ErrCodeInternalServerError:
fmt.Println(fsx.ErrCodeInternalServerError, aerr.Error())
case fsx.ErrCodeMissingFileSystemConfiguration:
fmt.Println(fsx.ErrCodeMissingFileSystemConfiguration, aerr.Error())
default:
fmt.Println(aerr.Error())
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
}
return
}
fmt.Println(result)
}
// To create a new file system from backup
//
// This operation creates a new file system from backup.
func ExampleFSx_CreateFileSystemFromBackup_shared00() {
svc := fsx.New(session.New())
input := &fsx.CreateFileSystemFromBackupInput{
BackupId: aws.String("backup-03e3c82e0183b7b6b"),
ClientRequestToken: aws.String("f4c94ed7-238d-4c46-93db-48cd62ec33b7"),
SecurityGroupIds: []*string{
aws.String("sg-edcd9784"),
},
SubnetIds: []*string{
aws.String("subnet-1234abcd"),
},
Tags: []*fsx.Tag{
{
Key: aws.String("Name"),
Value: aws.String("MyFileSystem"),
},
},
WindowsConfiguration: &fsx.CreateFileSystemWindowsConfiguration{
ThroughputCapacity: aws.Int64(8),
},
}
result, err := svc.CreateFileSystemFromBackup(input)
if err != nil {
if aerr, ok := err.(awserr.Error); ok {
switch aerr.Code() {
case fsx.ErrCodeBadRequest:
fmt.Println(fsx.ErrCodeBadRequest, aerr.Error())
case fsx.ErrCodeActiveDirectoryError:
fmt.Println(fsx.ErrCodeActiveDirectoryError, aerr.Error())
case fsx.ErrCodeIncompatibleParameterError:
fmt.Println(fsx.ErrCodeIncompatibleParameterError, aerr.Error())
case fsx.ErrCodeInvalidNetworkSettings:
fmt.Println(fsx.ErrCodeInvalidNetworkSettings, aerr.Error())
case fsx.ErrCodeServiceLimitExceeded:
fmt.Println(fsx.ErrCodeServiceLimitExceeded, aerr.Error())
case fsx.ErrCodeBackupNotFound:
fmt.Println(fsx.ErrCodeBackupNotFound, aerr.Error())
case fsx.ErrCodeInternalServerError:
fmt.Println(fsx.ErrCodeInternalServerError, aerr.Error())
case fsx.ErrCodeMissingFileSystemConfiguration:
fmt.Println(fsx.ErrCodeMissingFileSystemConfiguration, aerr.Error())
default:
fmt.Println(aerr.Error())
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
}
return
}
fmt.Println(result)
}
// To delete a backup
//
// This operation deletes an Amazon FSx file system backup.
func ExampleFSx_DeleteBackup_shared00() {
svc := fsx.New(session.New())
input := &fsx.DeleteBackupInput{
BackupId: aws.String("backup-03e3c82e0183b7b6b"),
}
result, err := svc.DeleteBackup(input)
if err != nil {
if aerr, ok := err.(awserr.Error); ok {
switch aerr.Code() {
case fsx.ErrCodeBadRequest:
fmt.Println(fsx.ErrCodeBadRequest, aerr.Error())
case fsx.ErrCodeBackupInProgress:
fmt.Println(fsx.ErrCodeBackupInProgress, aerr.Error())
case fsx.ErrCodeBackupNotFound:
fmt.Println(fsx.ErrCodeBackupNotFound, aerr.Error())
case fsx.ErrCodeBackupRestoring:
fmt.Println(fsx.ErrCodeBackupRestoring, aerr.Error())
case fsx.ErrCodeIncompatibleParameterError:
fmt.Println(fsx.ErrCodeIncompatibleParameterError, aerr.Error())
case fsx.ErrCodeInternalServerError:
fmt.Println(fsx.ErrCodeInternalServerError, aerr.Error())
default:
fmt.Println(aerr.Error())
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
}
return
}
fmt.Println(result)
}
// To delete a file system
//
// This operation deletes an Amazon FSx file system.
func ExampleFSx_DeleteFileSystem_shared00() {
svc := fsx.New(session.New())
input := &fsx.DeleteFileSystemInput{
FileSystemId: aws.String("fs-0498eed5fe91001ec"),
}
result, err := svc.DeleteFileSystem(input)
if err != nil {
if aerr, ok := err.(awserr.Error); ok {
switch aerr.Code() {
case fsx.ErrCodeBadRequest:
fmt.Println(fsx.ErrCodeBadRequest, aerr.Error())
case fsx.ErrCodeIncompatibleParameterError:
fmt.Println(fsx.ErrCodeIncompatibleParameterError, aerr.Error())
case fsx.ErrCodeFileSystemNotFound:
fmt.Println(fsx.ErrCodeFileSystemNotFound, aerr.Error())
case fsx.ErrCodeServiceLimitExceeded:
fmt.Println(fsx.ErrCodeServiceLimitExceeded, aerr.Error())
case fsx.ErrCodeInternalServerError:
fmt.Println(fsx.ErrCodeInternalServerError, aerr.Error())
default:
fmt.Println(aerr.Error())
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
}
return
}
fmt.Println(result)
}
// To describe Amazon FSx backups
//
// This operation describes all of the Amazon FSx backups in an account.
func ExampleFSx_DescribeBackups_shared00() {
svc := fsx.New(session.New())
input := &fsx.DescribeBackupsInput{}
result, err := svc.DescribeBackups(input)
if err != nil {
if aerr, ok := err.(awserr.Error); ok {
switch aerr.Code() {
case fsx.ErrCodeBadRequest:
fmt.Println(fsx.ErrCodeBadRequest, aerr.Error())
case fsx.ErrCodeFileSystemNotFound:
fmt.Println(fsx.ErrCodeFileSystemNotFound, aerr.Error())
case fsx.ErrCodeBackupNotFound:
fmt.Println(fsx.ErrCodeBackupNotFound, aerr.Error())
case fsx.ErrCodeInternalServerError:
fmt.Println(fsx.ErrCodeInternalServerError, aerr.Error())
default:
fmt.Println(aerr.Error())
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
}
return
}
fmt.Println(result)
}
// To describe an Amazon FSx file system
//
// This operation describes all of the Amazon FSx file systems in an account.
func ExampleFSx_DescribeFileSystems_shared00() {
svc := fsx.New(session.New())
input := &fsx.DescribeFileSystemsInput{}
result, err := svc.DescribeFileSystems(input)
if err != nil {
if aerr, ok := err.(awserr.Error); ok {
switch aerr.Code() {
case fsx.ErrCodeBadRequest:
fmt.Println(fsx.ErrCodeBadRequest, aerr.Error())
case fsx.ErrCodeFileSystemNotFound:
fmt.Println(fsx.ErrCodeFileSystemNotFound, aerr.Error())
case fsx.ErrCodeInternalServerError:
fmt.Println(fsx.ErrCodeInternalServerError, aerr.Error())
default:
fmt.Println(aerr.Error())
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
}
return
}
fmt.Println(result)
}
// To list tags for a resource
//
// This operation lists tags for an Amazon FSx resource.
func ExampleFSx_ListTagsForResource_shared00() {
svc := fsx.New(session.New())
input := &fsx.ListTagsForResourceInput{
ResourceARN: aws.String("arn:aws:fsx:us-east-1:012345678912:file-system/fs-0498eed5fe91001ec"),
}
result, err := svc.ListTagsForResource(input)
if err != nil {
if aerr, ok := err.(awserr.Error); ok {
switch aerr.Code() {
case fsx.ErrCodeBadRequest:
fmt.Println(fsx.ErrCodeBadRequest, aerr.Error())
case fsx.ErrCodeInternalServerError:
fmt.Println(fsx.ErrCodeInternalServerError, aerr.Error())
case fsx.ErrCodeResourceNotFound:
fmt.Println(fsx.ErrCodeResourceNotFound, aerr.Error())
case fsx.ErrCodeNotServiceResourceError:
fmt.Println(fsx.ErrCodeNotServiceResourceError, aerr.Error())
case fsx.ErrCodeResourceDoesNotSupportTagging:
fmt.Println(fsx.ErrCodeResourceDoesNotSupportTagging, aerr.Error())
default:
fmt.Println(aerr.Error())
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
}
return
}
fmt.Println(result)
}
// To tag a resource
//
// This operation tags an Amazon FSx resource.
func ExampleFSx_TagResource_shared00() {
svc := fsx.New(session.New())
input := &fsx.TagResourceInput{
ResourceARN: aws.String("arn:aws:fsx:us-east-1:012345678912:file-system/fs-0498eed5fe91001ec"),
Tags: []*fsx.Tag{
{
Key: aws.String("Name"),
Value: aws.String("MyFileSystem"),
},
},
}
result, err := svc.TagResource(input)
if err != nil {
if aerr, ok := err.(awserr.Error); ok {
switch aerr.Code() {
case fsx.ErrCodeBadRequest:
fmt.Println(fsx.ErrCodeBadRequest, aerr.Error())
case fsx.ErrCodeInternalServerError:
fmt.Println(fsx.ErrCodeInternalServerError, aerr.Error())
case fsx.ErrCodeResourceNotFound:
fmt.Println(fsx.ErrCodeResourceNotFound, aerr.Error())
case fsx.ErrCodeNotServiceResourceError:
fmt.Println(fsx.ErrCodeNotServiceResourceError, aerr.Error())
case fsx.ErrCodeResourceDoesNotSupportTagging:
fmt.Println(fsx.ErrCodeResourceDoesNotSupportTagging, aerr.Error())
default:
fmt.Println(aerr.Error())
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
}
return
}
fmt.Println(result)
}
// To untag a resource
//
// This operation untags an Amazon FSx resource.
func ExampleFSx_UntagResource_shared00() {
svc := fsx.New(session.New())
input := &fsx.UntagResourceInput{
ResourceARN: aws.String("arn:aws:fsx:us-east-1:012345678912:file-system/fs-0498eed5fe91001ec"),
TagKeys: []*string{
aws.String("Name"),
},
}
result, err := svc.UntagResource(input)
if err != nil {
if aerr, ok := err.(awserr.Error); ok {
switch aerr.Code() {
case fsx.ErrCodeBadRequest:
fmt.Println(fsx.ErrCodeBadRequest, aerr.Error())
case fsx.ErrCodeInternalServerError:
fmt.Println(fsx.ErrCodeInternalServerError, aerr.Error())
case fsx.ErrCodeResourceNotFound:
fmt.Println(fsx.ErrCodeResourceNotFound, aerr.Error())
case fsx.ErrCodeNotServiceResourceError:
fmt.Println(fsx.ErrCodeNotServiceResourceError, aerr.Error())
case fsx.ErrCodeResourceDoesNotSupportTagging:
fmt.Println(fsx.ErrCodeResourceDoesNotSupportTagging, aerr.Error())
default:
fmt.Println(aerr.Error())
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
}
return
}
fmt.Println(result)
}
// To update an existing file system
//
// This operation updates an existing file system.
func ExampleFSx_UpdateFileSystem_shared00() {
svc := fsx.New(session.New())
input := &fsx.UpdateFileSystemInput{
FileSystemId: aws.String("fs-0498eed5fe91001ec"),
WindowsConfiguration: &fsx.UpdateFileSystemWindowsConfiguration{
AutomaticBackupRetentionDays: aws.Int64(10),
DailyAutomaticBackupStartTime: aws.String("06:00"),
WeeklyMaintenanceStartTime: aws.String("3:06:00"),
},
}
result, err := svc.UpdateFileSystem(input)
if err != nil {
if aerr, ok := err.(awserr.Error); ok {
switch aerr.Code() {
case fsx.ErrCodeBadRequest:
fmt.Println(fsx.ErrCodeBadRequest, aerr.Error())
case fsx.ErrCodeUnsupportedOperation:
fmt.Println(fsx.ErrCodeUnsupportedOperation, aerr.Error())
case fsx.ErrCodeIncompatibleParameterError:
fmt.Println(fsx.ErrCodeIncompatibleParameterError, aerr.Error())
case fsx.ErrCodeInternalServerError:
fmt.Println(fsx.ErrCodeInternalServerError, aerr.Error())
case fsx.ErrCodeFileSystemNotFound:
fmt.Println(fsx.ErrCodeFileSystemNotFound, aerr.Error())
case fsx.ErrCodeMissingFileSystemConfiguration:
fmt.Println(fsx.ErrCodeMissingFileSystemConfiguration, aerr.Error())
default:
fmt.Println(aerr.Error())
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
}
return
}
fmt.Println(result)
}
+114
View File
@@ -0,0 +1,114 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
// Package fsxiface provides an interface to enable mocking the Amazon FSx 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.
package fsxiface
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/service/fsx"
)
// FSxAPI provides an interface to enable mocking the
// fsx.FSx 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
// // Amazon FSx.
// func myFunc(svc fsxiface.FSxAPI) bool {
// // Make svc.CreateBackup request
// }
//
// func main() {
// sess := session.New()
// svc := fsx.New(sess)
//
// myFunc(svc)
// }
//
// In your _test.go file:
//
// // Define a mock struct to be used in your unit tests of myFunc.
// type mockFSxClient struct {
// fsxiface.FSxAPI
// }
// func (m *mockFSxClient) CreateBackup(input *fsx.CreateBackupInput) (*fsx.CreateBackupOutput, error) {
// // mock response/functionality
// }
//
// func TestMyFunc(t *testing.T) {
// // Setup Test
// mockSvc := &mockFSxClient{}
//
// 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.
type FSxAPI interface {
CreateBackup(*fsx.CreateBackupInput) (*fsx.CreateBackupOutput, error)
CreateBackupWithContext(aws.Context, *fsx.CreateBackupInput, ...request.Option) (*fsx.CreateBackupOutput, error)
CreateBackupRequest(*fsx.CreateBackupInput) (*request.Request, *fsx.CreateBackupOutput)
CreateFileSystem(*fsx.CreateFileSystemInput) (*fsx.CreateFileSystemOutput, error)
CreateFileSystemWithContext(aws.Context, *fsx.CreateFileSystemInput, ...request.Option) (*fsx.CreateFileSystemOutput, error)
CreateFileSystemRequest(*fsx.CreateFileSystemInput) (*request.Request, *fsx.CreateFileSystemOutput)
CreateFileSystemFromBackup(*fsx.CreateFileSystemFromBackupInput) (*fsx.CreateFileSystemFromBackupOutput, error)
CreateFileSystemFromBackupWithContext(aws.Context, *fsx.CreateFileSystemFromBackupInput, ...request.Option) (*fsx.CreateFileSystemFromBackupOutput, error)
CreateFileSystemFromBackupRequest(*fsx.CreateFileSystemFromBackupInput) (*request.Request, *fsx.CreateFileSystemFromBackupOutput)
DeleteBackup(*fsx.DeleteBackupInput) (*fsx.DeleteBackupOutput, error)
DeleteBackupWithContext(aws.Context, *fsx.DeleteBackupInput, ...request.Option) (*fsx.DeleteBackupOutput, error)
DeleteBackupRequest(*fsx.DeleteBackupInput) (*request.Request, *fsx.DeleteBackupOutput)
DeleteFileSystem(*fsx.DeleteFileSystemInput) (*fsx.DeleteFileSystemOutput, error)
DeleteFileSystemWithContext(aws.Context, *fsx.DeleteFileSystemInput, ...request.Option) (*fsx.DeleteFileSystemOutput, error)
DeleteFileSystemRequest(*fsx.DeleteFileSystemInput) (*request.Request, *fsx.DeleteFileSystemOutput)
DescribeBackups(*fsx.DescribeBackupsInput) (*fsx.DescribeBackupsOutput, error)
DescribeBackupsWithContext(aws.Context, *fsx.DescribeBackupsInput, ...request.Option) (*fsx.DescribeBackupsOutput, error)
DescribeBackupsRequest(*fsx.DescribeBackupsInput) (*request.Request, *fsx.DescribeBackupsOutput)
DescribeBackupsPages(*fsx.DescribeBackupsInput, func(*fsx.DescribeBackupsOutput, bool) bool) error
DescribeBackupsPagesWithContext(aws.Context, *fsx.DescribeBackupsInput, func(*fsx.DescribeBackupsOutput, bool) bool, ...request.Option) error
DescribeFileSystems(*fsx.DescribeFileSystemsInput) (*fsx.DescribeFileSystemsOutput, error)
DescribeFileSystemsWithContext(aws.Context, *fsx.DescribeFileSystemsInput, ...request.Option) (*fsx.DescribeFileSystemsOutput, error)
DescribeFileSystemsRequest(*fsx.DescribeFileSystemsInput) (*request.Request, *fsx.DescribeFileSystemsOutput)
DescribeFileSystemsPages(*fsx.DescribeFileSystemsInput, func(*fsx.DescribeFileSystemsOutput, bool) bool) error
DescribeFileSystemsPagesWithContext(aws.Context, *fsx.DescribeFileSystemsInput, func(*fsx.DescribeFileSystemsOutput, bool) bool, ...request.Option) error
ListTagsForResource(*fsx.ListTagsForResourceInput) (*fsx.ListTagsForResourceOutput, error)
ListTagsForResourceWithContext(aws.Context, *fsx.ListTagsForResourceInput, ...request.Option) (*fsx.ListTagsForResourceOutput, error)
ListTagsForResourceRequest(*fsx.ListTagsForResourceInput) (*request.Request, *fsx.ListTagsForResourceOutput)
TagResource(*fsx.TagResourceInput) (*fsx.TagResourceOutput, error)
TagResourceWithContext(aws.Context, *fsx.TagResourceInput, ...request.Option) (*fsx.TagResourceOutput, error)
TagResourceRequest(*fsx.TagResourceInput) (*request.Request, *fsx.TagResourceOutput)
UntagResource(*fsx.UntagResourceInput) (*fsx.UntagResourceOutput, error)
UntagResourceWithContext(aws.Context, *fsx.UntagResourceInput, ...request.Option) (*fsx.UntagResourceOutput, error)
UntagResourceRequest(*fsx.UntagResourceInput) (*request.Request, *fsx.UntagResourceOutput)
UpdateFileSystem(*fsx.UpdateFileSystemInput) (*fsx.UpdateFileSystemOutput, error)
UpdateFileSystemWithContext(aws.Context, *fsx.UpdateFileSystemInput, ...request.Option) (*fsx.UpdateFileSystemOutput, error)
UpdateFileSystemRequest(*fsx.UpdateFileSystemInput) (*request.Request, *fsx.UpdateFileSystemOutput)
}
var _ FSxAPI = (*fsx.FSx)(nil)
+97
View File
@@ -0,0 +1,97 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package fsx
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/client"
"github.com/aws/aws-sdk-go/aws/client/metadata"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/aws/signer/v4"
"github.com/aws/aws-sdk-go/private/protocol/jsonrpc"
)
// FSx provides the API operation methods for making requests to
// Amazon FSx. See this package's package overview docs
// for details on the service.
//
// FSx methods are safe to use concurrently. It is not safe to
// modify mutate any of the struct's properties though.
type FSx struct {
*client.Client
}
// Used for custom client initialization logic
var initClient func(*client.Client)
// Used for custom request initialization logic
var initRequest func(*request.Request)
// Service information constants
const (
ServiceName = "FSx" // Name of service.
EndpointsID = "fsx" // ID to lookup a service endpoint with.
ServiceID = "FSx" // ServiceID is a unique identifer of a specific service.
)
// New creates a new instance of the FSx client with a session.
// If additional configuration is needed for the client instance use the optional
// aws.Config parameter to add your extra config.
//
// Example:
// // Create a FSx client from just a session.
// svc := fsx.New(mySession)
//
// // Create a FSx client with additional configuration
// svc := fsx.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
func New(p client.ConfigProvider, cfgs ...*aws.Config) *FSx {
c := p.ClientConfig(EndpointsID, cfgs...)
return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
}
// newClient creates, initializes and returns a new service client instance.
func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *FSx {
svc := &FSx{
Client: client.New(
cfg,
metadata.ClientInfo{
ServiceName: ServiceName,
ServiceID: ServiceID,
SigningName: signingName,
SigningRegion: signingRegion,
Endpoint: endpoint,
APIVersion: "2018-03-01",
JSONVersion: "1.1",
TargetPrefix: "AWSSimbaAPIService_v20180301",
},
handlers,
),
}
// Handlers
svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler)
svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler)
svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler)
svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler)
// Run custom client initialization if present
if initClient != nil {
initClient(svc.Client)
}
return svc
}
// newRequest creates a new request for a FSx operation and runs any
// custom request initialization.
func (c *FSx) newRequest(op *request.Operation, params, data interface{}) *request.Request {
req := c.NewRequest(op, params, data)
// Run custom request initialization if present
if initRequest != nil {
initRequest(req)
}
return req
}