service.go 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. package opsworks
  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. // Welcome to the AWS OpsWorks API Reference. This guide provides descriptions,
  12. // syntax, and usage examples for AWS OpsWorks actions and data types, including
  13. // common parameters and error codes.
  14. //
  15. // AWS OpsWorks is an application management service that provides an integrated
  16. // experience for overseeing the complete application lifecycle. For information
  17. // about this product, go to the AWS OpsWorks (http://aws.amazon.com/opsworks/)
  18. // details page.
  19. //
  20. // SDKs and CLI
  21. //
  22. // The most common way to use the AWS OpsWorks API is by using the AWS Command
  23. // Line Interface (CLI) or by using one of the AWS SDKs to implement applications
  24. // in your preferred language. For more information, see:
  25. //
  26. // AWS CLI (http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-welcome.html)
  27. //
  28. // AWS SDK for Java (http://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/services/opsworks/AWSOpsWorksClient.html)
  29. //
  30. // AWS SDK for .NET (http://docs.aws.amazon.com/sdkfornet/latest/apidocs/html/N_Amazon_OpsWorks.htm)
  31. //
  32. // AWS SDK for PHP 2 (http://docs.aws.amazon.com/aws-sdk-php-2/latest/class-Aws.OpsWorks.OpsWorksClient.html)
  33. //
  34. // AWS SDK for Ruby (http://docs.aws.amazon.com/sdkforruby/api/)
  35. //
  36. // AWS SDK for Node.js (http://aws.amazon.com/documentation/sdkforjavascript/)
  37. //
  38. // AWS SDK for Python(Boto) (http://docs.pythonboto.org/en/latest/ref/opsworks.html)
  39. //
  40. // Endpoints
  41. //
  42. // AWS OpsWorks supports two endpoints, opsworks.us-east-1.amazonaws.com and
  43. // opsworks.ap-south-1.amazonaws.com (both HTTPS). You must connect to one of
  44. // those two endpoints. You can then use the API to direct AWS OpsWorks to create
  45. // stacks in any AWS region. Stacks created in all regions except ap-south-1
  46. // are connected to the us-east-1 regional endpoint; stacks created in ap-south-1
  47. // are associated with the ap-south-1 regional endpoint, and can only be accessed
  48. // or managed within that endpoint.
  49. //
  50. // Chef Versions
  51. //
  52. // When you call CreateStack, CloneStack, or UpdateStack we recommend you use
  53. // the ConfigurationManager parameter to specify the Chef version. The recommended
  54. // and default value for Linux stacks is currently 12. Windows stacks use Chef
  55. // 12.2. For more information, see Chef Versions (http://docs.aws.amazon.com/opsworks/latest/userguide/workingcookbook-chef11.html).
  56. //
  57. // You can specify Chef 12, 11.10, or 11.4 for your Linux stack. We recommend
  58. // migrating your existing Linux stacks to Chef 12 as soon as possible.
  59. //The service client's operations are safe to be used concurrently.
  60. // It is not safe to mutate any of the client's properties though.
  61. type OpsWorks struct {
  62. *client.Client
  63. }
  64. // Used for custom client initialization logic
  65. var initClient func(*client.Client)
  66. // Used for custom request initialization logic
  67. var initRequest func(*request.Request)
  68. // A ServiceName is the name of the service the client will make API calls to.
  69. const ServiceName = "opsworks"
  70. // New creates a new instance of the OpsWorks client with a session.
  71. // If additional configuration is needed for the client instance use the optional
  72. // aws.Config parameter to add your extra config.
  73. //
  74. // Example:
  75. // // Create a OpsWorks client from just a session.
  76. // svc := opsworks.New(mySession)
  77. //
  78. // // Create a OpsWorks client with additional configuration
  79. // svc := opsworks.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
  80. func New(p client.ConfigProvider, cfgs ...*aws.Config) *OpsWorks {
  81. c := p.ClientConfig(ServiceName, cfgs...)
  82. return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion)
  83. }
  84. // newClient creates, initializes and returns a new service client instance.
  85. func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OpsWorks {
  86. svc := &OpsWorks{
  87. Client: client.New(
  88. cfg,
  89. metadata.ClientInfo{
  90. ServiceName: ServiceName,
  91. SigningRegion: signingRegion,
  92. Endpoint: endpoint,
  93. APIVersion: "2013-02-18",
  94. JSONVersion: "1.1",
  95. TargetPrefix: "OpsWorks_20130218",
  96. },
  97. handlers,
  98. ),
  99. }
  100. // Handlers
  101. svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
  102. svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler)
  103. svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler)
  104. svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler)
  105. svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler)
  106. // Run custom client initialization if present
  107. if initClient != nil {
  108. initClient(svc.Client)
  109. }
  110. return svc
  111. }
  112. // newRequest creates a new request for a OpsWorks operation and runs any
  113. // custom request initialization.
  114. func (c *OpsWorks) newRequest(op *request.Operation, params, data interface{}) *request.Request {
  115. req := c.NewRequest(op, params, data)
  116. // Run custom request initialization if present
  117. if initRequest != nil {
  118. initRequest(req)
  119. }
  120. return req
  121. }