api.go 106 KB

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