api.go 75 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653
  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 "aws/request.Request" representing the
  11. // client's request for the AssumeRole operation. The "output" return
  12. // value can be used to capture response data after the request's "Send" method
  13. // is called.
  14. //
  15. // Creating a request object using this method should be used when you want to inject
  16. // custom logic into the request's lifecycle using a custom handler, or if you want to
  17. // access properties on the request object before or after sending the request. If
  18. // you just want the service response, call the AssumeRole method directly
  19. // instead.
  20. //
  21. // Note: You must call the "Send" method on the returned request object in order
  22. // to execute the request.
  23. //
  24. // // Example sending a request using the AssumeRoleRequest method.
  25. // req, resp := client.AssumeRoleRequest(params)
  26. //
  27. // err := req.Send()
  28. // if err == nil { // resp is now filled
  29. // fmt.Println(resp)
  30. // }
  31. //
  32. func (c *STS) AssumeRoleRequest(input *AssumeRoleInput) (req *request.Request, output *AssumeRoleOutput) {
  33. op := &request.Operation{
  34. Name: opAssumeRole,
  35. HTTPMethod: "POST",
  36. HTTPPath: "/",
  37. }
  38. if input == nil {
  39. input = &AssumeRoleInput{}
  40. }
  41. req = c.newRequest(op, input, output)
  42. output = &AssumeRoleOutput{}
  43. req.Data = output
  44. return
  45. }
  46. // Returns a set of temporary security credentials (consisting of an access
  47. // key ID, a secret access key, and a security token) that you can use to access
  48. // AWS resources that you might not normally have access to. Typically, you
  49. // use AssumeRole for cross-account access or federation. For a comparison of
  50. // AssumeRole with the other APIs that produce temporary credentials, see Requesting
  51. // Temporary Security Credentials (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html)
  52. // and Comparing the AWS STS APIs (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison)
  53. // in the IAM User Guide.
  54. //
  55. // Important: You cannot call AssumeRole by using AWS root account credentials;
  56. // access is denied. You must use credentials for an IAM user or an IAM role
  57. // to call AssumeRole.
  58. //
  59. // For cross-account access, imagine that you own multiple accounts and need
  60. // to access resources in each account. You could create long-term credentials
  61. // in each account to access those resources. However, managing all those credentials
  62. // and remembering which one can access which account can be time consuming.
  63. // Instead, you can create one set of long-term credentials in one account and
  64. // then use temporary security credentials to access all the other accounts
  65. // by assuming roles in those accounts. For more information about roles, see
  66. // IAM Roles (Delegation and Federation) (http://docs.aws.amazon.com/IAM/latest/UserGuide/roles-toplevel.html)
  67. // in the IAM User Guide.
  68. //
  69. // For federation, you can, for example, grant single sign-on access to the
  70. // AWS Management Console. If you already have an identity and authentication
  71. // system in your corporate network, you don't have to recreate user identities
  72. // in AWS in order to grant those user identities access to AWS. Instead, after
  73. // a user has been authenticated, you call AssumeRole (and specify the role
  74. // with the appropriate permissions) to get temporary security credentials for
  75. // that user. With those temporary security credentials, you construct a sign-in
  76. // URL that users can use to access the console. For more information, see Common
  77. // Scenarios for Temporary Credentials (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp.html#sts-introduction)
  78. // in the IAM User Guide.
  79. //
  80. // The temporary security credentials are valid for the duration that you specified
  81. // when calling AssumeRole, which can be from 900 seconds (15 minutes) to a
  82. // maximum of 3600 seconds (1 hour). The default is 1 hour.
  83. //
  84. // The temporary security credentials created by AssumeRole can be used to
  85. // make API calls to any AWS service with the following exception: you cannot
  86. // call the STS service's GetFederationToken or GetSessionToken APIs.
  87. //
  88. // Optionally, you can pass an IAM access policy to this operation. If you
  89. // choose not to pass a policy, the temporary security credentials that are
  90. // returned by the operation have the permissions that are defined in the access
  91. // policy of the role that is being assumed. If you pass a policy to this operation,
  92. // the temporary security credentials that are returned by the operation have
  93. // the permissions that are allowed by both the access policy of the role that
  94. // is being assumed, and the policy that you pass. This gives you a way to
  95. // further restrict the permissions for the resulting temporary security credentials.
  96. // You cannot use the passed policy to grant permissions that are in excess
  97. // of those allowed by the access policy of the role that is being assumed.
  98. // For more information, see Permissions for AssumeRole, AssumeRoleWithSAML,
  99. // and AssumeRoleWithWebIdentity (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_assumerole.html)
  100. // in the IAM User Guide.
  101. //
  102. // To assume a role, your AWS account must be trusted by the role. The trust
  103. // relationship is defined in the role's trust policy when the role is created.
  104. // That trust policy states which accounts are allowed to delegate access to
  105. // this account's role.
  106. //
  107. // The user who wants to access the role must also have permissions delegated
  108. // from the role's administrator. If the user is in a different account than
  109. // the role, then the user's administrator must attach a policy that allows
  110. // the user to call AssumeRole on the ARN of the role in the other account.
  111. // If the user is in the same account as the role, then you can either attach
  112. // a policy to the user (identical to the previous different account user),
  113. // or you can add the user as a principal directly in the role's trust policy
  114. //
  115. // Using MFA with AssumeRole
  116. //
  117. // You can optionally include multi-factor authentication (MFA) information
  118. // when you call AssumeRole. This is useful for cross-account scenarios in which
  119. // you want to make sure that the user who is assuming the role has been authenticated
  120. // using an AWS MFA device. In that scenario, the trust policy of the role being
  121. // assumed includes a condition that tests for MFA authentication; if the caller
  122. // does not include valid MFA information, the request to assume the role is
  123. // denied. The condition in a trust policy that tests for MFA authentication
  124. // might look like the following example.
  125. //
  126. // "Condition": {"Bool": {"aws:MultiFactorAuthPresent": true}}
  127. //
  128. // For more information, see Configuring MFA-Protected API Access (http://docs.aws.amazon.com/IAM/latest/UserGuide/MFAProtectedAPI.html)
  129. // in the IAM User Guide guide.
  130. //
  131. // To use MFA with AssumeRole, you pass values for the SerialNumber and TokenCode
  132. // parameters. The SerialNumber value identifies the user's hardware or virtual
  133. // MFA device. The TokenCode is the time-based one-time password (TOTP) that
  134. // the MFA devices produces.
  135. func (c *STS) AssumeRole(input *AssumeRoleInput) (*AssumeRoleOutput, error) {
  136. req, out := c.AssumeRoleRequest(input)
  137. err := req.Send()
  138. return out, err
  139. }
  140. const opAssumeRoleWithSAML = "AssumeRoleWithSAML"
  141. // AssumeRoleWithSAMLRequest generates a "aws/request.Request" representing the
  142. // client's request for the AssumeRoleWithSAML operation. The "output" return
  143. // value can be used to capture response data after the request's "Send" method
  144. // is called.
  145. //
  146. // Creating a request object using this method should be used when you want to inject
  147. // custom logic into the request's lifecycle using a custom handler, or if you want to
  148. // access properties on the request object before or after sending the request. If
  149. // you just want the service response, call the AssumeRoleWithSAML method directly
  150. // instead.
  151. //
  152. // Note: You must call the "Send" method on the returned request object in order
  153. // to execute the request.
  154. //
  155. // // Example sending a request using the AssumeRoleWithSAMLRequest method.
  156. // req, resp := client.AssumeRoleWithSAMLRequest(params)
  157. //
  158. // err := req.Send()
  159. // if err == nil { // resp is now filled
  160. // fmt.Println(resp)
  161. // }
  162. //
  163. func (c *STS) AssumeRoleWithSAMLRequest(input *AssumeRoleWithSAMLInput) (req *request.Request, output *AssumeRoleWithSAMLOutput) {
  164. op := &request.Operation{
  165. Name: opAssumeRoleWithSAML,
  166. HTTPMethod: "POST",
  167. HTTPPath: "/",
  168. }
  169. if input == nil {
  170. input = &AssumeRoleWithSAMLInput{}
  171. }
  172. req = c.newRequest(op, input, output)
  173. output = &AssumeRoleWithSAMLOutput{}
  174. req.Data = output
  175. return
  176. }
  177. // Returns a set of temporary security credentials for users who have been authenticated
  178. // via a SAML authentication response. This operation provides a mechanism for
  179. // tying an enterprise identity store or directory to role-based AWS access
  180. // without user-specific credentials or configuration. For a comparison of AssumeRoleWithSAML
  181. // with the other APIs that produce temporary credentials, see Requesting Temporary
  182. // Security Credentials (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html)
  183. // and Comparing the AWS STS APIs (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison)
  184. // in the IAM User Guide.
  185. //
  186. // The temporary security credentials returned by this operation consist of
  187. // an access key ID, a secret access key, and a security token. Applications
  188. // can use these temporary security credentials to sign calls to AWS services.
  189. //
  190. // The temporary security credentials are valid for the duration that you specified
  191. // when calling AssumeRole, or until the time specified in the SAML authentication
  192. // response's SessionNotOnOrAfter value, whichever is shorter. The duration
  193. // can be from 900 seconds (15 minutes) to a maximum of 3600 seconds (1 hour).
  194. // The default is 1 hour.
  195. //
  196. // The temporary security credentials created by AssumeRoleWithSAML can be
  197. // used to make API calls to any AWS service with the following exception: you
  198. // cannot call the STS service's GetFederationToken or GetSessionToken APIs.
  199. //
  200. // Optionally, you can pass an IAM access policy to this operation. If you
  201. // choose not to pass a policy, the temporary security credentials that are
  202. // returned by the operation have the permissions that are defined in the access
  203. // policy of the role that is being assumed. If you pass a policy to this operation,
  204. // the temporary security credentials that are returned by the operation have
  205. // the permissions that are allowed by the intersection of both the access policy
  206. // of the role that is being assumed, and the policy that you pass. This means
  207. // that both policies must grant the permission for the action to be allowed.
  208. // This gives you a way to further restrict the permissions for the resulting
  209. // temporary security credentials. You cannot use the passed policy to grant
  210. // permissions that are in excess of those allowed by the access policy of the
  211. // role that is being assumed. For more information, see Permissions for AssumeRole,
  212. // AssumeRoleWithSAML, and AssumeRoleWithWebIdentity (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_assumerole.html)
  213. // in the IAM User Guide.
  214. //
  215. // Before your application can call AssumeRoleWithSAML, you must configure
  216. // your SAML identity provider (IdP) to issue the claims required by AWS. Additionally,
  217. // you must use AWS Identity and Access Management (IAM) to create a SAML provider
  218. // entity in your AWS account that represents your identity provider, and create
  219. // an IAM role that specifies this SAML provider in its trust policy.
  220. //
  221. // Calling AssumeRoleWithSAML does not require the use of AWS security credentials.
  222. // The identity of the caller is validated by using keys in the metadata document
  223. // that is uploaded for the SAML provider entity for your identity provider.
  224. //
  225. // Calling AssumeRoleWithSAML can result in an entry in your AWS CloudTrail
  226. // logs. The entry includes the value in the NameID element of the SAML assertion.
  227. // We recommend that you use a NameIDType that is not associated with any personally
  228. // identifiable information (PII). For example, you could instead use the Persistent
  229. // Identifier (urn:oasis:names:tc:SAML:2.0:nameid-format:persistent).
  230. //
  231. // For more information, see the following resources:
  232. //
  233. // About SAML 2.0-based Federation (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_saml.html)
  234. // in the IAM User Guide.
  235. //
  236. // Creating SAML Identity Providers (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_create_saml.html)
  237. // in the IAM User Guide.
  238. //
  239. // Configuring a Relying Party and Claims (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_create_saml_relying-party.html)
  240. // in the IAM User Guide.
  241. //
  242. // Creating a Role for SAML 2.0 Federation (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-idp_saml.html)
  243. // in the IAM User Guide.
  244. func (c *STS) AssumeRoleWithSAML(input *AssumeRoleWithSAMLInput) (*AssumeRoleWithSAMLOutput, error) {
  245. req, out := c.AssumeRoleWithSAMLRequest(input)
  246. err := req.Send()
  247. return out, err
  248. }
  249. const opAssumeRoleWithWebIdentity = "AssumeRoleWithWebIdentity"
  250. // AssumeRoleWithWebIdentityRequest generates a "aws/request.Request" representing the
  251. // client's request for the AssumeRoleWithWebIdentity operation. The "output" return
  252. // value can be used to capture response data after the request's "Send" method
  253. // is called.
  254. //
  255. // Creating a request object using this method should be used when you want to inject
  256. // custom logic into the request's lifecycle using a custom handler, or if you want to
  257. // access properties on the request object before or after sending the request. If
  258. // you just want the service response, call the AssumeRoleWithWebIdentity method directly
  259. // instead.
  260. //
  261. // Note: You must call the "Send" method on the returned request object in order
  262. // to execute the request.
  263. //
  264. // // Example sending a request using the AssumeRoleWithWebIdentityRequest method.
  265. // req, resp := client.AssumeRoleWithWebIdentityRequest(params)
  266. //
  267. // err := req.Send()
  268. // if err == nil { // resp is now filled
  269. // fmt.Println(resp)
  270. // }
  271. //
  272. func (c *STS) AssumeRoleWithWebIdentityRequest(input *AssumeRoleWithWebIdentityInput) (req *request.Request, output *AssumeRoleWithWebIdentityOutput) {
  273. op := &request.Operation{
  274. Name: opAssumeRoleWithWebIdentity,
  275. HTTPMethod: "POST",
  276. HTTPPath: "/",
  277. }
  278. if input == nil {
  279. input = &AssumeRoleWithWebIdentityInput{}
  280. }
  281. req = c.newRequest(op, input, output)
  282. output = &AssumeRoleWithWebIdentityOutput{}
  283. req.Data = output
  284. return
  285. }
  286. // Returns a set of temporary security credentials for users who have been authenticated
  287. // in a mobile or web application with a web identity provider, such as Amazon
  288. // Cognito, Login with Amazon, Facebook, Google, or any OpenID Connect-compatible
  289. // identity provider.
  290. //
  291. // For mobile applications, we recommend that you use Amazon Cognito. You
  292. // can use Amazon Cognito with the AWS SDK for iOS (http://aws.amazon.com/sdkforios/)
  293. // and the AWS SDK for Android (http://aws.amazon.com/sdkforandroid/) to uniquely
  294. // identify a user and supply the user with a consistent identity throughout
  295. // the lifetime of an application.
  296. //
  297. // To learn more about Amazon Cognito, see Amazon Cognito Overview (http://docs.aws.amazon.com/mobile/sdkforandroid/developerguide/cognito-auth.html#d0e840)
  298. // in the AWS SDK for Android Developer Guide guide and Amazon Cognito Overview
  299. // (http://docs.aws.amazon.com/mobile/sdkforios/developerguide/cognito-auth.html#d0e664)
  300. // in the AWS SDK for iOS Developer Guide.
  301. //
  302. // Calling AssumeRoleWithWebIdentity does not require the use of AWS security
  303. // credentials. Therefore, you can distribute an application (for example, on
  304. // mobile devices) that requests temporary security credentials without including
  305. // long-term AWS credentials in the application, and without deploying server-based
  306. // proxy services that use long-term AWS credentials. Instead, the identity
  307. // of the caller is validated by using a token from the web identity provider.
  308. // For a comparison of AssumeRoleWithWebIdentity with the other APIs that produce
  309. // temporary credentials, see Requesting Temporary Security Credentials (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html)
  310. // and Comparing the AWS STS APIs (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison)
  311. // in the IAM User Guide.
  312. //
  313. // The temporary security credentials returned by this API consist of an access
  314. // key ID, a secret access key, and a security token. Applications can use these
  315. // temporary security credentials to sign calls to AWS service APIs.
  316. //
  317. // The credentials are valid for the duration that you specified when calling
  318. // AssumeRoleWithWebIdentity, which can be from 900 seconds (15 minutes) to
  319. // a maximum of 3600 seconds (1 hour). The default is 1 hour.
  320. //
  321. // The temporary security credentials created by AssumeRoleWithWebIdentity
  322. // can be used to make API calls to any AWS service with the following exception:
  323. // you cannot call the STS service's GetFederationToken or GetSessionToken APIs.
  324. //
  325. // Optionally, you can pass an IAM access policy to this operation. If you
  326. // choose not to pass a policy, the temporary security credentials that are
  327. // returned by the operation have the permissions that are defined in the access
  328. // policy of the role that is being assumed. If you pass a policy to this operation,
  329. // the temporary security credentials that are returned by the operation have
  330. // the permissions that are allowed by both the access policy of the role that
  331. // is being assumed, and the policy that you pass. This gives you a way to
  332. // further restrict the permissions for the resulting temporary security credentials.
  333. // You cannot use the passed policy to grant permissions that are in excess
  334. // of those allowed by the access policy of the role that is being assumed.
  335. // For more information, see Permissions for AssumeRole, AssumeRoleWithSAML,
  336. // and AssumeRoleWithWebIdentity (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_assumerole.html)
  337. // in the IAM User Guide.
  338. //
  339. // Before your application can call AssumeRoleWithWebIdentity, you must have
  340. // an identity token from a supported identity provider and create a role that
  341. // the application can assume. The role that your application assumes must trust
  342. // the identity provider that is associated with the identity token. In other
  343. // words, the identity provider must be specified in the role's trust policy.
  344. //
  345. // Calling AssumeRoleWithWebIdentity can result in an entry in your AWS CloudTrail
  346. // logs. The entry includes the Subject (http://openid.net/specs/openid-connect-core-1_0.html#Claims)
  347. // of the provided Web Identity Token. We recommend that you avoid using any
  348. // personally identifiable information (PII) in this field. For example, you
  349. // could instead use a GUID or a pairwise identifier, as suggested in the OIDC
  350. // specification (http://openid.net/specs/openid-connect-core-1_0.html#SubjectIDTypes).
  351. //
  352. // For more information about how to use web identity federation and the AssumeRoleWithWebIdentity
  353. // API, see the following resources:
  354. //
  355. // Using Web Identity Federation APIs for Mobile Apps (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_oidc_manual)
  356. // and Federation Through a Web-based Identity Provider (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#api_assumerolewithwebidentity).
  357. //
  358. // Web Identity Federation Playground (https://web-identity-federation-playground.s3.amazonaws.com/index.html).
  359. // This interactive website lets you walk through the process of authenticating
  360. // via Login with Amazon, Facebook, or Google, getting temporary security credentials,
  361. // and then using those credentials to make a request to AWS.
  362. //
  363. // AWS SDK for iOS (http://aws.amazon.com/sdkforios/) and AWS SDK for Android
  364. // (http://aws.amazon.com/sdkforandroid/). These toolkits contain sample apps
  365. // that show how to invoke the identity providers, and then how to use the information
  366. // from these providers to get and use temporary security credentials.
  367. //
  368. // Web Identity Federation with Mobile Applications (http://aws.amazon.com/articles/4617974389850313).
  369. // This article discusses web identity federation and shows an example of how
  370. // to use web identity federation to get access to content in Amazon S3.
  371. func (c *STS) AssumeRoleWithWebIdentity(input *AssumeRoleWithWebIdentityInput) (*AssumeRoleWithWebIdentityOutput, error) {
  372. req, out := c.AssumeRoleWithWebIdentityRequest(input)
  373. err := req.Send()
  374. return out, err
  375. }
  376. const opDecodeAuthorizationMessage = "DecodeAuthorizationMessage"
  377. // DecodeAuthorizationMessageRequest generates a "aws/request.Request" representing the
  378. // client's request for the DecodeAuthorizationMessage operation. The "output" return
  379. // value can be used to capture response data after the request's "Send" method
  380. // is called.
  381. //
  382. // Creating a request object using this method should be used when you want to inject
  383. // custom logic into the request's lifecycle using a custom handler, or if you want to
  384. // access properties on the request object before or after sending the request. If
  385. // you just want the service response, call the DecodeAuthorizationMessage method directly
  386. // instead.
  387. //
  388. // Note: You must call the "Send" method on the returned request object in order
  389. // to execute the request.
  390. //
  391. // // Example sending a request using the DecodeAuthorizationMessageRequest method.
  392. // req, resp := client.DecodeAuthorizationMessageRequest(params)
  393. //
  394. // err := req.Send()
  395. // if err == nil { // resp is now filled
  396. // fmt.Println(resp)
  397. // }
  398. //
  399. func (c *STS) DecodeAuthorizationMessageRequest(input *DecodeAuthorizationMessageInput) (req *request.Request, output *DecodeAuthorizationMessageOutput) {
  400. op := &request.Operation{
  401. Name: opDecodeAuthorizationMessage,
  402. HTTPMethod: "POST",
  403. HTTPPath: "/",
  404. }
  405. if input == nil {
  406. input = &DecodeAuthorizationMessageInput{}
  407. }
  408. req = c.newRequest(op, input, output)
  409. output = &DecodeAuthorizationMessageOutput{}
  410. req.Data = output
  411. return
  412. }
  413. // Decodes additional information about the authorization status of a request
  414. // from an encoded message returned in response to an AWS request.
  415. //
  416. // For example, if a user is not authorized to perform an action that he or
  417. // she has requested, the request returns a Client.UnauthorizedOperation response
  418. // (an HTTP 403 response). Some AWS actions additionally return an encoded message
  419. // that can provide details about this authorization failure.
  420. //
  421. // Only certain AWS actions return an encoded authorization message. The documentation
  422. // for an individual action indicates whether that action returns an encoded
  423. // message in addition to returning an HTTP code.
  424. //
  425. // The message is encoded because the details of the authorization status
  426. // can constitute privileged information that the user who requested the action
  427. // should not see. To decode an authorization status message, a user must be
  428. // granted permissions via an IAM policy to request the DecodeAuthorizationMessage
  429. // (sts:DecodeAuthorizationMessage) action.
  430. //
  431. // The decoded message includes the following type of information:
  432. //
  433. // Whether the request was denied due to an explicit deny or due to the absence
  434. // of an explicit allow. For more information, see Determining Whether a Request
  435. // is Allowed or Denied (http://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_evaluation-logic.html#policy-eval-denyallow)
  436. // in the IAM User Guide.
  437. //
  438. // The principal who made the request.
  439. //
  440. // The requested action.
  441. //
  442. // The requested resource.
  443. //
  444. // The values of condition keys in the context of the user's request.
  445. func (c *STS) DecodeAuthorizationMessage(input *DecodeAuthorizationMessageInput) (*DecodeAuthorizationMessageOutput, error) {
  446. req, out := c.DecodeAuthorizationMessageRequest(input)
  447. err := req.Send()
  448. return out, err
  449. }
  450. const opGetCallerIdentity = "GetCallerIdentity"
  451. // GetCallerIdentityRequest generates a "aws/request.Request" representing the
  452. // client's request for the GetCallerIdentity operation. The "output" return
  453. // value can be used to capture response data after the request's "Send" method
  454. // is called.
  455. //
  456. // Creating a request object using this method should be used when you want to inject
  457. // custom logic into the request's lifecycle using a custom handler, or if you want to
  458. // access properties on the request object before or after sending the request. If
  459. // you just want the service response, call the GetCallerIdentity method directly
  460. // instead.
  461. //
  462. // Note: You must call the "Send" method on the returned request object in order
  463. // to execute the request.
  464. //
  465. // // Example sending a request using the GetCallerIdentityRequest method.
  466. // req, resp := client.GetCallerIdentityRequest(params)
  467. //
  468. // err := req.Send()
  469. // if err == nil { // resp is now filled
  470. // fmt.Println(resp)
  471. // }
  472. //
  473. func (c *STS) GetCallerIdentityRequest(input *GetCallerIdentityInput) (req *request.Request, output *GetCallerIdentityOutput) {
  474. op := &request.Operation{
  475. Name: opGetCallerIdentity,
  476. HTTPMethod: "POST",
  477. HTTPPath: "/",
  478. }
  479. if input == nil {
  480. input = &GetCallerIdentityInput{}
  481. }
  482. req = c.newRequest(op, input, output)
  483. output = &GetCallerIdentityOutput{}
  484. req.Data = output
  485. return
  486. }
  487. // Returns details about the IAM identity whose credentials are used to call
  488. // the API.
  489. func (c *STS) GetCallerIdentity(input *GetCallerIdentityInput) (*GetCallerIdentityOutput, error) {
  490. req, out := c.GetCallerIdentityRequest(input)
  491. err := req.Send()
  492. return out, err
  493. }
  494. const opGetFederationToken = "GetFederationToken"
  495. // GetFederationTokenRequest generates a "aws/request.Request" representing the
  496. // client's request for the GetFederationToken operation. The "output" return
  497. // value can be used to capture response data after the request's "Send" method
  498. // is called.
  499. //
  500. // Creating a request object using this method should be used when you want to inject
  501. // custom logic into the request's lifecycle using a custom handler, or if you want to
  502. // access properties on the request object before or after sending the request. If
  503. // you just want the service response, call the GetFederationToken method directly
  504. // instead.
  505. //
  506. // Note: You must call the "Send" method on the returned request object in order
  507. // to execute the request.
  508. //
  509. // // Example sending a request using the GetFederationTokenRequest method.
  510. // req, resp := client.GetFederationTokenRequest(params)
  511. //
  512. // err := req.Send()
  513. // if err == nil { // resp is now filled
  514. // fmt.Println(resp)
  515. // }
  516. //
  517. func (c *STS) GetFederationTokenRequest(input *GetFederationTokenInput) (req *request.Request, output *GetFederationTokenOutput) {
  518. op := &request.Operation{
  519. Name: opGetFederationToken,
  520. HTTPMethod: "POST",
  521. HTTPPath: "/",
  522. }
  523. if input == nil {
  524. input = &GetFederationTokenInput{}
  525. }
  526. req = c.newRequest(op, input, output)
  527. output = &GetFederationTokenOutput{}
  528. req.Data = output
  529. return
  530. }
  531. // Returns a set of temporary security credentials (consisting of an access
  532. // key ID, a secret access key, and a security token) for a federated user.
  533. // A typical use is in a proxy application that gets temporary security credentials
  534. // on behalf of distributed applications inside a corporate network. Because
  535. // you must call the GetFederationToken action using the long-term security
  536. // credentials of an IAM user, this call is appropriate in contexts where those
  537. // credentials can be safely stored, usually in a server-based application.
  538. // For a comparison of GetFederationToken with the other APIs that produce temporary
  539. // credentials, see Requesting Temporary Security Credentials (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html)
  540. // and Comparing the AWS STS APIs (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison)
  541. // in the IAM User Guide.
  542. //
  543. // If you are creating a mobile-based or browser-based app that can authenticate
  544. // users using a web identity provider like Login with Amazon, Facebook, Google,
  545. // or an OpenID Connect-compatible identity provider, we recommend that you
  546. // use Amazon Cognito (http://aws.amazon.com/cognito/) or AssumeRoleWithWebIdentity.
  547. // For more information, see Federation Through a Web-based Identity Provider
  548. // (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#api_assumerolewithwebidentity).
  549. //
  550. // The GetFederationToken action must be called by using the long-term AWS
  551. // security credentials of an IAM user. You can also call GetFederationToken
  552. // using the security credentials of an AWS root account, but we do not recommended
  553. // it. Instead, we recommend that you create an IAM user for the purpose of
  554. // the proxy application and then attach a policy to the IAM user that limits
  555. // federated users to only the actions and resources that they need access to.
  556. // For more information, see IAM Best Practices (http://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html)
  557. // in the IAM User Guide.
  558. //
  559. // The temporary security credentials that are obtained by using the long-term
  560. // credentials of an IAM user are valid for the specified duration, from 900
  561. // seconds (15 minutes) up to a maximium of 129600 seconds (36 hours). The default
  562. // is 43200 seconds (12 hours). Temporary credentials that are obtained by using
  563. // AWS root account credentials have a maximum duration of 3600 seconds (1 hour).
  564. //
  565. // The temporary security credentials created by GetFederationToken can be
  566. // used to make API calls to any AWS service with the following exceptions:
  567. //
  568. // You cannot use these credentials to call any IAM APIs.
  569. //
  570. // You cannot call any STS APIs.
  571. //
  572. // Permissions
  573. //
  574. // The permissions for the temporary security credentials returned by GetFederationToken
  575. // are determined by a combination of the following:
  576. //
  577. // The policy or policies that are attached to the IAM user whose credentials
  578. // are used to call GetFederationToken.
  579. //
  580. // The policy that is passed as a parameter in the call.
  581. //
  582. // The passed policy is attached to the temporary security credentials that
  583. // result from the GetFederationToken API call--that is, to the federated user.
  584. // When the federated user makes an AWS request, AWS evaluates the policy attached
  585. // to the federated user in combination with the policy or policies attached
  586. // to the IAM user whose credentials were used to call GetFederationToken. AWS
  587. // allows the federated user's request only when both the federated user and
  588. // the IAM user are explicitly allowed to perform the requested action. The
  589. // passed policy cannot grant more permissions than those that are defined in
  590. // the IAM user policy.
  591. //
  592. // A typical use case is that the permissions of the IAM user whose credentials
  593. // are used to call GetFederationToken are designed to allow access to all the
  594. // actions and resources that any federated user will need. Then, for individual
  595. // users, you pass a policy to the operation that scopes down the permissions
  596. // to a level that's appropriate to that individual user, using a policy that
  597. // allows only a subset of permissions that are granted to the IAM user.
  598. //
  599. // If you do not pass a policy, the resulting temporary security credentials
  600. // have no effective permissions. The only exception is when the temporary security
  601. // credentials are used to access a resource that has a resource-based policy
  602. // that specifically allows the federated user to access the resource.
  603. //
  604. // For more information about how permissions work, see Permissions for GetFederationToken
  605. // (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_getfederationtoken.html).
  606. // For information about using GetFederationToken to create temporary security
  607. // credentials, see GetFederationToken—Federation Through a Custom Identity
  608. // Broker (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#api_getfederationtoken).
  609. func (c *STS) GetFederationToken(input *GetFederationTokenInput) (*GetFederationTokenOutput, error) {
  610. req, out := c.GetFederationTokenRequest(input)
  611. err := req.Send()
  612. return out, err
  613. }
  614. const opGetSessionToken = "GetSessionToken"
  615. // GetSessionTokenRequest generates a "aws/request.Request" representing the
  616. // client's request for the GetSessionToken operation. The "output" return
  617. // value can be used to capture response data after the request's "Send" method
  618. // is called.
  619. //
  620. // Creating a request object using this method should be used when you want to inject
  621. // custom logic into the request's lifecycle using a custom handler, or if you want to
  622. // access properties on the request object before or after sending the request. If
  623. // you just want the service response, call the GetSessionToken method directly
  624. // instead.
  625. //
  626. // Note: You must call the "Send" method on the returned request object in order
  627. // to execute the request.
  628. //
  629. // // Example sending a request using the GetSessionTokenRequest method.
  630. // req, resp := client.GetSessionTokenRequest(params)
  631. //
  632. // err := req.Send()
  633. // if err == nil { // resp is now filled
  634. // fmt.Println(resp)
  635. // }
  636. //
  637. func (c *STS) GetSessionTokenRequest(input *GetSessionTokenInput) (req *request.Request, output *GetSessionTokenOutput) {
  638. op := &request.Operation{
  639. Name: opGetSessionToken,
  640. HTTPMethod: "POST",
  641. HTTPPath: "/",
  642. }
  643. if input == nil {
  644. input = &GetSessionTokenInput{}
  645. }
  646. req = c.newRequest(op, input, output)
  647. output = &GetSessionTokenOutput{}
  648. req.Data = output
  649. return
  650. }
  651. // Returns a set of temporary credentials for an AWS account or IAM user. The
  652. // credentials consist of an access key ID, a secret access key, and a security
  653. // token. Typically, you use GetSessionToken if you want to use MFA to protect
  654. // programmatic calls to specific AWS APIs like Amazon EC2 StopInstances. MFA-enabled
  655. // IAM users would need to call GetSessionToken and submit an MFA code that
  656. // is associated with their MFA device. Using the temporary security credentials
  657. // that are returned from the call, IAM users can then make programmatic calls
  658. // to APIs that require MFA authentication. If you do not supply a correct MFA
  659. // code, then the API returns an access denied error. For a comparison of GetSessionToken
  660. // with the other APIs that produce temporary credentials, see Requesting Temporary
  661. // Security Credentials (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html)
  662. // and Comparing the AWS STS APIs (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison)
  663. // in the IAM User Guide.
  664. //
  665. // The GetSessionToken action must be called by using the long-term AWS security
  666. // credentials of the AWS account or an IAM user. Credentials that are created
  667. // by IAM users are valid for the duration that you specify, from 900 seconds
  668. // (15 minutes) up to a maximum of 129600 seconds (36 hours), with a default
  669. // of 43200 seconds (12 hours); credentials that are created by using account
  670. // credentials can range from 900 seconds (15 minutes) up to a maximum of 3600
  671. // seconds (1 hour), with a default of 1 hour.
  672. //
  673. // The temporary security credentials created by GetSessionToken can be used
  674. // to make API calls to any AWS service with the following exceptions:
  675. //
  676. // You cannot call any IAM APIs unless MFA authentication information is
  677. // included in the request.
  678. //
  679. // You cannot call any STS API except AssumeRole.
  680. //
  681. // We recommend that you do not call GetSessionToken with root account credentials.
  682. // Instead, follow our best practices (http://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#create-iam-users)
  683. // by creating one or more IAM users, giving them the necessary permissions,
  684. // and using IAM users for everyday interaction with AWS.
  685. //
  686. // The permissions associated with the temporary security credentials returned
  687. // by GetSessionToken are based on the permissions associated with account or
  688. // IAM user whose credentials are used to call the action. If GetSessionToken
  689. // is called using root account credentials, the temporary credentials have
  690. // root account permissions. Similarly, if GetSessionToken is called using the
  691. // credentials of an IAM user, the temporary credentials have the same permissions
  692. // as the IAM user.
  693. //
  694. // For more information about using GetSessionToken to create temporary credentials,
  695. // go to Temporary Credentials for Users in Untrusted Environments (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#api_getsessiontoken)
  696. // in the IAM User Guide.
  697. func (c *STS) GetSessionToken(input *GetSessionTokenInput) (*GetSessionTokenOutput, error) {
  698. req, out := c.GetSessionTokenRequest(input)
  699. err := req.Send()
  700. return out, err
  701. }
  702. type AssumeRoleInput struct {
  703. _ struct{} `type:"structure"`
  704. // The duration, in seconds, of the role session. The value can range from 900
  705. // seconds (15 minutes) to 3600 seconds (1 hour). By default, the value is set
  706. // to 3600 seconds.
  707. //
  708. // This is separate from the duration of a console session that you might
  709. // request using the returned credentials. The request to the federation endpoint
  710. // for a console sign-in token takes a SessionDuration parameter that specifies
  711. // the maximum length of the console session, separately from the DurationSeconds
  712. // parameter on this API. For more information, see Creating a URL that Enables
  713. // Federated Users to Access the AWS Management Console (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_enable-console-custom-url.html)
  714. // in the IAM User Guide.
  715. DurationSeconds *int64 `min:"900" type:"integer"`
  716. // A unique identifier that is used by third parties when assuming roles in
  717. // their customers' accounts. For each role that the third party can assume,
  718. // they should instruct their customers to ensure the role's trust policy checks
  719. // for the external ID that the third party generated. Each time the third party
  720. // assumes the role, they should pass the customer's external ID. The external
  721. // ID is useful in order to help third parties bind a role to the customer who
  722. // created it. For more information about the external ID, see How to Use an
  723. // External ID When Granting Access to Your AWS Resources to a Third Party (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-user_externalid.html)
  724. // in the IAM User Guide.
  725. //
  726. // The format for this parameter, as described by its regex pattern, is a string
  727. // of characters consisting of upper- and lower-case alphanumeric characters
  728. // with no spaces. You can also include underscores or any of the following
  729. // characters: =,.@:\/-
  730. ExternalId *string `min:"2" type:"string"`
  731. // An IAM policy in JSON format.
  732. //
  733. // This parameter is optional. If you pass a policy, the temporary security
  734. // credentials that are returned by the operation have the permissions that
  735. // are allowed by both (the intersection of) the access policy of the role that
  736. // is being assumed, and the policy that you pass. This gives you a way to further
  737. // restrict the permissions for the resulting temporary security credentials.
  738. // You cannot use the passed policy to grant permissions that are in excess
  739. // of those allowed by the access policy of the role that is being assumed.
  740. // For more information, see Permissions for AssumeRole, AssumeRoleWithSAML,
  741. // and AssumeRoleWithWebIdentity (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_assumerole.html)
  742. // in the IAM User Guide.
  743. //
  744. // The format for this parameter, as described by its regex pattern, is a string
  745. // of characters up to 2048 characters in length. The characters can be any
  746. // ASCII character from the space character to the end of the valid character
  747. // list (\u0020-\u00FF). It can also include the tab (\u0009), linefeed (\u000A),
  748. // and carriage return (\u000D) characters.
  749. //
  750. // The policy plain text must be 2048 bytes or shorter. However, an internal
  751. // conversion compresses it into a packed binary format with a separate limit.
  752. // The PackedPolicySize response element indicates by percentage how close to
  753. // the upper size limit the policy is, with 100% equaling the maximum allowed
  754. // size.
  755. Policy *string `min:"1" type:"string"`
  756. // The Amazon Resource Name (ARN) of the role to assume.
  757. RoleArn *string `min:"20" type:"string" required:"true"`
  758. // An identifier for the assumed role session.
  759. //
  760. // Use the role session name to uniquely identify a session when the same role
  761. // is assumed by different principals or for different reasons. In cross-account
  762. // scenarios, the role session name is visible to, and can be logged by the
  763. // account that owns the role. The role session name is also used in the ARN
  764. // of the assumed role principal. This means that subsequent cross-account API
  765. // requests using the temporary security credentials will expose the role session
  766. // name to the external account in their CloudTrail logs.
  767. //
  768. // The format for this parameter, as described by its regex pattern, is a string
  769. // of characters consisting of upper- and lower-case alphanumeric characters
  770. // with no spaces. You can also include underscores or any of the following
  771. // characters: =,.@-
  772. RoleSessionName *string `min:"2" type:"string" required:"true"`
  773. // The identification number of the MFA device that is associated with the user
  774. // who is making the AssumeRole call. Specify this value if the trust policy
  775. // of the role being assumed includes a condition that requires MFA authentication.
  776. // The value is either the serial number for a hardware device (such as GAHT12345678)
  777. // or an Amazon Resource Name (ARN) for a virtual device (such as arn:aws:iam::123456789012:mfa/user).
  778. //
  779. // The format for this parameter, as described by its regex pattern, is a string
  780. // of characters consisting of upper- and lower-case alphanumeric characters
  781. // with no spaces. You can also include underscores or any of the following
  782. // characters: =,.@-
  783. SerialNumber *string `min:"9" type:"string"`
  784. // The value provided by the MFA device, if the trust policy of the role being
  785. // assumed requires MFA (that is, if the policy includes a condition that tests
  786. // for MFA). If the role being assumed requires MFA and if the TokenCode value
  787. // is missing or expired, the AssumeRole call returns an "access denied" error.
  788. //
  789. // The format for this parameter, as described by its regex pattern, is a sequence
  790. // of six numeric digits.
  791. TokenCode *string `min:"6" type:"string"`
  792. }
  793. // String returns the string representation
  794. func (s AssumeRoleInput) String() string {
  795. return awsutil.Prettify(s)
  796. }
  797. // GoString returns the string representation
  798. func (s AssumeRoleInput) GoString() string {
  799. return s.String()
  800. }
  801. // Validate inspects the fields of the type to determine if they are valid.
  802. func (s *AssumeRoleInput) Validate() error {
  803. invalidParams := request.ErrInvalidParams{Context: "AssumeRoleInput"}
  804. if s.DurationSeconds != nil && *s.DurationSeconds < 900 {
  805. invalidParams.Add(request.NewErrParamMinValue("DurationSeconds", 900))
  806. }
  807. if s.ExternalId != nil && len(*s.ExternalId) < 2 {
  808. invalidParams.Add(request.NewErrParamMinLen("ExternalId", 2))
  809. }
  810. if s.Policy != nil && len(*s.Policy) < 1 {
  811. invalidParams.Add(request.NewErrParamMinLen("Policy", 1))
  812. }
  813. if s.RoleArn == nil {
  814. invalidParams.Add(request.NewErrParamRequired("RoleArn"))
  815. }
  816. if s.RoleArn != nil && len(*s.RoleArn) < 20 {
  817. invalidParams.Add(request.NewErrParamMinLen("RoleArn", 20))
  818. }
  819. if s.RoleSessionName == nil {
  820. invalidParams.Add(request.NewErrParamRequired("RoleSessionName"))
  821. }
  822. if s.RoleSessionName != nil && len(*s.RoleSessionName) < 2 {
  823. invalidParams.Add(request.NewErrParamMinLen("RoleSessionName", 2))
  824. }
  825. if s.SerialNumber != nil && len(*s.SerialNumber) < 9 {
  826. invalidParams.Add(request.NewErrParamMinLen("SerialNumber", 9))
  827. }
  828. if s.TokenCode != nil && len(*s.TokenCode) < 6 {
  829. invalidParams.Add(request.NewErrParamMinLen("TokenCode", 6))
  830. }
  831. if invalidParams.Len() > 0 {
  832. return invalidParams
  833. }
  834. return nil
  835. }
  836. // Contains the response to a successful AssumeRole request, including temporary
  837. // AWS credentials that can be used to make AWS requests.
  838. type AssumeRoleOutput struct {
  839. _ struct{} `type:"structure"`
  840. // The Amazon Resource Name (ARN) and the assumed role ID, which are identifiers
  841. // that you can use to refer to the resulting temporary security credentials.
  842. // For example, you can reference these credentials as a principal in a resource-based
  843. // policy by using the ARN or assumed role ID. The ARN and ID include the RoleSessionName
  844. // that you specified when you called AssumeRole.
  845. AssumedRoleUser *AssumedRoleUser `type:"structure"`
  846. // The temporary security credentials, which include an access key ID, a secret
  847. // access key, and a security (or session) token.
  848. //
  849. // Note: The size of the security token that STS APIs return is not fixed.
  850. // We strongly recommend that you make no assumptions about the maximum size.
  851. // As of this writing, the typical size is less than 4096 bytes, but that can
  852. // vary. Also, future updates to AWS might require larger sizes.
  853. Credentials *Credentials `type:"structure"`
  854. // A percentage value that indicates the size of the policy in packed form.
  855. // The service rejects any policy with a packed size greater than 100 percent,
  856. // which means the policy exceeded the allowed space.
  857. PackedPolicySize *int64 `type:"integer"`
  858. }
  859. // String returns the string representation
  860. func (s AssumeRoleOutput) String() string {
  861. return awsutil.Prettify(s)
  862. }
  863. // GoString returns the string representation
  864. func (s AssumeRoleOutput) GoString() string {
  865. return s.String()
  866. }
  867. type AssumeRoleWithSAMLInput struct {
  868. _ struct{} `type:"structure"`
  869. // The duration, in seconds, of the role session. The value can range from 900
  870. // seconds (15 minutes) to 3600 seconds (1 hour). By default, the value is set
  871. // to 3600 seconds. An expiration can also be specified in the SAML authentication
  872. // response's SessionNotOnOrAfter value. The actual expiration time is whichever
  873. // value is shorter.
  874. //
  875. // This is separate from the duration of a console session that you might
  876. // request using the returned credentials. The request to the federation endpoint
  877. // for a console sign-in token takes a SessionDuration parameter that specifies
  878. // the maximum length of the console session, separately from the DurationSeconds
  879. // parameter on this API. For more information, see Enabling SAML 2.0 Federated
  880. // Users to Access the AWS Management Console (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_enable-console-saml.html)
  881. // in the IAM User Guide.
  882. DurationSeconds *int64 `min:"900" type:"integer"`
  883. // An IAM policy in JSON format.
  884. //
  885. // The policy parameter is optional. If you pass a policy, the temporary security
  886. // credentials that are returned by the operation have the permissions that
  887. // are allowed by both the access policy of the role that is being assumed,
  888. // and the policy that you pass. This gives you a way to further restrict
  889. // the permissions for the resulting temporary security credentials. You cannot
  890. // use the passed policy to grant permissions that are in excess of those allowed
  891. // by the access policy of the role that is being assumed. For more information,
  892. // Permissions for AssumeRole, AssumeRoleWithSAML, and AssumeRoleWithWebIdentity
  893. // (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_assumerole.html)
  894. // in the IAM User Guide.
  895. //
  896. // The format for this parameter, as described by its regex pattern, is a string
  897. // of characters up to 2048 characters in length. The characters can be any
  898. // ASCII character from the space character to the end of the valid character
  899. // list (\u0020-\u00FF). It can also include the tab (\u0009), linefeed (\u000A),
  900. // and carriage return (\u000D) characters.
  901. //
  902. // The policy plain text must be 2048 bytes or shorter. However, an internal
  903. // conversion compresses it into a packed binary format with a separate limit.
  904. // The PackedPolicySize response element indicates by percentage how close to
  905. // the upper size limit the policy is, with 100% equaling the maximum allowed
  906. // size.
  907. Policy *string `min:"1" type:"string"`
  908. // The Amazon Resource Name (ARN) of the SAML provider in IAM that describes
  909. // the IdP.
  910. PrincipalArn *string `min:"20" type:"string" required:"true"`
  911. // The Amazon Resource Name (ARN) of the role that the caller is assuming.
  912. RoleArn *string `min:"20" type:"string" required:"true"`
  913. // The base-64 encoded SAML authentication response provided by the IdP.
  914. //
  915. // For more information, see Configuring a Relying Party and Adding Claims
  916. // (http://docs.aws.amazon.com/IAM/latest/UserGuide/create-role-saml-IdP-tasks.html)
  917. // in the Using IAM guide.
  918. SAMLAssertion *string `min:"4" type:"string" required:"true"`
  919. }
  920. // String returns the string representation
  921. func (s AssumeRoleWithSAMLInput) String() string {
  922. return awsutil.Prettify(s)
  923. }
  924. // GoString returns the string representation
  925. func (s AssumeRoleWithSAMLInput) GoString() string {
  926. return s.String()
  927. }
  928. // Validate inspects the fields of the type to determine if they are valid.
  929. func (s *AssumeRoleWithSAMLInput) Validate() error {
  930. invalidParams := request.ErrInvalidParams{Context: "AssumeRoleWithSAMLInput"}
  931. if s.DurationSeconds != nil && *s.DurationSeconds < 900 {
  932. invalidParams.Add(request.NewErrParamMinValue("DurationSeconds", 900))
  933. }
  934. if s.Policy != nil && len(*s.Policy) < 1 {
  935. invalidParams.Add(request.NewErrParamMinLen("Policy", 1))
  936. }
  937. if s.PrincipalArn == nil {
  938. invalidParams.Add(request.NewErrParamRequired("PrincipalArn"))
  939. }
  940. if s.PrincipalArn != nil && len(*s.PrincipalArn) < 20 {
  941. invalidParams.Add(request.NewErrParamMinLen("PrincipalArn", 20))
  942. }
  943. if s.RoleArn == nil {
  944. invalidParams.Add(request.NewErrParamRequired("RoleArn"))
  945. }
  946. if s.RoleArn != nil && len(*s.RoleArn) < 20 {
  947. invalidParams.Add(request.NewErrParamMinLen("RoleArn", 20))
  948. }
  949. if s.SAMLAssertion == nil {
  950. invalidParams.Add(request.NewErrParamRequired("SAMLAssertion"))
  951. }
  952. if s.SAMLAssertion != nil && len(*s.SAMLAssertion) < 4 {
  953. invalidParams.Add(request.NewErrParamMinLen("SAMLAssertion", 4))
  954. }
  955. if invalidParams.Len() > 0 {
  956. return invalidParams
  957. }
  958. return nil
  959. }
  960. // Contains the response to a successful AssumeRoleWithSAML request, including
  961. // temporary AWS credentials that can be used to make AWS requests.
  962. type AssumeRoleWithSAMLOutput struct {
  963. _ struct{} `type:"structure"`
  964. // The identifiers for the temporary security credentials that the operation
  965. // returns.
  966. AssumedRoleUser *AssumedRoleUser `type:"structure"`
  967. // The value of the Recipient attribute of the SubjectConfirmationData element
  968. // of the SAML assertion.
  969. Audience *string `type:"string"`
  970. // The temporary security credentials, which include an access key ID, a secret
  971. // access key, and a security (or session) token.
  972. //
  973. // Note: The size of the security token that STS APIs return is not fixed.
  974. // We strongly recommend that you make no assumptions about the maximum size.
  975. // As of this writing, the typical size is less than 4096 bytes, but that can
  976. // vary. Also, future updates to AWS might require larger sizes.
  977. Credentials *Credentials `type:"structure"`
  978. // The value of the Issuer element of the SAML assertion.
  979. Issuer *string `type:"string"`
  980. // A hash value based on the concatenation of the Issuer response value, the
  981. // AWS account ID, and the friendly name (the last part of the ARN) of the SAML
  982. // provider in IAM. The combination of NameQualifier and Subject can be used
  983. // to uniquely identify a federated user.
  984. //
  985. // The following pseudocode shows how the hash value is calculated:
  986. //
  987. // BASE64 ( SHA1 ( "https://example.com/saml" + "123456789012" + "/MySAMLIdP"
  988. // ) )
  989. NameQualifier *string `type:"string"`
  990. // A percentage value that indicates the size of the policy in packed form.
  991. // The service rejects any policy with a packed size greater than 100 percent,
  992. // which means the policy exceeded the allowed space.
  993. PackedPolicySize *int64 `type:"integer"`
  994. // The value of the NameID element in the Subject element of the SAML assertion.
  995. Subject *string `type:"string"`
  996. // The format of the name ID, as defined by the Format attribute in the NameID
  997. // element of the SAML assertion. Typical examples of the format are transient
  998. // or persistent.
  999. //
  1000. // If the format includes the prefix urn:oasis:names:tc:SAML:2.0:nameid-format,
  1001. // that prefix is removed. For example, urn:oasis:names:tc:SAML:2.0:nameid-format:transient
  1002. // is returned as transient. If the format includes any other prefix, the format
  1003. // is returned with no modifications.
  1004. SubjectType *string `type:"string"`
  1005. }
  1006. // String returns the string representation
  1007. func (s AssumeRoleWithSAMLOutput) String() string {
  1008. return awsutil.Prettify(s)
  1009. }
  1010. // GoString returns the string representation
  1011. func (s AssumeRoleWithSAMLOutput) GoString() string {
  1012. return s.String()
  1013. }
  1014. type AssumeRoleWithWebIdentityInput struct {
  1015. _ struct{} `type:"structure"`
  1016. // The duration, in seconds, of the role session. The value can range from 900
  1017. // seconds (15 minutes) to 3600 seconds (1 hour). By default, the value is set
  1018. // to 3600 seconds.
  1019. //
  1020. // This is separate from the duration of a console session that you might
  1021. // request using the returned credentials. The request to the federation endpoint
  1022. // for a console sign-in token takes a SessionDuration parameter that specifies
  1023. // the maximum length of the console session, separately from the DurationSeconds
  1024. // parameter on this API. For more information, see Creating a URL that Enables
  1025. // Federated Users to Access the AWS Management Console (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_enable-console-custom-url.html)
  1026. // in the IAM User Guide.
  1027. DurationSeconds *int64 `min:"900" type:"integer"`
  1028. // An IAM policy in JSON format.
  1029. //
  1030. // The policy parameter is optional. If you pass a policy, the temporary security
  1031. // credentials that are returned by the operation have the permissions that
  1032. // are allowed by both the access policy of the role that is being assumed,
  1033. // and the policy that you pass. This gives you a way to further restrict
  1034. // the permissions for the resulting temporary security credentials. You cannot
  1035. // use the passed policy to grant permissions that are in excess of those allowed
  1036. // by the access policy of the role that is being assumed. For more information,
  1037. // see Permissions for AssumeRoleWithWebIdentity (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_assumerole.html)
  1038. // in the IAM User Guide.
  1039. //
  1040. // The format for this parameter, as described by its regex pattern, is a string
  1041. // of characters up to 2048 characters in length. The characters can be any
  1042. // ASCII character from the space character to the end of the valid character
  1043. // list (\u0020-\u00FF). It can also include the tab (\u0009), linefeed (\u000A),
  1044. // and carriage return (\u000D) characters.
  1045. //
  1046. // The policy plain text must be 2048 bytes or shorter. However, an internal
  1047. // conversion compresses it into a packed binary format with a separate limit.
  1048. // The PackedPolicySize response element indicates by percentage how close to
  1049. // the upper size limit the policy is, with 100% equaling the maximum allowed
  1050. // size.
  1051. Policy *string `min:"1" type:"string"`
  1052. // The fully qualified host component of the domain name of the identity provider.
  1053. //
  1054. // Specify this value only for OAuth 2.0 access tokens. Currently www.amazon.com
  1055. // and graph.facebook.com are the only supported identity providers for OAuth
  1056. // 2.0 access tokens. Do not include URL schemes and port numbers.
  1057. //
  1058. // Do not specify this value for OpenID Connect ID tokens.
  1059. ProviderId *string `min:"4" type:"string"`
  1060. // The Amazon Resource Name (ARN) of the role that the caller is assuming.
  1061. RoleArn *string `min:"20" type:"string" required:"true"`
  1062. // An identifier for the assumed role session. Typically, you pass the name
  1063. // or identifier that is associated with the user who is using your application.
  1064. // That way, the temporary security credentials that your application will use
  1065. // are associated with that user. This session name is included as part of the
  1066. // ARN and assumed role ID in the AssumedRoleUser response element.
  1067. //
  1068. // The format for this parameter, as described by its regex pattern, is a string
  1069. // of characters consisting of upper- and lower-case alphanumeric characters
  1070. // with no spaces. You can also include underscores or any of the following
  1071. // characters: =,.@-
  1072. RoleSessionName *string `min:"2" type:"string" required:"true"`
  1073. // The OAuth 2.0 access token or OpenID Connect ID token that is provided by
  1074. // the identity provider. Your application must get this token by authenticating
  1075. // the user who is using your application with a web identity provider before
  1076. // the application makes an AssumeRoleWithWebIdentity call.
  1077. WebIdentityToken *string `min:"4" type:"string" required:"true"`
  1078. }
  1079. // String returns the string representation
  1080. func (s AssumeRoleWithWebIdentityInput) String() string {
  1081. return awsutil.Prettify(s)
  1082. }
  1083. // GoString returns the string representation
  1084. func (s AssumeRoleWithWebIdentityInput) GoString() string {
  1085. return s.String()
  1086. }
  1087. // Validate inspects the fields of the type to determine if they are valid.
  1088. func (s *AssumeRoleWithWebIdentityInput) Validate() error {
  1089. invalidParams := request.ErrInvalidParams{Context: "AssumeRoleWithWebIdentityInput"}
  1090. if s.DurationSeconds != nil && *s.DurationSeconds < 900 {
  1091. invalidParams.Add(request.NewErrParamMinValue("DurationSeconds", 900))
  1092. }
  1093. if s.Policy != nil && len(*s.Policy) < 1 {
  1094. invalidParams.Add(request.NewErrParamMinLen("Policy", 1))
  1095. }
  1096. if s.ProviderId != nil && len(*s.ProviderId) < 4 {
  1097. invalidParams.Add(request.NewErrParamMinLen("ProviderId", 4))
  1098. }
  1099. if s.RoleArn == nil {
  1100. invalidParams.Add(request.NewErrParamRequired("RoleArn"))
  1101. }
  1102. if s.RoleArn != nil && len(*s.RoleArn) < 20 {
  1103. invalidParams.Add(request.NewErrParamMinLen("RoleArn", 20))
  1104. }
  1105. if s.RoleSessionName == nil {
  1106. invalidParams.Add(request.NewErrParamRequired("RoleSessionName"))
  1107. }
  1108. if s.RoleSessionName != nil && len(*s.RoleSessionName) < 2 {
  1109. invalidParams.Add(request.NewErrParamMinLen("RoleSessionName", 2))
  1110. }
  1111. if s.WebIdentityToken == nil {
  1112. invalidParams.Add(request.NewErrParamRequired("WebIdentityToken"))
  1113. }
  1114. if s.WebIdentityToken != nil && len(*s.WebIdentityToken) < 4 {
  1115. invalidParams.Add(request.NewErrParamMinLen("WebIdentityToken", 4))
  1116. }
  1117. if invalidParams.Len() > 0 {
  1118. return invalidParams
  1119. }
  1120. return nil
  1121. }
  1122. // Contains the response to a successful AssumeRoleWithWebIdentity request,
  1123. // including temporary AWS credentials that can be used to make AWS requests.
  1124. type AssumeRoleWithWebIdentityOutput struct {
  1125. _ struct{} `type:"structure"`
  1126. // The Amazon Resource Name (ARN) and the assumed role ID, which are identifiers
  1127. // that you can use to refer to the resulting temporary security credentials.
  1128. // For example, you can reference these credentials as a principal in a resource-based
  1129. // policy by using the ARN or assumed role ID. The ARN and ID include the RoleSessionName
  1130. // that you specified when you called AssumeRole.
  1131. AssumedRoleUser *AssumedRoleUser `type:"structure"`
  1132. // The intended audience (also known as client ID) of the web identity token.
  1133. // This is traditionally the client identifier issued to the application that
  1134. // requested the web identity token.
  1135. Audience *string `type:"string"`
  1136. // The temporary security credentials, which include an access key ID, a secret
  1137. // access key, and a security token.
  1138. //
  1139. // Note: The size of the security token that STS APIs return is not fixed.
  1140. // We strongly recommend that you make no assumptions about the maximum size.
  1141. // As of this writing, the typical size is less than 4096 bytes, but that can
  1142. // vary. Also, future updates to AWS might require larger sizes.
  1143. Credentials *Credentials `type:"structure"`
  1144. // A percentage value that indicates the size of the policy in packed form.
  1145. // The service rejects any policy with a packed size greater than 100 percent,
  1146. // which means the policy exceeded the allowed space.
  1147. PackedPolicySize *int64 `type:"integer"`
  1148. // The issuing authority of the web identity token presented. For OpenID Connect
  1149. // ID Tokens this contains the value of the iss field. For OAuth 2.0 access
  1150. // tokens, this contains the value of the ProviderId parameter that was passed
  1151. // in the AssumeRoleWithWebIdentity request.
  1152. Provider *string `type:"string"`
  1153. // The unique user identifier that is returned by the identity provider. This
  1154. // identifier is associated with the WebIdentityToken that was submitted with
  1155. // the AssumeRoleWithWebIdentity call. The identifier is typically unique to
  1156. // the user and the application that acquired the WebIdentityToken (pairwise
  1157. // identifier). For OpenID Connect ID tokens, this field contains the value
  1158. // returned by the identity provider as the token's sub (Subject) claim.
  1159. SubjectFromWebIdentityToken *string `min:"6" type:"string"`
  1160. }
  1161. // String returns the string representation
  1162. func (s AssumeRoleWithWebIdentityOutput) String() string {
  1163. return awsutil.Prettify(s)
  1164. }
  1165. // GoString returns the string representation
  1166. func (s AssumeRoleWithWebIdentityOutput) GoString() string {
  1167. return s.String()
  1168. }
  1169. // The identifiers for the temporary security credentials that the operation
  1170. // returns.
  1171. type AssumedRoleUser struct {
  1172. _ struct{} `type:"structure"`
  1173. // The ARN of the temporary security credentials that are returned from the
  1174. // AssumeRole action. For more information about ARNs and how to use them in
  1175. // policies, see IAM Identifiers (http://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html)
  1176. // in Using IAM.
  1177. Arn *string `min:"20" type:"string" required:"true"`
  1178. // A unique identifier that contains the role ID and the role session name of
  1179. // the role that is being assumed. The role ID is generated by AWS when the
  1180. // role is created.
  1181. AssumedRoleId *string `min:"2" type:"string" required:"true"`
  1182. }
  1183. // String returns the string representation
  1184. func (s AssumedRoleUser) String() string {
  1185. return awsutil.Prettify(s)
  1186. }
  1187. // GoString returns the string representation
  1188. func (s AssumedRoleUser) GoString() string {
  1189. return s.String()
  1190. }
  1191. // AWS credentials for API authentication.
  1192. type Credentials struct {
  1193. _ struct{} `type:"structure"`
  1194. // The access key ID that identifies the temporary security credentials.
  1195. AccessKeyId *string `min:"16" type:"string" required:"true"`
  1196. // The date on which the current credentials expire.
  1197. Expiration *time.Time `type:"timestamp" timestampFormat:"iso8601" required:"true"`
  1198. // The secret access key that can be used to sign requests.
  1199. SecretAccessKey *string `type:"string" required:"true"`
  1200. // The token that users must pass to the service API to use the temporary credentials.
  1201. SessionToken *string `type:"string" required:"true"`
  1202. }
  1203. // String returns the string representation
  1204. func (s Credentials) String() string {
  1205. return awsutil.Prettify(s)
  1206. }
  1207. // GoString returns the string representation
  1208. func (s Credentials) GoString() string {
  1209. return s.String()
  1210. }
  1211. type DecodeAuthorizationMessageInput struct {
  1212. _ struct{} `type:"structure"`
  1213. // The encoded message that was returned with the response.
  1214. EncodedMessage *string `min:"1" type:"string" required:"true"`
  1215. }
  1216. // String returns the string representation
  1217. func (s DecodeAuthorizationMessageInput) String() string {
  1218. return awsutil.Prettify(s)
  1219. }
  1220. // GoString returns the string representation
  1221. func (s DecodeAuthorizationMessageInput) GoString() string {
  1222. return s.String()
  1223. }
  1224. // Validate inspects the fields of the type to determine if they are valid.
  1225. func (s *DecodeAuthorizationMessageInput) Validate() error {
  1226. invalidParams := request.ErrInvalidParams{Context: "DecodeAuthorizationMessageInput"}
  1227. if s.EncodedMessage == nil {
  1228. invalidParams.Add(request.NewErrParamRequired("EncodedMessage"))
  1229. }
  1230. if s.EncodedMessage != nil && len(*s.EncodedMessage) < 1 {
  1231. invalidParams.Add(request.NewErrParamMinLen("EncodedMessage", 1))
  1232. }
  1233. if invalidParams.Len() > 0 {
  1234. return invalidParams
  1235. }
  1236. return nil
  1237. }
  1238. // A document that contains additional information about the authorization status
  1239. // of a request from an encoded message that is returned in response to an AWS
  1240. // request.
  1241. type DecodeAuthorizationMessageOutput struct {
  1242. _ struct{} `type:"structure"`
  1243. // An XML document that contains the decoded message.
  1244. DecodedMessage *string `type:"string"`
  1245. }
  1246. // String returns the string representation
  1247. func (s DecodeAuthorizationMessageOutput) String() string {
  1248. return awsutil.Prettify(s)
  1249. }
  1250. // GoString returns the string representation
  1251. func (s DecodeAuthorizationMessageOutput) GoString() string {
  1252. return s.String()
  1253. }
  1254. // Identifiers for the federated user that is associated with the credentials.
  1255. type FederatedUser struct {
  1256. _ struct{} `type:"structure"`
  1257. // The ARN that specifies the federated user that is associated with the credentials.
  1258. // For more information about ARNs and how to use them in policies, see IAM
  1259. // Identifiers (http://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html)
  1260. // in Using IAM.
  1261. Arn *string `min:"20" type:"string" required:"true"`
  1262. // The string that identifies the federated user associated with the credentials,
  1263. // similar to the unique ID of an IAM user.
  1264. FederatedUserId *string `min:"2" type:"string" required:"true"`
  1265. }
  1266. // String returns the string representation
  1267. func (s FederatedUser) String() string {
  1268. return awsutil.Prettify(s)
  1269. }
  1270. // GoString returns the string representation
  1271. func (s FederatedUser) GoString() string {
  1272. return s.String()
  1273. }
  1274. type GetCallerIdentityInput struct {
  1275. _ struct{} `type:"structure"`
  1276. }
  1277. // String returns the string representation
  1278. func (s GetCallerIdentityInput) String() string {
  1279. return awsutil.Prettify(s)
  1280. }
  1281. // GoString returns the string representation
  1282. func (s GetCallerIdentityInput) GoString() string {
  1283. return s.String()
  1284. }
  1285. // Contains the response to a successful GetCallerIdentity request, including
  1286. // information about the entity making the request.
  1287. type GetCallerIdentityOutput struct {
  1288. _ struct{} `type:"structure"`
  1289. // The AWS account ID number of the account that owns or contains the calling
  1290. // entity.
  1291. Account *string `type:"string"`
  1292. // The AWS ARN associated with the calling entity.
  1293. Arn *string `min:"20" type:"string"`
  1294. // The unique identifier of the calling entity. The exact value depends on the
  1295. // type of entity making the call. The values returned are those listed in the
  1296. // aws:userid column in the Principal table (http://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_variables.html#principaltable)
  1297. // found on the Policy Variables reference page in the IAM User Guide.
  1298. UserId *string `type:"string"`
  1299. }
  1300. // String returns the string representation
  1301. func (s GetCallerIdentityOutput) String() string {
  1302. return awsutil.Prettify(s)
  1303. }
  1304. // GoString returns the string representation
  1305. func (s GetCallerIdentityOutput) GoString() string {
  1306. return s.String()
  1307. }
  1308. type GetFederationTokenInput struct {
  1309. _ struct{} `type:"structure"`
  1310. // The duration, in seconds, that the session should last. Acceptable durations
  1311. // for federation sessions range from 900 seconds (15 minutes) to 129600 seconds
  1312. // (36 hours), with 43200 seconds (12 hours) as the default. Sessions obtained
  1313. // using AWS account (root) credentials are restricted to a maximum of 3600
  1314. // seconds (one hour). If the specified duration is longer than one hour, the
  1315. // session obtained by using AWS account (root) credentials defaults to one
  1316. // hour.
  1317. DurationSeconds *int64 `min:"900" type:"integer"`
  1318. // The name of the federated user. The name is used as an identifier for the
  1319. // temporary security credentials (such as Bob). For example, you can reference
  1320. // the federated user name in a resource-based policy, such as in an Amazon
  1321. // S3 bucket policy.
  1322. //
  1323. // The format for this parameter, as described by its regex pattern, is a string
  1324. // of characters consisting of upper- and lower-case alphanumeric characters
  1325. // with no spaces. You can also include underscores or any of the following
  1326. // characters: =,.@-
  1327. Name *string `min:"2" type:"string" required:"true"`
  1328. // An IAM policy in JSON format that is passed with the GetFederationToken call
  1329. // and evaluated along with the policy or policies that are attached to the
  1330. // IAM user whose credentials are used to call GetFederationToken. The passed
  1331. // policy is used to scope down the permissions that are available to the IAM
  1332. // user, by allowing only a subset of the permissions that are granted to the
  1333. // IAM user. The passed policy cannot grant more permissions than those granted
  1334. // to the IAM user. The final permissions for the federated user are the most
  1335. // restrictive set based on the intersection of the passed policy and the IAM
  1336. // user policy.
  1337. //
  1338. // If you do not pass a policy, the resulting temporary security credentials
  1339. // have no effective permissions. The only exception is when the temporary security
  1340. // credentials are used to access a resource that has a resource-based policy
  1341. // that specifically allows the federated user to access the resource.
  1342. //
  1343. // The format for this parameter, as described by its regex pattern, is a string
  1344. // of characters up to 2048 characters in length. The characters can be any
  1345. // ASCII character from the space character to the end of the valid character
  1346. // list (\u0020-\u00FF). It can also include the tab (\u0009), linefeed (\u000A),
  1347. // and carriage return (\u000D) characters.
  1348. //
  1349. // The policy plain text must be 2048 bytes or shorter. However, an internal
  1350. // conversion compresses it into a packed binary format with a separate limit.
  1351. // The PackedPolicySize response element indicates by percentage how close to
  1352. // the upper size limit the policy is, with 100% equaling the maximum allowed
  1353. // size.
  1354. //
  1355. // For more information about how permissions work, see Permissions for GetFederationToken
  1356. // (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_control-access_getfederationtoken.html).
  1357. Policy *string `min:"1" type:"string"`
  1358. }
  1359. // String returns the string representation
  1360. func (s GetFederationTokenInput) String() string {
  1361. return awsutil.Prettify(s)
  1362. }
  1363. // GoString returns the string representation
  1364. func (s GetFederationTokenInput) GoString() string {
  1365. return s.String()
  1366. }
  1367. // Validate inspects the fields of the type to determine if they are valid.
  1368. func (s *GetFederationTokenInput) Validate() error {
  1369. invalidParams := request.ErrInvalidParams{Context: "GetFederationTokenInput"}
  1370. if s.DurationSeconds != nil && *s.DurationSeconds < 900 {
  1371. invalidParams.Add(request.NewErrParamMinValue("DurationSeconds", 900))
  1372. }
  1373. if s.Name == nil {
  1374. invalidParams.Add(request.NewErrParamRequired("Name"))
  1375. }
  1376. if s.Name != nil && len(*s.Name) < 2 {
  1377. invalidParams.Add(request.NewErrParamMinLen("Name", 2))
  1378. }
  1379. if s.Policy != nil && len(*s.Policy) < 1 {
  1380. invalidParams.Add(request.NewErrParamMinLen("Policy", 1))
  1381. }
  1382. if invalidParams.Len() > 0 {
  1383. return invalidParams
  1384. }
  1385. return nil
  1386. }
  1387. // Contains the response to a successful GetFederationToken request, including
  1388. // temporary AWS credentials that can be used to make AWS requests.
  1389. type GetFederationTokenOutput struct {
  1390. _ struct{} `type:"structure"`
  1391. // The temporary security credentials, which include an access key ID, a secret
  1392. // access key, and a security (or session) token.
  1393. //
  1394. // Note: The size of the security token that STS APIs return is not fixed.
  1395. // We strongly recommend that you make no assumptions about the maximum size.
  1396. // As of this writing, the typical size is less than 4096 bytes, but that can
  1397. // vary. Also, future updates to AWS might require larger sizes.
  1398. Credentials *Credentials `type:"structure"`
  1399. // Identifiers for the federated user associated with the credentials (such
  1400. // as arn:aws:sts::123456789012:federated-user/Bob or 123456789012:Bob). You
  1401. // can use the federated user's ARN in your resource-based policies, such as
  1402. // an Amazon S3 bucket policy.
  1403. FederatedUser *FederatedUser `type:"structure"`
  1404. // A percentage value indicating the size of the policy in packed form. The
  1405. // service rejects policies for which the packed size is greater than 100 percent
  1406. // of the allowed value.
  1407. PackedPolicySize *int64 `type:"integer"`
  1408. }
  1409. // String returns the string representation
  1410. func (s GetFederationTokenOutput) String() string {
  1411. return awsutil.Prettify(s)
  1412. }
  1413. // GoString returns the string representation
  1414. func (s GetFederationTokenOutput) GoString() string {
  1415. return s.String()
  1416. }
  1417. type GetSessionTokenInput struct {
  1418. _ struct{} `type:"structure"`
  1419. // The duration, in seconds, that the credentials should remain valid. Acceptable
  1420. // durations for IAM user sessions range from 900 seconds (15 minutes) to 129600
  1421. // seconds (36 hours), with 43200 seconds (12 hours) as the default. Sessions
  1422. // for AWS account owners are restricted to a maximum of 3600 seconds (one hour).
  1423. // If the duration is longer than one hour, the session for AWS account owners
  1424. // defaults to one hour.
  1425. DurationSeconds *int64 `min:"900" type:"integer"`
  1426. // The identification number of the MFA device that is associated with the IAM
  1427. // user who is making the GetSessionToken call. Specify this value if the IAM
  1428. // user has a policy that requires MFA authentication. The value is either the
  1429. // serial number for a hardware device (such as GAHT12345678) or an Amazon Resource
  1430. // Name (ARN) for a virtual device (such as arn:aws:iam::123456789012:mfa/user).
  1431. // You can find the device for an IAM user by going to the AWS Management Console
  1432. // and viewing the user's security credentials.
  1433. //
  1434. // The format for this parameter, as described by its regex pattern, is a string
  1435. // of characters consisting of upper- and lower-case alphanumeric characters
  1436. // with no spaces. You can also include underscores or any of the following
  1437. // characters: =,.@-
  1438. SerialNumber *string `min:"9" type:"string"`
  1439. // The value provided by the MFA device, if MFA is required. If any policy requires
  1440. // the IAM user to submit an MFA code, specify this value. If MFA authentication
  1441. // is required, and the user does not provide a code when requesting a set of
  1442. // temporary security credentials, the user will receive an "access denied"
  1443. // response when requesting resources that require MFA authentication.
  1444. //
  1445. // The format for this parameter, as described by its regex pattern, is a sequence
  1446. // of six numeric digits.
  1447. TokenCode *string `min:"6" type:"string"`
  1448. }
  1449. // String returns the string representation
  1450. func (s GetSessionTokenInput) String() string {
  1451. return awsutil.Prettify(s)
  1452. }
  1453. // GoString returns the string representation
  1454. func (s GetSessionTokenInput) GoString() string {
  1455. return s.String()
  1456. }
  1457. // Validate inspects the fields of the type to determine if they are valid.
  1458. func (s *GetSessionTokenInput) Validate() error {
  1459. invalidParams := request.ErrInvalidParams{Context: "GetSessionTokenInput"}
  1460. if s.DurationSeconds != nil && *s.DurationSeconds < 900 {
  1461. invalidParams.Add(request.NewErrParamMinValue("DurationSeconds", 900))
  1462. }
  1463. if s.SerialNumber != nil && len(*s.SerialNumber) < 9 {
  1464. invalidParams.Add(request.NewErrParamMinLen("SerialNumber", 9))
  1465. }
  1466. if s.TokenCode != nil && len(*s.TokenCode) < 6 {
  1467. invalidParams.Add(request.NewErrParamMinLen("TokenCode", 6))
  1468. }
  1469. if invalidParams.Len() > 0 {
  1470. return invalidParams
  1471. }
  1472. return nil
  1473. }
  1474. // Contains the response to a successful GetSessionToken request, including
  1475. // temporary AWS credentials that can be used to make AWS requests.
  1476. type GetSessionTokenOutput struct {
  1477. _ struct{} `type:"structure"`
  1478. // The temporary security credentials, which include an access key ID, a secret
  1479. // access key, and a security (or session) token.
  1480. //
  1481. // Note: The size of the security token that STS APIs return is not fixed.
  1482. // We strongly recommend that you make no assumptions about the maximum size.
  1483. // As of this writing, the typical size is less than 4096 bytes, but that can
  1484. // vary. Also, future updates to AWS might require larger sizes.
  1485. Credentials *Credentials `type:"structure"`
  1486. }
  1487. // String returns the string representation
  1488. func (s GetSessionTokenOutput) String() string {
  1489. return awsutil.Prettify(s)
  1490. }
  1491. // GoString returns the string representation
  1492. func (s GetSessionTokenOutput) GoString() string {
  1493. return s.String()
  1494. }