service.go 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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 the following endpoints, all HTTPS. You must connect
  43. // to one of the following endpoints. Stacks can only be accessed or managed
  44. // within the endpoint in which they are created.
  45. //
  46. // * opsworks.us-east-1.amazonaws.com
  47. //
  48. // * opsworks.us-west-1.amazonaws.com
  49. //
  50. // * opsworks.us-west-2.amazonaws.com
  51. //
  52. // * opsworks.eu-west-1.amazonaws.com
  53. //
  54. // * opsworks.eu-central-1.amazonaws.com
  55. //
  56. // * opsworks.ap-northeast-1.amazonaws.com
  57. //
  58. // * opsworks.ap-northeast-2.amazonaws.com
  59. //
  60. // * opsworks.ap-south-1.amazonaws.com
  61. //
  62. // * opsworks.ap-southeast-1.amazonaws.com
  63. //
  64. // * opsworks.ap-southeast-2.amazonaws.com
  65. //
  66. // * opsworks.sa-east-1.amazonaws.com
  67. //
  68. // Chef Versions
  69. //
  70. // When you call CreateStack, CloneStack, or UpdateStack we recommend you use
  71. // the ConfigurationManager parameter to specify the Chef version. The recommended
  72. // and default value for Linux stacks is currently 12. Windows stacks use Chef
  73. // 12.2. For more information, see Chef Versions (http://docs.aws.amazon.com/opsworks/latest/userguide/workingcookbook-chef11.html).
  74. //
  75. // You can specify Chef 12, 11.10, or 11.4 for your Linux stack. We recommend
  76. // migrating your existing Linux stacks to Chef 12 as soon as possible.
  77. //The service client's operations are safe to be used concurrently.
  78. // It is not safe to mutate any of the client's properties though.
  79. type OpsWorks struct {
  80. *client.Client
  81. }
  82. // Used for custom client initialization logic
  83. var initClient func(*client.Client)
  84. // Used for custom request initialization logic
  85. var initRequest func(*request.Request)
  86. // A ServiceName is the name of the service the client will make API calls to.
  87. const ServiceName = "opsworks"
  88. // New creates a new instance of the OpsWorks client with a session.
  89. // If additional configuration is needed for the client instance use the optional
  90. // aws.Config parameter to add your extra config.
  91. //
  92. // Example:
  93. // // Create a OpsWorks client from just a session.
  94. // svc := opsworks.New(mySession)
  95. //
  96. // // Create a OpsWorks client with additional configuration
  97. // svc := opsworks.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
  98. func New(p client.ConfigProvider, cfgs ...*aws.Config) *OpsWorks {
  99. c := p.ClientConfig(ServiceName, cfgs...)
  100. return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion)
  101. }
  102. // newClient creates, initializes and returns a new service client instance.
  103. func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *OpsWorks {
  104. svc := &OpsWorks{
  105. Client: client.New(
  106. cfg,
  107. metadata.ClientInfo{
  108. ServiceName: ServiceName,
  109. SigningRegion: signingRegion,
  110. Endpoint: endpoint,
  111. APIVersion: "2013-02-18",
  112. JSONVersion: "1.1",
  113. TargetPrefix: "OpsWorks_20130218",
  114. },
  115. handlers,
  116. ),
  117. }
  118. // Handlers
  119. svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
  120. svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler)
  121. svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler)
  122. svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler)
  123. svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler)
  124. // Run custom client initialization if present
  125. if initClient != nil {
  126. initClient(svc.Client)
  127. }
  128. return svc
  129. }
  130. // newRequest creates a new request for a OpsWorks operation and runs any
  131. // custom request initialization.
  132. func (c *OpsWorks) newRequest(op *request.Operation, params, data interface{}) *request.Request {
  133. req := c.NewRequest(op, params, data)
  134. // Run custom request initialization if present
  135. if initRequest != nil {
  136. initRequest(req)
  137. }
  138. return req
  139. }