Switch to using the dep tool and update all the dependencies

This commit is contained in:
Nick Craig-Wood
2017-05-11 15:39:54 +01:00
parent 5135ff73cb
commit 98c2d2c41b
5321 changed files with 4483197 additions and 5918 deletions
File diff suppressed because it is too large Load Diff
+85
View File
@@ -0,0 +1,85 @@
// 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 EC2 Container Registry (Amazon ECR) is a managed AWS Docker registry
// service. Customers can use the familiar Docker CLI to push, pull, and manage
// images. Amazon ECR provides a secure, scalable, and reliable registry. Amazon
// ECR supports private Docker repositories with resource-based permissions
// using AWS IAM so that specific users or Amazon EC2 instances can access repositories
// and images. Developers can use the Docker CLI to author and manage 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 use the client for Amazon EC2 Container Registry you will first need
// to create a new instance of it.
//
// When creating a client for an AWS service you'll first need to have a Session
// already created. The Session provides configuration that can be shared
// between multiple service clients. Additional configuration can be applied to
// the Session and service's client when they are constructed. The aws package's
// Config type contains several fields such as Region for the AWS Region the
// client should make API requests too. The optional Config value can be provided
// as the variadic argument for Sessions and client creation.
//
// Once the service's client is created you can use it to make API requests the
// AWS service. These clients are safe to use concurrently.
//
// // Create a session to share configuration, and load external configuration.
// sess := session.Must(session.NewSession())
//
// // Create the service's client with the session.
// svc := ecr.New(sess)
//
// See the SDK's documentation for more information on how to use service clients.
// https://docs.aws.amazon.com/sdk-for-go/api/
//
// See aws package's Config type for more information on configuration options.
// https://docs.aws.amazon.com/sdk-for-go/api/aws/#Config
//
// See the Amazon EC2 Container Registry client ECR for more
// information on creating the service's client.
// https://docs.aws.amazon.com/sdk-for-go/api/service/ecr/#New
//
// Once the client is created you can make an API request to the service.
// Each API method takes a input parameter, and returns the service response
// and an error.
//
// The API method will document which error codes the service can be returned
// by the operation if the service models the API operation's errors. These
// errors will also be available as const strings prefixed with "ErrCode".
//
// result, err := svc.BatchCheckLayerAvailability(params)
// if err != nil {
// // Cast err to awserr.Error to handle specific error codes.
// aerr, ok := err.(awserr.Error)
// if ok && aerr.Code() == <error code to check for> {
// // Specific error code handling
// }
// return err
// }
//
// fmt.Println("BatchCheckLayerAvailability result:")
// fmt.Println(result)
//
// Using the Client with Context
//
// The service's client also provides methods to make API requests with a Context
// value. This allows you to control the timeout, and cancellation of pending
// requests. These methods also take request Option as variadic parameter to apply
// additional configuration to the API request.
//
// ctx := context.Background()
//
// result, err := svc.BatchCheckLayerAvailabilityWithContext(ctx, params)
//
// See the request package documentation for more information on using Context pattern
// with the SDK.
// https://docs.aws.amazon.com/sdk-for-go/api/aws/request/
package ecr
+141
View File
@@ -0,0 +1,141 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
// Package ecriface provides an interface to enable mocking the Amazon EC2 Container Registry 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 ecriface
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/service/ecr"
)
// ECRAPI provides an interface to enable mocking the
// ecr.ECR 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 the SDK's request pipeline.
//
// // myFunc uses an SDK service client to make a request to
// // Amazon EC2 Container Registry.
// func myFunc(svc ecriface.ECRAPI) bool {
// // Make svc.BatchCheckLayerAvailability request
// }
//
// func main() {
// sess := session.New()
// svc := ecr.New(sess)
//
// myFunc(svc)
// }
//
// In your _test.go file:
//
// // Define a mock struct to be used in your unit tests of myFunc.
// type mockECRClient struct {
// ecriface.ECRAPI
// }
// func (m *mockECRClient) BatchCheckLayerAvailability(input *ecr.BatchCheckLayerAvailabilityInput) (*ecr.BatchCheckLayerAvailabilityOutput, error) {
// // mock response/functionality
// }
//
// func TestMyFunc(t *testing.T) {
// // Setup Test
// mockSvc := &mockECRClient{}
//
// 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 ECRAPI interface {
BatchCheckLayerAvailability(*ecr.BatchCheckLayerAvailabilityInput) (*ecr.BatchCheckLayerAvailabilityOutput, error)
BatchCheckLayerAvailabilityWithContext(aws.Context, *ecr.BatchCheckLayerAvailabilityInput, ...request.Option) (*ecr.BatchCheckLayerAvailabilityOutput, error)
BatchCheckLayerAvailabilityRequest(*ecr.BatchCheckLayerAvailabilityInput) (*request.Request, *ecr.BatchCheckLayerAvailabilityOutput)
BatchDeleteImage(*ecr.BatchDeleteImageInput) (*ecr.BatchDeleteImageOutput, error)
BatchDeleteImageWithContext(aws.Context, *ecr.BatchDeleteImageInput, ...request.Option) (*ecr.BatchDeleteImageOutput, error)
BatchDeleteImageRequest(*ecr.BatchDeleteImageInput) (*request.Request, *ecr.BatchDeleteImageOutput)
BatchGetImage(*ecr.BatchGetImageInput) (*ecr.BatchGetImageOutput, error)
BatchGetImageWithContext(aws.Context, *ecr.BatchGetImageInput, ...request.Option) (*ecr.BatchGetImageOutput, error)
BatchGetImageRequest(*ecr.BatchGetImageInput) (*request.Request, *ecr.BatchGetImageOutput)
CompleteLayerUpload(*ecr.CompleteLayerUploadInput) (*ecr.CompleteLayerUploadOutput, error)
CompleteLayerUploadWithContext(aws.Context, *ecr.CompleteLayerUploadInput, ...request.Option) (*ecr.CompleteLayerUploadOutput, error)
CompleteLayerUploadRequest(*ecr.CompleteLayerUploadInput) (*request.Request, *ecr.CompleteLayerUploadOutput)
CreateRepository(*ecr.CreateRepositoryInput) (*ecr.CreateRepositoryOutput, error)
CreateRepositoryWithContext(aws.Context, *ecr.CreateRepositoryInput, ...request.Option) (*ecr.CreateRepositoryOutput, error)
CreateRepositoryRequest(*ecr.CreateRepositoryInput) (*request.Request, *ecr.CreateRepositoryOutput)
DeleteRepository(*ecr.DeleteRepositoryInput) (*ecr.DeleteRepositoryOutput, error)
DeleteRepositoryWithContext(aws.Context, *ecr.DeleteRepositoryInput, ...request.Option) (*ecr.DeleteRepositoryOutput, error)
DeleteRepositoryRequest(*ecr.DeleteRepositoryInput) (*request.Request, *ecr.DeleteRepositoryOutput)
DeleteRepositoryPolicy(*ecr.DeleteRepositoryPolicyInput) (*ecr.DeleteRepositoryPolicyOutput, error)
DeleteRepositoryPolicyWithContext(aws.Context, *ecr.DeleteRepositoryPolicyInput, ...request.Option) (*ecr.DeleteRepositoryPolicyOutput, error)
DeleteRepositoryPolicyRequest(*ecr.DeleteRepositoryPolicyInput) (*request.Request, *ecr.DeleteRepositoryPolicyOutput)
DescribeImages(*ecr.DescribeImagesInput) (*ecr.DescribeImagesOutput, error)
DescribeImagesWithContext(aws.Context, *ecr.DescribeImagesInput, ...request.Option) (*ecr.DescribeImagesOutput, error)
DescribeImagesRequest(*ecr.DescribeImagesInput) (*request.Request, *ecr.DescribeImagesOutput)
DescribeImagesPages(*ecr.DescribeImagesInput, func(*ecr.DescribeImagesOutput, bool) bool) error
DescribeImagesPagesWithContext(aws.Context, *ecr.DescribeImagesInput, func(*ecr.DescribeImagesOutput, bool) bool, ...request.Option) error
DescribeRepositories(*ecr.DescribeRepositoriesInput) (*ecr.DescribeRepositoriesOutput, error)
DescribeRepositoriesWithContext(aws.Context, *ecr.DescribeRepositoriesInput, ...request.Option) (*ecr.DescribeRepositoriesOutput, error)
DescribeRepositoriesRequest(*ecr.DescribeRepositoriesInput) (*request.Request, *ecr.DescribeRepositoriesOutput)
DescribeRepositoriesPages(*ecr.DescribeRepositoriesInput, func(*ecr.DescribeRepositoriesOutput, bool) bool) error
DescribeRepositoriesPagesWithContext(aws.Context, *ecr.DescribeRepositoriesInput, func(*ecr.DescribeRepositoriesOutput, bool) bool, ...request.Option) error
GetAuthorizationToken(*ecr.GetAuthorizationTokenInput) (*ecr.GetAuthorizationTokenOutput, error)
GetAuthorizationTokenWithContext(aws.Context, *ecr.GetAuthorizationTokenInput, ...request.Option) (*ecr.GetAuthorizationTokenOutput, error)
GetAuthorizationTokenRequest(*ecr.GetAuthorizationTokenInput) (*request.Request, *ecr.GetAuthorizationTokenOutput)
GetDownloadUrlForLayer(*ecr.GetDownloadUrlForLayerInput) (*ecr.GetDownloadUrlForLayerOutput, error)
GetDownloadUrlForLayerWithContext(aws.Context, *ecr.GetDownloadUrlForLayerInput, ...request.Option) (*ecr.GetDownloadUrlForLayerOutput, error)
GetDownloadUrlForLayerRequest(*ecr.GetDownloadUrlForLayerInput) (*request.Request, *ecr.GetDownloadUrlForLayerOutput)
GetRepositoryPolicy(*ecr.GetRepositoryPolicyInput) (*ecr.GetRepositoryPolicyOutput, error)
GetRepositoryPolicyWithContext(aws.Context, *ecr.GetRepositoryPolicyInput, ...request.Option) (*ecr.GetRepositoryPolicyOutput, error)
GetRepositoryPolicyRequest(*ecr.GetRepositoryPolicyInput) (*request.Request, *ecr.GetRepositoryPolicyOutput)
InitiateLayerUpload(*ecr.InitiateLayerUploadInput) (*ecr.InitiateLayerUploadOutput, error)
InitiateLayerUploadWithContext(aws.Context, *ecr.InitiateLayerUploadInput, ...request.Option) (*ecr.InitiateLayerUploadOutput, error)
InitiateLayerUploadRequest(*ecr.InitiateLayerUploadInput) (*request.Request, *ecr.InitiateLayerUploadOutput)
ListImages(*ecr.ListImagesInput) (*ecr.ListImagesOutput, error)
ListImagesWithContext(aws.Context, *ecr.ListImagesInput, ...request.Option) (*ecr.ListImagesOutput, error)
ListImagesRequest(*ecr.ListImagesInput) (*request.Request, *ecr.ListImagesOutput)
ListImagesPages(*ecr.ListImagesInput, func(*ecr.ListImagesOutput, bool) bool) error
ListImagesPagesWithContext(aws.Context, *ecr.ListImagesInput, func(*ecr.ListImagesOutput, bool) bool, ...request.Option) error
PutImage(*ecr.PutImageInput) (*ecr.PutImageOutput, error)
PutImageWithContext(aws.Context, *ecr.PutImageInput, ...request.Option) (*ecr.PutImageOutput, error)
PutImageRequest(*ecr.PutImageInput) (*request.Request, *ecr.PutImageOutput)
SetRepositoryPolicy(*ecr.SetRepositoryPolicyInput) (*ecr.SetRepositoryPolicyOutput, error)
SetRepositoryPolicyWithContext(aws.Context, *ecr.SetRepositoryPolicyInput, ...request.Option) (*ecr.SetRepositoryPolicyOutput, error)
SetRepositoryPolicyRequest(*ecr.SetRepositoryPolicyInput) (*request.Request, *ecr.SetRepositoryPolicyOutput)
UploadLayerPart(*ecr.UploadLayerPartInput) (*ecr.UploadLayerPartOutput, error)
UploadLayerPartWithContext(aws.Context, *ecr.UploadLayerPartInput, ...request.Option) (*ecr.UploadLayerPartOutput, error)
UploadLayerPartRequest(*ecr.UploadLayerPartInput) (*request.Request, *ecr.UploadLayerPartOutput)
}
var _ ECRAPI = (*ecr.ECR)(nil)
+121
View File
@@ -0,0 +1,121 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package ecr
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 are no changes to
// the manifest or image tag since the last push.
ErrCodeImageAlreadyExistsException = "ImageAlreadyExistsException"
// ErrCodeImageNotFoundException for service response error code
// "ImageNotFoundException".
//
// The image requested does not exist in the specified repository.
ErrCodeImageNotFoundException = "ImageNotFoundException"
// 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"
// 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"
// 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 Default Service Limits
// (http://docs.aws.amazon.com/AmazonECR/latest/userguide/service_limits.html)
// in the Amazon EC2 Container Registry User Guide.
ErrCodeLimitExceededException = "LimitExceededException"
// 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"
// ErrCodeServerException for service response error code
// "ServerException".
//
// These errors are usually caused by a server-side issue.
ErrCodeServerException = "ServerException"
// 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"
)
+450
View File
@@ -0,0 +1,450 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package ecr_test
import (
"bytes"
"fmt"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/ecr"
)
var _ time.Duration
var _ bytes.Buffer
func ExampleECR_BatchCheckLayerAvailability() {
sess := session.Must(session.NewSession())
svc := ecr.New(sess)
params := &ecr.BatchCheckLayerAvailabilityInput{
LayerDigests: []*string{ // Required
aws.String("BatchedOperationLayerDigest"), // Required
// More values...
},
RepositoryName: aws.String("RepositoryName"), // Required
RegistryId: aws.String("RegistryId"),
}
resp, err := svc.BatchCheckLayerAvailability(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleECR_BatchDeleteImage() {
sess := session.Must(session.NewSession())
svc := ecr.New(sess)
params := &ecr.BatchDeleteImageInput{
ImageIds: []*ecr.ImageIdentifier{ // Required
{ // Required
ImageDigest: aws.String("ImageDigest"),
ImageTag: aws.String("ImageTag"),
},
// More values...
},
RepositoryName: aws.String("RepositoryName"), // Required
RegistryId: aws.String("RegistryId"),
}
resp, err := svc.BatchDeleteImage(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleECR_BatchGetImage() {
sess := session.Must(session.NewSession())
svc := ecr.New(sess)
params := &ecr.BatchGetImageInput{
ImageIds: []*ecr.ImageIdentifier{ // Required
{ // Required
ImageDigest: aws.String("ImageDigest"),
ImageTag: aws.String("ImageTag"),
},
// More values...
},
RepositoryName: aws.String("RepositoryName"), // Required
AcceptedMediaTypes: []*string{
aws.String("MediaType"), // Required
// More values...
},
RegistryId: aws.String("RegistryId"),
}
resp, err := svc.BatchGetImage(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleECR_CompleteLayerUpload() {
sess := session.Must(session.NewSession())
svc := ecr.New(sess)
params := &ecr.CompleteLayerUploadInput{
LayerDigests: []*string{ // Required
aws.String("LayerDigest"), // Required
// More values...
},
RepositoryName: aws.String("RepositoryName"), // Required
UploadId: aws.String("UploadId"), // Required
RegistryId: aws.String("RegistryId"),
}
resp, err := svc.CompleteLayerUpload(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleECR_CreateRepository() {
sess := session.Must(session.NewSession())
svc := ecr.New(sess)
params := &ecr.CreateRepositoryInput{
RepositoryName: aws.String("RepositoryName"), // Required
}
resp, err := svc.CreateRepository(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleECR_DeleteRepository() {
sess := session.Must(session.NewSession())
svc := ecr.New(sess)
params := &ecr.DeleteRepositoryInput{
RepositoryName: aws.String("RepositoryName"), // Required
Force: aws.Bool(true),
RegistryId: aws.String("RegistryId"),
}
resp, err := svc.DeleteRepository(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleECR_DeleteRepositoryPolicy() {
sess := session.Must(session.NewSession())
svc := ecr.New(sess)
params := &ecr.DeleteRepositoryPolicyInput{
RepositoryName: aws.String("RepositoryName"), // Required
RegistryId: aws.String("RegistryId"),
}
resp, err := svc.DeleteRepositoryPolicy(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleECR_DescribeImages() {
sess := session.Must(session.NewSession())
svc := ecr.New(sess)
params := &ecr.DescribeImagesInput{
RepositoryName: aws.String("RepositoryName"), // Required
Filter: &ecr.DescribeImagesFilter{
TagStatus: aws.String("TagStatus"),
},
ImageIds: []*ecr.ImageIdentifier{
{ // Required
ImageDigest: aws.String("ImageDigest"),
ImageTag: aws.String("ImageTag"),
},
// More values...
},
MaxResults: aws.Int64(1),
NextToken: aws.String("NextToken"),
RegistryId: aws.String("RegistryId"),
}
resp, err := svc.DescribeImages(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleECR_DescribeRepositories() {
sess := session.Must(session.NewSession())
svc := ecr.New(sess)
params := &ecr.DescribeRepositoriesInput{
MaxResults: aws.Int64(1),
NextToken: aws.String("NextToken"),
RegistryId: aws.String("RegistryId"),
RepositoryNames: []*string{
aws.String("RepositoryName"), // Required
// More values...
},
}
resp, err := svc.DescribeRepositories(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleECR_GetAuthorizationToken() {
sess := session.Must(session.NewSession())
svc := ecr.New(sess)
params := &ecr.GetAuthorizationTokenInput{
RegistryIds: []*string{
aws.String("RegistryId"), // Required
// More values...
},
}
resp, err := svc.GetAuthorizationToken(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleECR_GetDownloadUrlForLayer() {
sess := session.Must(session.NewSession())
svc := ecr.New(sess)
params := &ecr.GetDownloadUrlForLayerInput{
LayerDigest: aws.String("LayerDigest"), // Required
RepositoryName: aws.String("RepositoryName"), // Required
RegistryId: aws.String("RegistryId"),
}
resp, err := svc.GetDownloadUrlForLayer(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleECR_GetRepositoryPolicy() {
sess := session.Must(session.NewSession())
svc := ecr.New(sess)
params := &ecr.GetRepositoryPolicyInput{
RepositoryName: aws.String("RepositoryName"), // Required
RegistryId: aws.String("RegistryId"),
}
resp, err := svc.GetRepositoryPolicy(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleECR_InitiateLayerUpload() {
sess := session.Must(session.NewSession())
svc := ecr.New(sess)
params := &ecr.InitiateLayerUploadInput{
RepositoryName: aws.String("RepositoryName"), // Required
RegistryId: aws.String("RegistryId"),
}
resp, err := svc.InitiateLayerUpload(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleECR_ListImages() {
sess := session.Must(session.NewSession())
svc := ecr.New(sess)
params := &ecr.ListImagesInput{
RepositoryName: aws.String("RepositoryName"), // Required
Filter: &ecr.ListImagesFilter{
TagStatus: aws.String("TagStatus"),
},
MaxResults: aws.Int64(1),
NextToken: aws.String("NextToken"),
RegistryId: aws.String("RegistryId"),
}
resp, err := svc.ListImages(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleECR_PutImage() {
sess := session.Must(session.NewSession())
svc := ecr.New(sess)
params := &ecr.PutImageInput{
ImageManifest: aws.String("ImageManifest"), // Required
RepositoryName: aws.String("RepositoryName"), // Required
ImageTag: aws.String("ImageTag"),
RegistryId: aws.String("RegistryId"),
}
resp, err := svc.PutImage(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleECR_SetRepositoryPolicy() {
sess := session.Must(session.NewSession())
svc := ecr.New(sess)
params := &ecr.SetRepositoryPolicyInput{
PolicyText: aws.String("RepositoryPolicyText"), // Required
RepositoryName: aws.String("RepositoryName"), // Required
Force: aws.Bool(true),
RegistryId: aws.String("RegistryId"),
}
resp, err := svc.SetRepositoryPolicy(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleECR_UploadLayerPart() {
sess := session.Must(session.NewSession())
svc := ecr.New(sess)
params := &ecr.UploadLayerPartInput{
LayerPartBlob: []byte("PAYLOAD"), // Required
PartFirstByte: aws.Int64(1), // Required
PartLastByte: aws.Int64(1), // Required
RepositoryName: aws.String("RepositoryName"), // Required
UploadId: aws.String("UploadId"), // Required
RegistryId: aws.String("RegistryId"),
}
resp, err := svc.UploadLayerPart(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
+95
View File
@@ -0,0 +1,95 @@
// 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/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" // Service endpoint prefix API calls made to.
EndpointsID = ServiceName // Service ID for Regions and Endpoints metadata.
)
// 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:
// // 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...)
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) *ECR {
svc := &ECR{
Client: client.New(
cfg,
metadata.ClientInfo{
ServiceName: ServiceName,
SigningName: signingName,
SigningRegion: signingRegion,
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(jsonrpc.UnmarshalErrorHandler)
// 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
}