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
+40
View File
@@ -0,0 +1,40 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
// Package eks provides the client and types for making API
// requests to Amazon Elastic Kubernetes Service.
//
// Amazon Elastic Kubernetes Service (Amazon EKS) is a managed service that
// makes it easy for you to run Kubernetes on AWS without needing to stand up
// or maintain your own Kubernetes control plane. Kubernetes is an open-source
// system for automating the deployment, scaling, and management of containerized
// applications.
//
// Amazon EKS runs up-to-date versions of the open-source Kubernetes software,
// so you can use all the existing plugins and tooling from the Kubernetes community.
// Applications running on Amazon EKS are fully compatible with applications
// running on any standard Kubernetes environment, whether running in on-premises
// data centers or public clouds. This means that you can easily migrate any
// standard Kubernetes application to Amazon EKS without any code modification
// required.
//
// See https://docs.aws.amazon.com/goto/WebAPI/eks-2017-11-01 for more information on this service.
//
// See eks package documentation for more information.
// https://docs.aws.amazon.com/sdk-for-go/api/service/eks/
//
// Using the Client
//
// To contact Amazon Elastic Kubernetes Service 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 Elastic Kubernetes Service client EKS for more
// information on creating client for this service.
// https://docs.aws.amazon.com/sdk-for-go/api/service/eks/#New
package eks
+102
View File
@@ -0,0 +1,102 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
// Package eksiface provides an interface to enable mocking the Amazon Elastic Kubernetes Service 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 eksiface
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/service/eks"
)
// EKSAPI provides an interface to enable mocking the
// eks.EKS 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 Elastic Kubernetes Service.
// func myFunc(svc eksiface.EKSAPI) bool {
// // Make svc.CreateCluster request
// }
//
// func main() {
// sess := session.New()
// svc := eks.New(sess)
//
// myFunc(svc)
// }
//
// In your _test.go file:
//
// // Define a mock struct to be used in your unit tests of myFunc.
// type mockEKSClient struct {
// eksiface.EKSAPI
// }
// func (m *mockEKSClient) CreateCluster(input *eks.CreateClusterInput) (*eks.CreateClusterOutput, error) {
// // mock response/functionality
// }
//
// func TestMyFunc(t *testing.T) {
// // Setup Test
// mockSvc := &mockEKSClient{}
//
// 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 EKSAPI interface {
CreateCluster(*eks.CreateClusterInput) (*eks.CreateClusterOutput, error)
CreateClusterWithContext(aws.Context, *eks.CreateClusterInput, ...request.Option) (*eks.CreateClusterOutput, error)
CreateClusterRequest(*eks.CreateClusterInput) (*request.Request, *eks.CreateClusterOutput)
DeleteCluster(*eks.DeleteClusterInput) (*eks.DeleteClusterOutput, error)
DeleteClusterWithContext(aws.Context, *eks.DeleteClusterInput, ...request.Option) (*eks.DeleteClusterOutput, error)
DeleteClusterRequest(*eks.DeleteClusterInput) (*request.Request, *eks.DeleteClusterOutput)
DescribeCluster(*eks.DescribeClusterInput) (*eks.DescribeClusterOutput, error)
DescribeClusterWithContext(aws.Context, *eks.DescribeClusterInput, ...request.Option) (*eks.DescribeClusterOutput, error)
DescribeClusterRequest(*eks.DescribeClusterInput) (*request.Request, *eks.DescribeClusterOutput)
DescribeUpdate(*eks.DescribeUpdateInput) (*eks.DescribeUpdateOutput, error)
DescribeUpdateWithContext(aws.Context, *eks.DescribeUpdateInput, ...request.Option) (*eks.DescribeUpdateOutput, error)
DescribeUpdateRequest(*eks.DescribeUpdateInput) (*request.Request, *eks.DescribeUpdateOutput)
ListClusters(*eks.ListClustersInput) (*eks.ListClustersOutput, error)
ListClustersWithContext(aws.Context, *eks.ListClustersInput, ...request.Option) (*eks.ListClustersOutput, error)
ListClustersRequest(*eks.ListClustersInput) (*request.Request, *eks.ListClustersOutput)
ListUpdates(*eks.ListUpdatesInput) (*eks.ListUpdatesOutput, error)
ListUpdatesWithContext(aws.Context, *eks.ListUpdatesInput, ...request.Option) (*eks.ListUpdatesOutput, error)
ListUpdatesRequest(*eks.ListUpdatesInput) (*request.Request, *eks.ListUpdatesOutput)
UpdateClusterConfig(*eks.UpdateClusterConfigInput) (*eks.UpdateClusterConfigOutput, error)
UpdateClusterConfigWithContext(aws.Context, *eks.UpdateClusterConfigInput, ...request.Option) (*eks.UpdateClusterConfigOutput, error)
UpdateClusterConfigRequest(*eks.UpdateClusterConfigInput) (*request.Request, *eks.UpdateClusterConfigOutput)
UpdateClusterVersion(*eks.UpdateClusterVersionInput) (*eks.UpdateClusterVersionOutput, error)
UpdateClusterVersionWithContext(aws.Context, *eks.UpdateClusterVersionInput, ...request.Option) (*eks.UpdateClusterVersionOutput, error)
UpdateClusterVersionRequest(*eks.UpdateClusterVersionInput) (*request.Request, *eks.UpdateClusterVersionOutput)
WaitUntilClusterActive(*eks.DescribeClusterInput) error
WaitUntilClusterActiveWithContext(aws.Context, *eks.DescribeClusterInput, ...request.WaiterOption) error
WaitUntilClusterDeleted(*eks.DescribeClusterInput) error
WaitUntilClusterDeletedWithContext(aws.Context, *eks.DescribeClusterInput, ...request.WaiterOption) error
}
var _ EKSAPI = (*eks.EKS)(nil)
+68
View File
@@ -0,0 +1,68 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package eks
const (
// ErrCodeClientException for service response error code
// "ClientException".
//
// These errors are usually caused by a client action. Actions can include using
// an action or resource on behalf of a user that doesn't have permissions to
// use the action or resource or specifying an identifier that is not valid.
ErrCodeClientException = "ClientException"
// ErrCodeInvalidParameterException for service response error code
// "InvalidParameterException".
//
// The specified parameter is invalid. Review the available parameters for the
// API request.
ErrCodeInvalidParameterException = "InvalidParameterException"
// ErrCodeInvalidRequestException for service response error code
// "InvalidRequestException".
//
// The request is invalid given the state of the cluster. Check the state of
// the cluster and the associated operations.
ErrCodeInvalidRequestException = "InvalidRequestException"
// ErrCodeResourceInUseException for service response error code
// "ResourceInUseException".
//
// The specified resource is in use.
ErrCodeResourceInUseException = "ResourceInUseException"
// ErrCodeResourceLimitExceededException for service response error code
// "ResourceLimitExceededException".
//
// You have encountered a service limit on the specified resource.
ErrCodeResourceLimitExceededException = "ResourceLimitExceededException"
// ErrCodeResourceNotFoundException for service response error code
// "ResourceNotFoundException".
//
// The specified resource could not be found. You can view your available clusters
// with ListClusters. Amazon EKS clusters are Region-specific.
ErrCodeResourceNotFoundException = "ResourceNotFoundException"
// ErrCodeServerException for service response error code
// "ServerException".
//
// These errors are usually caused by a server-side issue.
ErrCodeServerException = "ServerException"
// ErrCodeServiceUnavailableException for service response error code
// "ServiceUnavailableException".
//
// The service is unavailable. Back off and retry the operation.
ErrCodeServiceUnavailableException = "ServiceUnavailableException"
// ErrCodeUnsupportedAvailabilityZoneException for service response error code
// "UnsupportedAvailabilityZoneException".
//
// At least one of your specified cluster subnets is in an Availability Zone
// that does not support Amazon EKS. The exception output specifies the supported
// Availability Zones for your account, from which you can choose subnets for
// your cluster.
ErrCodeUnsupportedAvailabilityZoneException = "UnsupportedAvailabilityZoneException"
)
+185
View File
@@ -0,0 +1,185 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package eks_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/eks"
)
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 cluster
//
// The following example creates an Amazon EKS cluster called prod.
func ExampleEKS_CreateCluster_shared00() {
svc := eks.New(session.New())
input := &eks.CreateClusterInput{
ClientRequestToken: aws.String("1d2129a1-3d38-460a-9756-e5b91fddb951"),
Name: aws.String("prod"),
ResourcesVpcConfig: &eks.VpcConfigRequest{
SecurityGroupIds: []*string{
aws.String("sg-6979fe18"),
},
SubnetIds: []*string{
aws.String("subnet-6782e71e"),
aws.String("subnet-e7e761ac"),
},
},
RoleArn: aws.String("arn:aws:iam::012345678910:role/eks-service-role-AWSServiceRoleForAmazonEKS-J7ONKE3BQ4PI"),
Version: aws.String("1.10"),
}
result, err := svc.CreateCluster(input)
if err != nil {
if aerr, ok := err.(awserr.Error); ok {
switch aerr.Code() {
case eks.ErrCodeResourceInUseException:
fmt.Println(eks.ErrCodeResourceInUseException, aerr.Error())
case eks.ErrCodeResourceLimitExceededException:
fmt.Println(eks.ErrCodeResourceLimitExceededException, aerr.Error())
case eks.ErrCodeInvalidParameterException:
fmt.Println(eks.ErrCodeInvalidParameterException, aerr.Error())
case eks.ErrCodeClientException:
fmt.Println(eks.ErrCodeClientException, aerr.Error())
case eks.ErrCodeServerException:
fmt.Println(eks.ErrCodeServerException, aerr.Error())
case eks.ErrCodeServiceUnavailableException:
fmt.Println(eks.ErrCodeServiceUnavailableException, aerr.Error())
case eks.ErrCodeUnsupportedAvailabilityZoneException:
fmt.Println(eks.ErrCodeUnsupportedAvailabilityZoneException, 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 cluster
//
// This example command deletes a cluster named `devel` in your default region.
func ExampleEKS_DeleteCluster_shared00() {
svc := eks.New(session.New())
input := &eks.DeleteClusterInput{
Name: aws.String("devel"),
}
result, err := svc.DeleteCluster(input)
if err != nil {
if aerr, ok := err.(awserr.Error); ok {
switch aerr.Code() {
case eks.ErrCodeResourceInUseException:
fmt.Println(eks.ErrCodeResourceInUseException, aerr.Error())
case eks.ErrCodeResourceNotFoundException:
fmt.Println(eks.ErrCodeResourceNotFoundException, aerr.Error())
case eks.ErrCodeClientException:
fmt.Println(eks.ErrCodeClientException, aerr.Error())
case eks.ErrCodeServerException:
fmt.Println(eks.ErrCodeServerException, aerr.Error())
case eks.ErrCodeServiceUnavailableException:
fmt.Println(eks.ErrCodeServiceUnavailableException, 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 a cluster
//
// This example command provides a description of the specified cluster in your default
// region.
func ExampleEKS_DescribeCluster_shared00() {
svc := eks.New(session.New())
input := &eks.DescribeClusterInput{
Name: aws.String("devel"),
}
result, err := svc.DescribeCluster(input)
if err != nil {
if aerr, ok := err.(awserr.Error); ok {
switch aerr.Code() {
case eks.ErrCodeResourceNotFoundException:
fmt.Println(eks.ErrCodeResourceNotFoundException, aerr.Error())
case eks.ErrCodeClientException:
fmt.Println(eks.ErrCodeClientException, aerr.Error())
case eks.ErrCodeServerException:
fmt.Println(eks.ErrCodeServerException, aerr.Error())
case eks.ErrCodeServiceUnavailableException:
fmt.Println(eks.ErrCodeServiceUnavailableException, 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 your available clusters
//
// This example command lists all of your available clusters in your default region.
func ExampleEKS_ListClusters_shared00() {
svc := eks.New(session.New())
input := &eks.ListClustersInput{}
result, err := svc.ListClusters(input)
if err != nil {
if aerr, ok := err.(awserr.Error); ok {
switch aerr.Code() {
case eks.ErrCodeInvalidParameterException:
fmt.Println(eks.ErrCodeInvalidParameterException, aerr.Error())
case eks.ErrCodeClientException:
fmt.Println(eks.ErrCodeClientException, aerr.Error())
case eks.ErrCodeServerException:
fmt.Println(eks.ErrCodeServerException, aerr.Error())
case eks.ErrCodeServiceUnavailableException:
fmt.Println(eks.ErrCodeServiceUnavailableException, 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)
}
+98
View File
@@ -0,0 +1,98 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package eks
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/restjson"
)
// EKS provides the API operation methods for making requests to
// Amazon Elastic Kubernetes Service. See this package's package overview docs
// for details on the service.
//
// EKS methods are safe to use concurrently. It is not safe to
// modify mutate any of the struct's properties though.
type EKS 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 = "eks" // Name of service.
EndpointsID = ServiceName // ID to lookup a service endpoint with.
ServiceID = "EKS" // ServiceID is a unique identifer of a specific service.
)
// New creates a new instance of the EKS 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 EKS client from just a session.
// svc := eks.New(mySession)
//
// // Create a EKS client with additional configuration
// svc := eks.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
func New(p client.ConfigProvider, cfgs ...*aws.Config) *EKS {
c := p.ClientConfig(EndpointsID, cfgs...)
if c.SigningNameDerived || len(c.SigningName) == 0 {
c.SigningName = "eks"
}
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) *EKS {
svc := &EKS{
Client: client.New(
cfg,
metadata.ClientInfo{
ServiceName: ServiceName,
ServiceID: ServiceID,
SigningName: signingName,
SigningRegion: signingRegion,
Endpoint: endpoint,
APIVersion: "2017-11-01",
},
handlers,
),
}
// Handlers
svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
svc.Handlers.Build.PushBackNamed(restjson.BuildHandler)
svc.Handlers.Unmarshal.PushBackNamed(restjson.UnmarshalHandler)
svc.Handlers.UnmarshalMeta.PushBackNamed(restjson.UnmarshalMetaHandler)
svc.Handlers.UnmarshalError.PushBackNamed(restjson.UnmarshalErrorHandler)
// Run custom client initialization if present
if initClient != nil {
initClient(svc.Client)
}
return svc
}
// newRequest creates a new request for a EKS operation and runs any
// custom request initialization.
func (c *EKS) 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
}
+122
View File
@@ -0,0 +1,122 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package eks
import (
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/request"
)
// WaitUntilClusterActive uses the Amazon EKS API operation
// DescribeCluster to wait for a condition to be met before returning.
// If the condition is not met within the max attempt window, an error will
// be returned.
func (c *EKS) WaitUntilClusterActive(input *DescribeClusterInput) error {
return c.WaitUntilClusterActiveWithContext(aws.BackgroundContext(), input)
}
// WaitUntilClusterActiveWithContext is an extended version of WaitUntilClusterActive.
// With the support for passing in a context and options to configure the
// Waiter and the underlying request options.
//
// The context must be non-nil and will be used for request cancellation. If
// the context is nil a panic will occur. In the future the SDK may create
// sub-contexts for http.Requests. See https://golang.org/pkg/context/
// for more information on using Contexts.
func (c *EKS) WaitUntilClusterActiveWithContext(ctx aws.Context, input *DescribeClusterInput, opts ...request.WaiterOption) error {
w := request.Waiter{
Name: "WaitUntilClusterActive",
MaxAttempts: 40,
Delay: request.ConstantWaiterDelay(30 * time.Second),
Acceptors: []request.WaiterAcceptor{
{
State: request.FailureWaiterState,
Matcher: request.PathWaiterMatch, Argument: "cluster.status",
Expected: "DELETING",
},
{
State: request.FailureWaiterState,
Matcher: request.PathWaiterMatch, Argument: "cluster.status",
Expected: "FAILED",
},
{
State: request.SuccessWaiterState,
Matcher: request.PathWaiterMatch, Argument: "cluster.status",
Expected: "ACTIVE",
},
},
Logger: c.Config.Logger,
NewRequest: func(opts []request.Option) (*request.Request, error) {
var inCpy *DescribeClusterInput
if input != nil {
tmp := *input
inCpy = &tmp
}
req, _ := c.DescribeClusterRequest(inCpy)
req.SetContext(ctx)
req.ApplyOptions(opts...)
return req, nil
},
}
w.ApplyOptions(opts...)
return w.WaitWithContext(ctx)
}
// WaitUntilClusterDeleted uses the Amazon EKS API operation
// DescribeCluster to wait for a condition to be met before returning.
// If the condition is not met within the max attempt window, an error will
// be returned.
func (c *EKS) WaitUntilClusterDeleted(input *DescribeClusterInput) error {
return c.WaitUntilClusterDeletedWithContext(aws.BackgroundContext(), input)
}
// WaitUntilClusterDeletedWithContext is an extended version of WaitUntilClusterDeleted.
// With the support for passing in a context and options to configure the
// Waiter and the underlying request options.
//
// The context must be non-nil and will be used for request cancellation. If
// the context is nil a panic will occur. In the future the SDK may create
// sub-contexts for http.Requests. See https://golang.org/pkg/context/
// for more information on using Contexts.
func (c *EKS) WaitUntilClusterDeletedWithContext(ctx aws.Context, input *DescribeClusterInput, opts ...request.WaiterOption) error {
w := request.Waiter{
Name: "WaitUntilClusterDeleted",
MaxAttempts: 40,
Delay: request.ConstantWaiterDelay(30 * time.Second),
Acceptors: []request.WaiterAcceptor{
{
State: request.FailureWaiterState,
Matcher: request.PathWaiterMatch, Argument: "cluster.status",
Expected: "ACTIVE",
},
{
State: request.FailureWaiterState,
Matcher: request.PathWaiterMatch, Argument: "cluster.status",
Expected: "CREATING",
},
{
State: request.SuccessWaiterState,
Matcher: request.ErrorWaiterMatch,
Expected: "ResourceNotFoundException",
},
},
Logger: c.Config.Logger,
NewRequest: func(opts []request.Option) (*request.Request, error) {
var inCpy *DescribeClusterInput
if input != nil {
tmp := *input
inCpy = &tmp
}
req, _ := c.DescribeClusterRequest(inCpy)
req.SetContext(ctx)
req.ApplyOptions(opts...)
return req, nil
},
}
w.ApplyOptions(opts...)
return w.WaitWithContext(ctx)
}