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
+1065 -161
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -7,7 +7,7 @@
// for use with Amazon EC2 instances in the AWS Cloud. With Amazon EFS, storage
// capacity is elastic, growing and shrinking automatically as you add and remove
// files, so your applications have the storage they need, when they need it.
// For more information, see the User Guide (http://docs.aws.amazon.com/efs/latest/ug/api-reference.html).
// For more information, see the User Guide (https://docs.aws.amazon.com/efs/latest/ug/api-reference.html).
//
// See https://docs.aws.amazon.com/goto/WebAPI/elasticfilesystem-2015-02-01 for more information on this service.
//
+12
View File
@@ -88,6 +88,10 @@ type EFSAPI interface {
DescribeFileSystemsWithContext(aws.Context, *efs.DescribeFileSystemsInput, ...request.Option) (*efs.DescribeFileSystemsOutput, error)
DescribeFileSystemsRequest(*efs.DescribeFileSystemsInput) (*request.Request, *efs.DescribeFileSystemsOutput)
DescribeLifecycleConfiguration(*efs.DescribeLifecycleConfigurationInput) (*efs.DescribeLifecycleConfigurationOutput, error)
DescribeLifecycleConfigurationWithContext(aws.Context, *efs.DescribeLifecycleConfigurationInput, ...request.Option) (*efs.DescribeLifecycleConfigurationOutput, error)
DescribeLifecycleConfigurationRequest(*efs.DescribeLifecycleConfigurationInput) (*request.Request, *efs.DescribeLifecycleConfigurationOutput)
DescribeMountTargetSecurityGroups(*efs.DescribeMountTargetSecurityGroupsInput) (*efs.DescribeMountTargetSecurityGroupsOutput, error)
DescribeMountTargetSecurityGroupsWithContext(aws.Context, *efs.DescribeMountTargetSecurityGroupsInput, ...request.Option) (*efs.DescribeMountTargetSecurityGroupsOutput, error)
DescribeMountTargetSecurityGroupsRequest(*efs.DescribeMountTargetSecurityGroupsInput) (*request.Request, *efs.DescribeMountTargetSecurityGroupsOutput)
@@ -103,6 +107,14 @@ type EFSAPI interface {
ModifyMountTargetSecurityGroups(*efs.ModifyMountTargetSecurityGroupsInput) (*efs.ModifyMountTargetSecurityGroupsOutput, error)
ModifyMountTargetSecurityGroupsWithContext(aws.Context, *efs.ModifyMountTargetSecurityGroupsInput, ...request.Option) (*efs.ModifyMountTargetSecurityGroupsOutput, error)
ModifyMountTargetSecurityGroupsRequest(*efs.ModifyMountTargetSecurityGroupsInput) (*request.Request, *efs.ModifyMountTargetSecurityGroupsOutput)
PutLifecycleConfiguration(*efs.PutLifecycleConfigurationInput) (*efs.PutLifecycleConfigurationOutput, error)
PutLifecycleConfigurationWithContext(aws.Context, *efs.PutLifecycleConfigurationInput, ...request.Option) (*efs.PutLifecycleConfigurationOutput, error)
PutLifecycleConfigurationRequest(*efs.PutLifecycleConfigurationInput) (*request.Request, *efs.PutLifecycleConfigurationOutput)
UpdateFileSystem(*efs.UpdateFileSystemInput) (*efs.UpdateFileSystemOutput, error)
UpdateFileSystemWithContext(aws.Context, *efs.UpdateFileSystemInput, ...request.Option) (*efs.UpdateFileSystemOutput, error)
UpdateFileSystemRequest(*efs.UpdateFileSystemInput) (*request.Request, *efs.UpdateFileSystemOutput)
}
var _ EFSAPI = (*efs.EFS)(nil)
+35 -10
View File
@@ -34,21 +34,21 @@ const (
// ErrCodeFileSystemLimitExceeded for service response error code
// "FileSystemLimitExceeded".
//
// Returned if the AWS account has already created maximum number of file systems
// allowed per account.
// Returned if the AWS account has already created the maximum number of file
// systems allowed per account.
ErrCodeFileSystemLimitExceeded = "FileSystemLimitExceeded"
// ErrCodeFileSystemNotFound for service response error code
// "FileSystemNotFound".
//
// Returned if the specified FileSystemId does not exist in the requester's
// Returned if the specified FileSystemId value doesn't exist in the requester's
// AWS account.
ErrCodeFileSystemNotFound = "FileSystemNotFound"
// ErrCodeIncorrectFileSystemLifeCycleState for service response error code
// "IncorrectFileSystemLifeCycleState".
//
// Returned if the file system's life cycle state is not "created".
// Returned if the file system's lifecycle state is not "available".
ErrCodeIncorrectFileSystemLifeCycleState = "IncorrectFileSystemLifeCycleState"
// ErrCodeIncorrectMountTargetState for service response error code
@@ -57,6 +57,16 @@ const (
// Returned if the mount target is not in the correct state for the operation.
ErrCodeIncorrectMountTargetState = "IncorrectMountTargetState"
// ErrCodeInsufficientThroughputCapacity for service response error code
// "InsufficientThroughputCapacity".
//
// Returned if there's not enough capacity to provision additional throughput.
// This value might be returned when you try to create a file system in provisioned
// throughput mode, when you attempt to increase the provisioned throughput
// of an existing file system, or when you attempt to change an existing file
// system from bursting to provisioned throughput mode.
ErrCodeInsufficientThroughputCapacity = "InsufficientThroughputCapacity"
// ErrCodeInternalServerError for service response error code
// "InternalServerError".
//
@@ -87,11 +97,12 @@ const (
// ErrCodeNetworkInterfaceLimitExceeded for service response error code
// "NetworkInterfaceLimitExceeded".
//
// The calling account has reached the ENI limit for the specific AWS region.
// Client should try to delete some ENIs or get its account limit raised. For
// more information, see Amazon VPC Limits (http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Appendix_Limits.html)
// in the Amazon Virtual Private Cloud User Guide (see the Network interfaces
// per VPC entry in the table).
// The calling account has reached the limit for elastic network interfaces
// for the specific AWS Region. The client should try to delete some elastic
// network interfaces or get the account limit raised. For more information,
// see Amazon VPC Limits (https://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Appendix_Limits.html)
// in the Amazon VPC User Guide (see the Network interfaces per VPC entry in
// the table).
ErrCodeNetworkInterfaceLimitExceeded = "NetworkInterfaceLimitExceeded"
// ErrCodeNoFreeAddressesInSubnet for service response error code
@@ -111,7 +122,7 @@ const (
// ErrCodeSecurityGroupNotFound for service response error code
// "SecurityGroupNotFound".
//
// Returned if one of the specified security groups does not exist in the subnet's
// Returned if one of the specified security groups doesn't exist in the subnet's
// VPC.
ErrCodeSecurityGroupNotFound = "SecurityGroupNotFound"
@@ -121,6 +132,20 @@ const (
// Returned if there is no subnet with ID SubnetId provided in the request.
ErrCodeSubnetNotFound = "SubnetNotFound"
// ErrCodeThroughputLimitExceeded for service response error code
// "ThroughputLimitExceeded".
//
// Returned if the throughput mode or amount of provisioned throughput can't
// be changed because the throughput limit of 1024 MiB/s has been reached.
ErrCodeThroughputLimitExceeded = "ThroughputLimitExceeded"
// ErrCodeTooManyRequests for service response error code
// "TooManyRequests".
//
// Returned if you dont wait at least 24 hours before changing the throughput
// mode, or decreasing the Provisioned Throughput value.
ErrCodeTooManyRequests = "TooManyRequests"
// ErrCodeUnsupportedAvailabilityZone for service response error code
// "UnsupportedAvailabilityZone".
ErrCodeUnsupportedAvailabilityZone = "UnsupportedAvailabilityZone"
+88
View File
@@ -34,6 +34,12 @@ func ExampleEFS_CreateFileSystem_shared00() {
input := &efs.CreateFileSystemInput{
CreationToken: aws.String("tokenstring"),
PerformanceMode: aws.String("generalPurpose"),
Tags: []*efs.Tag{
{
Key: aws.String("Name"),
Value: aws.String("MyFileSystem"),
},
},
}
result, err := svc.CreateFileSystem(input)
@@ -48,6 +54,10 @@ func ExampleEFS_CreateFileSystem_shared00() {
fmt.Println(efs.ErrCodeFileSystemAlreadyExists, aerr.Error())
case efs.ErrCodeFileSystemLimitExceeded:
fmt.Println(efs.ErrCodeFileSystemLimitExceeded, aerr.Error())
case efs.ErrCodeInsufficientThroughputCapacity:
fmt.Println(efs.ErrCodeInsufficientThroughputCapacity, aerr.Error())
case efs.ErrCodeThroughputLimitExceeded:
fmt.Println(efs.ErrCodeThroughputLimitExceeded, aerr.Error())
default:
fmt.Println(aerr.Error())
}
@@ -290,6 +300,41 @@ func ExampleEFS_DescribeFileSystems_shared00() {
fmt.Println(result)
}
// To describe the lifecycle configuration for a file system
//
// This operation describes a file system's LifecycleConfiguration. EFS lifecycle management
// uses the LifecycleConfiguration object to identify which files to move to the EFS
// Infrequent Access (IA) storage class.
func ExampleEFS_DescribeLifecycleConfiguration_shared00() {
svc := efs.New(session.New())
input := &efs.DescribeLifecycleConfigurationInput{
FileSystemId: aws.String("fs-01234567"),
}
result, err := svc.DescribeLifecycleConfiguration(input)
if err != nil {
if aerr, ok := err.(awserr.Error); ok {
switch aerr.Code() {
case efs.ErrCodeInternalServerError:
fmt.Println(efs.ErrCodeInternalServerError, aerr.Error())
case efs.ErrCodeBadRequest:
fmt.Println(efs.ErrCodeBadRequest, aerr.Error())
case efs.ErrCodeFileSystemNotFound:
fmt.Println(efs.ErrCodeFileSystemNotFound, 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 the security groups for a mount target
//
// This operation describes all of the security groups for a file system's mount target.
@@ -435,3 +480,46 @@ func ExampleEFS_ModifyMountTargetSecurityGroups_shared00() {
fmt.Println(result)
}
// Creates a new lifecycleconfiguration object for a file system
//
// This operation enables lifecycle management on a file system by creating a new LifecycleConfiguration
// object. A LifecycleConfiguration object defines when files in an Amazon EFS file
// system are automatically transitioned to the lower-cost EFS Infrequent Access (IA)
// storage class. A LifecycleConfiguration applies to all files in a file system.
func ExampleEFS_PutLifecycleConfiguration_shared00() {
svc := efs.New(session.New())
input := &efs.PutLifecycleConfigurationInput{
FileSystemId: aws.String("fs-01234567"),
LifecyclePolicies: []*efs.LifecyclePolicy{
{
TransitionToIA: aws.String("AFTER_30_DAYS"),
},
},
}
result, err := svc.PutLifecycleConfiguration(input)
if err != nil {
if aerr, ok := err.(awserr.Error); ok {
switch aerr.Code() {
case efs.ErrCodeBadRequest:
fmt.Println(efs.ErrCodeBadRequest, aerr.Error())
case efs.ErrCodeInternalServerError:
fmt.Println(efs.ErrCodeInternalServerError, aerr.Error())
case efs.ErrCodeFileSystemNotFound:
fmt.Println(efs.ErrCodeFileSystemNotFound, aerr.Error())
case efs.ErrCodeIncorrectFileSystemLifeCycleState:
fmt.Println(efs.ErrCodeIncorrectFileSystemLifeCycleState, 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)
}
+58
View File
@@ -0,0 +1,58 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
// +build go1.10,integration
package efs_test
import (
"context"
"testing"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/awstesting/integration"
"github.com/aws/aws-sdk-go/service/efs"
)
var _ aws.Config
var _ awserr.Error
var _ request.Request
func TestInteg_00_DescribeFileSystems(t *testing.T) {
ctx, cancelFn := context.WithTimeout(context.Background(), 5*time.Second)
defer cancelFn()
sess := integration.SessionWithDefaultRegion("us-west-2")
svc := efs.New(sess)
params := &efs.DescribeFileSystemsInput{}
_, err := svc.DescribeFileSystemsWithContext(ctx, params)
if err != nil {
t.Errorf("expect no error, got %v", err)
}
}
func TestInteg_01_DeleteFileSystem(t *testing.T) {
ctx, cancelFn := context.WithTimeout(context.Background(), 5*time.Second)
defer cancelFn()
sess := integration.SessionWithDefaultRegion("us-west-2")
svc := efs.New(sess)
params := &efs.DeleteFileSystemInput{
FileSystemId: aws.String("fs-c5a1446c"),
}
_, err := svc.DeleteFileSystemWithContext(ctx, params)
if err == nil {
t.Fatalf("expect request to fail")
}
aerr, ok := err.(awserr.RequestFailure)
if !ok {
t.Fatalf("expect awserr, was %T", err)
}
if len(aerr.Code()) == 0 {
t.Errorf("expect non-empty error code")
}
if v := aerr.Code(); v == request.ErrCodeSerialization {
t.Errorf("expect API error code got serialization failure")
}
}
+4 -2
View File
@@ -29,8 +29,9 @@ var initRequest func(*request.Request)
// Service information constants
const (
ServiceName = "elasticfilesystem" // Service endpoint prefix API calls made to.
EndpointsID = ServiceName // Service ID for Regions and Endpoints metadata.
ServiceName = "elasticfilesystem" // Name of service.
EndpointsID = ServiceName // ID to lookup a service endpoint with.
ServiceID = "EFS" // ServiceID is a unique identifer of a specific service.
)
// New creates a new instance of the EFS client with a session.
@@ -55,6 +56,7 @@ func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegio
cfg,
metadata.ClientInfo{
ServiceName: ServiceName,
ServiceID: ServiceID,
SigningName: signingName,
SigningRegion: signingRegion,
Endpoint: endpoint,