service.go 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. package ecr
  3. import (
  4. "github.com/aws/aws-sdk-go/aws"
  5. "github.com/aws/aws-sdk-go/aws/client"
  6. "github.com/aws/aws-sdk-go/aws/client/metadata"
  7. "github.com/aws/aws-sdk-go/aws/request"
  8. "github.com/aws/aws-sdk-go/aws/signer/v4"
  9. "github.com/aws/aws-sdk-go/private/protocol/jsonrpc"
  10. )
  11. // Amazon EC2 Container Registry (Amazon ECR) is a managed AWS Docker registry
  12. // service. Customers can use the familiar Docker CLI to push, pull, and manage
  13. // images. Amazon ECR provides a secure, scalable, and reliable registry. Amazon
  14. // ECR supports private Docker repositories with resource-based permissions
  15. // using AWS IAM so that specific users or Amazon EC2 instances can access repositories
  16. // and images. Developers can use the Docker CLI to author and manage images.
  17. //The service client's operations are safe to be used concurrently.
  18. // It is not safe to mutate any of the client's properties though.
  19. type ECR struct {
  20. *client.Client
  21. }
  22. // Used for custom client initialization logic
  23. var initClient func(*client.Client)
  24. // Used for custom request initialization logic
  25. var initRequest func(*request.Request)
  26. // A ServiceName is the name of the service the client will make API calls to.
  27. const ServiceName = "ecr"
  28. // New creates a new instance of the ECR client with a session.
  29. // If additional configuration is needed for the client instance use the optional
  30. // aws.Config parameter to add your extra config.
  31. //
  32. // Example:
  33. // // Create a ECR client from just a session.
  34. // svc := ecr.New(mySession)
  35. //
  36. // // Create a ECR client with additional configuration
  37. // svc := ecr.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
  38. func New(p client.ConfigProvider, cfgs ...*aws.Config) *ECR {
  39. c := p.ClientConfig(ServiceName, cfgs...)
  40. return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion)
  41. }
  42. // newClient creates, initializes and returns a new service client instance.
  43. func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *ECR {
  44. svc := &ECR{
  45. Client: client.New(
  46. cfg,
  47. metadata.ClientInfo{
  48. ServiceName: ServiceName,
  49. SigningRegion: signingRegion,
  50. Endpoint: endpoint,
  51. APIVersion: "2015-09-21",
  52. JSONVersion: "1.1",
  53. TargetPrefix: "AmazonEC2ContainerRegistry_V20150921",
  54. },
  55. handlers,
  56. ),
  57. }
  58. // Handlers
  59. svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
  60. svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler)
  61. svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler)
  62. svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler)
  63. svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler)
  64. // Run custom client initialization if present
  65. if initClient != nil {
  66. initClient(svc.Client)
  67. }
  68. return svc
  69. }
  70. // newRequest creates a new request for a ECR operation and runs any
  71. // custom request initialization.
  72. func (c *ECR) newRequest(op *request.Operation, params, data interface{}) *request.Request {
  73. req := c.NewRequest(op, params, data)
  74. // Run custom request initialization if present
  75. if initRequest != nil {
  76. initRequest(req)
  77. }
  78. return req
  79. }