api.go 103 KB

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