Commit 429e5149 authored by Adrien Delorme's avatar Adrien Delorme
Browse files

tidy go modules

parent 0c00ef62
Showing with 0 additions and 171768 deletions
+0 -171768
......@@ -39,7 +39,6 @@ require (
github.com/gophercloud/utils v0.0.0-20200508015959-b0167b94122c
github.com/grpc-ecosystem/go-grpc-middleware v1.1.0
github.com/hako/durafmt v0.0.0-20200710122514-c0fb7b4da026
github.com/hashicorp/aws-sdk-go-base v0.6.0
github.com/hashicorp/errwrap v1.0.0
github.com/hashicorp/go-checkpoint v0.0.0-20171009173528-1545e56e46de
github.com/hashicorp/go-cleanhttp v0.5.1
......
// Package ec2query provides serialization of AWS EC2 requests and responses.
package ec2query
//go:generate go run -tags codegen ../../../private/model/cli/gen-protocol-tests ../../../models/protocol_tests/input/ec2.json build_test.go
import (
"net/url"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/private/protocol/query/queryutil"
)
// BuildHandler is a named request handler for building ec2query protocol requests
var BuildHandler = request.NamedHandler{Name: "awssdk.ec2query.Build", Fn: Build}
// Build builds a request for the EC2 protocol.
func Build(r *request.Request) {
body := url.Values{
"Action": {r.Operation.Name},
"Version": {r.ClientInfo.APIVersion},
}
if err := queryutil.Parse(body, r.Params, true); err != nil {
r.Error = awserr.New(request.ErrCodeSerialization,
"failed encoding EC2 Query request", err)
}
if !r.IsPresigned() {
r.HTTPRequest.Method = "POST"
r.HTTPRequest.Header.Set("Content-Type", "application/x-www-form-urlencoded; charset=utf-8")
r.SetBufferBody([]byte(body.Encode()))
} else { // This is a pre-signed request
r.HTTPRequest.Method = "GET"
r.HTTPRequest.URL.RawQuery = body.Encode()
}
}
package ec2query
//go:generate go run -tags codegen ../../../private/model/cli/gen-protocol-tests ../../../models/protocol_tests/output/ec2.json unmarshal_test.go
import (
"encoding/xml"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil"
)
// UnmarshalHandler is a named request handler for unmarshaling ec2query protocol requests
var UnmarshalHandler = request.NamedHandler{Name: "awssdk.ec2query.Unmarshal", Fn: Unmarshal}
// UnmarshalMetaHandler is a named request handler for unmarshaling ec2query protocol request metadata
var UnmarshalMetaHandler = request.NamedHandler{Name: "awssdk.ec2query.UnmarshalMeta", Fn: UnmarshalMeta}
// UnmarshalErrorHandler is a named request handler for unmarshaling ec2query protocol request errors
var UnmarshalErrorHandler = request.NamedHandler{Name: "awssdk.ec2query.UnmarshalError", Fn: UnmarshalError}
// Unmarshal unmarshals a response body for the EC2 protocol.
func Unmarshal(r *request.Request) {
defer r.HTTPResponse.Body.Close()
if r.DataFilled() {
decoder := xml.NewDecoder(r.HTTPResponse.Body)
err := xmlutil.UnmarshalXML(r.Data, decoder, "")
if err != nil {
r.Error = awserr.NewRequestFailure(
awserr.New(request.ErrCodeSerialization,
"failed decoding EC2 Query response", err),
r.HTTPResponse.StatusCode,
r.RequestID,
)
return
}
}
}
// UnmarshalMeta unmarshals response headers for the EC2 protocol.
func UnmarshalMeta(r *request.Request) {
r.RequestID = r.HTTPResponse.Header.Get("X-Amzn-Requestid")
if r.RequestID == "" {
// Alternative version of request id in the header
r.RequestID = r.HTTPResponse.Header.Get("X-Amz-Request-Id")
}
}
type xmlErrorResponse struct {
XMLName xml.Name `xml:"Response"`
Code string `xml:"Errors>Error>Code"`
Message string `xml:"Errors>Error>Message"`
RequestID string `xml:"RequestID"`
}
// UnmarshalError unmarshals a response error for the EC2 protocol.
func UnmarshalError(r *request.Request) {
defer r.HTTPResponse.Body.Close()
var respErr xmlErrorResponse
err := xmlutil.UnmarshalXMLError(&respErr, r.HTTPResponse.Body)
if err != nil {
r.Error = awserr.NewRequestFailure(
awserr.New(request.ErrCodeSerialization,
"failed to unmarshal error message", err),
r.HTTPResponse.StatusCode,
r.RequestID,
)
return
}
r.Error = awserr.NewRequestFailure(
awserr.New(respErr.Code, respErr.Message, nil),
r.HTTPResponse.StatusCode,
respErr.RequestID,
)
}
This diff is collapsed.
package ec2
import (
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awsutil"
"github.com/aws/aws-sdk-go/aws/client"
"github.com/aws/aws-sdk-go/aws/endpoints"
"github.com/aws/aws-sdk-go/aws/request"
)
const (
// customRetryerMinRetryDelay sets min retry delay
customRetryerMinRetryDelay = 1 * time.Second
// customRetryerMaxRetryDelay sets max retry delay
customRetryerMaxRetryDelay = 8 * time.Second
)
func init() {
initRequest = func(r *request.Request) {
if r.Operation.Name == opCopySnapshot { // fill the PresignedURL parameter
r.Handlers.Build.PushFront(fillPresignedURL)
}
// only set the retryer on request if config doesn't have a retryer
if r.Config.Retryer == nil && (r.Operation.Name == opModifyNetworkInterfaceAttribute || r.Operation.Name == opAssignPrivateIpAddresses) {
maxRetries := client.DefaultRetryerMaxNumRetries
if m := r.Config.MaxRetries; m != nil && *m != aws.UseServiceDefaultRetries {
maxRetries = *m
}
r.Retryer = client.DefaultRetryer{
NumMaxRetries: maxRetries,
MinRetryDelay: customRetryerMinRetryDelay,
MinThrottleDelay: customRetryerMinRetryDelay,
MaxRetryDelay: customRetryerMaxRetryDelay,
MaxThrottleDelay: customRetryerMaxRetryDelay,
}
}
}
}
func fillPresignedURL(r *request.Request) {
if !r.ParamsFilled() {
return
}
origParams := r.Params.(*CopySnapshotInput)
// Stop if PresignedURL/DestinationRegion is set
if origParams.PresignedUrl != nil || origParams.DestinationRegion != nil {
return
}
origParams.DestinationRegion = r.Config.Region
newParams := awsutil.CopyOf(r.Params).(*CopySnapshotInput)
// Create a new request based on the existing request. We will use this to
// presign the CopySnapshot request against the source region.
cfg := r.Config.Copy(aws.NewConfig().
WithEndpoint("").
WithRegion(aws.StringValue(origParams.SourceRegion)))
clientInfo := r.ClientInfo
resolved, err := r.Config.EndpointResolver.EndpointFor(
clientInfo.ServiceName, aws.StringValue(cfg.Region),
func(opt *endpoints.Options) {
opt.DisableSSL = aws.BoolValue(cfg.DisableSSL)
opt.UseDualStack = aws.BoolValue(cfg.UseDualStack)
},
)
if err != nil {
r.Error = err
return
}
clientInfo.Endpoint = resolved.URL
clientInfo.SigningRegion = resolved.SigningRegion
// Presign a CopySnapshot request with modified params
req := request.New(*cfg, clientInfo, r.Handlers, r.Retryer, r.Operation, newParams, r.Data)
url, err := req.Presign(5 * time.Minute) // 5 minutes should be enough.
if err != nil { // bubble error back up to original request
r.Error = err
return
}
// We have our URL, set it on params
origParams.PresignedUrl = &url
}
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
// Package ec2 provides the client and types for making API
// requests to Amazon Elastic Compute Cloud.
//
// Amazon Elastic Compute Cloud (Amazon EC2) provides secure and resizable computing
// capacity in the AWS cloud. Using Amazon EC2 eliminates the need to invest
// in hardware up front, so you can develop and deploy applications faster.
//
// To learn more, see the following resources:
//
// * Amazon EC2: AmazonEC2 product page (http://aws.amazon.com/ec2), Amazon
// EC2 documentation (http://aws.amazon.com/documentation/ec2)
//
// * Amazon EBS: Amazon EBS product page (http://aws.amazon.com/ebs), Amazon
// EBS documentation (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AmazonEBS.html)
//
// * Amazon VPC: Amazon VPC product page (http://aws.amazon.com/vpc), Amazon
// VPC documentation (http://aws.amazon.com/documentation/vpc)
//
// * AWS VPN: AWS VPN product page (http://aws.amazon.com/vpn), AWS VPN documentation
// (http://aws.amazon.com/documentation/vpn)
//
// See https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15 for more information on this service.
//
// See ec2 package documentation for more information.
// https://docs.aws.amazon.com/sdk-for-go/api/service/ec2/
//
// Using the Client
//
// To contact Amazon Elastic Compute Cloud 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 Compute Cloud client EC2 for more
// information on creating client for this service.
// https://docs.aws.amazon.com/sdk-for-go/api/service/ec2/#New
package ec2
This diff is collapsed.
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package ec2
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package ec2
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/ec2query"
)
// EC2 provides the API operation methods for making requests to
// Amazon Elastic Compute Cloud. See this package's package overview docs
// for details on the service.
//
// EC2 methods are safe to use concurrently. It is not safe to
// modify mutate any of the struct's properties though.
type EC2 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 = "ec2" // Name of service.
EndpointsID = ServiceName // ID to lookup a service endpoint with.
ServiceID = "EC2" // ServiceID is a unique identifier of a specific service.
)
// New creates a new instance of the EC2 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:
// mySession := session.Must(session.NewSession())
//
// // Create a EC2 client from just a session.
// svc := ec2.New(mySession)
//
// // Create a EC2 client with additional configuration
// svc := ec2.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
func New(p client.ConfigProvider, cfgs ...*aws.Config) *EC2 {
c := p.ClientConfig(EndpointsID, cfgs...)
return newClient(*c.Config, c.Handlers, c.PartitionID, c.Endpoint, c.SigningRegion, c.SigningName)
}
// newClient creates, initializes and returns a new service client instance.
func newClient(cfg aws.Config, handlers request.Handlers, partitionID, endpoint, signingRegion, signingName string) *EC2 {
svc := &EC2{
Client: client.New(
cfg,
metadata.ClientInfo{
ServiceName: ServiceName,
ServiceID: ServiceID,
SigningName: signingName,
SigningRegion: signingRegion,
PartitionID: partitionID,
Endpoint: endpoint,
APIVersion: "2016-11-15",
},
handlers,
),
}
// Handlers
svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
svc.Handlers.Build.PushBackNamed(ec2query.BuildHandler)
svc.Handlers.Unmarshal.PushBackNamed(ec2query.UnmarshalHandler)
svc.Handlers.UnmarshalMeta.PushBackNamed(ec2query.UnmarshalMetaHandler)
svc.Handlers.UnmarshalError.PushBackNamed(ec2query.UnmarshalErrorHandler)
// Run custom client initialization if present
if initClient != nil {
initClient(svc.Client)
}
return svc
}
// newRequest creates a new request for a EC2 operation and runs any
// custom request initialization.
func (c *EC2) 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
}
This diff is collapsed.
This diff is collapsed.
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
// Package ecr provides the client and types for making API
// requests to Amazon EC2 Container Registry.
//
// Amazon Elastic Container Registry (Amazon ECR) is a managed container image
// registry service. Customers can use the familiar Docker CLI, or their preferred
// client, to push, pull, and manage images. Amazon ECR provides a secure, scalable,
// and reliable registry for your Docker or Open Container Initiative (OCI)
// images. Amazon ECR supports private repositories with resource-based permissions
// using IAM so that specific users or Amazon EC2 instances can access repositories
// and images.
//
// See https://docs.aws.amazon.com/goto/WebAPI/ecr-2015-09-21 for more information on this service.
//
// See ecr package documentation for more information.
// https://docs.aws.amazon.com/sdk-for-go/api/service/ecr/
//
// Using the Client
//
// To contact Amazon EC2 Container Registry 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 EC2 Container Registry client ECR for more
// information on creating client for this service.
// https://docs.aws.amazon.com/sdk-for-go/api/service/ecr/#New
package ecr
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package ecr
import (
"github.com/aws/aws-sdk-go/private/protocol"
)
const (
// ErrCodeEmptyUploadException for service response error code
// "EmptyUploadException".
//
// The specified layer upload does not contain any layer parts.
ErrCodeEmptyUploadException = "EmptyUploadException"
// ErrCodeImageAlreadyExistsException for service response error code
// "ImageAlreadyExistsException".
//
// The specified image has already been pushed, and there were no changes to
// the manifest or image tag after the last push.
ErrCodeImageAlreadyExistsException = "ImageAlreadyExistsException"
// ErrCodeImageDigestDoesNotMatchException for service response error code
// "ImageDigestDoesNotMatchException".
//
// The specified image digest does not match the digest that Amazon ECR calculated
// for the image.
ErrCodeImageDigestDoesNotMatchException = "ImageDigestDoesNotMatchException"
// ErrCodeImageNotFoundException for service response error code
// "ImageNotFoundException".
//
// The image requested does not exist in the specified repository.
ErrCodeImageNotFoundException = "ImageNotFoundException"
// ErrCodeImageTagAlreadyExistsException for service response error code
// "ImageTagAlreadyExistsException".
//
// The specified image is tagged with a tag that already exists. The repository
// is configured for tag immutability.
ErrCodeImageTagAlreadyExistsException = "ImageTagAlreadyExistsException"
// ErrCodeInvalidLayerException for service response error code
// "InvalidLayerException".
//
// The layer digest calculation performed by Amazon ECR upon receipt of the
// image layer does not match the digest specified.
ErrCodeInvalidLayerException = "InvalidLayerException"
// ErrCodeInvalidLayerPartException for service response error code
// "InvalidLayerPartException".
//
// The layer part size is not valid, or the first byte specified is not consecutive
// to the last byte of a previous layer part upload.
ErrCodeInvalidLayerPartException = "InvalidLayerPartException"
// ErrCodeInvalidParameterException for service response error code
// "InvalidParameterException".
//
// The specified parameter is invalid. Review the available parameters for the
// API request.
ErrCodeInvalidParameterException = "InvalidParameterException"
// ErrCodeInvalidTagParameterException for service response error code
// "InvalidTagParameterException".
//
// An invalid parameter has been specified. Tag keys can have a maximum character
// length of 128 characters, and tag values can have a maximum length of 256
// characters.
ErrCodeInvalidTagParameterException = "InvalidTagParameterException"
// ErrCodeKmsException for service response error code
// "KmsException".
//
// The operation failed due to a KMS exception.
ErrCodeKmsException = "KmsException"
// ErrCodeLayerAlreadyExistsException for service response error code
// "LayerAlreadyExistsException".
//
// The image layer already exists in the associated repository.
ErrCodeLayerAlreadyExistsException = "LayerAlreadyExistsException"
// ErrCodeLayerInaccessibleException for service response error code
// "LayerInaccessibleException".
//
// The specified layer is not available because it is not associated with an
// image. Unassociated image layers may be cleaned up at any time.
ErrCodeLayerInaccessibleException = "LayerInaccessibleException"
// ErrCodeLayerPartTooSmallException for service response error code
// "LayerPartTooSmallException".
//
// Layer parts must be at least 5 MiB in size.
ErrCodeLayerPartTooSmallException = "LayerPartTooSmallException"
// ErrCodeLayersNotFoundException for service response error code
// "LayersNotFoundException".
//
// The specified layers could not be found, or the specified layer is not valid
// for this repository.
ErrCodeLayersNotFoundException = "LayersNotFoundException"
// ErrCodeLifecyclePolicyNotFoundException for service response error code
// "LifecyclePolicyNotFoundException".
//
// The lifecycle policy could not be found, and no policy is set to the repository.
ErrCodeLifecyclePolicyNotFoundException = "LifecyclePolicyNotFoundException"
// ErrCodeLifecyclePolicyPreviewInProgressException for service response error code
// "LifecyclePolicyPreviewInProgressException".
//
// The previous lifecycle policy preview request has not completed. Wait and
// try again.
ErrCodeLifecyclePolicyPreviewInProgressException = "LifecyclePolicyPreviewInProgressException"
// ErrCodeLifecyclePolicyPreviewNotFoundException for service response error code
// "LifecyclePolicyPreviewNotFoundException".
//
// There is no dry run for this repository.
ErrCodeLifecyclePolicyPreviewNotFoundException = "LifecyclePolicyPreviewNotFoundException"
// ErrCodeLimitExceededException for service response error code
// "LimitExceededException".
//
// The operation did not succeed because it would have exceeded a service limit
// for your account. For more information, see Amazon ECR Service Quotas (https://docs.aws.amazon.com/AmazonECR/latest/userguide/service-quotas.html)
// in the Amazon Elastic Container Registry User Guide.
ErrCodeLimitExceededException = "LimitExceededException"
// ErrCodeReferencedImagesNotFoundException for service response error code
// "ReferencedImagesNotFoundException".
//
// The manifest list is referencing an image that does not exist.
ErrCodeReferencedImagesNotFoundException = "ReferencedImagesNotFoundException"
// ErrCodeRegistryPolicyNotFoundException for service response error code
// "RegistryPolicyNotFoundException".
//
// The registry doesn't have an associated registry policy.
ErrCodeRegistryPolicyNotFoundException = "RegistryPolicyNotFoundException"
// ErrCodeRepositoryAlreadyExistsException for service response error code
// "RepositoryAlreadyExistsException".
//
// The specified repository already exists in the specified registry.
ErrCodeRepositoryAlreadyExistsException = "RepositoryAlreadyExistsException"
// ErrCodeRepositoryNotEmptyException for service response error code
// "RepositoryNotEmptyException".
//
// The specified repository contains images. To delete a repository that contains
// images, you must force the deletion with the force parameter.
ErrCodeRepositoryNotEmptyException = "RepositoryNotEmptyException"
// ErrCodeRepositoryNotFoundException for service response error code
// "RepositoryNotFoundException".
//
// The specified repository could not be found. Check the spelling of the specified
// repository and ensure that you are performing operations on the correct registry.
ErrCodeRepositoryNotFoundException = "RepositoryNotFoundException"
// ErrCodeRepositoryPolicyNotFoundException for service response error code
// "RepositoryPolicyNotFoundException".
//
// The specified repository and registry combination does not have an associated
// repository policy.
ErrCodeRepositoryPolicyNotFoundException = "RepositoryPolicyNotFoundException"
// ErrCodeScanNotFoundException for service response error code
// "ScanNotFoundException".
//
// The specified image scan could not be found. Ensure that image scanning is
// enabled on the repository and try again.
ErrCodeScanNotFoundException = "ScanNotFoundException"
// ErrCodeServerException for service response error code
// "ServerException".
//
// These errors are usually caused by a server-side issue.
ErrCodeServerException = "ServerException"
// ErrCodeTooManyTagsException for service response error code
// "TooManyTagsException".
//
// The list of tags on the repository is over the limit. The maximum number
// of tags that can be applied to a repository is 50.
ErrCodeTooManyTagsException = "TooManyTagsException"
// ErrCodeUnsupportedImageTypeException for service response error code
// "UnsupportedImageTypeException".
//
// The image is of a type that cannot be scanned.
ErrCodeUnsupportedImageTypeException = "UnsupportedImageTypeException"
// ErrCodeUploadNotFoundException for service response error code
// "UploadNotFoundException".
//
// The upload could not be found, or the specified upload ID is not valid for
// this repository.
ErrCodeUploadNotFoundException = "UploadNotFoundException"
// ErrCodeValidationException for service response error code
// "ValidationException".
//
// There was an exception validating this request.
ErrCodeValidationException = "ValidationException"
)
var exceptionFromCode = map[string]func(protocol.ResponseMetadata) error{
"EmptyUploadException": newErrorEmptyUploadException,
"ImageAlreadyExistsException": newErrorImageAlreadyExistsException,
"ImageDigestDoesNotMatchException": newErrorImageDigestDoesNotMatchException,
"ImageNotFoundException": newErrorImageNotFoundException,
"ImageTagAlreadyExistsException": newErrorImageTagAlreadyExistsException,
"InvalidLayerException": newErrorInvalidLayerException,
"InvalidLayerPartException": newErrorInvalidLayerPartException,
"InvalidParameterException": newErrorInvalidParameterException,
"InvalidTagParameterException": newErrorInvalidTagParameterException,
"KmsException": newErrorKmsException,
"LayerAlreadyExistsException": newErrorLayerAlreadyExistsException,
"LayerInaccessibleException": newErrorLayerInaccessibleException,
"LayerPartTooSmallException": newErrorLayerPartTooSmallException,
"LayersNotFoundException": newErrorLayersNotFoundException,
"LifecyclePolicyNotFoundException": newErrorLifecyclePolicyNotFoundException,
"LifecyclePolicyPreviewInProgressException": newErrorLifecyclePolicyPreviewInProgressException,
"LifecyclePolicyPreviewNotFoundException": newErrorLifecyclePolicyPreviewNotFoundException,
"LimitExceededException": newErrorLimitExceededException,
"ReferencedImagesNotFoundException": newErrorReferencedImagesNotFoundException,
"RegistryPolicyNotFoundException": newErrorRegistryPolicyNotFoundException,
"RepositoryAlreadyExistsException": newErrorRepositoryAlreadyExistsException,
"RepositoryNotEmptyException": newErrorRepositoryNotEmptyException,
"RepositoryNotFoundException": newErrorRepositoryNotFoundException,
"RepositoryPolicyNotFoundException": newErrorRepositoryPolicyNotFoundException,
"ScanNotFoundException": newErrorScanNotFoundException,
"ServerException": newErrorServerException,
"TooManyTagsException": newErrorTooManyTagsException,
"UnsupportedImageTypeException": newErrorUnsupportedImageTypeException,
"UploadNotFoundException": newErrorUploadNotFoundException,
"ValidationException": newErrorValidationException,
}
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package ecr
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"
"github.com/aws/aws-sdk-go/private/protocol/jsonrpc"
)
// ECR provides the API operation methods for making requests to
// Amazon EC2 Container Registry. See this package's package overview docs
// for details on the service.
//
// ECR methods are safe to use concurrently. It is not safe to
// modify mutate any of the struct's properties though.
type ECR 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 = "ecr" // Name of service.
EndpointsID = "api.ecr" // ID to lookup a service endpoint with.
ServiceID = "ECR" // ServiceID is a unique identifier of a specific service.
)
// New creates a new instance of the ECR 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:
// mySession := session.Must(session.NewSession())
//
// // Create a ECR client from just a session.
// svc := ecr.New(mySession)
//
// // Create a ECR client with additional configuration
// svc := ecr.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
func New(p client.ConfigProvider, cfgs ...*aws.Config) *ECR {
c := p.ClientConfig(EndpointsID, cfgs...)
if c.SigningNameDerived || len(c.SigningName) == 0 {
c.SigningName = "ecr"
}
return newClient(*c.Config, c.Handlers, c.PartitionID, c.Endpoint, c.SigningRegion, c.SigningName)
}
// newClient creates, initializes and returns a new service client instance.
func newClient(cfg aws.Config, handlers request.Handlers, partitionID, endpoint, signingRegion, signingName string) *ECR {
svc := &ECR{
Client: client.New(
cfg,
metadata.ClientInfo{
ServiceName: ServiceName,
ServiceID: ServiceID,
SigningName: signingName,
SigningRegion: signingRegion,
PartitionID: partitionID,
Endpoint: endpoint,
APIVersion: "2015-09-21",
JSONVersion: "1.1",
TargetPrefix: "AmazonEC2ContainerRegistry_V20150921",
},
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(
protocol.NewUnmarshalErrorHandler(jsonrpc.NewUnmarshalTypedError(exceptionFromCode)).NamedHandler(),
)
// Run custom client initialization if present
if initClient != nil {
initClient(svc.Client)
}
return svc
}
// newRequest creates a new request for a ECR operation and runs any
// custom request initialization.
func (c *ECR) 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
}
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package ecr
import (
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/request"
)
// WaitUntilImageScanComplete uses the Amazon ECR API operation
// DescribeImageScanFindings 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 *ECR) WaitUntilImageScanComplete(input *DescribeImageScanFindingsInput) error {
return c.WaitUntilImageScanCompleteWithContext(aws.BackgroundContext(), input)
}
// WaitUntilImageScanCompleteWithContext is an extended version of WaitUntilImageScanComplete.
// 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 *ECR) WaitUntilImageScanCompleteWithContext(ctx aws.Context, input *DescribeImageScanFindingsInput, opts ...request.WaiterOption) error {
w := request.Waiter{
Name: "WaitUntilImageScanComplete",
MaxAttempts: 60,
Delay: request.ConstantWaiterDelay(5 * time.Second),
Acceptors: []request.WaiterAcceptor{
{
State: request.SuccessWaiterState,
Matcher: request.PathWaiterMatch, Argument: "imageScanStatus.status",
Expected: "COMPLETE",
},
{
State: request.FailureWaiterState,
Matcher: request.PathWaiterMatch, Argument: "imageScanStatus.status",
Expected: "FAILED",
},
},
Logger: c.Config.Logger,
NewRequest: func(opts []request.Option) (*request.Request, error) {
var inCpy *DescribeImageScanFindingsInput
if input != nil {
tmp := *input
inCpy = &tmp
}
req, _ := c.DescribeImageScanFindingsRequest(inCpy)
req.SetContext(ctx)
req.ApplyOptions(opts...)
return req, nil
},
}
w.ApplyOptions(opts...)
return w.WaitWithContext(ctx)
}
// WaitUntilLifecyclePolicyPreviewComplete uses the Amazon ECR API operation
// GetLifecyclePolicyPreview 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 *ECR) WaitUntilLifecyclePolicyPreviewComplete(input *GetLifecyclePolicyPreviewInput) error {
return c.WaitUntilLifecyclePolicyPreviewCompleteWithContext(aws.BackgroundContext(), input)
}
// WaitUntilLifecyclePolicyPreviewCompleteWithContext is an extended version of WaitUntilLifecyclePolicyPreviewComplete.
// 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 *ECR) WaitUntilLifecyclePolicyPreviewCompleteWithContext(ctx aws.Context, input *GetLifecyclePolicyPreviewInput, opts ...request.WaiterOption) error {
w := request.Waiter{
Name: "WaitUntilLifecyclePolicyPreviewComplete",
MaxAttempts: 20,
Delay: request.ConstantWaiterDelay(5 * time.Second),
Acceptors: []request.WaiterAcceptor{
{
State: request.SuccessWaiterState,
Matcher: request.PathWaiterMatch, Argument: "status",
Expected: "COMPLETE",
},
{
State: request.FailureWaiterState,
Matcher: request.PathWaiterMatch, Argument: "status",
Expected: "FAILED",
},
},
Logger: c.Config.Logger,
NewRequest: func(opts []request.Option) (*request.Request, error) {
var inCpy *GetLifecyclePolicyPreviewInput
if input != nil {
tmp := *input
inCpy = &tmp
}
req, _ := c.GetLifecyclePolicyPreviewRequest(inCpy)
req.SetContext(ctx)
req.ApplyOptions(opts...)
return req, nil
},
}
w.ApplyOptions(opts...)
return w.WaitWithContext(ctx)
}
This diff is collapsed.
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
// Package iam provides the client and types for making API
// requests to AWS Identity and Access Management.
//
// AWS Identity and Access Management (IAM) is a web service for securely controlling
// access to AWS services. With IAM, you can centrally manage users, security
// credentials such as access keys, and permissions that control which AWS resources
// users and applications can access. For more information about IAM, see AWS
// Identity and Access Management (IAM) (http://aws.amazon.com/iam/) and the
// AWS Identity and Access Management User Guide (https://docs.aws.amazon.com/IAM/latest/UserGuide/).
//
// See https://docs.aws.amazon.com/goto/WebAPI/iam-2010-05-08 for more information on this service.
//
// See iam package documentation for more information.
// https://docs.aws.amazon.com/sdk-for-go/api/service/iam/
//
// Using the Client
//
// To contact AWS Identity and Access Management 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 AWS Identity and Access Management client IAM for more
// information on creating client for this service.
// https://docs.aws.amazon.com/sdk-for-go/api/service/iam/#New
package iam
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package iam
const (
// ErrCodeConcurrentModificationException for service response error code
// "ConcurrentModification".
//
// The request was rejected because multiple requests to change this object
// were submitted simultaneously. Wait a few minutes and submit your request
// again.
ErrCodeConcurrentModificationException = "ConcurrentModification"
// ErrCodeCredentialReportExpiredException for service response error code
// "ReportExpired".
//
// The request was rejected because the most recent credential report has expired.
// To generate a new credential report, use GenerateCredentialReport. For more
// information about credential report expiration, see Getting Credential Reports
// (https://docs.aws.amazon.com/IAM/latest/UserGuide/credential-reports.html)
// in the IAM User Guide.
ErrCodeCredentialReportExpiredException = "ReportExpired"
// ErrCodeCredentialReportNotPresentException for service response error code
// "ReportNotPresent".
//
// The request was rejected because the credential report does not exist. To
// generate a credential report, use GenerateCredentialReport.
ErrCodeCredentialReportNotPresentException = "ReportNotPresent"
// ErrCodeCredentialReportNotReadyException for service response error code
// "ReportInProgress".
//
// The request was rejected because the credential report is still being generated.
ErrCodeCredentialReportNotReadyException = "ReportInProgress"
// ErrCodeDeleteConflictException for service response error code
// "DeleteConflict".
//
// The request was rejected because it attempted to delete a resource that has
// attached subordinate entities. The error message describes these entities.
ErrCodeDeleteConflictException = "DeleteConflict"
// ErrCodeDuplicateCertificateException for service response error code
// "DuplicateCertificate".
//
// The request was rejected because the same certificate is associated with
// an IAM user in the account.
ErrCodeDuplicateCertificateException = "DuplicateCertificate"
// ErrCodeDuplicateSSHPublicKeyException for service response error code
// "DuplicateSSHPublicKey".
//
// The request was rejected because the SSH public key is already associated
// with the specified IAM user.
ErrCodeDuplicateSSHPublicKeyException = "DuplicateSSHPublicKey"
// ErrCodeEntityAlreadyExistsException for service response error code
// "EntityAlreadyExists".
//
// The request was rejected because it attempted to create a resource that already
// exists.
ErrCodeEntityAlreadyExistsException = "EntityAlreadyExists"
// ErrCodeEntityTemporarilyUnmodifiableException for service response error code
// "EntityTemporarilyUnmodifiable".
//
// The request was rejected because it referenced an entity that is temporarily
// unmodifiable, such as a user name that was deleted and then recreated. The
// error indicates that the request is likely to succeed if you try again after
// waiting several minutes. The error message describes the entity.
ErrCodeEntityTemporarilyUnmodifiableException = "EntityTemporarilyUnmodifiable"
// ErrCodeInvalidAuthenticationCodeException for service response error code
// "InvalidAuthenticationCode".
//
// The request was rejected because the authentication code was not recognized.
// The error message describes the specific error.
ErrCodeInvalidAuthenticationCodeException = "InvalidAuthenticationCode"
// ErrCodeInvalidCertificateException for service response error code
// "InvalidCertificate".
//
// The request was rejected because the certificate is invalid.
ErrCodeInvalidCertificateException = "InvalidCertificate"
// ErrCodeInvalidInputException for service response error code
// "InvalidInput".
//
// The request was rejected because an invalid or out-of-range value was supplied
// for an input parameter.
ErrCodeInvalidInputException = "InvalidInput"
// ErrCodeInvalidPublicKeyException for service response error code
// "InvalidPublicKey".
//
// The request was rejected because the public key is malformed or otherwise
// invalid.
ErrCodeInvalidPublicKeyException = "InvalidPublicKey"
// ErrCodeInvalidUserTypeException for service response error code
// "InvalidUserType".
//
// The request was rejected because the type of user for the transaction was
// incorrect.
ErrCodeInvalidUserTypeException = "InvalidUserType"
// ErrCodeKeyPairMismatchException for service response error code
// "KeyPairMismatch".
//
// The request was rejected because the public key certificate and the private
// key do not match.
ErrCodeKeyPairMismatchException = "KeyPairMismatch"
// ErrCodeLimitExceededException for service response error code
// "LimitExceeded".
//
// The request was rejected because it attempted to create resources beyond
// the current AWS account limitations. The error message describes the limit
// exceeded.
ErrCodeLimitExceededException = "LimitExceeded"
// ErrCodeMalformedCertificateException for service response error code
// "MalformedCertificate".
//
// The request was rejected because the certificate was malformed or expired.
// The error message describes the specific error.
ErrCodeMalformedCertificateException = "MalformedCertificate"
// ErrCodeMalformedPolicyDocumentException for service response error code
// "MalformedPolicyDocument".
//
// The request was rejected because the policy document was malformed. The error
// message describes the specific error.
ErrCodeMalformedPolicyDocumentException = "MalformedPolicyDocument"
// ErrCodeNoSuchEntityException for service response error code
// "NoSuchEntity".
//
// The request was rejected because it referenced a resource entity that does
// not exist. The error message describes the resource.
ErrCodeNoSuchEntityException = "NoSuchEntity"
// ErrCodePasswordPolicyViolationException for service response error code
// "PasswordPolicyViolation".
//
// The request was rejected because the provided password did not meet the requirements
// imposed by the account password policy.
ErrCodePasswordPolicyViolationException = "PasswordPolicyViolation"
// ErrCodePolicyEvaluationException for service response error code
// "PolicyEvaluation".
//
// The request failed because a provided policy could not be successfully evaluated.
// An additional detailed message indicates the source of the failure.
ErrCodePolicyEvaluationException = "PolicyEvaluation"
// ErrCodePolicyNotAttachableException for service response error code
// "PolicyNotAttachable".
//
// The request failed because AWS service role policies can only be attached
// to the service-linked role for that service.
ErrCodePolicyNotAttachableException = "PolicyNotAttachable"
// ErrCodeReportGenerationLimitExceededException for service response error code
// "ReportGenerationLimitExceeded".
//
// The request failed because the maximum number of concurrent requests for
// this account are already running.
ErrCodeReportGenerationLimitExceededException = "ReportGenerationLimitExceeded"
// ErrCodeServiceFailureException for service response error code
// "ServiceFailure".
//
// The request processing has failed because of an unknown error, exception
// or failure.
ErrCodeServiceFailureException = "ServiceFailure"
// ErrCodeServiceNotSupportedException for service response error code
// "NotSupportedService".
//
// The specified service does not support service-specific credentials.
ErrCodeServiceNotSupportedException = "NotSupportedService"
// ErrCodeUnmodifiableEntityException for service response error code
// "UnmodifiableEntity".
//
// The request was rejected because only the service that depends on the service-linked
// role can modify or delete the role on your behalf. The error message includes
// the name of the service that depends on this service-linked role. You must
// request the change through that service.
ErrCodeUnmodifiableEntityException = "UnmodifiableEntity"
// ErrCodeUnrecognizedPublicKeyEncodingException for service response error code
// "UnrecognizedPublicKeyEncoding".
//
// The request was rejected because the public key encoding format is unsupported
// or unrecognized.
ErrCodeUnrecognizedPublicKeyEncodingException = "UnrecognizedPublicKeyEncoding"
)
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package iam
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/query"
)
// IAM provides the API operation methods for making requests to
// AWS Identity and Access Management. See this package's package overview docs
// for details on the service.
//
// IAM methods are safe to use concurrently. It is not safe to
// modify mutate any of the struct's properties though.
type IAM 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 = "iam" // Name of service.
EndpointsID = ServiceName // ID to lookup a service endpoint with.
ServiceID = "IAM" // ServiceID is a unique identifier of a specific service.
)
// New creates a new instance of the IAM 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:
// mySession := session.Must(session.NewSession())
//
// // Create a IAM client from just a session.
// svc := iam.New(mySession)
//
// // Create a IAM client with additional configuration
// svc := iam.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
func New(p client.ConfigProvider, cfgs ...*aws.Config) *IAM {
c := p.ClientConfig(EndpointsID, cfgs...)
return newClient(*c.Config, c.Handlers, c.PartitionID, c.Endpoint, c.SigningRegion, c.SigningName)
}
// newClient creates, initializes and returns a new service client instance.
func newClient(cfg aws.Config, handlers request.Handlers, partitionID, endpoint, signingRegion, signingName string) *IAM {
svc := &IAM{
Client: client.New(
cfg,
metadata.ClientInfo{
ServiceName: ServiceName,
ServiceID: ServiceID,
SigningName: signingName,
SigningRegion: signingRegion,
PartitionID: partitionID,
Endpoint: endpoint,
APIVersion: "2010-05-08",
},
handlers,
),
}
// Handlers
svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
svc.Handlers.Build.PushBackNamed(query.BuildHandler)
svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler)
svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler)
svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler)
// Run custom client initialization if present
if initClient != nil {
initClient(svc.Client)
}
return svc
}
// newRequest creates a new request for a IAM operation and runs any
// custom request initialization.
func (c *IAM) 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
}
This diff is collapsed.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment