service.go 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. package support
  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. // The AWS Support API reference is intended for programmers who need detailed
  12. // information about the AWS Support operations and data types. This service
  13. // enables you to manage your AWS Support cases programmatically. It uses HTTP
  14. // methods that return results in JSON format.
  15. //
  16. // The AWS Support service also exposes a set of Trusted Advisor (http://aws.amazon.com/premiumsupport/trustedadvisor/)
  17. // features. You can retrieve a list of checks and their descriptions, get check
  18. // results, specify checks to refresh, and get the refresh status of checks.
  19. //
  20. // The following list describes the AWS Support case management operations:
  21. //
  22. // * Service names, issue categories, and available severity levels. The
  23. // DescribeServices and DescribeSeverityLevels operations return AWS service
  24. // names, service codes, service categories, and problem severity levels.
  25. // You use these values when you call the CreateCase operation.
  26. //
  27. // * Case creation, case details, and case resolution. The CreateCase, DescribeCases,
  28. // DescribeAttachment, and ResolveCase operations create AWS Support cases,
  29. // retrieve information about cases, and resolve cases.
  30. //
  31. // * Case communication. The DescribeCommunications, AddCommunicationToCase,
  32. // and AddAttachmentsToSet operations retrieve and add communications and
  33. // attachments to AWS Support cases.
  34. //
  35. // The following list describes the operations available from the AWS Support
  36. // service for Trusted Advisor:
  37. //
  38. // * DescribeTrustedAdvisorChecks returns the list of checks that run against
  39. // your AWS resources.
  40. //
  41. // * Using the checkId for a specific check returned by DescribeTrustedAdvisorChecks,
  42. // you can call DescribeTrustedAdvisorCheckResult to obtain the results for
  43. // the check you specified.
  44. //
  45. // * DescribeTrustedAdvisorCheckSummaries returns summarized results for
  46. // one or more Trusted Advisor checks.
  47. //
  48. // * RefreshTrustedAdvisorCheck requests that Trusted Advisor rerun a specified
  49. // check.
  50. //
  51. // * DescribeTrustedAdvisorCheckRefreshStatuses reports the refresh status
  52. // of one or more checks.
  53. //
  54. // For authentication of requests, AWS Support uses Signature Version 4 Signing
  55. // Process (http://docs.aws.amazon.com/general/latest/gr/signature-version-4.html).
  56. //
  57. // See About the AWS Support API (http://docs.aws.amazon.com/awssupport/latest/user/Welcome.html)
  58. // in the AWS Support User Guide for information about how to use this service
  59. // to create and manage your support cases, and how to call Trusted Advisor
  60. // for results of checks on your resources.
  61. //The service client's operations are safe to be used concurrently.
  62. // It is not safe to mutate any of the client's properties though.
  63. type Support struct {
  64. *client.Client
  65. }
  66. // Used for custom client initialization logic
  67. var initClient func(*client.Client)
  68. // Used for custom request initialization logic
  69. var initRequest func(*request.Request)
  70. // A ServiceName is the name of the service the client will make API calls to.
  71. const ServiceName = "support"
  72. // New creates a new instance of the Support client with a session.
  73. // If additional configuration is needed for the client instance use the optional
  74. // aws.Config parameter to add your extra config.
  75. //
  76. // Example:
  77. // // Create a Support client from just a session.
  78. // svc := support.New(mySession)
  79. //
  80. // // Create a Support client with additional configuration
  81. // svc := support.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
  82. func New(p client.ConfigProvider, cfgs ...*aws.Config) *Support {
  83. c := p.ClientConfig(ServiceName, cfgs...)
  84. return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion)
  85. }
  86. // newClient creates, initializes and returns a new service client instance.
  87. func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *Support {
  88. svc := &Support{
  89. Client: client.New(
  90. cfg,
  91. metadata.ClientInfo{
  92. ServiceName: ServiceName,
  93. SigningRegion: signingRegion,
  94. Endpoint: endpoint,
  95. APIVersion: "2013-04-15",
  96. JSONVersion: "1.1",
  97. TargetPrefix: "AWSSupport_20130415",
  98. },
  99. handlers,
  100. ),
  101. }
  102. // Handlers
  103. svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
  104. svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler)
  105. svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler)
  106. svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler)
  107. svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler)
  108. // Run custom client initialization if present
  109. if initClient != nil {
  110. initClient(svc.Client)
  111. }
  112. return svc
  113. }
  114. // newRequest creates a new request for a Support operation and runs any
  115. // custom request initialization.
  116. func (c *Support) newRequest(op *request.Operation, params, data interface{}) *request.Request {
  117. req := c.NewRequest(op, params, data)
  118. // Run custom request initialization if present
  119. if initRequest != nil {
  120. initRequest(req)
  121. }
  122. return req
  123. }