api.go 85 KB

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