api.go 106 KB

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