service.go 5.1 KB

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