service.go 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. package efs
  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 Elastic File System (Amazon EFS) provides simple, scalable file storage
  12. // for use with Amazon EC2 instances in the AWS Cloud. With Amazon EFS, storage
  13. // capacity is elastic, growing and shrinking automatically as you add and remove
  14. // files, so your applications have the storage they need, when they need it.
  15. // For more information, see the User Guide (http://docs.aws.amazon.com/efs/latest/ug/api-reference.html).
  16. //The service client's operations are safe to be used concurrently.
  17. // It is not safe to mutate any of the client's properties though.
  18. type EFS struct {
  19. *client.Client
  20. }
  21. // Used for custom client initialization logic
  22. var initClient func(*client.Client)
  23. // Used for custom request initialization logic
  24. var initRequest func(*request.Request)
  25. // A ServiceName is the name of the service the client will make API calls to.
  26. const ServiceName = "elasticfilesystem"
  27. // New creates a new instance of the EFS client with a session.
  28. // If additional configuration is needed for the client instance use the optional
  29. // aws.Config parameter to add your extra config.
  30. //
  31. // Example:
  32. // // Create a EFS client from just a session.
  33. // svc := efs.New(mySession)
  34. //
  35. // // Create a EFS client with additional configuration
  36. // svc := efs.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
  37. func New(p client.ConfigProvider, cfgs ...*aws.Config) *EFS {
  38. c := p.ClientConfig(ServiceName, cfgs...)
  39. return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion)
  40. }
  41. // newClient creates, initializes and returns a new service client instance.
  42. func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *EFS {
  43. svc := &EFS{
  44. Client: client.New(
  45. cfg,
  46. metadata.ClientInfo{
  47. ServiceName: ServiceName,
  48. SigningRegion: signingRegion,
  49. Endpoint: endpoint,
  50. APIVersion: "2015-02-01",
  51. },
  52. handlers,
  53. ),
  54. }
  55. // Handlers
  56. svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
  57. svc.Handlers.Build.PushBackNamed(restjson.BuildHandler)
  58. svc.Handlers.Unmarshal.PushBackNamed(restjson.UnmarshalHandler)
  59. svc.Handlers.UnmarshalMeta.PushBackNamed(restjson.UnmarshalMetaHandler)
  60. svc.Handlers.UnmarshalError.PushBackNamed(restjson.UnmarshalErrorHandler)
  61. // Run custom client initialization if present
  62. if initClient != nil {
  63. initClient(svc.Client)
  64. }
  65. return svc
  66. }
  67. // newRequest creates a new request for a EFS operation and runs any
  68. // custom request initialization.
  69. func (c *EFS) newRequest(op *request.Operation, params, data interface{}) *request.Request {
  70. req := c.NewRequest(op, params, data)
  71. // Run custom request initialization if present
  72. if initRequest != nil {
  73. initRequest(req)
  74. }
  75. return req
  76. }