service.go 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. package kms
  3. import (
  4. "github.com/aws/aws-sdk-go/aws"
  5. "github.com/aws/aws-sdk-go/aws/defaults"
  6. "github.com/aws/aws-sdk-go/aws/request"
  7. "github.com/aws/aws-sdk-go/aws/service"
  8. "github.com/aws/aws-sdk-go/aws/service/serviceinfo"
  9. "github.com/aws/aws-sdk-go/internal/protocol/jsonrpc"
  10. "github.com/aws/aws-sdk-go/internal/signer/v4"
  11. )
  12. // AWS Key Management Service (KMS) is an encryption and key management web
  13. // service. This guide describes the KMS actions that you can call programmatically.
  14. // For general information about KMS, see the AWS Key Management Service Developer
  15. // Guide (http://docs.aws.amazon.com/kms/latest/developerguide/overview.html)
  16. //
  17. // AWS provides SDKs that consist of libraries and sample code for various
  18. // programming languages and platforms (Java, Ruby, .Net, iOS, Android, etc.).
  19. // The SDKs provide a convenient way to create programmatic access to KMS and
  20. // AWS. For example, the SDKs take care of tasks such as signing requests (see
  21. // below), managing errors, and retrying requests automatically. For more information
  22. // about the AWS SDKs, including how to download and install them, see Tools
  23. // for Amazon Web Services (http://aws.amazon.com/tools/). We recommend that
  24. // you use the AWS SDKs to make programmatic API calls to KMS.
  25. //
  26. // Clients must support TLS (Transport Layer Security) 1.0. We recommend TLS
  27. // 1.2. Clients must also support cipher suites with Perfect Forward Secrecy
  28. // (PFS) such as Ephemeral Diffie-Hellman (DHE) or Elliptic Curve Ephemeral
  29. // Diffie-Hellman (ECDHE). Most modern systems such as Java 7 and later support
  30. // these modes.
  31. //
  32. // Signing Requests
  33. //
  34. // Requests must be signed by using an access key ID and a secret access key.
  35. // We strongly recommend that you do not use your AWS account access key ID
  36. // and secret key for everyday work with KMS. Instead, use the access key ID
  37. // and secret access key for an IAM user, or you can use the AWS Security Token
  38. // Service to generate temporary security credentials that you can use to sign
  39. // requests.
  40. //
  41. // All KMS operations require Signature Version 4 (http://docs.aws.amazon.com/general/latest/gr/signature-version-4.html).
  42. //
  43. // Recording API Requests
  44. //
  45. // KMS supports AWS CloudTrail, a service that records AWS API calls and related
  46. // events for your AWS account and delivers them to an Amazon S3 bucket that
  47. // you specify. By using the information collected by CloudTrail, you can determine
  48. // what requests were made to KMS, who made the request, when it was made, and
  49. // so on. To learn more about CloudTrail, including how to turn it on and find
  50. // your log files, see the AWS CloudTrail User Guide (http://docs.aws.amazon.com/awscloudtrail/latest/userguide/whatiscloudtrail.html)
  51. //
  52. // Additional Resources
  53. //
  54. // For more information about credentials and request signing, see the following:
  55. //
  56. // AWS Security Credentials (http://docs.aws.amazon.com/general/latest/gr/aws-security-credentials.html).
  57. // This topic provides general information about the types of credentials used
  58. // for accessing AWS. AWS Security Token Service (http://docs.aws.amazon.com/STS/latest/UsingSTS/).
  59. // This guide describes how to create and use temporary security credentials.
  60. // Signing AWS API Requests (http://docs.aws.amazon.com/general/latest/gr/signing_aws_api_requests.html).
  61. // This set of topics walks you through the process of signing a request using
  62. // an access key ID and a secret access key. Commonly Used APIs
  63. //
  64. // Of the APIs discussed in this guide, the following will prove the most
  65. // useful for most applications. You will likely perform actions other than
  66. // these, such as creating keys and assigning policies, by using the console.
  67. // Encrypt Decrypt GenerateDataKey GenerateDataKeyWithoutPlaintext
  68. type KMS struct {
  69. *service.Service
  70. }
  71. // Used for custom service initialization logic
  72. var initService func(*service.Service)
  73. // Used for custom request initialization logic
  74. var initRequest func(*request.Request)
  75. // New returns a new KMS client.
  76. func New(config *aws.Config) *KMS {
  77. service := &service.Service{
  78. ServiceInfo: serviceinfo.ServiceInfo{
  79. Config: defaults.DefaultConfig.Merge(config),
  80. ServiceName: "kms",
  81. APIVersion: "2014-11-01",
  82. JSONVersion: "1.1",
  83. TargetPrefix: "TrentService",
  84. },
  85. }
  86. service.Initialize()
  87. // Handlers
  88. service.Handlers.Sign.PushBack(v4.Sign)
  89. service.Handlers.Build.PushBack(jsonrpc.Build)
  90. service.Handlers.Unmarshal.PushBack(jsonrpc.Unmarshal)
  91. service.Handlers.UnmarshalMeta.PushBack(jsonrpc.UnmarshalMeta)
  92. service.Handlers.UnmarshalError.PushBack(jsonrpc.UnmarshalError)
  93. // Run custom service initialization if present
  94. if initService != nil {
  95. initService(service)
  96. }
  97. return &KMS{service}
  98. }
  99. // newRequest creates a new request for a KMS operation and runs any
  100. // custom request initialization.
  101. func (c *KMS) 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. }