service.go 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. package iam
  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/query"
  10. )
  11. // AWS Identity and Access Management (IAM) is a web service that you can use
  12. // to manage users and user permissions under your AWS account. This guide provides
  13. // descriptions of IAM actions that you can call programmatically. For general
  14. // information about IAM, see AWS Identity and Access Management (IAM) (http://aws.amazon.com/iam/).
  15. // For the user guide for IAM, see Using IAM (http://docs.aws.amazon.com/IAM/latest/UserGuide/).
  16. //
  17. // AWS provides SDKs that consist of libraries and sample code for various programming
  18. // languages and platforms (Java, Ruby, .NET, iOS, Android, etc.). The SDKs
  19. // provide a convenient way to create programmatic access to IAM and AWS. For
  20. // example, the SDKs take care of tasks such as cryptographically signing requests
  21. // (see below), managing errors, and retrying requests automatically. For information
  22. // about the AWS SDKs, including how to download and install them, see the Tools
  23. // for Amazon Web Services (http://aws.amazon.com/tools/) page.
  24. //
  25. // We recommend that you use the AWS SDKs to make programmatic API calls to
  26. // IAM. However, you can also use the IAM Query API to make direct calls to
  27. // the IAM web service. To learn more about the IAM Query API, see Making Query
  28. // Requests (http://docs.aws.amazon.com/IAM/latest/UserGuide/IAM_UsingQueryAPI.html)
  29. // in the Using IAM guide. IAM supports GET and POST requests for all actions.
  30. // That is, the API does not require you to use GET for some actions and POST
  31. // for others. However, GET requests are subject to the limitation size of a
  32. // URL. Therefore, for operations that require larger sizes, use a POST request.
  33. //
  34. // Signing Requests
  35. //
  36. // Requests must be signed using an access key ID and a secret access key. We
  37. // strongly recommend that you do not use your AWS account access key ID and
  38. // secret access key for everyday work with IAM. You can use the access key
  39. // ID and secret access key for an IAM user or you can use the AWS Security
  40. // Token Service to generate temporary security credentials and use those to
  41. // sign requests.
  42. //
  43. // To sign requests, we recommend that you use Signature Version 4 (http://docs.aws.amazon.com/general/latest/gr/signature-version-4.html).
  44. // If you have an existing application that uses Signature Version 2, you do
  45. // not have to update it to use Signature Version 4. However, some operations
  46. // now require Signature Version 4. The documentation for operations that require
  47. // version 4 indicate this requirement.
  48. //
  49. // Additional Resources
  50. //
  51. // For more information, see the following:
  52. //
  53. // * AWS Security Credentials (http://docs.aws.amazon.com/general/latest/gr/aws-security-credentials.html).
  54. // This topic provides general information about the types of credentials
  55. // used for accessing AWS.
  56. //
  57. // * IAM Best Practices (http://docs.aws.amazon.com/IAM/latest/UserGuide/IAMBestPractices.html).
  58. // This topic presents a list of suggestions for using the IAM service to
  59. // help secure your AWS resources.
  60. //
  61. // * Signing AWS API Requests (http://docs.aws.amazon.com/general/latest/gr/signing_aws_api_requests.html).
  62. // This set of topics walk you through the process of signing a request using
  63. // an access key ID and secret access key.
  64. //The service client's operations are safe to be used concurrently.
  65. // It is not safe to mutate any of the client's properties though.
  66. type IAM struct {
  67. *client.Client
  68. }
  69. // Used for custom client initialization logic
  70. var initClient func(*client.Client)
  71. // Used for custom request initialization logic
  72. var initRequest func(*request.Request)
  73. // A ServiceName is the name of the service the client will make API calls to.
  74. const ServiceName = "iam"
  75. // New creates a new instance of the IAM client with a session.
  76. // If additional configuration is needed for the client instance use the optional
  77. // aws.Config parameter to add your extra config.
  78. //
  79. // Example:
  80. // // Create a IAM client from just a session.
  81. // svc := iam.New(mySession)
  82. //
  83. // // Create a IAM client with additional configuration
  84. // svc := iam.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
  85. func New(p client.ConfigProvider, cfgs ...*aws.Config) *IAM {
  86. c := p.ClientConfig(ServiceName, cfgs...)
  87. return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion)
  88. }
  89. // newClient creates, initializes and returns a new service client instance.
  90. func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *IAM {
  91. svc := &IAM{
  92. Client: client.New(
  93. cfg,
  94. metadata.ClientInfo{
  95. ServiceName: ServiceName,
  96. SigningRegion: signingRegion,
  97. Endpoint: endpoint,
  98. APIVersion: "2010-05-08",
  99. },
  100. handlers,
  101. ),
  102. }
  103. // Handlers
  104. svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
  105. svc.Handlers.Build.PushBackNamed(query.BuildHandler)
  106. svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler)
  107. svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler)
  108. svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler)
  109. // Run custom client initialization if present
  110. if initClient != nil {
  111. initClient(svc.Client)
  112. }
  113. return svc
  114. }
  115. // newRequest creates a new request for a IAM operation and runs any
  116. // custom request initialization.
  117. func (c *IAM) newRequest(op *request.Operation, params, data interface{}) *request.Request {
  118. req := c.NewRequest(op, params, data)
  119. // Run custom request initialization if present
  120. if initRequest != nil {
  121. initRequest(req)
  122. }
  123. return req
  124. }