service.go 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. package glacier
  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/restjson"
  10. )
  11. // Amazon Glacier is a storage solution for "cold data."
  12. //
  13. // Amazon Glacier is an extremely low-cost storage service that provides secure,
  14. // durable, and easy-to-use storage for data backup and archival. With Amazon
  15. // Glacier, customers can store their data cost effectively for months, years,
  16. // or decades. Amazon Glacier also enables customers to offload the administrative
  17. // burdens of operating and scaling storage to AWS, so they don't have to worry
  18. // about capacity planning, hardware provisioning, data replication, hardware
  19. // failure and recovery, or time-consuming hardware migrations.
  20. //
  21. // Amazon Glacier is a great storage choice when low storage cost is paramount,
  22. // your data is rarely retrieved, and retrieval latency of several hours is
  23. // acceptable. If your application requires fast or frequent access to your
  24. // data, consider using Amazon S3. For more information, go to Amazon Simple
  25. // Storage Service (Amazon S3) (http://aws.amazon.com/s3/).
  26. //
  27. // You can store any kind of data in any format. There is no maximum limit
  28. // on the total amount of data you can store in Amazon Glacier.
  29. //
  30. // If you are a first-time user of Amazon Glacier, we recommend that you begin
  31. // by reading the following sections in the Amazon Glacier Developer Guide:
  32. //
  33. // What is Amazon Glacier (http://docs.aws.amazon.com/amazonglacier/latest/dev/introduction.html)
  34. // - This section of the Developer Guide describes the underlying data model,
  35. // the operations it supports, and the AWS SDKs that you can use to interact
  36. // with the service.
  37. //
  38. // Getting Started with Amazon Glacier (http://docs.aws.amazon.com/amazonglacier/latest/dev/amazon-glacier-getting-started.html)
  39. // - The Getting Started section walks you through the process of creating a
  40. // vault, uploading archives, creating jobs to download archives, retrieving
  41. // the job output, and deleting archives.
  42. //The service client's operations are safe to be used concurrently.
  43. // It is not safe to mutate any of the client's properties though.
  44. type Glacier struct {
  45. *client.Client
  46. }
  47. // Used for custom client initialization logic
  48. var initClient func(*client.Client)
  49. // Used for custom request initialization logic
  50. var initRequest func(*request.Request)
  51. // A ServiceName is the name of the service the client will make API calls to.
  52. const ServiceName = "glacier"
  53. // New creates a new instance of the Glacier client with a session.
  54. // If additional configuration is needed for the client instance use the optional
  55. // aws.Config parameter to add your extra config.
  56. //
  57. // Example:
  58. // // Create a Glacier client from just a session.
  59. // svc := glacier.New(mySession)
  60. //
  61. // // Create a Glacier client with additional configuration
  62. // svc := glacier.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
  63. func New(p client.ConfigProvider, cfgs ...*aws.Config) *Glacier {
  64. c := p.ClientConfig(ServiceName, cfgs...)
  65. return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion)
  66. }
  67. // newClient creates, initializes and returns a new service client instance.
  68. func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *Glacier {
  69. svc := &Glacier{
  70. Client: client.New(
  71. cfg,
  72. metadata.ClientInfo{
  73. ServiceName: ServiceName,
  74. SigningRegion: signingRegion,
  75. Endpoint: endpoint,
  76. APIVersion: "2012-06-01",
  77. },
  78. handlers,
  79. ),
  80. }
  81. // Handlers
  82. svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
  83. svc.Handlers.Build.PushBackNamed(restjson.BuildHandler)
  84. svc.Handlers.Unmarshal.PushBackNamed(restjson.UnmarshalHandler)
  85. svc.Handlers.UnmarshalMeta.PushBackNamed(restjson.UnmarshalMetaHandler)
  86. svc.Handlers.UnmarshalError.PushBackNamed(restjson.UnmarshalErrorHandler)
  87. // Run custom client initialization if present
  88. if initClient != nil {
  89. initClient(svc.Client)
  90. }
  91. return svc
  92. }
  93. // newRequest creates a new request for a Glacier operation and runs any
  94. // custom request initialization.
  95. func (c *Glacier) newRequest(op *request.Operation, params, data interface{}) *request.Request {
  96. req := c.NewRequest(op, params, data)
  97. // Run custom request initialization if present
  98. if initRequest != nil {
  99. initRequest(req)
  100. }
  101. return req
  102. }