service.go 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. package servicecatalog
  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. // Overview
  12. //
  13. // AWS Service Catalog (https://aws.amazon.com/servicecatalog/) allows organizations
  14. // to create and manage catalogs of IT services that are approved for use on
  15. // AWS. This documentation provides reference material for the AWS Service Catalog
  16. // end user API. To get the most out of this documentation, you need to be familiar
  17. // with the terminology discussed in AWS Service Catalog Concepts (http://docs.aws.amazon.com/servicecatalog/latest/userguide/what-is_concepts.html).
  18. //
  19. // Additional Resources
  20. //
  21. // AWS Service Catalog Administrator Guide (http://docs.aws.amazon.com/servicecatalog/latest/adminguide/introduction.html)
  22. //
  23. // AWS Service Catalog User Guide (http://docs.aws.amazon.com/servicecatalog/latest/userguide/introduction.html)
  24. //The service client's operations are safe to be used concurrently.
  25. // It is not safe to mutate any of the client's properties though.
  26. type ServiceCatalog struct {
  27. *client.Client
  28. }
  29. // Used for custom client initialization logic
  30. var initClient func(*client.Client)
  31. // Used for custom request initialization logic
  32. var initRequest func(*request.Request)
  33. // A ServiceName is the name of the service the client will make API calls to.
  34. const ServiceName = "servicecatalog"
  35. // New creates a new instance of the ServiceCatalog client with a session.
  36. // If additional configuration is needed for the client instance use the optional
  37. // aws.Config parameter to add your extra config.
  38. //
  39. // Example:
  40. // // Create a ServiceCatalog client from just a session.
  41. // svc := servicecatalog.New(mySession)
  42. //
  43. // // Create a ServiceCatalog client with additional configuration
  44. // svc := servicecatalog.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
  45. func New(p client.ConfigProvider, cfgs ...*aws.Config) *ServiceCatalog {
  46. c := p.ClientConfig(ServiceName, cfgs...)
  47. return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion)
  48. }
  49. // newClient creates, initializes and returns a new service client instance.
  50. func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *ServiceCatalog {
  51. svc := &ServiceCatalog{
  52. Client: client.New(
  53. cfg,
  54. metadata.ClientInfo{
  55. ServiceName: ServiceName,
  56. SigningRegion: signingRegion,
  57. Endpoint: endpoint,
  58. APIVersion: "2015-12-10",
  59. JSONVersion: "1.1",
  60. TargetPrefix: "AWS242ServiceCatalogService",
  61. },
  62. handlers,
  63. ),
  64. }
  65. // Handlers
  66. svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
  67. svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler)
  68. svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler)
  69. svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler)
  70. svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler)
  71. // Run custom client initialization if present
  72. if initClient != nil {
  73. initClient(svc.Client)
  74. }
  75. return svc
  76. }
  77. // newRequest creates a new request for a ServiceCatalog operation and runs any
  78. // custom request initialization.
  79. func (c *ServiceCatalog) newRequest(op *request.Operation, params, data interface{}) *request.Request {
  80. req := c.NewRequest(op, params, data)
  81. // Run custom request initialization if present
  82. if initRequest != nil {
  83. initRequest(req)
  84. }
  85. return req
  86. }