service.go 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. package storagegateway
  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. // AWS Storage Gateway is the service that connects an on-premises software
  12. // appliance with cloud-based storage to provide seamless and secure integration
  13. // between an organization's on-premises IT environment and AWS's storage infrastructure.
  14. // The service enables you to securely upload data to the AWS cloud for cost
  15. // effective backup and rapid disaster recovery.
  16. //
  17. // Use the following links to get started using the AWS Storage Gateway Service
  18. // API Reference:
  19. //
  20. // AWS Storage Gateway Required Request Headers (http://docs.aws.amazon.com/storagegateway/latest/userguide/AWSStorageGatewayHTTPRequestsHeaders.html):
  21. // Describes the required headers that you must send with every POST request
  22. // to AWS Storage Gateway.
  23. //
  24. // Signing Requests (http://docs.aws.amazon.com/storagegateway/latest/userguide/AWSStorageGatewaySigningRequests.html):
  25. // AWS Storage Gateway requires that you authenticate every request you send;
  26. // this topic describes how sign such a request.
  27. //
  28. // Error Responses (http://docs.aws.amazon.com/storagegateway/latest/userguide/APIErrorResponses.html):
  29. // Provides reference information about AWS Storage Gateway errors.
  30. //
  31. // Operations in AWS Storage Gateway (http://docs.aws.amazon.com/storagegateway/latest/userguide/AWSStorageGatewayAPIOperations.html):
  32. // Contains detailed descriptions of all AWS Storage Gateway operations, their
  33. // request parameters, response elements, possible errors, and examples of requests
  34. // and responses.
  35. //
  36. // AWS Storage Gateway Regions and Endpoints (http://docs.aws.amazon.com/general/latest/gr/index.html?rande.html):
  37. // Provides a list of each of the s and endpoints available for use with AWS
  38. // Storage Gateway.
  39. //
  40. // AWS Storage Gateway resource IDs are in uppercase. When you use these
  41. // resource IDs with the Amazon EC2 API, EC2 expects resource IDs in lowercase.
  42. // You must change your resource ID to lowercase to use it with the EC2 API.
  43. // For example, in Storage Gateway the ID for a volume might be vol-1122AABB.
  44. // When you use this ID with the EC2 API, you must change it to vol-1122aabb.
  45. // Otherwise, the EC2 API might not behave as expected.
  46. //
  47. // IDs for Storage Gateway volumes and Amazon EBS snapshots created from
  48. // gateway volumes are changing to a longer format. Starting in December 2016,
  49. // all new volumes and snapshots will be created with a 17-character string.
  50. // Starting in April 2016, you will be able to use these longer IDs so you can
  51. // test your systems with the new format. For more information, see Longer EC2
  52. // and EBS Resource IDs (https://aws.amazon.com/ec2/faqs/#longer-ids).
  53. //
  54. // For example, a volume ARN with the longer volume ID format will look like
  55. // this:
  56. //
  57. // arn:aws:storagegateway:us-west-2:111122223333:gateway/sgw-12A3456B/volume/vol-1122AABBCCDDEEFFG.
  58. //
  59. // A snapshot ID with the longer ID format will look like this: snap-78e226633445566ee.
  60. //
  61. // For more information, see Announcement: Heads-up – Longer AWS Storage Gateway
  62. // volume and snapshot IDs coming in 2016 (https://forums.aws.amazon.com/ann.jspa?annID=3557).
  63. //The service client's operations are safe to be used concurrently.
  64. // It is not safe to mutate any of the client's properties though.
  65. type StorageGateway struct {
  66. *client.Client
  67. }
  68. // Used for custom client initialization logic
  69. var initClient func(*client.Client)
  70. // Used for custom request initialization logic
  71. var initRequest func(*request.Request)
  72. // A ServiceName is the name of the service the client will make API calls to.
  73. const ServiceName = "storagegateway"
  74. // New creates a new instance of the StorageGateway client with a session.
  75. // If additional configuration is needed for the client instance use the optional
  76. // aws.Config parameter to add your extra config.
  77. //
  78. // Example:
  79. // // Create a StorageGateway client from just a session.
  80. // svc := storagegateway.New(mySession)
  81. //
  82. // // Create a StorageGateway client with additional configuration
  83. // svc := storagegateway.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
  84. func New(p client.ConfigProvider, cfgs ...*aws.Config) *StorageGateway {
  85. c := p.ClientConfig(ServiceName, cfgs...)
  86. return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion)
  87. }
  88. // newClient creates, initializes and returns a new service client instance.
  89. func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *StorageGateway {
  90. svc := &StorageGateway{
  91. Client: client.New(
  92. cfg,
  93. metadata.ClientInfo{
  94. ServiceName: ServiceName,
  95. SigningRegion: signingRegion,
  96. Endpoint: endpoint,
  97. APIVersion: "2013-06-30",
  98. JSONVersion: "1.1",
  99. TargetPrefix: "StorageGateway_20130630",
  100. },
  101. handlers,
  102. ),
  103. }
  104. // Handlers
  105. svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
  106. svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler)
  107. svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler)
  108. svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler)
  109. svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler)
  110. // Run custom client initialization if present
  111. if initClient != nil {
  112. initClient(svc.Client)
  113. }
  114. return svc
  115. }
  116. // newRequest creates a new request for a StorageGateway operation and runs any
  117. // custom request initialization.
  118. func (c *StorageGateway) newRequest(op *request.Operation, params, data interface{}) *request.Request {
  119. req := c.NewRequest(op, params, data)
  120. // Run custom request initialization if present
  121. if initRequest != nil {
  122. initRequest(req)
  123. }
  124. return req
  125. }