service.go 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. package cloudformation
  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/query"
  10. )
  11. // AWS CloudFormation enables you to create and manage AWS infrastructure deployments
  12. // predictably and repeatedly. AWS CloudFormation helps you leverage AWS products
  13. // such as Amazon EC2, EBS, Amazon SNS, ELB, and Auto Scaling to build highly-reliable,
  14. // highly scalable, cost effective applications without worrying about creating
  15. // and configuring the underlying AWS infrastructure.
  16. //
  17. // With AWS CloudFormation, you declare all of your resources and dependencies
  18. // in a template file. The template defines a collection of resources as a single
  19. // unit called a stack. AWS CloudFormation creates and deletes all member resources
  20. // of the stack together and manages all dependencies between the resources
  21. // for you.
  22. //
  23. // For more information about this product, go to the CloudFormation Product
  24. // Page (http://aws.amazon.com/cloudformation/).
  25. //
  26. // Amazon CloudFormation makes use of other AWS products. If you need additional
  27. // technical information about a specific AWS product, you can find the product's
  28. // technical documentation at http://docs.aws.amazon.com/ (http://docs.aws.amazon.com/).
  29. //The service client's operations are safe to be used concurrently.
  30. // It is not safe to mutate any of the client's properties though.
  31. type CloudFormation struct {
  32. *client.Client
  33. }
  34. // Used for custom client initialization logic
  35. var initClient func(*client.Client)
  36. // Used for custom request initialization logic
  37. var initRequest func(*request.Request)
  38. // A ServiceName is the name of the service the client will make API calls to.
  39. const ServiceName = "cloudformation"
  40. // New creates a new instance of the CloudFormation client with a session.
  41. // If additional configuration is needed for the client instance use the optional
  42. // aws.Config parameter to add your extra config.
  43. //
  44. // Example:
  45. // // Create a CloudFormation client from just a session.
  46. // svc := cloudformation.New(mySession)
  47. //
  48. // // Create a CloudFormation client with additional configuration
  49. // svc := cloudformation.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
  50. func New(p client.ConfigProvider, cfgs ...*aws.Config) *CloudFormation {
  51. c := p.ClientConfig(ServiceName, cfgs...)
  52. return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion)
  53. }
  54. // newClient creates, initializes and returns a new service client instance.
  55. func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *CloudFormation {
  56. svc := &CloudFormation{
  57. Client: client.New(
  58. cfg,
  59. metadata.ClientInfo{
  60. ServiceName: ServiceName,
  61. SigningRegion: signingRegion,
  62. Endpoint: endpoint,
  63. APIVersion: "2010-05-15",
  64. },
  65. handlers,
  66. ),
  67. }
  68. // Handlers
  69. svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
  70. svc.Handlers.Build.PushBackNamed(query.BuildHandler)
  71. svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler)
  72. svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler)
  73. svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler)
  74. // Run custom client initialization if present
  75. if initClient != nil {
  76. initClient(svc.Client)
  77. }
  78. return svc
  79. }
  80. // newRequest creates a new request for a CloudFormation operation and runs any
  81. // custom request initialization.
  82. func (c *CloudFormation) newRequest(op *request.Operation, params, data interface{}) *request.Request {
  83. req := c.NewRequest(op, params, data)
  84. // Run custom request initialization if present
  85. if initRequest != nil {
  86. initRequest(req)
  87. }
  88. return req
  89. }