api.go 51 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. // Package sts provides a client for AWS Security Token Service.
  3. package sts
  4. import (
  5. "time"
  6. "github.com/aws/aws-sdk-go/aws/awsutil"
  7. "github.com/aws/aws-sdk-go/aws/request"
  8. )
  9. const opAssumeRole = "AssumeRole"
  10. // AssumeRoleRequest generates a request for the AssumeRole operation.
  11. func (c *STS) AssumeRoleRequest(input *AssumeRoleInput) (req *request.Request, output *AssumeRoleOutput) {
  12. op := &request.Operation{
  13. Name: opAssumeRole,
  14. HTTPMethod: "POST",
  15. HTTPPath: "/",
  16. }
  17. if input == nil {
  18. input = &AssumeRoleInput{}
  19. }
  20. req = c.newRequest(op, input, output)
  21. output = &AssumeRoleOutput{}
  22. req.Data = output
  23. return
  24. }
  25. // Returns a set of temporary security credentials (consisting of an access
  26. // key ID, a secret access key, and a security token) that you can use to access
  27. // AWS resources that you might not normally have access to. Typically, you
  28. // use AssumeRole for cross-account access or federation.
  29. //
  30. // Important: You cannot call AssumeRole by using AWS account credentials;
  31. // access will be denied. You must use IAM user credentials or temporary security
  32. // credentials to call AssumeRole.
  33. //
  34. // For cross-account access, imagine that you own multiple accounts and need
  35. // to access resources in each account. You could create long-term credentials
  36. // in each account to access those resources. However, managing all those credentials
  37. // and remembering which one can access which account can be time consuming.
  38. // Instead, you can create one set of long-term credentials in one account and
  39. // then use temporary security credentials to access all the other accounts
  40. // by assuming roles in those accounts. For more information about roles, see
  41. // IAM Roles (Delegation and Federation) (http://docs.aws.amazon.com/IAM/latest/UserGuide/roles-toplevel.html)
  42. // in Using IAM.
  43. //
  44. // For federation, you can, for example, grant single sign-on access to the
  45. // AWS Management Console. If you already have an identity and authentication
  46. // system in your corporate network, you don't have to recreate user identities
  47. // in AWS in order to grant those user identities access to AWS. Instead, after
  48. // a user has been authenticated, you call AssumeRole (and specify the role
  49. // with the appropriate permissions) to get temporary security credentials for
  50. // that user. With those temporary security credentials, you construct a sign-in
  51. // URL that users can use to access the console. For more information, see Scenarios
  52. // for Granting Temporary Access (http://docs.aws.amazon.com/STS/latest/UsingSTS/STSUseCases.html)
  53. // in Using Temporary Security Credentials.
  54. //
  55. // The temporary security credentials are valid for the duration that you specified
  56. // when calling AssumeRole, which can be from 900 seconds (15 minutes) to 3600
  57. // seconds (1 hour). The default is 1 hour.
  58. //
  59. // Optionally, you can pass an IAM access policy to this operation. If you
  60. // choose not to pass a policy, the temporary security credentials that are
  61. // returned by the operation have the permissions that are defined in the access
  62. // policy of the role that is being assumed. If you pass a policy to this operation,
  63. // the temporary security credentials that are returned by the operation have
  64. // the permissions that are allowed by both the access policy of the role that
  65. // is being assumed, and the policy that you pass. This gives you a way to further
  66. // restrict the permissions for the resulting temporary security credentials.
  67. // You cannot use the passed policy to grant permissions that are in excess
  68. // of those allowed by the access policy of the role that is being assumed.
  69. // For more information, see Permissions for AssumeRole, AssumeRoleWithSAML,
  70. // and AssumeRoleWithWebIdentity (http://docs.aws.amazon.com/STS/latest/UsingSTS/permissions-assume-role.html)
  71. // in Using Temporary Security Credentials.
  72. //
  73. // To assume a role, your AWS account must be trusted by the role. The trust
  74. // relationship is defined in the role's trust policy when the role is created.
  75. // You must also have a policy that allows you to call sts:AssumeRole.
  76. //
  77. // Using MFA with AssumeRole
  78. //
  79. // You can optionally include multi-factor authentication (MFA) information
  80. // when you call AssumeRole. This is useful for cross-account scenarios in which
  81. // you want to make sure that the user who is assuming the role has been authenticated
  82. // using an AWS MFA device. In that scenario, the trust policy of the role being
  83. // assumed includes a condition that tests for MFA authentication; if the caller
  84. // does not include valid MFA information, the request to assume the role is
  85. // denied. The condition in a trust policy that tests for MFA authentication
  86. // might look like the following example.
  87. //
  88. // "Condition": {"Bool": {"aws:MultiFactorAuthPresent": true}}
  89. //
  90. // For more information, see Configuring MFA-Protected API Access (http://docs.aws.amazon.com/IAM/latest/UserGuide/MFAProtectedAPI.html)
  91. // in Using IAM guide.
  92. //
  93. // To use MFA with AssumeRole, you pass values for the SerialNumber and TokenCode
  94. // parameters. The SerialNumber value identifies the user's hardware or virtual
  95. // MFA device. The TokenCode is the time-based one-time password (TOTP) that
  96. // the MFA devices produces.
  97. func (c *STS) AssumeRole(input *AssumeRoleInput) (*AssumeRoleOutput, error) {
  98. req, out := c.AssumeRoleRequest(input)
  99. err := req.Send()
  100. return out, err
  101. }
  102. const opAssumeRoleWithSAML = "AssumeRoleWithSAML"
  103. // AssumeRoleWithSAMLRequest generates a request for the AssumeRoleWithSAML operation.
  104. func (c *STS) AssumeRoleWithSAMLRequest(input *AssumeRoleWithSAMLInput) (req *request.Request, output *AssumeRoleWithSAMLOutput) {
  105. op := &request.Operation{
  106. Name: opAssumeRoleWithSAML,
  107. HTTPMethod: "POST",
  108. HTTPPath: "/",
  109. }
  110. if input == nil {
  111. input = &AssumeRoleWithSAMLInput{}
  112. }
  113. req = c.newRequest(op, input, output)
  114. output = &AssumeRoleWithSAMLOutput{}
  115. req.Data = output
  116. return
  117. }
  118. // Returns a set of temporary security credentials for users who have been authenticated
  119. // via a SAML authentication response. This operation provides a mechanism for
  120. // tying an enterprise identity store or directory to role-based AWS access
  121. // without user-specific credentials or configuration.
  122. //
  123. // The temporary security credentials returned by this operation consist of
  124. // an access key ID, a secret access key, and a security token. Applications
  125. // can use these temporary security credentials to sign calls to AWS services.
  126. // The credentials are valid for the duration that you specified when calling
  127. // AssumeRoleWithSAML, which can be up to 3600 seconds (1 hour) or until the
  128. // time specified in the SAML authentication response's SessionNotOnOrAfter
  129. // value, whichever is shorter.
  130. //
  131. // The maximum duration for a session is 1 hour, and the minimum duration is
  132. // 15 minutes, even if values outside this range are specified. Optionally,
  133. // you can pass an IAM access policy to this operation. If you choose not to
  134. // pass a policy, the temporary security credentials that are returned by the
  135. // operation have the permissions that are defined in the access policy of the
  136. // role that is being assumed. If you pass a policy to this operation, the temporary
  137. // security credentials that are returned by the operation have the permissions
  138. // that are allowed by both the access policy of the role that is being assumed,
  139. // and the policy that you pass. This gives you a way to further restrict the
  140. // permissions for the resulting temporary security credentials. You cannot
  141. // use the passed policy to grant permissions that are in excess of those allowed
  142. // by the access policy of the role that is being assumed. For more information,
  143. // see Permissions for AssumeRoleWithSAML (http://docs.aws.amazon.com/STS/latest/UsingSTS/permissions-assume-role.html)
  144. // in Using Temporary Security Credentials.
  145. //
  146. // Before your application can call AssumeRoleWithSAML, you must configure
  147. // your SAML identity provider (IdP) to issue the claims required by AWS. Additionally,
  148. // you must use AWS Identity and Access Management (IAM) to create a SAML provider
  149. // entity in your AWS account that represents your identity provider, and create
  150. // an IAM role that specifies this SAML provider in its trust policy.
  151. //
  152. // Calling AssumeRoleWithSAML does not require the use of AWS security credentials.
  153. // The identity of the caller is validated by using keys in the metadata document
  154. // that is uploaded for the SAML provider entity for your identity provider.
  155. //
  156. // For more information, see the following resources:
  157. //
  158. // Creating Temporary Security Credentials for SAML Federation (http://docs.aws.amazon.com/STS/latest/UsingSTS/CreatingSAML.html).
  159. // SAML Providers (http://docs.aws.amazon.com/IAM/latest/UserGuide/idp-managing-identityproviders.html)
  160. // in Using IAM. Configuring a Relying Party and Claims (http://docs.aws.amazon.com/IAM/latest/UserGuide/create-role-saml-IdP-tasks.html)
  161. // in Using IAM. Creating a Role for SAML-Based Federation (http://docs.aws.amazon.com/IAM/latest/UserGuide/create-role-saml.html)
  162. // in Using IAM.
  163. func (c *STS) AssumeRoleWithSAML(input *AssumeRoleWithSAMLInput) (*AssumeRoleWithSAMLOutput, error) {
  164. req, out := c.AssumeRoleWithSAMLRequest(input)
  165. err := req.Send()
  166. return out, err
  167. }
  168. const opAssumeRoleWithWebIdentity = "AssumeRoleWithWebIdentity"
  169. // AssumeRoleWithWebIdentityRequest generates a request for the AssumeRoleWithWebIdentity operation.
  170. func (c *STS) AssumeRoleWithWebIdentityRequest(input *AssumeRoleWithWebIdentityInput) (req *request.Request, output *AssumeRoleWithWebIdentityOutput) {
  171. op := &request.Operation{
  172. Name: opAssumeRoleWithWebIdentity,
  173. HTTPMethod: "POST",
  174. HTTPPath: "/",
  175. }
  176. if input == nil {
  177. input = &AssumeRoleWithWebIdentityInput{}
  178. }
  179. req = c.newRequest(op, input, output)
  180. output = &AssumeRoleWithWebIdentityOutput{}
  181. req.Data = output
  182. return
  183. }
  184. // Returns a set of temporary security credentials for users who have been authenticated
  185. // in a mobile or web application with a web identity provider, such as Amazon
  186. // Cognito, Login with Amazon, Facebook, Google, or any OpenID Connect-compatible
  187. // identity provider.
  188. //
  189. // For mobile applications, we recommend that you use Amazon Cognito. You
  190. // can use Amazon Cognito with the AWS SDK for iOS (http://aws.amazon.com/sdkforios/)
  191. // and the AWS SDK for Android (http://aws.amazon.com/sdkforandroid/) to uniquely
  192. // identify a user and supply the user with a consistent identity throughout
  193. // the lifetime of an application.
  194. //
  195. // To learn more about Amazon Cognito, see Amazon Cognito Overview (http://docs.aws.amazon.com/mobile/sdkforandroid/developerguide/cognito-auth.html#d0e840)
  196. // in the AWS SDK for Android Developer Guide guide and Amazon Cognito Overview
  197. // (http://docs.aws.amazon.com/mobile/sdkforios/developerguide/cognito-auth.html#d0e664)
  198. // in the AWS SDK for iOS Developer Guide.
  199. //
  200. // Calling AssumeRoleWithWebIdentity does not require the use of AWS security
  201. // credentials. Therefore, you can distribute an application (for example, on
  202. // mobile devices) that requests temporary security credentials without including
  203. // long-term AWS credentials in the application, and without deploying server-based
  204. // proxy services that use long-term AWS credentials. Instead, the identity
  205. // of the caller is validated by using a token from the web identity provider.
  206. //
  207. // The temporary security credentials returned by this API consist of an access
  208. // key ID, a secret access key, and a security token. Applications can use these
  209. // temporary security credentials to sign calls to AWS service APIs. The credentials
  210. // are valid for the duration that you specified when calling AssumeRoleWithWebIdentity,
  211. // which can be from 900 seconds (15 minutes) to 3600 seconds (1 hour). By default,
  212. // the temporary security credentials are valid for 1 hour.
  213. //
  214. // Optionally, you can pass an IAM access policy to this operation. If you
  215. // choose not to pass a policy, the temporary security credentials that are
  216. // returned by the operation have the permissions that are defined in the access
  217. // policy of the role that is being assumed. If you pass a policy to this operation,
  218. // the temporary security credentials that are returned by the operation have
  219. // the permissions that are allowed by both the access policy of the role that
  220. // is being assumed, and the policy that you pass. This gives you a way to further
  221. // restrict the permissions for the resulting temporary security credentials.
  222. // You cannot use the passed policy to grant permissions that are in excess
  223. // of those allowed by the access policy of the role that is being assumed.
  224. // For more information, see Permissions for AssumeRoleWithWebIdentity (http://docs.aws.amazon.com/STS/latest/UsingSTS/permissions-assume-role.html).
  225. //
  226. // Before your application can call AssumeRoleWithWebIdentity, you must have
  227. // an identity token from a supported identity provider and create a role that
  228. // the application can assume. The role that your application assumes must trust
  229. // the identity provider that is associated with the identity token. In other
  230. // words, the identity provider must be specified in the role's trust policy.
  231. //
  232. // For more information about how to use web identity federation and the AssumeRoleWithWebIdentity
  233. // API, see the following resources:
  234. //
  235. // Creating a Mobile Application with Third-Party Sign-In (http://docs.aws.amazon.com/STS/latest/UsingSTS/STSUseCases.html#MobileApplication-KnownProvider)
  236. // and Creating Temporary Security Credentials for Mobile Apps Using Third-Party
  237. // Identity Providers (http://docs.aws.amazon.com/STS/latest/UsingSTS/CreatingWIF.html).
  238. // Web Identity Federation Playground (https://web-identity-federation-playground.s3.amazonaws.com/index.html).
  239. // This interactive website lets you walk through the process of authenticating
  240. // via Login with Amazon, Facebook, or Google, getting temporary security credentials,
  241. // and then using those credentials to make a request to AWS. AWS SDK for
  242. // iOS (http://aws.amazon.com/sdkforios/) and AWS SDK for Android (http://aws.amazon.com/sdkforandroid/).
  243. // These toolkits contain sample apps that show how to invoke the identity providers,
  244. // and then how to use the information from these providers to get and use temporary
  245. // security credentials. Web Identity Federation with Mobile Applications
  246. // (http://aws.amazon.com/articles/4617974389850313). This article discusses
  247. // web identity federation and shows an example of how to use web identity federation
  248. // to get access to content in Amazon S3.
  249. func (c *STS) AssumeRoleWithWebIdentity(input *AssumeRoleWithWebIdentityInput) (*AssumeRoleWithWebIdentityOutput, error) {
  250. req, out := c.AssumeRoleWithWebIdentityRequest(input)
  251. err := req.Send()
  252. return out, err
  253. }
  254. const opDecodeAuthorizationMessage = "DecodeAuthorizationMessage"
  255. // DecodeAuthorizationMessageRequest generates a request for the DecodeAuthorizationMessage operation.
  256. func (c *STS) DecodeAuthorizationMessageRequest(input *DecodeAuthorizationMessageInput) (req *request.Request, output *DecodeAuthorizationMessageOutput) {
  257. op := &request.Operation{
  258. Name: opDecodeAuthorizationMessage,
  259. HTTPMethod: "POST",
  260. HTTPPath: "/",
  261. }
  262. if input == nil {
  263. input = &DecodeAuthorizationMessageInput{}
  264. }
  265. req = c.newRequest(op, input, output)
  266. output = &DecodeAuthorizationMessageOutput{}
  267. req.Data = output
  268. return
  269. }
  270. // Decodes additional information about the authorization status of a request
  271. // from an encoded message returned in response to an AWS request.
  272. //
  273. // For example, if a user is not authorized to perform an action that he or
  274. // she has requested, the request returns a Client.UnauthorizedOperation response
  275. // (an HTTP 403 response). Some AWS actions additionally return an encoded message
  276. // that can provide details about this authorization failure.
  277. //
  278. // Only certain AWS actions return an encoded authorization message. The documentation
  279. // for an individual action indicates whether that action returns an encoded
  280. // message in addition to returning an HTTP code. The message is encoded because
  281. // the details of the authorization status can constitute privileged information
  282. // that the user who requested the action should not see. To decode an authorization
  283. // status message, a user must be granted permissions via an IAM policy to request
  284. // the DecodeAuthorizationMessage (sts:DecodeAuthorizationMessage) action.
  285. //
  286. // The decoded message includes the following type of information:
  287. //
  288. // Whether the request was denied due to an explicit deny or due to the absence
  289. // of an explicit allow. For more information, see Determining Whether a Request
  290. // is Allowed or Denied (http://docs.aws.amazon.com/IAM/latest/UserGuide/AccessPolicyLanguage_EvaluationLogic.html#policy-eval-denyallow)
  291. // in Using IAM. The principal who made the request. The requested action.
  292. // The requested resource. The values of condition keys in the context of the
  293. // user's request.
  294. func (c *STS) DecodeAuthorizationMessage(input *DecodeAuthorizationMessageInput) (*DecodeAuthorizationMessageOutput, error) {
  295. req, out := c.DecodeAuthorizationMessageRequest(input)
  296. err := req.Send()
  297. return out, err
  298. }
  299. const opGetFederationToken = "GetFederationToken"
  300. // GetFederationTokenRequest generates a request for the GetFederationToken operation.
  301. func (c *STS) GetFederationTokenRequest(input *GetFederationTokenInput) (req *request.Request, output *GetFederationTokenOutput) {
  302. op := &request.Operation{
  303. Name: opGetFederationToken,
  304. HTTPMethod: "POST",
  305. HTTPPath: "/",
  306. }
  307. if input == nil {
  308. input = &GetFederationTokenInput{}
  309. }
  310. req = c.newRequest(op, input, output)
  311. output = &GetFederationTokenOutput{}
  312. req.Data = output
  313. return
  314. }
  315. // Returns a set of temporary security credentials (consisting of an access
  316. // key ID, a secret access key, and a security token) for a federated user.
  317. // A typical use is in a proxy application that gets temporary security credentials
  318. // on behalf of distributed applications inside a corporate network. Because
  319. // you must call the GetFederationToken action using the long-term security
  320. // credentials of an IAM user, this call is appropriate in contexts where those
  321. // credentials can be safely stored, usually in a server-based application.
  322. //
  323. // If you are creating a mobile-based or browser-based app that can authenticate
  324. // users using a web identity provider like Login with Amazon, Facebook, Google,
  325. // or an OpenID Connect-compatible identity provider, we recommend that you
  326. // use Amazon Cognito (http://aws.amazon.com/cognito/) or AssumeRoleWithWebIdentity.
  327. // For more information, see Creating Temporary Security Credentials for Mobile
  328. // Apps Using Identity Providers (http://docs.aws.amazon.com/STS/latest/UsingSTS/CreatingWIF.html).
  329. //
  330. // The GetFederationToken action must be called by using the long-term AWS
  331. // security credentials of an IAM user. You can also call GetFederationToken
  332. // using the security credentials of an AWS account (root), but this is not
  333. // recommended. Instead, we recommend that you create an IAM user for the purpose
  334. // of the proxy application and then attach a policy to the IAM user that limits
  335. // federated users to only the actions and resources they need access to. For
  336. // more information, see IAM Best Practices (http://docs.aws.amazon.com/IAM/latest/UserGuide/IAMBestPractices.html)
  337. // in Using IAM.
  338. //
  339. // The temporary security credentials that are obtained by using the long-term
  340. // credentials of an IAM user are valid for the specified duration, between
  341. // 900 seconds (15 minutes) and 129600 seconds (36 hours). Temporary credentials
  342. // that are obtained by using AWS account (root) credentials have a maximum
  343. // duration of 3600 seconds (1 hour)
  344. //
  345. // Permissions
  346. //
  347. // The permissions for the temporary security credentials returned by GetFederationToken
  348. // are determined by a combination of the following:
  349. //
  350. // The policy or policies that are attached to the IAM user whose credentials
  351. // are used to call GetFederationToken. The policy that is passed as a parameter
  352. // in the call. The passed policy is attached to the temporary security credentials
  353. // that result from the GetFederationToken API call--that is, to the federated
  354. // user. When the federated user makes an AWS request, AWS evaluates the policy
  355. // attached to the federated user in combination with the policy or policies
  356. // attached to the IAM user whose credentials were used to call GetFederationToken.
  357. // AWS allows the federated user's request only when both the federated user
  358. // and the IAM user are explicitly allowed to perform the requested action.
  359. // The passed policy cannot grant more permissions than those that are defined
  360. // in the IAM user policy.
  361. //
  362. // A typical use case is that the permissions of the IAM user whose credentials
  363. // are used to call GetFederationToken are designed to allow access to all the
  364. // actions and resources that any federated user will need. Then, for individual
  365. // users, you pass a policy to the operation that scopes down the permissions
  366. // to a level that's appropriate to that individual user, using a policy that
  367. // allows only a subset of permissions that are granted to the IAM user.
  368. //
  369. // If you do not pass a policy, the resulting temporary security credentials
  370. // have no effective permissions. The only exception is when the temporary security
  371. // credentials are used to access a resource that has a resource-based policy
  372. // that specifically allows the federated user to access the resource.
  373. //
  374. // For more information about how permissions work, see Permissions for GetFederationToken
  375. // (http://docs.aws.amazon.com/STS/latest/UsingSTS/permissions-get-federation-token.html).
  376. // For information about using GetFederationToken to create temporary security
  377. // credentials, see Creating Temporary Credentials to Enable Access for Federated
  378. // Users (http://docs.aws.amazon.com/STS/latest/UsingSTS/CreatingFedTokens.html).
  379. func (c *STS) GetFederationToken(input *GetFederationTokenInput) (*GetFederationTokenOutput, error) {
  380. req, out := c.GetFederationTokenRequest(input)
  381. err := req.Send()
  382. return out, err
  383. }
  384. const opGetSessionToken = "GetSessionToken"
  385. // GetSessionTokenRequest generates a request for the GetSessionToken operation.
  386. func (c *STS) GetSessionTokenRequest(input *GetSessionTokenInput) (req *request.Request, output *GetSessionTokenOutput) {
  387. op := &request.Operation{
  388. Name: opGetSessionToken,
  389. HTTPMethod: "POST",
  390. HTTPPath: "/",
  391. }
  392. if input == nil {
  393. input = &GetSessionTokenInput{}
  394. }
  395. req = c.newRequest(op, input, output)
  396. output = &GetSessionTokenOutput{}
  397. req.Data = output
  398. return
  399. }
  400. // Returns a set of temporary credentials for an AWS account or IAM user. The
  401. // credentials consist of an access key ID, a secret access key, and a security
  402. // token. Typically, you use GetSessionToken if you want to use MFA to protect
  403. // programmatic calls to specific AWS APIs like Amazon EC2 StopInstances. MFA-enabled
  404. // IAM users would need to call GetSessionToken and submit an MFA code that
  405. // is associated with their MFA device. Using the temporary security credentials
  406. // that are returned from the call, IAM users can then make programmatic calls
  407. // to APIs that require MFA authentication.
  408. //
  409. // The GetSessionToken action must be called by using the long-term AWS security
  410. // credentials of the AWS account or an IAM user. Credentials that are created
  411. // by IAM users are valid for the duration that you specify, between 900 seconds
  412. // (15 minutes) and 129600 seconds (36 hours); credentials that are created
  413. // by using account credentials have a maximum duration of 3600 seconds (1 hour).
  414. //
  415. // We recommend that you do not call GetSessionToken with root account credentials.
  416. // Instead, follow our best practices (http://docs.aws.amazon.com/IAM/latest/UserGuide/IAMBestPractices.html#create-iam-users)
  417. // by creating one or more IAM users, giving them the necessary permissions,
  418. // and using IAM users for everyday interaction with AWS.
  419. //
  420. // The permissions associated with the temporary security credentials returned
  421. // by GetSessionToken are based on the permissions associated with account or
  422. // IAM user whose credentials are used to call the action. If GetSessionToken
  423. // is called using root account credentials, the temporary credentials have
  424. // root account permissions. Similarly, if GetSessionToken is called using the
  425. // credentials of an IAM user, the temporary credentials have the same permissions
  426. // as the IAM user.
  427. //
  428. // For more information about using GetSessionToken to create temporary credentials,
  429. // go to Creating Temporary Credentials to Enable Access for IAM Users (http://docs.aws.amazon.com/STS/latest/UsingSTS/CreatingSessionTokens.html"
  430. // target="_blank).
  431. func (c *STS) GetSessionToken(input *GetSessionTokenInput) (*GetSessionTokenOutput, error) {
  432. req, out := c.GetSessionTokenRequest(input)
  433. err := req.Send()
  434. return out, err
  435. }
  436. type AssumeRoleInput struct {
  437. // The duration, in seconds, of the role session. The value can range from 900
  438. // seconds (15 minutes) to 3600 seconds (1 hour). By default, the value is set
  439. // to 3600 seconds.
  440. DurationSeconds *int64 `type:"integer"`
  441. // A unique identifier that is used by third parties when assuming roles in
  442. // their customers' accounts. For each role that the third party can assume,
  443. // they should instruct their customers to ensure the role's trust policy checks
  444. // for the external ID that the third party generated. Each time the third party
  445. // assumes the role, they should pass the customer's external ID. The external
  446. // ID is useful in order to help third parties bind a role to the customer who
  447. // created it. For more information about the external ID, see How to Use External
  448. // ID When Granting Access to Your AWS Resources (http://docs.aws.amazon.com/STS/latest/UsingSTS/sts-delegating-externalid.html)
  449. // in Using Temporary Security Credentials.
  450. ExternalId *string `type:"string"`
  451. // An IAM policy in JSON format.
  452. //
  453. // This parameter is optional. If you pass a policy, the temporary security
  454. // credentials that are returned by the operation have the permissions that
  455. // are allowed by both (the intersection of) the access policy of the role that
  456. // is being assumed, and the policy that you pass. This gives you a way to further
  457. // restrict the permissions for the resulting temporary security credentials.
  458. // You cannot use the passed policy to grant permissions that are in excess
  459. // of those allowed by the access policy of the role that is being assumed.
  460. // For more information, see Permissions for AssumeRole, AssumeRoleWithSAML,
  461. // and AssumeRoleWithWebIdentity (http://docs.aws.amazon.com/STS/latest/UsingSTS/permissions-assume-role.html)
  462. // in Using Temporary Security Credentials.
  463. //
  464. // The policy plain text must be 2048 bytes or shorter. However, an internal
  465. // conversion compresses it into a packed binary format with a separate limit.
  466. // The PackedPolicySize response element indicates by percentage how close to
  467. // the upper size limit the policy is, with 100% equaling the maximum allowed
  468. // size.
  469. Policy *string `type:"string"`
  470. // The Amazon Resource Name (ARN) of the role to assume.
  471. RoleArn *string `type:"string" required:"true"`
  472. // An identifier for the assumed role session.
  473. //
  474. // Use the role session name to uniquely identity a session when the same role
  475. // is assumed by different principals or for different reasons. In cross-account
  476. // scenarios, the role session name is visible to, and can be logged by the
  477. // account that owns the role. The role session name is also used in the ARN
  478. // of the assumed role principal. This means that subsequent cross-account API
  479. // requests using the temporary security credentials will expose the role session
  480. // name to the external account in their CloudTrail logs.
  481. RoleSessionName *string `type:"string" required:"true"`
  482. // The identification number of the MFA device that is associated with the user
  483. // who is making the AssumeRole call. Specify this value if the trust policy
  484. // of the role being assumed includes a condition that requires MFA authentication.
  485. // The value is either the serial number for a hardware device (such as GAHT12345678)
  486. // or an Amazon Resource Name (ARN) for a virtual device (such as arn:aws:iam::123456789012:mfa/user).
  487. SerialNumber *string `type:"string"`
  488. // The value provided by the MFA device, if the trust policy of the role being
  489. // assumed requires MFA (that is, if the policy includes a condition that tests
  490. // for MFA). If the role being assumed requires MFA and if the TokenCode value
  491. // is missing or expired, the AssumeRole call returns an "access denied" error.
  492. TokenCode *string `type:"string"`
  493. metadataAssumeRoleInput `json:"-" xml:"-"`
  494. }
  495. type metadataAssumeRoleInput struct {
  496. SDKShapeTraits bool `type:"structure"`
  497. }
  498. // String returns the string representation
  499. func (s AssumeRoleInput) String() string {
  500. return awsutil.Prettify(s)
  501. }
  502. // GoString returns the string representation
  503. func (s AssumeRoleInput) GoString() string {
  504. return s.String()
  505. }
  506. // Contains the response to a successful AssumeRole request, including temporary
  507. // AWS credentials that can be used to make AWS requests.
  508. type AssumeRoleOutput struct {
  509. // The Amazon Resource Name (ARN) and the assumed role ID, which are identifiers
  510. // that you can use to refer to the resulting temporary security credentials.
  511. // For example, you can reference these credentials as a principal in a resource-based
  512. // policy by using the ARN or assumed role ID. The ARN and ID include the RoleSessionName
  513. // that you specified when you called AssumeRole.
  514. AssumedRoleUser *AssumedRoleUser `type:"structure"`
  515. // The temporary security credentials, which include an access key ID, a secret
  516. // access key, and a security (or session) token.
  517. Credentials *Credentials `type:"structure"`
  518. // A percentage value that indicates the size of the policy in packed form.
  519. // The service rejects any policy with a packed size greater than 100 percent,
  520. // which means the policy exceeded the allowed space.
  521. PackedPolicySize *int64 `type:"integer"`
  522. metadataAssumeRoleOutput `json:"-" xml:"-"`
  523. }
  524. type metadataAssumeRoleOutput struct {
  525. SDKShapeTraits bool `type:"structure"`
  526. }
  527. // String returns the string representation
  528. func (s AssumeRoleOutput) String() string {
  529. return awsutil.Prettify(s)
  530. }
  531. // GoString returns the string representation
  532. func (s AssumeRoleOutput) GoString() string {
  533. return s.String()
  534. }
  535. type AssumeRoleWithSAMLInput struct {
  536. // The duration, in seconds, of the role session. The value can range from 900
  537. // seconds (15 minutes) to 3600 seconds (1 hour). By default, the value is set
  538. // to 3600 seconds. An expiration can also be specified in the SAML authentication
  539. // response's SessionNotOnOrAfter value. The actual expiration time is whichever
  540. // value is shorter.
  541. //
  542. // The maximum duration for a session is 1 hour, and the minimum duration is
  543. // 15 minutes, even if values outside this range are specified.
  544. DurationSeconds *int64 `type:"integer"`
  545. // An IAM policy in JSON format.
  546. //
  547. // The policy parameter is optional. If you pass a policy, the temporary security
  548. // credentials that are returned by the operation have the permissions that
  549. // are allowed by both the access policy of the role that is being assumed,
  550. // and the policy that you pass. This gives you a way to further restrict the
  551. // permissions for the resulting temporary security credentials. You cannot
  552. // use the passed policy to grant permissions that are in excess of those allowed
  553. // by the access policy of the role that is being assumed. For more information,
  554. // see Permissions for AssumeRoleWithSAML (http://docs.aws.amazon.com/STS/latest/UsingSTS/permissions-assume-role.html)
  555. // in Using Temporary Security Credentials.
  556. //
  557. // The policy plain text must be 2048 bytes or shorter. However, an internal
  558. // conversion compresses it into a packed binary format with a separate limit.
  559. // The PackedPolicySize response element indicates by percentage how close to
  560. // the upper size limit the policy is, with 100% equaling the maximum allowed
  561. // size.
  562. Policy *string `type:"string"`
  563. // The Amazon Resource Name (ARN) of the SAML provider in IAM that describes
  564. // the IdP.
  565. PrincipalArn *string `type:"string" required:"true"`
  566. // The Amazon Resource Name (ARN) of the role that the caller is assuming.
  567. RoleArn *string `type:"string" required:"true"`
  568. // The base-64 encoded SAML authentication response provided by the IdP.
  569. //
  570. // For more information, see Configuring a Relying Party and Adding Claims
  571. // (http://docs.aws.amazon.com/IAM/latest/UserGuide/create-role-saml-IdP-tasks.html)
  572. // in the Using IAM guide.
  573. SAMLAssertion *string `type:"string" required:"true"`
  574. metadataAssumeRoleWithSAMLInput `json:"-" xml:"-"`
  575. }
  576. type metadataAssumeRoleWithSAMLInput struct {
  577. SDKShapeTraits bool `type:"structure"`
  578. }
  579. // String returns the string representation
  580. func (s AssumeRoleWithSAMLInput) String() string {
  581. return awsutil.Prettify(s)
  582. }
  583. // GoString returns the string representation
  584. func (s AssumeRoleWithSAMLInput) GoString() string {
  585. return s.String()
  586. }
  587. // Contains the response to a successful AssumeRoleWithSAML request, including
  588. // temporary AWS credentials that can be used to make AWS requests.
  589. type AssumeRoleWithSAMLOutput struct {
  590. // The identifiers for the temporary security credentials that the operation
  591. // returns.
  592. AssumedRoleUser *AssumedRoleUser `type:"structure"`
  593. // The value of the Recipient attribute of the SubjectConfirmationData element
  594. // of the SAML assertion.
  595. Audience *string `type:"string"`
  596. // AWS credentials for API authentication.
  597. Credentials *Credentials `type:"structure"`
  598. // The value of the Issuer element of the SAML assertion.
  599. Issuer *string `type:"string"`
  600. // A hash value based on the concatenation of the Issuer response value, the
  601. // AWS account ID, and the friendly name (the last part of the ARN) of the SAML
  602. // provider in IAM. The combination of NameQualifier and Subject can be used
  603. // to uniquely identify a federated user.
  604. //
  605. // The following pseudocode shows how the hash value is calculated:
  606. //
  607. // BASE64 ( SHA1 ( "https://example.com/saml" + "123456789012" + "/MySAMLIdP"
  608. // ) )
  609. NameQualifier *string `type:"string"`
  610. // A percentage value that indicates the size of the policy in packed form.
  611. // The service rejects any policy with a packed size greater than 100 percent,
  612. // which means the policy exceeded the allowed space.
  613. PackedPolicySize *int64 `type:"integer"`
  614. // The value of the NameID element in the Subject element of the SAML assertion.
  615. Subject *string `type:"string"`
  616. // The format of the name ID, as defined by the Format attribute in the NameID
  617. // element of the SAML assertion. Typical examples of the format are transient
  618. // or persistent.
  619. //
  620. // If the format includes the prefix urn:oasis:names:tc:SAML:2.0:nameid-format,
  621. // that prefix is removed. For example, urn:oasis:names:tc:SAML:2.0:nameid-format:transient
  622. // is returned as transient. If the format includes any other prefix, the format
  623. // is returned with no modifications.
  624. SubjectType *string `type:"string"`
  625. metadataAssumeRoleWithSAMLOutput `json:"-" xml:"-"`
  626. }
  627. type metadataAssumeRoleWithSAMLOutput struct {
  628. SDKShapeTraits bool `type:"structure"`
  629. }
  630. // String returns the string representation
  631. func (s AssumeRoleWithSAMLOutput) String() string {
  632. return awsutil.Prettify(s)
  633. }
  634. // GoString returns the string representation
  635. func (s AssumeRoleWithSAMLOutput) GoString() string {
  636. return s.String()
  637. }
  638. type AssumeRoleWithWebIdentityInput struct {
  639. // The duration, in seconds, of the role session. The value can range from 900
  640. // seconds (15 minutes) to 3600 seconds (1 hour). By default, the value is set
  641. // to 3600 seconds.
  642. DurationSeconds *int64 `type:"integer"`
  643. // An IAM policy in JSON format.
  644. //
  645. // The policy parameter is optional. If you pass a policy, the temporary security
  646. // credentials that are returned by the operation have the permissions that
  647. // are allowed by both the access policy of the role that is being assumed,
  648. // and the policy that you pass. This gives you a way to further restrict the
  649. // permissions for the resulting temporary security credentials. You cannot
  650. // use the passed policy to grant permissions that are in excess of those allowed
  651. // by the access policy of the role that is being assumed. For more information,
  652. // see Permissions for AssumeRoleWithWebIdentity (http://docs.aws.amazon.com/STS/latest/UsingSTS/permissions-assume-role.html).
  653. //
  654. // The policy plain text must be 2048 bytes or shorter. However, an internal
  655. // conversion compresses it into a packed binary format with a separate limit.
  656. // The PackedPolicySize response element indicates by percentage how close to
  657. // the upper size limit the policy is, with 100% equaling the maximum allowed
  658. // size.
  659. Policy *string `type:"string"`
  660. // The fully qualified host component of the domain name of the identity provider.
  661. //
  662. // Specify this value only for OAuth 2.0 access tokens. Currently www.amazon.com
  663. // and graph.facebook.com are the only supported identity providers for OAuth
  664. // 2.0 access tokens. Do not include URL schemes and port numbers.
  665. //
  666. // Do not specify this value for OpenID Connect ID tokens.
  667. ProviderId *string `type:"string"`
  668. // The Amazon Resource Name (ARN) of the role that the caller is assuming.
  669. RoleArn *string `type:"string" required:"true"`
  670. // An identifier for the assumed role session. Typically, you pass the name
  671. // or identifier that is associated with the user who is using your application.
  672. // That way, the temporary security credentials that your application will use
  673. // are associated with that user. This session name is included as part of the
  674. // ARN and assumed role ID in the AssumedRoleUser response element.
  675. RoleSessionName *string `type:"string" required:"true"`
  676. // The OAuth 2.0 access token or OpenID Connect ID token that is provided by
  677. // the identity provider. Your application must get this token by authenticating
  678. // the user who is using your application with a web identity provider before
  679. // the application makes an AssumeRoleWithWebIdentity call.
  680. WebIdentityToken *string `type:"string" required:"true"`
  681. metadataAssumeRoleWithWebIdentityInput `json:"-" xml:"-"`
  682. }
  683. type metadataAssumeRoleWithWebIdentityInput struct {
  684. SDKShapeTraits bool `type:"structure"`
  685. }
  686. // String returns the string representation
  687. func (s AssumeRoleWithWebIdentityInput) String() string {
  688. return awsutil.Prettify(s)
  689. }
  690. // GoString returns the string representation
  691. func (s AssumeRoleWithWebIdentityInput) GoString() string {
  692. return s.String()
  693. }
  694. // Contains the response to a successful AssumeRoleWithWebIdentity request,
  695. // including temporary AWS credentials that can be used to make AWS requests.
  696. type AssumeRoleWithWebIdentityOutput struct {
  697. // The Amazon Resource Name (ARN) and the assumed role ID, which are identifiers
  698. // that you can use to refer to the resulting temporary security credentials.
  699. // For example, you can reference these credentials as a principal in a resource-based
  700. // policy by using the ARN or assumed role ID. The ARN and ID include the RoleSessionName
  701. // that you specified when you called AssumeRole.
  702. AssumedRoleUser *AssumedRoleUser `type:"structure"`
  703. // The intended audience (also known as client ID) of the web identity token.
  704. // This is traditionally the client identifier issued to the application that
  705. // requested the web identity token.
  706. Audience *string `type:"string"`
  707. // The temporary security credentials, which include an access key ID, a secret
  708. // access key, and a security token.
  709. Credentials *Credentials `type:"structure"`
  710. // A percentage value that indicates the size of the policy in packed form.
  711. // The service rejects any policy with a packed size greater than 100 percent,
  712. // which means the policy exceeded the allowed space.
  713. PackedPolicySize *int64 `type:"integer"`
  714. // The issuing authority of the web identity token presented. For OpenID Connect
  715. // ID Tokens this contains the value of the iss field. For OAuth 2.0 access
  716. // tokens, this contains the value of the ProviderId parameter that was passed
  717. // in the AssumeRoleWithWebIdentity request.
  718. Provider *string `type:"string"`
  719. // The unique user identifier that is returned by the identity provider. This
  720. // identifier is associated with the WebIdentityToken that was submitted with
  721. // the AssumeRoleWithWebIdentity call. The identifier is typically unique to
  722. // the user and the application that acquired the WebIdentityToken (pairwise
  723. // identifier). For OpenID Connect ID tokens, this field contains the value
  724. // returned by the identity provider as the token's sub (Subject) claim.
  725. SubjectFromWebIdentityToken *string `type:"string"`
  726. metadataAssumeRoleWithWebIdentityOutput `json:"-" xml:"-"`
  727. }
  728. type metadataAssumeRoleWithWebIdentityOutput struct {
  729. SDKShapeTraits bool `type:"structure"`
  730. }
  731. // String returns the string representation
  732. func (s AssumeRoleWithWebIdentityOutput) String() string {
  733. return awsutil.Prettify(s)
  734. }
  735. // GoString returns the string representation
  736. func (s AssumeRoleWithWebIdentityOutput) GoString() string {
  737. return s.String()
  738. }
  739. // The identifiers for the temporary security credentials that the operation
  740. // returns.
  741. type AssumedRoleUser struct {
  742. // The ARN of the temporary security credentials that are returned from the
  743. // AssumeRole action. For more information about ARNs and how to use them in
  744. // policies, see IAM Identifiers (http://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html)
  745. // in Using IAM.
  746. Arn *string `type:"string" required:"true"`
  747. // A unique identifier that contains the role ID and the role session name of
  748. // the role that is being assumed. The role ID is generated by AWS when the
  749. // role is created.
  750. AssumedRoleId *string `type:"string" required:"true"`
  751. metadataAssumedRoleUser `json:"-" xml:"-"`
  752. }
  753. type metadataAssumedRoleUser struct {
  754. SDKShapeTraits bool `type:"structure"`
  755. }
  756. // String returns the string representation
  757. func (s AssumedRoleUser) String() string {
  758. return awsutil.Prettify(s)
  759. }
  760. // GoString returns the string representation
  761. func (s AssumedRoleUser) GoString() string {
  762. return s.String()
  763. }
  764. // AWS credentials for API authentication.
  765. type Credentials struct {
  766. // The access key ID that identifies the temporary security credentials.
  767. AccessKeyId *string `type:"string" required:"true"`
  768. // The date on which the current credentials expire.
  769. Expiration *time.Time `type:"timestamp" timestampFormat:"iso8601" required:"true"`
  770. // The secret access key that can be used to sign requests.
  771. SecretAccessKey *string `type:"string" required:"true"`
  772. // The token that users must pass to the service API to use the temporary credentials.
  773. SessionToken *string `type:"string" required:"true"`
  774. metadataCredentials `json:"-" xml:"-"`
  775. }
  776. type metadataCredentials struct {
  777. SDKShapeTraits bool `type:"structure"`
  778. }
  779. // String returns the string representation
  780. func (s Credentials) String() string {
  781. return awsutil.Prettify(s)
  782. }
  783. // GoString returns the string representation
  784. func (s Credentials) GoString() string {
  785. return s.String()
  786. }
  787. type DecodeAuthorizationMessageInput struct {
  788. // The encoded message that was returned with the response.
  789. EncodedMessage *string `type:"string" required:"true"`
  790. metadataDecodeAuthorizationMessageInput `json:"-" xml:"-"`
  791. }
  792. type metadataDecodeAuthorizationMessageInput struct {
  793. SDKShapeTraits bool `type:"structure"`
  794. }
  795. // String returns the string representation
  796. func (s DecodeAuthorizationMessageInput) String() string {
  797. return awsutil.Prettify(s)
  798. }
  799. // GoString returns the string representation
  800. func (s DecodeAuthorizationMessageInput) GoString() string {
  801. return s.String()
  802. }
  803. // A document that contains additional information about the authorization status
  804. // of a request from an encoded message that is returned in response to an AWS
  805. // request.
  806. type DecodeAuthorizationMessageOutput struct {
  807. // An XML document that contains the decoded message. For more information,
  808. // see DecodeAuthorizationMessage.
  809. DecodedMessage *string `type:"string"`
  810. metadataDecodeAuthorizationMessageOutput `json:"-" xml:"-"`
  811. }
  812. type metadataDecodeAuthorizationMessageOutput struct {
  813. SDKShapeTraits bool `type:"structure"`
  814. }
  815. // String returns the string representation
  816. func (s DecodeAuthorizationMessageOutput) String() string {
  817. return awsutil.Prettify(s)
  818. }
  819. // GoString returns the string representation
  820. func (s DecodeAuthorizationMessageOutput) GoString() string {
  821. return s.String()
  822. }
  823. // Identifiers for the federated user that is associated with the credentials.
  824. type FederatedUser struct {
  825. // The ARN that specifies the federated user that is associated with the credentials.
  826. // For more information about ARNs and how to use them in policies, see IAM
  827. // Identifiers (http://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html)
  828. // in Using IAM.
  829. Arn *string `type:"string" required:"true"`
  830. // The string that identifies the federated user associated with the credentials,
  831. // similar to the unique ID of an IAM user.
  832. FederatedUserId *string `type:"string" required:"true"`
  833. metadataFederatedUser `json:"-" xml:"-"`
  834. }
  835. type metadataFederatedUser struct {
  836. SDKShapeTraits bool `type:"structure"`
  837. }
  838. // String returns the string representation
  839. func (s FederatedUser) String() string {
  840. return awsutil.Prettify(s)
  841. }
  842. // GoString returns the string representation
  843. func (s FederatedUser) GoString() string {
  844. return s.String()
  845. }
  846. type GetFederationTokenInput struct {
  847. // The duration, in seconds, that the session should last. Acceptable durations
  848. // for federation sessions range from 900 seconds (15 minutes) to 129600 seconds
  849. // (36 hours), with 43200 seconds (12 hours) as the default. Sessions obtained
  850. // using AWS account (root) credentials are restricted to a maximum of 3600
  851. // seconds (one hour). If the specified duration is longer than one hour, the
  852. // session obtained by using AWS account (root) credentials defaults to one
  853. // hour.
  854. DurationSeconds *int64 `type:"integer"`
  855. // The name of the federated user. The name is used as an identifier for the
  856. // temporary security credentials (such as Bob). For example, you can reference
  857. // the federated user name in a resource-based policy, such as in an Amazon
  858. // S3 bucket policy.
  859. Name *string `type:"string" required:"true"`
  860. // An IAM policy in JSON format that is passed with the GetFederationToken call
  861. // and evaluated along with the policy or policies that are attached to the
  862. // IAM user whose credentials are used to call GetFederationToken. The passed
  863. // policy is used to scope down the permissions that are available to the IAM
  864. // user, by allowing only a subset of the permissions that are granted to the
  865. // IAM user. The passed policy cannot grant more permissions than those granted
  866. // to the IAM user. The final permissions for the federated user are the most
  867. // restrictive set based on the intersection of the passed policy and the IAM
  868. // user policy.
  869. //
  870. // If you do not pass a policy, the resulting temporary security credentials
  871. // have no effective permissions. The only exception is when the temporary security
  872. // credentials are used to access a resource that has a resource-based policy
  873. // that specifically allows the federated user to access the resource.
  874. //
  875. // The policy plain text must be 2048 bytes or shorter. However, an internal
  876. // conversion compresses it into a packed binary format with a separate limit.
  877. // The PackedPolicySize response element indicates by percentage how close to
  878. // the upper size limit the policy is, with 100% equaling the maximum allowed
  879. // size. For more information about how permissions work, see Permissions for
  880. // GetFederationToken (http://docs.aws.amazon.com/STS/latest/UsingSTS/permissions-get-federation-token.html).
  881. Policy *string `type:"string"`
  882. metadataGetFederationTokenInput `json:"-" xml:"-"`
  883. }
  884. type metadataGetFederationTokenInput struct {
  885. SDKShapeTraits bool `type:"structure"`
  886. }
  887. // String returns the string representation
  888. func (s GetFederationTokenInput) String() string {
  889. return awsutil.Prettify(s)
  890. }
  891. // GoString returns the string representation
  892. func (s GetFederationTokenInput) GoString() string {
  893. return s.String()
  894. }
  895. // Contains the response to a successful GetFederationToken request, including
  896. // temporary AWS credentials that can be used to make AWS requests.
  897. type GetFederationTokenOutput struct {
  898. // Credentials for the service API authentication.
  899. Credentials *Credentials `type:"structure"`
  900. // Identifiers for the federated user associated with the credentials (such
  901. // as arn:aws:sts::123456789012:federated-user/Bob or 123456789012:Bob). You
  902. // can use the federated user's ARN in your resource-based policies, such as
  903. // an Amazon S3 bucket policy.
  904. FederatedUser *FederatedUser `type:"structure"`
  905. // A percentage value indicating the size of the policy in packed form. The
  906. // service rejects policies for which the packed size is greater than 100 percent
  907. // of the allowed value.
  908. PackedPolicySize *int64 `type:"integer"`
  909. metadataGetFederationTokenOutput `json:"-" xml:"-"`
  910. }
  911. type metadataGetFederationTokenOutput struct {
  912. SDKShapeTraits bool `type:"structure"`
  913. }
  914. // String returns the string representation
  915. func (s GetFederationTokenOutput) String() string {
  916. return awsutil.Prettify(s)
  917. }
  918. // GoString returns the string representation
  919. func (s GetFederationTokenOutput) GoString() string {
  920. return s.String()
  921. }
  922. type GetSessionTokenInput struct {
  923. // The duration, in seconds, that the credentials should remain valid. Acceptable
  924. // durations for IAM user sessions range from 900 seconds (15 minutes) to 129600
  925. // seconds (36 hours), with 43200 seconds (12 hours) as the default. Sessions
  926. // for AWS account owners are restricted to a maximum of 3600 seconds (one hour).
  927. // If the duration is longer than one hour, the session for AWS account owners
  928. // defaults to one hour.
  929. DurationSeconds *int64 `type:"integer"`
  930. // The identification number of the MFA device that is associated with the IAM
  931. // user who is making the GetSessionToken call. Specify this value if the IAM
  932. // user has a policy that requires MFA authentication. The value is either the
  933. // serial number for a hardware device (such as GAHT12345678) or an Amazon Resource
  934. // Name (ARN) for a virtual device (such as arn:aws:iam::123456789012:mfa/user).
  935. // You can find the device for an IAM user by going to the AWS Management Console
  936. // and viewing the user's security credentials.
  937. SerialNumber *string `type:"string"`
  938. // The value provided by the MFA device, if MFA is required. If any policy requires
  939. // the IAM user to submit an MFA code, specify this value. If MFA authentication
  940. // is required, and the user does not provide a code when requesting a set of
  941. // temporary security credentials, the user will receive an "access denied"
  942. // response when requesting resources that require MFA authentication.
  943. TokenCode *string `type:"string"`
  944. metadataGetSessionTokenInput `json:"-" xml:"-"`
  945. }
  946. type metadataGetSessionTokenInput struct {
  947. SDKShapeTraits bool `type:"structure"`
  948. }
  949. // String returns the string representation
  950. func (s GetSessionTokenInput) String() string {
  951. return awsutil.Prettify(s)
  952. }
  953. // GoString returns the string representation
  954. func (s GetSessionTokenInput) GoString() string {
  955. return s.String()
  956. }
  957. // Contains the response to a successful GetSessionToken request, including
  958. // temporary AWS credentials that can be used to make AWS requests.
  959. type GetSessionTokenOutput struct {
  960. // The session credentials for API authentication.
  961. Credentials *Credentials `type:"structure"`
  962. metadataGetSessionTokenOutput `json:"-" xml:"-"`
  963. }
  964. type metadataGetSessionTokenOutput struct {
  965. SDKShapeTraits bool `type:"structure"`
  966. }
  967. // String returns the string representation
  968. func (s GetSessionTokenOutput) String() string {
  969. return awsutil.Prettify(s)
  970. }
  971. // GoString returns the string representation
  972. func (s GetSessionTokenOutput) GoString() string {
  973. return s.String()
  974. }