service.go 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. package configservice
  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. // AWS Config provides a way to keep track of the configurations of all the
  12. // AWS resources associated with your AWS account. You can use AWS Config to
  13. // get the current and historical configurations of each AWS resource and also
  14. // to get information about the relationship between the resources. An AWS resource
  15. // can be an Amazon Compute Cloud (Amazon EC2) instance, an Elastic Block Store
  16. // (EBS) volume, an Elastic network Interface (ENI), or a security group. For
  17. // a complete list of resources currently supported by AWS Config, see Supported
  18. // AWS Resources (http://docs.aws.amazon.com/config/latest/developerguide/resource-config-reference.html#supported-resources).
  19. //
  20. // You can access and manage AWS Config through the AWS Management Console,
  21. // the AWS Command Line Interface (AWS CLI), the AWS Config API, or the AWS
  22. // SDKs for AWS Config
  23. //
  24. // This reference guide contains documentation for the AWS Config API and the
  25. // AWS CLI commands that you can use to manage AWS Config.
  26. //
  27. // The AWS Config API uses the Signature Version 4 protocol for signing requests.
  28. // For more information about how to sign a request with this protocol, see
  29. // Signature Version 4 Signing Process (http://docs.aws.amazon.com/general/latest/gr/signature-version-4.html).
  30. //
  31. // For detailed information about AWS Config features and their associated actions
  32. // or commands, as well as how to work with AWS Management Console, see What
  33. // Is AWS Config? (http://docs.aws.amazon.com/config/latest/developerguide/WhatIsConfig.html)
  34. // in the AWS Config Developer Guide.
  35. //The service client's operations are safe to be used concurrently.
  36. // It is not safe to mutate any of the client's properties though.
  37. type ConfigService struct {
  38. *client.Client
  39. }
  40. // Used for custom client initialization logic
  41. var initClient func(*client.Client)
  42. // Used for custom request initialization logic
  43. var initRequest func(*request.Request)
  44. // A ServiceName is the name of the service the client will make API calls to.
  45. const ServiceName = "config"
  46. // New creates a new instance of the ConfigService client with a session.
  47. // If additional configuration is needed for the client instance use the optional
  48. // aws.Config parameter to add your extra config.
  49. //
  50. // Example:
  51. // // Create a ConfigService client from just a session.
  52. // svc := configservice.New(mySession)
  53. //
  54. // // Create a ConfigService client with additional configuration
  55. // svc := configservice.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
  56. func New(p client.ConfigProvider, cfgs ...*aws.Config) *ConfigService {
  57. c := p.ClientConfig(ServiceName, cfgs...)
  58. return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion)
  59. }
  60. // newClient creates, initializes and returns a new service client instance.
  61. func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *ConfigService {
  62. svc := &ConfigService{
  63. Client: client.New(
  64. cfg,
  65. metadata.ClientInfo{
  66. ServiceName: ServiceName,
  67. SigningRegion: signingRegion,
  68. Endpoint: endpoint,
  69. APIVersion: "2014-11-12",
  70. JSONVersion: "1.1",
  71. TargetPrefix: "StarlingDoveService",
  72. },
  73. handlers,
  74. ),
  75. }
  76. // Handlers
  77. svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
  78. svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler)
  79. svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler)
  80. svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler)
  81. svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler)
  82. // Run custom client initialization if present
  83. if initClient != nil {
  84. initClient(svc.Client)
  85. }
  86. return svc
  87. }
  88. // newRequest creates a new request for a ConfigService operation and runs any
  89. // custom request initialization.
  90. func (c *ConfigService) newRequest(op *request.Operation, params, data interface{}) *request.Request {
  91. req := c.NewRequest(op, params, data)
  92. // Run custom request initialization if present
  93. if initRequest != nil {
  94. initRequest(req)
  95. }
  96. return req
  97. }