api.go 138 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115
  1. // Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
  2. package sts
  3. import (
  4. "fmt"
  5. "time"
  6. "github.com/aws/aws-sdk-go/aws"
  7. "github.com/aws/aws-sdk-go/aws/awsutil"
  8. "github.com/aws/aws-sdk-go/aws/credentials"
  9. "github.com/aws/aws-sdk-go/aws/request"
  10. )
  11. const opAssumeRole = "AssumeRole"
  12. // AssumeRoleRequest generates a "aws/request.Request" representing the
  13. // client's request for the AssumeRole operation. The "output" return
  14. // value will be populated with the request's response once the request completes
  15. // successfully.
  16. //
  17. // Use "Send" method on the returned Request to send the API call to the service.
  18. // the "output" return value is not valid until after Send returns without error.
  19. //
  20. // See AssumeRole for more information on using the AssumeRole
  21. // API call, and error handling.
  22. //
  23. // This method is useful when you want to inject custom logic or configuration
  24. // into the SDK's request lifecycle. Such as custom headers, or retry logic.
  25. //
  26. //
  27. // // Example sending a request using the AssumeRoleRequest method.
  28. // req, resp := client.AssumeRoleRequest(params)
  29. //
  30. // err := req.Send()
  31. // if err == nil { // resp is now filled
  32. // fmt.Println(resp)
  33. // }
  34. //
  35. // See also, https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/AssumeRole
  36. func (c *STS) AssumeRoleRequest(input *AssumeRoleInput) (req *request.Request, output *AssumeRoleOutput) {
  37. op := &request.Operation{
  38. Name: opAssumeRole,
  39. HTTPMethod: "POST",
  40. HTTPPath: "/",
  41. }
  42. if input == nil {
  43. input = &AssumeRoleInput{}
  44. }
  45. output = &AssumeRoleOutput{}
  46. req = c.newRequest(op, input, output)
  47. return
  48. }
  49. // AssumeRole API operation for AWS Security Token Service.
  50. //
  51. // Returns a set of temporary security credentials that you can use to access
  52. // AWS resources that you might not normally have access to. These temporary
  53. // credentials consist of an access key ID, a secret access key, and a security
  54. // token. Typically, you use AssumeRole within your account or for cross-account
  55. // access. For a comparison of AssumeRole with other API operations that produce
  56. // temporary credentials, see Requesting Temporary Security Credentials (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html)
  57. // and Comparing the AWS STS API operations (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison)
  58. // in the IAM User Guide.
  59. //
  60. // You cannot use AWS account root user credentials to call AssumeRole. You
  61. // must use credentials for an IAM user or an IAM role 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.
  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 (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles.html)
  71. // in the IAM User Guide.
  72. //
  73. // Session Duration
  74. //
  75. // By default, the temporary security credentials created by AssumeRole last
  76. // for one hour. However, you can use the optional DurationSeconds parameter
  77. // to specify the duration of your session. You can provide a value from 900
  78. // seconds (15 minutes) up to the maximum session duration setting for the role.
  79. // This setting can have a value from 1 hour to 12 hours. To learn how to view
  80. // the maximum value for your role, see View the Maximum Session Duration Setting
  81. // for a Role (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html#id_roles_use_view-role-max-session)
  82. // in the IAM User Guide. The maximum session duration limit applies when you
  83. // use the AssumeRole* API operations or the assume-role* CLI commands. However
  84. // the limit does not apply when you use those operations to create a console
  85. // URL. For more information, see Using IAM Roles (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html)
  86. // in the IAM User Guide.
  87. //
  88. // Permissions
  89. //
  90. // The temporary security credentials created by AssumeRole can be used to make
  91. // API calls to any AWS service with the following exception: You cannot call
  92. // the AWS STS GetFederationToken or GetSessionToken API operations.
  93. //
  94. // (Optional) You can pass inline or managed session policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session)
  95. // to this operation. You can pass a single JSON policy document to use as an
  96. // inline session policy. You can also specify up to 10 managed policies to
  97. // use as managed session policies. The plain text that you use for both inline
  98. // and managed session policies can't exceed 2,048 characters. Passing policies
  99. // to this operation returns new temporary credentials. The resulting session's
  100. // permissions are the intersection of the role's identity-based policy and
  101. // the session policies. You can use the role's temporary credentials in subsequent
  102. // AWS API calls to access resources in the account that owns the role. You
  103. // cannot use session policies to grant more permissions than those allowed
  104. // by the identity-based policy of the role that is being assumed. For more
  105. // information, see Session Policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session)
  106. // in the IAM User Guide.
  107. //
  108. // To assume a role from a different account, your AWS account must be trusted
  109. // by the role. The trust relationship is defined in the role's trust policy
  110. // when the role is created. That trust policy states which accounts are allowed
  111. // to delegate that access to users in the account.
  112. //
  113. // A user who wants to access a role in a different account must also have permissions
  114. // that are delegated from the user account administrator. The administrator
  115. // must attach a policy that allows the user to call AssumeRole for the ARN
  116. // of the role in the other account. If the user is in the same account as the
  117. // role, then you can do either of the following:
  118. //
  119. // * Attach a policy to the user (identical to the previous user in a different
  120. // account).
  121. //
  122. // * Add the user as a principal directly in the role's trust policy.
  123. //
  124. // In this case, the trust policy acts as an IAM resource-based policy. Users
  125. // in the same account as the role do not need explicit permission to assume
  126. // the role. For more information about trust policies and resource-based policies,
  127. // see IAM Policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html)
  128. // in the IAM User Guide.
  129. //
  130. // Tags
  131. //
  132. // (Optional) You can pass tag key-value pairs to your session. These tags are
  133. // called session tags. For more information about session tags, see Passing
  134. // Session Tags in STS (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html)
  135. // in the IAM User Guide.
  136. //
  137. // An administrator must grant you the permissions necessary to pass session
  138. // tags. The administrator can also create granular permissions to allow you
  139. // to pass only specific session tags. For more information, see Tutorial: Using
  140. // Tags for Attribute-Based Access Control (https://docs.aws.amazon.com/IAM/latest/UserGuide/tutorial_attribute-based-access-control.html)
  141. // in the IAM User Guide.
  142. //
  143. // You can set the session tags as transitive. Transitive tags persist during
  144. // role chaining. For more information, see Chaining Roles with Session Tags
  145. // (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html#id_session-tags_role-chaining)
  146. // in the IAM User Guide.
  147. //
  148. // Using MFA with AssumeRole
  149. //
  150. // (Optional) You can include multi-factor authentication (MFA) information
  151. // when you call AssumeRole. This is useful for cross-account scenarios to ensure
  152. // that the user that assumes the role has been authenticated with an AWS MFA
  153. // device. In that scenario, the trust policy of the role being assumed includes
  154. // a condition that tests for MFA authentication. If the caller does not include
  155. // valid MFA information, the request to assume the role is denied. The condition
  156. // in a trust policy that tests for MFA authentication might look like the following
  157. // example.
  158. //
  159. // "Condition": {"Bool": {"aws:MultiFactorAuthPresent": true}}
  160. //
  161. // For more information, see Configuring MFA-Protected API Access (https://docs.aws.amazon.com/IAM/latest/UserGuide/MFAProtectedAPI.html)
  162. // in the IAM User Guide guide.
  163. //
  164. // To use MFA with AssumeRole, you pass values for the SerialNumber and TokenCode
  165. // parameters. The SerialNumber value identifies the user's hardware or virtual
  166. // MFA device. The TokenCode is the time-based one-time password (TOTP) that
  167. // the MFA device produces.
  168. //
  169. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  170. // with awserr.Error's Code and Message methods to get detailed information about
  171. // the error.
  172. //
  173. // See the AWS API reference guide for AWS Security Token Service's
  174. // API operation AssumeRole for usage and error information.
  175. //
  176. // Returned Error Codes:
  177. // * ErrCodeMalformedPolicyDocumentException "MalformedPolicyDocument"
  178. // The request was rejected because the policy document was malformed. The error
  179. // message describes the specific error.
  180. //
  181. // * ErrCodePackedPolicyTooLargeException "PackedPolicyTooLarge"
  182. // The request was rejected because the total packed size of the session policies
  183. // and session tags combined was too large. An AWS conversion compresses the
  184. // session policy document, session policy ARNs, and session tags into a packed
  185. // binary format that has a separate limit. The error message indicates by percentage
  186. // how close the policies and tags are to the upper size limit. For more information,
  187. // see Passing Session Tags in STS (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html)
  188. // in the IAM User Guide.
  189. //
  190. // You could receive this error even though you meet other defined session policy
  191. // and session tag limits. For more information, see IAM and STS Entity Character
  192. // Limits (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html)
  193. // in the IAM User Guide.
  194. //
  195. // * ErrCodeRegionDisabledException "RegionDisabledException"
  196. // STS is not activated in the requested region for the account that is being
  197. // asked to generate credentials. The account administrator must use the IAM
  198. // console to activate STS in that region. For more information, see Activating
  199. // and Deactivating AWS STS in an AWS Region (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html)
  200. // in the IAM User Guide.
  201. //
  202. // See also, https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/AssumeRole
  203. func (c *STS) AssumeRole(input *AssumeRoleInput) (*AssumeRoleOutput, error) {
  204. req, out := c.AssumeRoleRequest(input)
  205. return out, req.Send()
  206. }
  207. // AssumeRoleWithContext is the same as AssumeRole with the addition of
  208. // the ability to pass a context and additional request options.
  209. //
  210. // See AssumeRole for details on how to use this API operation.
  211. //
  212. // The context must be non-nil and will be used for request cancellation. If
  213. // the context is nil a panic will occur. In the future the SDK may create
  214. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  215. // for more information on using Contexts.
  216. func (c *STS) AssumeRoleWithContext(ctx aws.Context, input *AssumeRoleInput, opts ...request.Option) (*AssumeRoleOutput, error) {
  217. req, out := c.AssumeRoleRequest(input)
  218. req.SetContext(ctx)
  219. req.ApplyOptions(opts...)
  220. return out, req.Send()
  221. }
  222. const opAssumeRoleWithSAML = "AssumeRoleWithSAML"
  223. // AssumeRoleWithSAMLRequest generates a "aws/request.Request" representing the
  224. // client's request for the AssumeRoleWithSAML operation. The "output" return
  225. // value will be populated with the request's response once the request completes
  226. // successfully.
  227. //
  228. // Use "Send" method on the returned Request to send the API call to the service.
  229. // the "output" return value is not valid until after Send returns without error.
  230. //
  231. // See AssumeRoleWithSAML for more information on using the AssumeRoleWithSAML
  232. // API call, and error handling.
  233. //
  234. // This method is useful when you want to inject custom logic or configuration
  235. // into the SDK's request lifecycle. Such as custom headers, or retry logic.
  236. //
  237. //
  238. // // Example sending a request using the AssumeRoleWithSAMLRequest method.
  239. // req, resp := client.AssumeRoleWithSAMLRequest(params)
  240. //
  241. // err := req.Send()
  242. // if err == nil { // resp is now filled
  243. // fmt.Println(resp)
  244. // }
  245. //
  246. // See also, https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/AssumeRoleWithSAML
  247. func (c *STS) AssumeRoleWithSAMLRequest(input *AssumeRoleWithSAMLInput) (req *request.Request, output *AssumeRoleWithSAMLOutput) {
  248. op := &request.Operation{
  249. Name: opAssumeRoleWithSAML,
  250. HTTPMethod: "POST",
  251. HTTPPath: "/",
  252. }
  253. if input == nil {
  254. input = &AssumeRoleWithSAMLInput{}
  255. }
  256. output = &AssumeRoleWithSAMLOutput{}
  257. req = c.newRequest(op, input, output)
  258. req.Config.Credentials = credentials.AnonymousCredentials
  259. return
  260. }
  261. // AssumeRoleWithSAML API operation for AWS Security Token Service.
  262. //
  263. // Returns a set of temporary security credentials for users who have been authenticated
  264. // via a SAML authentication response. This operation provides a mechanism for
  265. // tying an enterprise identity store or directory to role-based AWS access
  266. // without user-specific credentials or configuration. For a comparison of AssumeRoleWithSAML
  267. // with the other API operations that produce temporary credentials, see Requesting
  268. // Temporary Security Credentials (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html)
  269. // and Comparing the AWS STS API operations (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison)
  270. // in the IAM User Guide.
  271. //
  272. // The temporary security credentials returned by this operation consist of
  273. // an access key ID, a secret access key, and a security token. Applications
  274. // can use these temporary security credentials to sign calls to AWS services.
  275. //
  276. // Session Duration
  277. //
  278. // By default, the temporary security credentials created by AssumeRoleWithSAML
  279. // last for one hour. However, you can use the optional DurationSeconds parameter
  280. // to specify the duration of your session. Your role session lasts for the
  281. // duration that you specify, or until the time specified in the SAML authentication
  282. // response's SessionNotOnOrAfter value, whichever is shorter. You can provide
  283. // a DurationSeconds value from 900 seconds (15 minutes) up to the maximum session
  284. // duration setting for the role. This setting can have a value from 1 hour
  285. // to 12 hours. To learn how to view the maximum value for your role, see View
  286. // the Maximum Session Duration Setting for a Role (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html#id_roles_use_view-role-max-session)
  287. // in the IAM User Guide. The maximum session duration limit applies when you
  288. // use the AssumeRole* API operations or the assume-role* CLI commands. However
  289. // the limit does not apply when you use those operations to create a console
  290. // URL. For more information, see Using IAM Roles (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html)
  291. // in the IAM User Guide.
  292. //
  293. // Permissions
  294. //
  295. // The temporary security credentials created by AssumeRoleWithSAML can be used
  296. // to make API calls to any AWS service with the following exception: you cannot
  297. // call the STS GetFederationToken or GetSessionToken API operations.
  298. //
  299. // (Optional) You can pass inline or managed session policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session)
  300. // to this operation. You can pass a single JSON policy document to use as an
  301. // inline session policy. You can also specify up to 10 managed policies to
  302. // use as managed session policies. The plain text that you use for both inline
  303. // and managed session policies can't exceed 2,048 characters. Passing policies
  304. // to this operation returns new temporary credentials. The resulting session's
  305. // permissions are the intersection of the role's identity-based policy and
  306. // the session policies. You can use the role's temporary credentials in subsequent
  307. // AWS API calls to access resources in the account that owns the role. You
  308. // cannot use session policies to grant more permissions than those allowed
  309. // by the identity-based policy of the role that is being assumed. For more
  310. // information, see Session Policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session)
  311. // in the IAM User Guide.
  312. //
  313. // Calling AssumeRoleWithSAML does not require the use of AWS security credentials.
  314. // The identity of the caller is validated by using keys in the metadata document
  315. // that is uploaded for the SAML provider entity for your identity provider.
  316. //
  317. // Calling AssumeRoleWithSAML can result in an entry in your AWS CloudTrail
  318. // logs. The entry includes the value in the NameID element of the SAML assertion.
  319. // We recommend that you use a NameIDType that is not associated with any personally
  320. // identifiable information (PII). For example, you could instead use the persistent
  321. // identifier (urn:oasis:names:tc:SAML:2.0:nameid-format:persistent).
  322. //
  323. // Tags
  324. //
  325. // (Optional) You can configure your IdP to pass attributes into your SAML assertion
  326. // as session tags. Each session tag consists of a key name and an associated
  327. // value. For more information about session tags, see Passing Session Tags
  328. // in STS (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html)
  329. // in the IAM User Guide.
  330. //
  331. // You can pass up to 50 session tags. The plain text session tag keys can’t
  332. // exceed 128 characters and the values can’t exceed 256 characters. For these
  333. // and additional limits, see IAM and STS Character Limits (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_iam-limits.html#reference_iam-limits-entity-length)
  334. // in the IAM User Guide.
  335. //
  336. // An AWS conversion compresses the passed session policies and session tags
  337. // into a packed binary format that has a separate limit. Your request can fail
  338. // for this limit even if your plain text meets the other requirements. The
  339. // PackedPolicySize response element indicates by percentage how close the policies
  340. // and tags for your request are to the upper size limit.
  341. //
  342. // You can pass a session tag with the same key as a tag that is attached to
  343. // the role. When you do, session tags override the role's tags with the same
  344. // key.
  345. //
  346. // An administrator must grant you the permissions necessary to pass session
  347. // tags. The administrator can also create granular permissions to allow you
  348. // to pass only specific session tags. For more information, see Tutorial: Using
  349. // Tags for Attribute-Based Access Control (https://docs.aws.amazon.com/IAM/latest/UserGuide/tutorial_attribute-based-access-control.html)
  350. // in the IAM User Guide.
  351. //
  352. // You can set the session tags as transitive. Transitive tags persist during
  353. // role chaining. For more information, see Chaining Roles with Session Tags
  354. // (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html#id_session-tags_role-chaining)
  355. // in the IAM User Guide.
  356. //
  357. // SAML Configuration
  358. //
  359. // Before your application can call AssumeRoleWithSAML, you must configure your
  360. // SAML identity provider (IdP) to issue the claims required by AWS. Additionally,
  361. // you must use AWS Identity and Access Management (IAM) to create a SAML provider
  362. // entity in your AWS account that represents your identity provider. You must
  363. // also create an IAM role that specifies this SAML provider in its trust policy.
  364. //
  365. // For more information, see the following resources:
  366. //
  367. // * About SAML 2.0-based Federation (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_saml.html)
  368. // in the IAM User Guide.
  369. //
  370. // * Creating SAML Identity Providers (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_create_saml.html)
  371. // in the IAM User Guide.
  372. //
  373. // * Configuring a Relying Party and Claims (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_create_saml_relying-party.html)
  374. // in the IAM User Guide.
  375. //
  376. // * Creating a Role for SAML 2.0 Federation (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-idp_saml.html)
  377. // in the IAM User Guide.
  378. //
  379. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  380. // with awserr.Error's Code and Message methods to get detailed information about
  381. // the error.
  382. //
  383. // See the AWS API reference guide for AWS Security Token Service's
  384. // API operation AssumeRoleWithSAML for usage and error information.
  385. //
  386. // Returned Error Codes:
  387. // * ErrCodeMalformedPolicyDocumentException "MalformedPolicyDocument"
  388. // The request was rejected because the policy document was malformed. The error
  389. // message describes the specific error.
  390. //
  391. // * ErrCodePackedPolicyTooLargeException "PackedPolicyTooLarge"
  392. // The request was rejected because the total packed size of the session policies
  393. // and session tags combined was too large. An AWS conversion compresses the
  394. // session policy document, session policy ARNs, and session tags into a packed
  395. // binary format that has a separate limit. The error message indicates by percentage
  396. // how close the policies and tags are to the upper size limit. For more information,
  397. // see Passing Session Tags in STS (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html)
  398. // in the IAM User Guide.
  399. //
  400. // You could receive this error even though you meet other defined session policy
  401. // and session tag limits. For more information, see IAM and STS Entity Character
  402. // Limits (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html)
  403. // in the IAM User Guide.
  404. //
  405. // * ErrCodeIDPRejectedClaimException "IDPRejectedClaim"
  406. // The identity provider (IdP) reported that authentication failed. This might
  407. // be because the claim is invalid.
  408. //
  409. // If this error is returned for the AssumeRoleWithWebIdentity operation, it
  410. // can also mean that the claim has expired or has been explicitly revoked.
  411. //
  412. // * ErrCodeInvalidIdentityTokenException "InvalidIdentityToken"
  413. // The web identity token that was passed could not be validated by AWS. Get
  414. // a new identity token from the identity provider and then retry the request.
  415. //
  416. // * ErrCodeExpiredTokenException "ExpiredTokenException"
  417. // The web identity token that was passed is expired or is not valid. Get a
  418. // new identity token from the identity provider and then retry the request.
  419. //
  420. // * ErrCodeRegionDisabledException "RegionDisabledException"
  421. // STS is not activated in the requested region for the account that is being
  422. // asked to generate credentials. The account administrator must use the IAM
  423. // console to activate STS in that region. For more information, see Activating
  424. // and Deactivating AWS STS in an AWS Region (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html)
  425. // in the IAM User Guide.
  426. //
  427. // See also, https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/AssumeRoleWithSAML
  428. func (c *STS) AssumeRoleWithSAML(input *AssumeRoleWithSAMLInput) (*AssumeRoleWithSAMLOutput, error) {
  429. req, out := c.AssumeRoleWithSAMLRequest(input)
  430. return out, req.Send()
  431. }
  432. // AssumeRoleWithSAMLWithContext is the same as AssumeRoleWithSAML with the addition of
  433. // the ability to pass a context and additional request options.
  434. //
  435. // See AssumeRoleWithSAML for details on how to use this API operation.
  436. //
  437. // The context must be non-nil and will be used for request cancellation. If
  438. // the context is nil a panic will occur. In the future the SDK may create
  439. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  440. // for more information on using Contexts.
  441. func (c *STS) AssumeRoleWithSAMLWithContext(ctx aws.Context, input *AssumeRoleWithSAMLInput, opts ...request.Option) (*AssumeRoleWithSAMLOutput, error) {
  442. req, out := c.AssumeRoleWithSAMLRequest(input)
  443. req.SetContext(ctx)
  444. req.ApplyOptions(opts...)
  445. return out, req.Send()
  446. }
  447. const opAssumeRoleWithWebIdentity = "AssumeRoleWithWebIdentity"
  448. // AssumeRoleWithWebIdentityRequest generates a "aws/request.Request" representing the
  449. // client's request for the AssumeRoleWithWebIdentity operation. The "output" return
  450. // value will be populated with the request's response once the request completes
  451. // successfully.
  452. //
  453. // Use "Send" method on the returned Request to send the API call to the service.
  454. // the "output" return value is not valid until after Send returns without error.
  455. //
  456. // See AssumeRoleWithWebIdentity for more information on using the AssumeRoleWithWebIdentity
  457. // API call, and error handling.
  458. //
  459. // This method is useful when you want to inject custom logic or configuration
  460. // into the SDK's request lifecycle. Such as custom headers, or retry logic.
  461. //
  462. //
  463. // // Example sending a request using the AssumeRoleWithWebIdentityRequest method.
  464. // req, resp := client.AssumeRoleWithWebIdentityRequest(params)
  465. //
  466. // err := req.Send()
  467. // if err == nil { // resp is now filled
  468. // fmt.Println(resp)
  469. // }
  470. //
  471. // See also, https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/AssumeRoleWithWebIdentity
  472. func (c *STS) AssumeRoleWithWebIdentityRequest(input *AssumeRoleWithWebIdentityInput) (req *request.Request, output *AssumeRoleWithWebIdentityOutput) {
  473. op := &request.Operation{
  474. Name: opAssumeRoleWithWebIdentity,
  475. HTTPMethod: "POST",
  476. HTTPPath: "/",
  477. }
  478. if input == nil {
  479. input = &AssumeRoleWithWebIdentityInput{}
  480. }
  481. output = &AssumeRoleWithWebIdentityOutput{}
  482. req = c.newRequest(op, input, output)
  483. req.Config.Credentials = credentials.AnonymousCredentials
  484. return
  485. }
  486. // AssumeRoleWithWebIdentity API operation for AWS Security Token Service.
  487. //
  488. // Returns a set of temporary security credentials for users who have been authenticated
  489. // in a mobile or web application with a web identity provider. Example providers
  490. // include Amazon Cognito, Login with Amazon, Facebook, Google, or any OpenID
  491. // Connect-compatible identity provider.
  492. //
  493. // For mobile applications, we recommend that you use Amazon Cognito. You can
  494. // use Amazon Cognito with the AWS SDK for iOS Developer Guide (http://aws.amazon.com/sdkforios/)
  495. // and the AWS SDK for Android Developer Guide (http://aws.amazon.com/sdkforandroid/)
  496. // to uniquely identify a user. You can also supply the user with a consistent
  497. // identity throughout the lifetime of an application.
  498. //
  499. // To learn more about Amazon Cognito, see Amazon Cognito Overview (https://docs.aws.amazon.com/mobile/sdkforandroid/developerguide/cognito-auth.html#d0e840)
  500. // in AWS SDK for Android Developer Guide and Amazon Cognito Overview (https://docs.aws.amazon.com/mobile/sdkforios/developerguide/cognito-auth.html#d0e664)
  501. // in the AWS SDK for iOS Developer Guide.
  502. //
  503. // Calling AssumeRoleWithWebIdentity does not require the use of AWS security
  504. // credentials. Therefore, you can distribute an application (for example, on
  505. // mobile devices) that requests temporary security credentials without including
  506. // long-term AWS credentials in the application. You also don't need to deploy
  507. // server-based proxy services that use long-term AWS credentials. Instead,
  508. // the identity of the caller is validated by using a token from the web identity
  509. // provider. For a comparison of AssumeRoleWithWebIdentity with the other API
  510. // operations that produce temporary credentials, see Requesting Temporary Security
  511. // Credentials (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html)
  512. // and Comparing the AWS STS API operations (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison)
  513. // in the IAM User Guide.
  514. //
  515. // The temporary security credentials returned by this API consist of an access
  516. // key ID, a secret access key, and a security token. Applications can use these
  517. // temporary security credentials to sign calls to AWS service API operations.
  518. //
  519. // Session Duration
  520. //
  521. // By default, the temporary security credentials created by AssumeRoleWithWebIdentity
  522. // last for one hour. However, you can use the optional DurationSeconds parameter
  523. // to specify the duration of your session. You can provide a value from 900
  524. // seconds (15 minutes) up to the maximum session duration setting for the role.
  525. // This setting can have a value from 1 hour to 12 hours. To learn how to view
  526. // the maximum value for your role, see View the Maximum Session Duration Setting
  527. // for a Role (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html#id_roles_use_view-role-max-session)
  528. // in the IAM User Guide. The maximum session duration limit applies when you
  529. // use the AssumeRole* API operations or the assume-role* CLI commands. However
  530. // the limit does not apply when you use those operations to create a console
  531. // URL. For more information, see Using IAM Roles (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html)
  532. // in the IAM User Guide.
  533. //
  534. // Permissions
  535. //
  536. // The temporary security credentials created by AssumeRoleWithWebIdentity can
  537. // be used to make API calls to any AWS service with the following exception:
  538. // you cannot call the STS GetFederationToken or GetSessionToken API operations.
  539. //
  540. // (Optional) You can pass inline or managed session policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session)
  541. // to this operation. You can pass a single JSON policy document to use as an
  542. // inline session policy. You can also specify up to 10 managed policies to
  543. // use as managed session policies. The plain text that you use for both inline
  544. // and managed session policies can't exceed 2,048 characters. Passing policies
  545. // to this operation returns new temporary credentials. The resulting session's
  546. // permissions are the intersection of the role's identity-based policy and
  547. // the session policies. You can use the role's temporary credentials in subsequent
  548. // AWS API calls to access resources in the account that owns the role. You
  549. // cannot use session policies to grant more permissions than those allowed
  550. // by the identity-based policy of the role that is being assumed. For more
  551. // information, see Session Policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session)
  552. // in the IAM User Guide.
  553. //
  554. // Tags
  555. //
  556. // (Optional) You can configure your IdP to pass attributes into your web identity
  557. // token as session tags. Each session tag consists of a key name and an associated
  558. // value. For more information about session tags, see Passing Session Tags
  559. // in STS (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html)
  560. // in the IAM User Guide.
  561. //
  562. // You can pass up to 50 session tags. The plain text session tag keys can’t
  563. // exceed 128 characters and the values can’t exceed 256 characters. For these
  564. // and additional limits, see IAM and STS Character Limits (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_iam-limits.html#reference_iam-limits-entity-length)
  565. // in the IAM User Guide.
  566. //
  567. // An AWS conversion compresses the passed session policies and session tags
  568. // into a packed binary format that has a separate limit. Your request can fail
  569. // for this limit even if your plain text meets the other requirements. The
  570. // PackedPolicySize response element indicates by percentage how close the policies
  571. // and tags for your request are to the upper size limit.
  572. //
  573. // You can pass a session tag with the same key as a tag that is attached to
  574. // the role. When you do, the session tag overrides the role tag with the same
  575. // key.
  576. //
  577. // An administrator must grant you the permissions necessary to pass session
  578. // tags. The administrator can also create granular permissions to allow you
  579. // to pass only specific session tags. For more information, see Tutorial: Using
  580. // Tags for Attribute-Based Access Control (https://docs.aws.amazon.com/IAM/latest/UserGuide/tutorial_attribute-based-access-control.html)
  581. // in the IAM User Guide.
  582. //
  583. // You can set the session tags as transitive. Transitive tags persist during
  584. // role chaining. For more information, see Chaining Roles with Session Tags
  585. // (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html#id_session-tags_role-chaining)
  586. // in the IAM User Guide.
  587. //
  588. // Identities
  589. //
  590. // Before your application can call AssumeRoleWithWebIdentity, you must have
  591. // an identity token from a supported identity provider and create a role that
  592. // the application can assume. The role that your application assumes must trust
  593. // the identity provider that is associated with the identity token. In other
  594. // words, the identity provider must be specified in the role's trust policy.
  595. //
  596. // Calling AssumeRoleWithWebIdentity can result in an entry in your AWS CloudTrail
  597. // logs. The entry includes the Subject (http://openid.net/specs/openid-connect-core-1_0.html#Claims)
  598. // of the provided Web Identity Token. We recommend that you avoid using any
  599. // personally identifiable information (PII) in this field. For example, you
  600. // could instead use a GUID or a pairwise identifier, as suggested in the OIDC
  601. // specification (http://openid.net/specs/openid-connect-core-1_0.html#SubjectIDTypes).
  602. //
  603. // For more information about how to use web identity federation and the AssumeRoleWithWebIdentity
  604. // API, see the following resources:
  605. //
  606. // * Using Web Identity Federation API Operations for Mobile Apps (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_oidc_manual.html)
  607. // and Federation Through a Web-based Identity Provider (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#api_assumerolewithwebidentity).
  608. //
  609. // * Web Identity Federation Playground (https://web-identity-federation-playground.s3.amazonaws.com/index.html).
  610. // Walk through the process of authenticating through Login with Amazon,
  611. // Facebook, or Google, getting temporary security credentials, and then
  612. // using those credentials to make a request to AWS.
  613. //
  614. // * AWS SDK for iOS Developer Guide (http://aws.amazon.com/sdkforios/) and
  615. // AWS SDK for Android Developer Guide (http://aws.amazon.com/sdkforandroid/).
  616. // These toolkits contain sample apps that show how to invoke the identity
  617. // providers. The toolkits then show how to use the information from these
  618. // providers to get and use temporary security credentials.
  619. //
  620. // * Web Identity Federation with Mobile Applications (http://aws.amazon.com/articles/web-identity-federation-with-mobile-applications).
  621. // This article discusses web identity federation and shows an example of
  622. // how to use web identity federation to get access to content in Amazon
  623. // S3.
  624. //
  625. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  626. // with awserr.Error's Code and Message methods to get detailed information about
  627. // the error.
  628. //
  629. // See the AWS API reference guide for AWS Security Token Service's
  630. // API operation AssumeRoleWithWebIdentity for usage and error information.
  631. //
  632. // Returned Error Codes:
  633. // * ErrCodeMalformedPolicyDocumentException "MalformedPolicyDocument"
  634. // The request was rejected because the policy document was malformed. The error
  635. // message describes the specific error.
  636. //
  637. // * ErrCodePackedPolicyTooLargeException "PackedPolicyTooLarge"
  638. // The request was rejected because the total packed size of the session policies
  639. // and session tags combined was too large. An AWS conversion compresses the
  640. // session policy document, session policy ARNs, and session tags into a packed
  641. // binary format that has a separate limit. The error message indicates by percentage
  642. // how close the policies and tags are to the upper size limit. For more information,
  643. // see Passing Session Tags in STS (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html)
  644. // in the IAM User Guide.
  645. //
  646. // You could receive this error even though you meet other defined session policy
  647. // and session tag limits. For more information, see IAM and STS Entity Character
  648. // Limits (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html)
  649. // in the IAM User Guide.
  650. //
  651. // * ErrCodeIDPRejectedClaimException "IDPRejectedClaim"
  652. // The identity provider (IdP) reported that authentication failed. This might
  653. // be because the claim is invalid.
  654. //
  655. // If this error is returned for the AssumeRoleWithWebIdentity operation, it
  656. // can also mean that the claim has expired or has been explicitly revoked.
  657. //
  658. // * ErrCodeIDPCommunicationErrorException "IDPCommunicationError"
  659. // The request could not be fulfilled because the identity provider (IDP) that
  660. // was asked to verify the incoming identity token could not be reached. This
  661. // is often a transient error caused by network conditions. Retry the request
  662. // a limited number of times so that you don't exceed the request rate. If the
  663. // error persists, the identity provider might be down or not responding.
  664. //
  665. // * ErrCodeInvalidIdentityTokenException "InvalidIdentityToken"
  666. // The web identity token that was passed could not be validated by AWS. Get
  667. // a new identity token from the identity provider and then retry the request.
  668. //
  669. // * ErrCodeExpiredTokenException "ExpiredTokenException"
  670. // The web identity token that was passed is expired or is not valid. Get a
  671. // new identity token from the identity provider and then retry the request.
  672. //
  673. // * ErrCodeRegionDisabledException "RegionDisabledException"
  674. // STS is not activated in the requested region for the account that is being
  675. // asked to generate credentials. The account administrator must use the IAM
  676. // console to activate STS in that region. For more information, see Activating
  677. // and Deactivating AWS STS in an AWS Region (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html)
  678. // in the IAM User Guide.
  679. //
  680. // See also, https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/AssumeRoleWithWebIdentity
  681. func (c *STS) AssumeRoleWithWebIdentity(input *AssumeRoleWithWebIdentityInput) (*AssumeRoleWithWebIdentityOutput, error) {
  682. req, out := c.AssumeRoleWithWebIdentityRequest(input)
  683. return out, req.Send()
  684. }
  685. // AssumeRoleWithWebIdentityWithContext is the same as AssumeRoleWithWebIdentity with the addition of
  686. // the ability to pass a context and additional request options.
  687. //
  688. // See AssumeRoleWithWebIdentity for details on how to use this API operation.
  689. //
  690. // The context must be non-nil and will be used for request cancellation. If
  691. // the context is nil a panic will occur. In the future the SDK may create
  692. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  693. // for more information on using Contexts.
  694. func (c *STS) AssumeRoleWithWebIdentityWithContext(ctx aws.Context, input *AssumeRoleWithWebIdentityInput, opts ...request.Option) (*AssumeRoleWithWebIdentityOutput, error) {
  695. req, out := c.AssumeRoleWithWebIdentityRequest(input)
  696. req.SetContext(ctx)
  697. req.ApplyOptions(opts...)
  698. return out, req.Send()
  699. }
  700. const opDecodeAuthorizationMessage = "DecodeAuthorizationMessage"
  701. // DecodeAuthorizationMessageRequest generates a "aws/request.Request" representing the
  702. // client's request for the DecodeAuthorizationMessage operation. The "output" return
  703. // value will be populated with the request's response once the request completes
  704. // successfully.
  705. //
  706. // Use "Send" method on the returned Request to send the API call to the service.
  707. // the "output" return value is not valid until after Send returns without error.
  708. //
  709. // See DecodeAuthorizationMessage for more information on using the DecodeAuthorizationMessage
  710. // API call, and error handling.
  711. //
  712. // This method is useful when you want to inject custom logic or configuration
  713. // into the SDK's request lifecycle. Such as custom headers, or retry logic.
  714. //
  715. //
  716. // // Example sending a request using the DecodeAuthorizationMessageRequest method.
  717. // req, resp := client.DecodeAuthorizationMessageRequest(params)
  718. //
  719. // err := req.Send()
  720. // if err == nil { // resp is now filled
  721. // fmt.Println(resp)
  722. // }
  723. //
  724. // See also, https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/DecodeAuthorizationMessage
  725. func (c *STS) DecodeAuthorizationMessageRequest(input *DecodeAuthorizationMessageInput) (req *request.Request, output *DecodeAuthorizationMessageOutput) {
  726. op := &request.Operation{
  727. Name: opDecodeAuthorizationMessage,
  728. HTTPMethod: "POST",
  729. HTTPPath: "/",
  730. }
  731. if input == nil {
  732. input = &DecodeAuthorizationMessageInput{}
  733. }
  734. output = &DecodeAuthorizationMessageOutput{}
  735. req = c.newRequest(op, input, output)
  736. return
  737. }
  738. // DecodeAuthorizationMessage API operation for AWS Security Token Service.
  739. //
  740. // Decodes additional information about the authorization status of a request
  741. // from an encoded message returned in response to an AWS request.
  742. //
  743. // For example, if a user is not authorized to perform an operation that he
  744. // or she has requested, the request returns a Client.UnauthorizedOperation
  745. // response (an HTTP 403 response). Some AWS operations additionally return
  746. // an encoded message that can provide details about this authorization failure.
  747. //
  748. // Only certain AWS operations return an encoded authorization message. The
  749. // documentation for an individual operation indicates whether that operation
  750. // returns an encoded message in addition to returning an HTTP code.
  751. //
  752. // The message is encoded because the details of the authorization status can
  753. // constitute privileged information that the user who requested the operation
  754. // should not see. To decode an authorization status message, a user must be
  755. // granted permissions via an IAM policy to request the DecodeAuthorizationMessage
  756. // (sts:DecodeAuthorizationMessage) action.
  757. //
  758. // The decoded message includes the following type of information:
  759. //
  760. // * Whether the request was denied due to an explicit deny or due to the
  761. // absence of an explicit allow. For more information, see Determining Whether
  762. // a Request is Allowed or Denied (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_evaluation-logic.html#policy-eval-denyallow)
  763. // in the IAM User Guide.
  764. //
  765. // * The principal who made the request.
  766. //
  767. // * The requested action.
  768. //
  769. // * The requested resource.
  770. //
  771. // * The values of condition keys in the context of the user's request.
  772. //
  773. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  774. // with awserr.Error's Code and Message methods to get detailed information about
  775. // the error.
  776. //
  777. // See the AWS API reference guide for AWS Security Token Service's
  778. // API operation DecodeAuthorizationMessage for usage and error information.
  779. //
  780. // Returned Error Codes:
  781. // * ErrCodeInvalidAuthorizationMessageException "InvalidAuthorizationMessageException"
  782. // The error returned if the message passed to DecodeAuthorizationMessage was
  783. // invalid. This can happen if the token contains invalid characters, such as
  784. // linebreaks.
  785. //
  786. // See also, https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/DecodeAuthorizationMessage
  787. func (c *STS) DecodeAuthorizationMessage(input *DecodeAuthorizationMessageInput) (*DecodeAuthorizationMessageOutput, error) {
  788. req, out := c.DecodeAuthorizationMessageRequest(input)
  789. return out, req.Send()
  790. }
  791. // DecodeAuthorizationMessageWithContext is the same as DecodeAuthorizationMessage with the addition of
  792. // the ability to pass a context and additional request options.
  793. //
  794. // See DecodeAuthorizationMessage for details on how to use this API operation.
  795. //
  796. // The context must be non-nil and will be used for request cancellation. If
  797. // the context is nil a panic will occur. In the future the SDK may create
  798. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  799. // for more information on using Contexts.
  800. func (c *STS) DecodeAuthorizationMessageWithContext(ctx aws.Context, input *DecodeAuthorizationMessageInput, opts ...request.Option) (*DecodeAuthorizationMessageOutput, error) {
  801. req, out := c.DecodeAuthorizationMessageRequest(input)
  802. req.SetContext(ctx)
  803. req.ApplyOptions(opts...)
  804. return out, req.Send()
  805. }
  806. const opGetAccessKeyInfo = "GetAccessKeyInfo"
  807. // GetAccessKeyInfoRequest generates a "aws/request.Request" representing the
  808. // client's request for the GetAccessKeyInfo operation. The "output" return
  809. // value will be populated with the request's response once the request completes
  810. // successfully.
  811. //
  812. // Use "Send" method on the returned Request to send the API call to the service.
  813. // the "output" return value is not valid until after Send returns without error.
  814. //
  815. // See GetAccessKeyInfo for more information on using the GetAccessKeyInfo
  816. // API call, and error handling.
  817. //
  818. // This method is useful when you want to inject custom logic or configuration
  819. // into the SDK's request lifecycle. Such as custom headers, or retry logic.
  820. //
  821. //
  822. // // Example sending a request using the GetAccessKeyInfoRequest method.
  823. // req, resp := client.GetAccessKeyInfoRequest(params)
  824. //
  825. // err := req.Send()
  826. // if err == nil { // resp is now filled
  827. // fmt.Println(resp)
  828. // }
  829. //
  830. // See also, https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/GetAccessKeyInfo
  831. func (c *STS) GetAccessKeyInfoRequest(input *GetAccessKeyInfoInput) (req *request.Request, output *GetAccessKeyInfoOutput) {
  832. op := &request.Operation{
  833. Name: opGetAccessKeyInfo,
  834. HTTPMethod: "POST",
  835. HTTPPath: "/",
  836. }
  837. if input == nil {
  838. input = &GetAccessKeyInfoInput{}
  839. }
  840. output = &GetAccessKeyInfoOutput{}
  841. req = c.newRequest(op, input, output)
  842. return
  843. }
  844. // GetAccessKeyInfo API operation for AWS Security Token Service.
  845. //
  846. // Returns the account identifier for the specified access key ID.
  847. //
  848. // Access keys consist of two parts: an access key ID (for example, AKIAIOSFODNN7EXAMPLE)
  849. // and a secret access key (for example, wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY).
  850. // For more information about access keys, see Managing Access Keys for IAM
  851. // Users (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html)
  852. // in the IAM User Guide.
  853. //
  854. // When you pass an access key ID to this operation, it returns the ID of the
  855. // AWS account to which the keys belong. Access key IDs beginning with AKIA
  856. // are long-term credentials for an IAM user or the AWS account root user. Access
  857. // key IDs beginning with ASIA are temporary credentials that are created using
  858. // STS operations. If the account in the response belongs to you, you can sign
  859. // in as the root user and review your root user access keys. Then, you can
  860. // pull a credentials report (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_getting-report.html)
  861. // to learn which IAM user owns the keys. To learn who requested the temporary
  862. // credentials for an ASIA access key, view the STS events in your CloudTrail
  863. // logs (https://docs.aws.amazon.com/IAM/latest/UserGuide/cloudtrail-integration.html)
  864. // in the IAM User Guide.
  865. //
  866. // This operation does not indicate the state of the access key. The key might
  867. // be active, inactive, or deleted. Active keys might not have permissions to
  868. // perform an operation. Providing a deleted access key might return an error
  869. // that the key doesn't exist.
  870. //
  871. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  872. // with awserr.Error's Code and Message methods to get detailed information about
  873. // the error.
  874. //
  875. // See the AWS API reference guide for AWS Security Token Service's
  876. // API operation GetAccessKeyInfo for usage and error information.
  877. // See also, https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/GetAccessKeyInfo
  878. func (c *STS) GetAccessKeyInfo(input *GetAccessKeyInfoInput) (*GetAccessKeyInfoOutput, error) {
  879. req, out := c.GetAccessKeyInfoRequest(input)
  880. return out, req.Send()
  881. }
  882. // GetAccessKeyInfoWithContext is the same as GetAccessKeyInfo with the addition of
  883. // the ability to pass a context and additional request options.
  884. //
  885. // See GetAccessKeyInfo for details on how to use this API operation.
  886. //
  887. // The context must be non-nil and will be used for request cancellation. If
  888. // the context is nil a panic will occur. In the future the SDK may create
  889. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  890. // for more information on using Contexts.
  891. func (c *STS) GetAccessKeyInfoWithContext(ctx aws.Context, input *GetAccessKeyInfoInput, opts ...request.Option) (*GetAccessKeyInfoOutput, error) {
  892. req, out := c.GetAccessKeyInfoRequest(input)
  893. req.SetContext(ctx)
  894. req.ApplyOptions(opts...)
  895. return out, req.Send()
  896. }
  897. const opGetCallerIdentity = "GetCallerIdentity"
  898. // GetCallerIdentityRequest generates a "aws/request.Request" representing the
  899. // client's request for the GetCallerIdentity operation. The "output" return
  900. // value will be populated with the request's response once the request completes
  901. // successfully.
  902. //
  903. // Use "Send" method on the returned Request to send the API call to the service.
  904. // the "output" return value is not valid until after Send returns without error.
  905. //
  906. // See GetCallerIdentity for more information on using the GetCallerIdentity
  907. // API call, and error handling.
  908. //
  909. // This method is useful when you want to inject custom logic or configuration
  910. // into the SDK's request lifecycle. Such as custom headers, or retry logic.
  911. //
  912. //
  913. // // Example sending a request using the GetCallerIdentityRequest method.
  914. // req, resp := client.GetCallerIdentityRequest(params)
  915. //
  916. // err := req.Send()
  917. // if err == nil { // resp is now filled
  918. // fmt.Println(resp)
  919. // }
  920. //
  921. // See also, https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/GetCallerIdentity
  922. func (c *STS) GetCallerIdentityRequest(input *GetCallerIdentityInput) (req *request.Request, output *GetCallerIdentityOutput) {
  923. op := &request.Operation{
  924. Name: opGetCallerIdentity,
  925. HTTPMethod: "POST",
  926. HTTPPath: "/",
  927. }
  928. if input == nil {
  929. input = &GetCallerIdentityInput{}
  930. }
  931. output = &GetCallerIdentityOutput{}
  932. req = c.newRequest(op, input, output)
  933. return
  934. }
  935. // GetCallerIdentity API operation for AWS Security Token Service.
  936. //
  937. // Returns details about the IAM user or role whose credentials are used to
  938. // call the operation.
  939. //
  940. // No permissions are required to perform this operation. If an administrator
  941. // adds a policy to your IAM user or role that explicitly denies access to the
  942. // sts:GetCallerIdentity action, you can still perform this operation. Permissions
  943. // are not required because the same information is returned when an IAM user
  944. // or role is denied access. To view an example response, see I Am Not Authorized
  945. // to Perform: iam:DeleteVirtualMFADevice (https://docs.aws.amazon.com/IAM/latest/UserGuide/troubleshoot_general.html#troubleshoot_general_access-denied-delete-mfa)
  946. // in the IAM User Guide.
  947. //
  948. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  949. // with awserr.Error's Code and Message methods to get detailed information about
  950. // the error.
  951. //
  952. // See the AWS API reference guide for AWS Security Token Service's
  953. // API operation GetCallerIdentity for usage and error information.
  954. // See also, https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/GetCallerIdentity
  955. func (c *STS) GetCallerIdentity(input *GetCallerIdentityInput) (*GetCallerIdentityOutput, error) {
  956. req, out := c.GetCallerIdentityRequest(input)
  957. return out, req.Send()
  958. }
  959. // GetCallerIdentityWithContext is the same as GetCallerIdentity with the addition of
  960. // the ability to pass a context and additional request options.
  961. //
  962. // See GetCallerIdentity for details on how to use this API operation.
  963. //
  964. // The context must be non-nil and will be used for request cancellation. If
  965. // the context is nil a panic will occur. In the future the SDK may create
  966. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  967. // for more information on using Contexts.
  968. func (c *STS) GetCallerIdentityWithContext(ctx aws.Context, input *GetCallerIdentityInput, opts ...request.Option) (*GetCallerIdentityOutput, error) {
  969. req, out := c.GetCallerIdentityRequest(input)
  970. req.SetContext(ctx)
  971. req.ApplyOptions(opts...)
  972. return out, req.Send()
  973. }
  974. const opGetFederationToken = "GetFederationToken"
  975. // GetFederationTokenRequest generates a "aws/request.Request" representing the
  976. // client's request for the GetFederationToken operation. The "output" return
  977. // value will be populated with the request's response once the request completes
  978. // successfully.
  979. //
  980. // Use "Send" method on the returned Request to send the API call to the service.
  981. // the "output" return value is not valid until after Send returns without error.
  982. //
  983. // See GetFederationToken for more information on using the GetFederationToken
  984. // API call, and error handling.
  985. //
  986. // This method is useful when you want to inject custom logic or configuration
  987. // into the SDK's request lifecycle. Such as custom headers, or retry logic.
  988. //
  989. //
  990. // // Example sending a request using the GetFederationTokenRequest method.
  991. // req, resp := client.GetFederationTokenRequest(params)
  992. //
  993. // err := req.Send()
  994. // if err == nil { // resp is now filled
  995. // fmt.Println(resp)
  996. // }
  997. //
  998. // See also, https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/GetFederationToken
  999. func (c *STS) GetFederationTokenRequest(input *GetFederationTokenInput) (req *request.Request, output *GetFederationTokenOutput) {
  1000. op := &request.Operation{
  1001. Name: opGetFederationToken,
  1002. HTTPMethod: "POST",
  1003. HTTPPath: "/",
  1004. }
  1005. if input == nil {
  1006. input = &GetFederationTokenInput{}
  1007. }
  1008. output = &GetFederationTokenOutput{}
  1009. req = c.newRequest(op, input, output)
  1010. return
  1011. }
  1012. // GetFederationToken API operation for AWS Security Token Service.
  1013. //
  1014. // Returns a set of temporary security credentials (consisting of an access
  1015. // key ID, a secret access key, and a security token) for a federated user.
  1016. // A typical use is in a proxy application that gets temporary security credentials
  1017. // on behalf of distributed applications inside a corporate network. You must
  1018. // call the GetFederationToken operation using the long-term security credentials
  1019. // of an IAM user. As a result, this call is appropriate in contexts where those
  1020. // credentials can be safely stored, usually in a server-based application.
  1021. // For a comparison of GetFederationToken with the other API operations that
  1022. // produce temporary credentials, see Requesting Temporary Security Credentials
  1023. // (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html)
  1024. // and Comparing the AWS STS API operations (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison)
  1025. // in the IAM User Guide.
  1026. //
  1027. // You can create a mobile-based or browser-based app that can authenticate
  1028. // users using a web identity provider like Login with Amazon, Facebook, Google,
  1029. // or an OpenID Connect-compatible identity provider. In this case, we recommend
  1030. // that you use Amazon Cognito (http://aws.amazon.com/cognito/) or AssumeRoleWithWebIdentity.
  1031. // For more information, see Federation Through a Web-based Identity Provider
  1032. // (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#api_assumerolewithwebidentity)
  1033. // in the IAM User Guide.
  1034. //
  1035. // You can also call GetFederationToken using the security credentials of an
  1036. // AWS account root user, but we do not recommend it. Instead, we recommend
  1037. // that you create an IAM user for the purpose of the proxy application. Then
  1038. // attach a policy to the IAM user that limits federated users to only the actions
  1039. // and resources that they need to access. For more information, see IAM Best
  1040. // Practices (https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html)
  1041. // in the IAM User Guide.
  1042. //
  1043. // Session duration
  1044. //
  1045. // The temporary credentials are valid for the specified duration, from 900
  1046. // seconds (15 minutes) up to a maximum of 129,600 seconds (36 hours). The default
  1047. // session duration is 43,200 seconds (12 hours). Temporary credentials that
  1048. // are obtained by using AWS account root user credentials have a maximum duration
  1049. // of 3,600 seconds (1 hour).
  1050. //
  1051. // Permissions
  1052. //
  1053. // You can use the temporary credentials created by GetFederationToken in any
  1054. // AWS service except the following:
  1055. //
  1056. // * You cannot call any IAM operations using the AWS CLI or the AWS API.
  1057. //
  1058. // * You cannot call any STS operations except GetCallerIdentity.
  1059. //
  1060. // You must pass an inline or managed session policy (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session)
  1061. // to this operation. You can pass a single JSON policy document to use as an
  1062. // inline session policy. You can also specify up to 10 managed policies to
  1063. // use as managed session policies. The plain text that you use for both inline
  1064. // and managed session policies can't exceed 2,048 characters.
  1065. //
  1066. // Though the session policy parameters are optional, if you do not pass a policy,
  1067. // then the resulting federated user session has no permissions. When you pass
  1068. // session policies, the session permissions are the intersection of the IAM
  1069. // user policies and the session policies that you pass. This gives you a way
  1070. // to further restrict the permissions for a federated user. You cannot use
  1071. // session policies to grant more permissions than those that are defined in
  1072. // the permissions policy of the IAM user. For more information, see Session
  1073. // Policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session)
  1074. // in the IAM User Guide. For information about using GetFederationToken to
  1075. // create temporary security credentials, see GetFederationToken—Federation
  1076. // Through a Custom Identity Broker (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#api_getfederationtoken).
  1077. //
  1078. // You can use the credentials to access a resource that has a resource-based
  1079. // policy. If that policy specifically references the federated user session
  1080. // in the Principal element of the policy, the session has the permissions allowed
  1081. // by the policy. These permissions are granted in addition to the permissions
  1082. // granted by the session policies.
  1083. //
  1084. // Tags
  1085. //
  1086. // (Optional) You can pass tag key-value pairs to your session. These are called
  1087. // session tags. For more information about session tags, see Passing Session
  1088. // Tags in STS (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html)
  1089. // in the IAM User Guide.
  1090. //
  1091. // An administrator must grant you the permissions necessary to pass session
  1092. // tags. The administrator can also create granular permissions to allow you
  1093. // to pass only specific session tags. For more information, see Tutorial: Using
  1094. // Tags for Attribute-Based Access Control (https://docs.aws.amazon.com/IAM/latest/UserGuide/tutorial_attribute-based-access-control.html)
  1095. // in the IAM User Guide.
  1096. //
  1097. // Tag key–value pairs are not case sensitive, but case is preserved. This
  1098. // means that you cannot have separate Department and department tag keys. Assume
  1099. // that the user that you are federating has the Department=Marketing tag and
  1100. // you pass the department=engineering session tag. Department and department
  1101. // are not saved as separate tags, and the session tag passed in the request
  1102. // takes precedence over the user tag.
  1103. //
  1104. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  1105. // with awserr.Error's Code and Message methods to get detailed information about
  1106. // the error.
  1107. //
  1108. // See the AWS API reference guide for AWS Security Token Service's
  1109. // API operation GetFederationToken for usage and error information.
  1110. //
  1111. // Returned Error Codes:
  1112. // * ErrCodeMalformedPolicyDocumentException "MalformedPolicyDocument"
  1113. // The request was rejected because the policy document was malformed. The error
  1114. // message describes the specific error.
  1115. //
  1116. // * ErrCodePackedPolicyTooLargeException "PackedPolicyTooLarge"
  1117. // The request was rejected because the total packed size of the session policies
  1118. // and session tags combined was too large. An AWS conversion compresses the
  1119. // session policy document, session policy ARNs, and session tags into a packed
  1120. // binary format that has a separate limit. The error message indicates by percentage
  1121. // how close the policies and tags are to the upper size limit. For more information,
  1122. // see Passing Session Tags in STS (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html)
  1123. // in the IAM User Guide.
  1124. //
  1125. // You could receive this error even though you meet other defined session policy
  1126. // and session tag limits. For more information, see IAM and STS Entity Character
  1127. // Limits (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html)
  1128. // in the IAM User Guide.
  1129. //
  1130. // * ErrCodeRegionDisabledException "RegionDisabledException"
  1131. // STS is not activated in the requested region for the account that is being
  1132. // asked to generate credentials. The account administrator must use the IAM
  1133. // console to activate STS in that region. For more information, see Activating
  1134. // and Deactivating AWS STS in an AWS Region (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html)
  1135. // in the IAM User Guide.
  1136. //
  1137. // See also, https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/GetFederationToken
  1138. func (c *STS) GetFederationToken(input *GetFederationTokenInput) (*GetFederationTokenOutput, error) {
  1139. req, out := c.GetFederationTokenRequest(input)
  1140. return out, req.Send()
  1141. }
  1142. // GetFederationTokenWithContext is the same as GetFederationToken with the addition of
  1143. // the ability to pass a context and additional request options.
  1144. //
  1145. // See GetFederationToken for details on how to use this API operation.
  1146. //
  1147. // The context must be non-nil and will be used for request cancellation. If
  1148. // the context is nil a panic will occur. In the future the SDK may create
  1149. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  1150. // for more information on using Contexts.
  1151. func (c *STS) GetFederationTokenWithContext(ctx aws.Context, input *GetFederationTokenInput, opts ...request.Option) (*GetFederationTokenOutput, error) {
  1152. req, out := c.GetFederationTokenRequest(input)
  1153. req.SetContext(ctx)
  1154. req.ApplyOptions(opts...)
  1155. return out, req.Send()
  1156. }
  1157. const opGetSessionToken = "GetSessionToken"
  1158. // GetSessionTokenRequest generates a "aws/request.Request" representing the
  1159. // client's request for the GetSessionToken operation. The "output" return
  1160. // value will be populated with the request's response once the request completes
  1161. // successfully.
  1162. //
  1163. // Use "Send" method on the returned Request to send the API call to the service.
  1164. // the "output" return value is not valid until after Send returns without error.
  1165. //
  1166. // See GetSessionToken for more information on using the GetSessionToken
  1167. // API call, and error handling.
  1168. //
  1169. // This method is useful when you want to inject custom logic or configuration
  1170. // into the SDK's request lifecycle. Such as custom headers, or retry logic.
  1171. //
  1172. //
  1173. // // Example sending a request using the GetSessionTokenRequest method.
  1174. // req, resp := client.GetSessionTokenRequest(params)
  1175. //
  1176. // err := req.Send()
  1177. // if err == nil { // resp is now filled
  1178. // fmt.Println(resp)
  1179. // }
  1180. //
  1181. // See also, https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/GetSessionToken
  1182. func (c *STS) GetSessionTokenRequest(input *GetSessionTokenInput) (req *request.Request, output *GetSessionTokenOutput) {
  1183. op := &request.Operation{
  1184. Name: opGetSessionToken,
  1185. HTTPMethod: "POST",
  1186. HTTPPath: "/",
  1187. }
  1188. if input == nil {
  1189. input = &GetSessionTokenInput{}
  1190. }
  1191. output = &GetSessionTokenOutput{}
  1192. req = c.newRequest(op, input, output)
  1193. return
  1194. }
  1195. // GetSessionToken API operation for AWS Security Token Service.
  1196. //
  1197. // Returns a set of temporary credentials for an AWS account or IAM user. The
  1198. // credentials consist of an access key ID, a secret access key, and a security
  1199. // token. Typically, you use GetSessionToken if you want to use MFA to protect
  1200. // programmatic calls to specific AWS API operations like Amazon EC2 StopInstances.
  1201. // MFA-enabled IAM users would need to call GetSessionToken and submit an MFA
  1202. // code that is associated with their MFA device. Using the temporary security
  1203. // credentials that are returned from the call, IAM users can then make programmatic
  1204. // calls to API operations that require MFA authentication. If you do not supply
  1205. // a correct MFA code, then the API returns an access denied error. For a comparison
  1206. // of GetSessionToken with the other API operations that produce temporary credentials,
  1207. // see Requesting Temporary Security Credentials (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html)
  1208. // and Comparing the AWS STS API operations (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#stsapi_comparison)
  1209. // in the IAM User Guide.
  1210. //
  1211. // Session Duration
  1212. //
  1213. // The GetSessionToken operation must be called by using the long-term AWS security
  1214. // credentials of the AWS account root user or an IAM user. Credentials that
  1215. // are created by IAM users are valid for the duration that you specify. This
  1216. // duration can range from 900 seconds (15 minutes) up to a maximum of 129,600
  1217. // seconds (36 hours), with a default of 43,200 seconds (12 hours). Credentials
  1218. // based on account credentials can range from 900 seconds (15 minutes) up to
  1219. // 3,600 seconds (1 hour), with a default of 1 hour.
  1220. //
  1221. // Permissions
  1222. //
  1223. // The temporary security credentials created by GetSessionToken can be used
  1224. // to make API calls to any AWS service with the following exceptions:
  1225. //
  1226. // * You cannot call any IAM API operations unless MFA authentication information
  1227. // is included in the request.
  1228. //
  1229. // * You cannot call any STS API except AssumeRole or GetCallerIdentity.
  1230. //
  1231. // We recommend that you do not call GetSessionToken with AWS account root user
  1232. // credentials. Instead, follow our best practices (https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#create-iam-users)
  1233. // by creating one or more IAM users, giving them the necessary permissions,
  1234. // and using IAM users for everyday interaction with AWS.
  1235. //
  1236. // The credentials that are returned by GetSessionToken are based on permissions
  1237. // associated with the user whose credentials were used to call the operation.
  1238. // If GetSessionToken is called using AWS account root user credentials, the
  1239. // temporary credentials have root user permissions. Similarly, if GetSessionToken
  1240. // is called using the credentials of an IAM user, the temporary credentials
  1241. // have the same permissions as the IAM user.
  1242. //
  1243. // For more information about using GetSessionToken to create temporary credentials,
  1244. // go to Temporary Credentials for Users in Untrusted Environments (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html#api_getsessiontoken)
  1245. // in the IAM User Guide.
  1246. //
  1247. // Returns awserr.Error for service API and SDK errors. Use runtime type assertions
  1248. // with awserr.Error's Code and Message methods to get detailed information about
  1249. // the error.
  1250. //
  1251. // See the AWS API reference guide for AWS Security Token Service's
  1252. // API operation GetSessionToken for usage and error information.
  1253. //
  1254. // Returned Error Codes:
  1255. // * ErrCodeRegionDisabledException "RegionDisabledException"
  1256. // STS is not activated in the requested region for the account that is being
  1257. // asked to generate credentials. The account administrator must use the IAM
  1258. // console to activate STS in that region. For more information, see Activating
  1259. // and Deactivating AWS STS in an AWS Region (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html)
  1260. // in the IAM User Guide.
  1261. //
  1262. // See also, https://docs.aws.amazon.com/goto/WebAPI/sts-2011-06-15/GetSessionToken
  1263. func (c *STS) GetSessionToken(input *GetSessionTokenInput) (*GetSessionTokenOutput, error) {
  1264. req, out := c.GetSessionTokenRequest(input)
  1265. return out, req.Send()
  1266. }
  1267. // GetSessionTokenWithContext is the same as GetSessionToken with the addition of
  1268. // the ability to pass a context and additional request options.
  1269. //
  1270. // See GetSessionToken for details on how to use this API operation.
  1271. //
  1272. // The context must be non-nil and will be used for request cancellation. If
  1273. // the context is nil a panic will occur. In the future the SDK may create
  1274. // sub-contexts for http.Requests. See https://golang.org/pkg/context/
  1275. // for more information on using Contexts.
  1276. func (c *STS) GetSessionTokenWithContext(ctx aws.Context, input *GetSessionTokenInput, opts ...request.Option) (*GetSessionTokenOutput, error) {
  1277. req, out := c.GetSessionTokenRequest(input)
  1278. req.SetContext(ctx)
  1279. req.ApplyOptions(opts...)
  1280. return out, req.Send()
  1281. }
  1282. type AssumeRoleInput struct {
  1283. _ struct{} `type:"structure"`
  1284. // The duration, in seconds, of the role session. The value can range from 900
  1285. // seconds (15 minutes) up to the maximum session duration setting for the role.
  1286. // This setting can have a value from 1 hour to 12 hours. If you specify a value
  1287. // higher than this setting, the operation fails. For example, if you specify
  1288. // a session duration of 12 hours, but your administrator set the maximum session
  1289. // duration to 6 hours, your operation fails. To learn how to view the maximum
  1290. // value for your role, see View the Maximum Session Duration Setting for a
  1291. // Role (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html#id_roles_use_view-role-max-session)
  1292. // in the IAM User Guide.
  1293. //
  1294. // By default, the value is set to 3600 seconds.
  1295. //
  1296. // The DurationSeconds parameter is separate from the duration of a console
  1297. // session that you might request using the returned credentials. The request
  1298. // to the federation endpoint for a console sign-in token takes a SessionDuration
  1299. // parameter that specifies the maximum length of the console session. For more
  1300. // information, see Creating a URL that Enables Federated Users to Access the
  1301. // AWS Management Console (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_enable-console-custom-url.html)
  1302. // in the IAM User Guide.
  1303. DurationSeconds *int64 `min:"900" type:"integer"`
  1304. // A unique identifier that might be required when you assume a role in another
  1305. // account. If the administrator of the account to which the role belongs provided
  1306. // you with an external ID, then provide that value in the ExternalId parameter.
  1307. // This value can be any string, such as a passphrase or account number. A cross-account
  1308. // role is usually set up to trust everyone in an account. Therefore, the administrator
  1309. // of the trusting account might send an external ID to the administrator of
  1310. // the trusted account. That way, only someone with the ID can assume the role,
  1311. // rather than everyone in the account. For more information about the external
  1312. // ID, see How to Use an External ID When Granting Access to Your AWS Resources
  1313. // to a Third Party (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-user_externalid.html)
  1314. // in the IAM User Guide.
  1315. //
  1316. // The regex used to validate this parameter is a string of characters consisting
  1317. // of upper- and lower-case alphanumeric characters with no spaces. You can
  1318. // also include underscores or any of the following characters: =,.@:/-
  1319. ExternalId *string `min:"2" type:"string"`
  1320. // An IAM policy in JSON format that you want to use as an inline session policy.
  1321. //
  1322. // This parameter is optional. Passing policies to this operation returns new
  1323. // temporary credentials. The resulting session's permissions are the intersection
  1324. // of the role's identity-based policy and the session policies. You can use
  1325. // the role's temporary credentials in subsequent AWS API calls to access resources
  1326. // in the account that owns the role. You cannot use session policies to grant
  1327. // more permissions than those allowed by the identity-based policy of the role
  1328. // that is being assumed. For more information, see Session Policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session)
  1329. // in the IAM User Guide.
  1330. //
  1331. // The plain text that you use for both inline and managed session policies
  1332. // can't exceed 2,048 characters. The JSON policy characters can be any ASCII
  1333. // character from the space character to the end of the valid character list
  1334. // (\u0020 through \u00FF). It can also include the tab (\u0009), linefeed (\u000A),
  1335. // and carriage return (\u000D) characters.
  1336. //
  1337. // An AWS conversion compresses the passed session policies and session tags
  1338. // into a packed binary format that has a separate limit. Your request can fail
  1339. // for this limit even if your plain text meets the other requirements. The
  1340. // PackedPolicySize response element indicates by percentage how close the policies
  1341. // and tags for your request are to the upper size limit.
  1342. Policy *string `min:"1" type:"string"`
  1343. // The Amazon Resource Names (ARNs) of the IAM managed policies that you want
  1344. // to use as managed session policies. The policies must exist in the same account
  1345. // as the role.
  1346. //
  1347. // This parameter is optional. You can provide up to 10 managed policy ARNs.
  1348. // However, the plain text that you use for both inline and managed session
  1349. // policies can't exceed 2,048 characters. For more information about ARNs,
  1350. // see Amazon Resource Names (ARNs) and AWS Service Namespaces (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html)
  1351. // in the AWS General Reference.
  1352. //
  1353. // An AWS conversion compresses the passed session policies and session tags
  1354. // into a packed binary format that has a separate limit. Your request can fail
  1355. // for this limit even if your plain text meets the other requirements. The
  1356. // PackedPolicySize response element indicates by percentage how close the policies
  1357. // and tags for your request are to the upper size limit.
  1358. //
  1359. // Passing policies to this operation returns new temporary credentials. The
  1360. // resulting session's permissions are the intersection of the role's identity-based
  1361. // policy and the session policies. You can use the role's temporary credentials
  1362. // in subsequent AWS API calls to access resources in the account that owns
  1363. // the role. You cannot use session policies to grant more permissions than
  1364. // those allowed by the identity-based policy of the role that is being assumed.
  1365. // For more information, see Session Policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session)
  1366. // in the IAM User Guide.
  1367. PolicyArns []*PolicyDescriptorType `type:"list"`
  1368. // The Amazon Resource Name (ARN) of the role to assume.
  1369. //
  1370. // RoleArn is a required field
  1371. RoleArn *string `min:"20" type:"string" required:"true"`
  1372. // An identifier for the assumed role session.
  1373. //
  1374. // Use the role session name to uniquely identify a session when the same role
  1375. // is assumed by different principals or for different reasons. In cross-account
  1376. // scenarios, the role session name is visible to, and can be logged by the
  1377. // account that owns the role. The role session name is also used in the ARN
  1378. // of the assumed role principal. This means that subsequent cross-account API
  1379. // requests that use the temporary security credentials will expose the role
  1380. // session name to the external account in their AWS CloudTrail logs.
  1381. //
  1382. // The regex used to validate this parameter is a string of characters consisting
  1383. // of upper- and lower-case alphanumeric characters with no spaces. You can
  1384. // also include underscores or any of the following characters: =,.@-
  1385. //
  1386. // RoleSessionName is a required field
  1387. RoleSessionName *string `min:"2" type:"string" required:"true"`
  1388. // The identification number of the MFA device that is associated with the user
  1389. // who is making the AssumeRole call. Specify this value if the trust policy
  1390. // of the role being assumed includes a condition that requires MFA authentication.
  1391. // The value is either the serial number for a hardware device (such as GAHT12345678)
  1392. // or an Amazon Resource Name (ARN) for a virtual device (such as arn:aws:iam::123456789012:mfa/user).
  1393. //
  1394. // The regex used to validate this parameter is a string of characters consisting
  1395. // of upper- and lower-case alphanumeric characters with no spaces. You can
  1396. // also include underscores or any of the following characters: =,.@-
  1397. SerialNumber *string `min:"9" type:"string"`
  1398. // A list of session tags that you want to pass. Each session tag consists of
  1399. // a key name and an associated value. For more information about session tags,
  1400. // see Tagging AWS STS Sessions (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html)
  1401. // in the IAM User Guide.
  1402. //
  1403. // This parameter is optional. You can pass up to 50 session tags. The plain
  1404. // text session tag keys can’t exceed 128 characters, and the values can’t
  1405. // exceed 256 characters. For these and additional limits, see IAM and STS Character
  1406. // Limits (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_iam-limits.html#reference_iam-limits-entity-length)
  1407. // in the IAM User Guide.
  1408. //
  1409. // An AWS conversion compresses the passed session policies and session tags
  1410. // into a packed binary format that has a separate limit. Your request can fail
  1411. // for this limit even if your plain text meets the other requirements. The
  1412. // PackedPolicySize response element indicates by percentage how close the policies
  1413. // and tags for your request are to the upper size limit.
  1414. //
  1415. // You can pass a session tag with the same key as a tag that is already attached
  1416. // to the role. When you do, session tags override a role tag with the same
  1417. // key.
  1418. //
  1419. // Tag key–value pairs are not case sensitive, but case is preserved. This
  1420. // means that you cannot have separate Department and department tag keys. Assume
  1421. // that the role has the Department=Marketing tag and you pass the department=engineering
  1422. // session tag. Department and department are not saved as separate tags, and
  1423. // the session tag passed in the request takes precedence over the role tag.
  1424. //
  1425. // Additionally, if you used temporary credentials to perform this operation,
  1426. // the new session inherits any transitive session tags from the calling session.
  1427. // If you pass a session tag with the same key as an inherited tag, the operation
  1428. // fails. To view the inherited tags for a session, see the AWS CloudTrail logs.
  1429. // For more information, see Viewing Session Tags in CloudTrail (https://docs.aws.amazon.com/IAM/latest/UserGuide/session-tags.html#id_session-tags_ctlogs)
  1430. // in the IAM User Guide.
  1431. Tags []*Tag `type:"list"`
  1432. // The value provided by the MFA device, if the trust policy of the role being
  1433. // assumed requires MFA (that is, if the policy includes a condition that tests
  1434. // for MFA). If the role being assumed requires MFA and if the TokenCode value
  1435. // is missing or expired, the AssumeRole call returns an "access denied" error.
  1436. //
  1437. // The format for this parameter, as described by its regex pattern, is a sequence
  1438. // of six numeric digits.
  1439. TokenCode *string `min:"6" type:"string"`
  1440. // A list of keys for session tags that you want to set as transitive. If you
  1441. // set a tag key as transitive, the corresponding key and value passes to subsequent
  1442. // sessions in a role chain. For more information, see Chaining Roles with Session
  1443. // Tags (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html#id_session-tags_role-chaining)
  1444. // in the IAM User Guide.
  1445. //
  1446. // This parameter is optional. When you set session tags as transitive, the
  1447. // session policy and session tags packed binary limit is not affected.
  1448. //
  1449. // If you choose not to specify a transitive tag key, then no tags are passed
  1450. // from this session to any subsequent sessions.
  1451. TransitiveTagKeys []*string `type:"list"`
  1452. }
  1453. // String returns the string representation
  1454. func (s AssumeRoleInput) String() string {
  1455. return awsutil.Prettify(s)
  1456. }
  1457. // GoString returns the string representation
  1458. func (s AssumeRoleInput) GoString() string {
  1459. return s.String()
  1460. }
  1461. // Validate inspects the fields of the type to determine if they are valid.
  1462. func (s *AssumeRoleInput) Validate() error {
  1463. invalidParams := request.ErrInvalidParams{Context: "AssumeRoleInput"}
  1464. if s.DurationSeconds != nil && *s.DurationSeconds < 900 {
  1465. invalidParams.Add(request.NewErrParamMinValue("DurationSeconds", 900))
  1466. }
  1467. if s.ExternalId != nil && len(*s.ExternalId) < 2 {
  1468. invalidParams.Add(request.NewErrParamMinLen("ExternalId", 2))
  1469. }
  1470. if s.Policy != nil && len(*s.Policy) < 1 {
  1471. invalidParams.Add(request.NewErrParamMinLen("Policy", 1))
  1472. }
  1473. if s.RoleArn == nil {
  1474. invalidParams.Add(request.NewErrParamRequired("RoleArn"))
  1475. }
  1476. if s.RoleArn != nil && len(*s.RoleArn) < 20 {
  1477. invalidParams.Add(request.NewErrParamMinLen("RoleArn", 20))
  1478. }
  1479. if s.RoleSessionName == nil {
  1480. invalidParams.Add(request.NewErrParamRequired("RoleSessionName"))
  1481. }
  1482. if s.RoleSessionName != nil && len(*s.RoleSessionName) < 2 {
  1483. invalidParams.Add(request.NewErrParamMinLen("RoleSessionName", 2))
  1484. }
  1485. if s.SerialNumber != nil && len(*s.SerialNumber) < 9 {
  1486. invalidParams.Add(request.NewErrParamMinLen("SerialNumber", 9))
  1487. }
  1488. if s.TokenCode != nil && len(*s.TokenCode) < 6 {
  1489. invalidParams.Add(request.NewErrParamMinLen("TokenCode", 6))
  1490. }
  1491. if s.PolicyArns != nil {
  1492. for i, v := range s.PolicyArns {
  1493. if v == nil {
  1494. continue
  1495. }
  1496. if err := v.Validate(); err != nil {
  1497. invalidParams.AddNested(fmt.Sprintf("%s[%v]", "PolicyArns", i), err.(request.ErrInvalidParams))
  1498. }
  1499. }
  1500. }
  1501. if s.Tags != nil {
  1502. for i, v := range s.Tags {
  1503. if v == nil {
  1504. continue
  1505. }
  1506. if err := v.Validate(); err != nil {
  1507. invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Tags", i), err.(request.ErrInvalidParams))
  1508. }
  1509. }
  1510. }
  1511. if invalidParams.Len() > 0 {
  1512. return invalidParams
  1513. }
  1514. return nil
  1515. }
  1516. // SetDurationSeconds sets the DurationSeconds field's value.
  1517. func (s *AssumeRoleInput) SetDurationSeconds(v int64) *AssumeRoleInput {
  1518. s.DurationSeconds = &v
  1519. return s
  1520. }
  1521. // SetExternalId sets the ExternalId field's value.
  1522. func (s *AssumeRoleInput) SetExternalId(v string) *AssumeRoleInput {
  1523. s.ExternalId = &v
  1524. return s
  1525. }
  1526. // SetPolicy sets the Policy field's value.
  1527. func (s *AssumeRoleInput) SetPolicy(v string) *AssumeRoleInput {
  1528. s.Policy = &v
  1529. return s
  1530. }
  1531. // SetPolicyArns sets the PolicyArns field's value.
  1532. func (s *AssumeRoleInput) SetPolicyArns(v []*PolicyDescriptorType) *AssumeRoleInput {
  1533. s.PolicyArns = v
  1534. return s
  1535. }
  1536. // SetRoleArn sets the RoleArn field's value.
  1537. func (s *AssumeRoleInput) SetRoleArn(v string) *AssumeRoleInput {
  1538. s.RoleArn = &v
  1539. return s
  1540. }
  1541. // SetRoleSessionName sets the RoleSessionName field's value.
  1542. func (s *AssumeRoleInput) SetRoleSessionName(v string) *AssumeRoleInput {
  1543. s.RoleSessionName = &v
  1544. return s
  1545. }
  1546. // SetSerialNumber sets the SerialNumber field's value.
  1547. func (s *AssumeRoleInput) SetSerialNumber(v string) *AssumeRoleInput {
  1548. s.SerialNumber = &v
  1549. return s
  1550. }
  1551. // SetTags sets the Tags field's value.
  1552. func (s *AssumeRoleInput) SetTags(v []*Tag) *AssumeRoleInput {
  1553. s.Tags = v
  1554. return s
  1555. }
  1556. // SetTokenCode sets the TokenCode field's value.
  1557. func (s *AssumeRoleInput) SetTokenCode(v string) *AssumeRoleInput {
  1558. s.TokenCode = &v
  1559. return s
  1560. }
  1561. // SetTransitiveTagKeys sets the TransitiveTagKeys field's value.
  1562. func (s *AssumeRoleInput) SetTransitiveTagKeys(v []*string) *AssumeRoleInput {
  1563. s.TransitiveTagKeys = v
  1564. return s
  1565. }
  1566. // Contains the response to a successful AssumeRole request, including temporary
  1567. // AWS credentials that can be used to make AWS requests.
  1568. type AssumeRoleOutput struct {
  1569. _ struct{} `type:"structure"`
  1570. // The Amazon Resource Name (ARN) and the assumed role ID, which are identifiers
  1571. // that you can use to refer to the resulting temporary security credentials.
  1572. // For example, you can reference these credentials as a principal in a resource-based
  1573. // policy by using the ARN or assumed role ID. The ARN and ID include the RoleSessionName
  1574. // that you specified when you called AssumeRole.
  1575. AssumedRoleUser *AssumedRoleUser `type:"structure"`
  1576. // The temporary security credentials, which include an access key ID, a secret
  1577. // access key, and a security (or session) token.
  1578. //
  1579. // The size of the security token that STS API operations return is not fixed.
  1580. // We strongly recommend that you make no assumptions about the maximum size.
  1581. Credentials *Credentials `type:"structure"`
  1582. // A percentage value that indicates the packed size of the session policies
  1583. // and session tags combined passed in the request. The request fails if the
  1584. // packed size is greater than 100 percent, which means the policies and tags
  1585. // exceeded the allowed space.
  1586. PackedPolicySize *int64 `type:"integer"`
  1587. }
  1588. // String returns the string representation
  1589. func (s AssumeRoleOutput) String() string {
  1590. return awsutil.Prettify(s)
  1591. }
  1592. // GoString returns the string representation
  1593. func (s AssumeRoleOutput) GoString() string {
  1594. return s.String()
  1595. }
  1596. // SetAssumedRoleUser sets the AssumedRoleUser field's value.
  1597. func (s *AssumeRoleOutput) SetAssumedRoleUser(v *AssumedRoleUser) *AssumeRoleOutput {
  1598. s.AssumedRoleUser = v
  1599. return s
  1600. }
  1601. // SetCredentials sets the Credentials field's value.
  1602. func (s *AssumeRoleOutput) SetCredentials(v *Credentials) *AssumeRoleOutput {
  1603. s.Credentials = v
  1604. return s
  1605. }
  1606. // SetPackedPolicySize sets the PackedPolicySize field's value.
  1607. func (s *AssumeRoleOutput) SetPackedPolicySize(v int64) *AssumeRoleOutput {
  1608. s.PackedPolicySize = &v
  1609. return s
  1610. }
  1611. type AssumeRoleWithSAMLInput struct {
  1612. _ struct{} `type:"structure"`
  1613. // The duration, in seconds, of the role session. Your role session lasts for
  1614. // the duration that you specify for the DurationSeconds parameter, or until
  1615. // the time specified in the SAML authentication response's SessionNotOnOrAfter
  1616. // value, whichever is shorter. You can provide a DurationSeconds value from
  1617. // 900 seconds (15 minutes) up to the maximum session duration setting for the
  1618. // role. This setting can have a value from 1 hour to 12 hours. If you specify
  1619. // a value higher than this setting, the operation fails. For example, if you
  1620. // specify a session duration of 12 hours, but your administrator set the maximum
  1621. // session duration to 6 hours, your operation fails. To learn how to view the
  1622. // maximum value for your role, see View the Maximum Session Duration Setting
  1623. // for a Role (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html#id_roles_use_view-role-max-session)
  1624. // in the IAM User Guide.
  1625. //
  1626. // By default, the value is set to 3600 seconds.
  1627. //
  1628. // The DurationSeconds parameter is separate from the duration of a console
  1629. // session that you might request using the returned credentials. The request
  1630. // to the federation endpoint for a console sign-in token takes a SessionDuration
  1631. // parameter that specifies the maximum length of the console session. For more
  1632. // information, see Creating a URL that Enables Federated Users to Access the
  1633. // AWS Management Console (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_enable-console-custom-url.html)
  1634. // in the IAM User Guide.
  1635. DurationSeconds *int64 `min:"900" type:"integer"`
  1636. // An IAM policy in JSON format that you want to use as an inline session policy.
  1637. //
  1638. // This parameter is optional. Passing policies to this operation returns new
  1639. // temporary credentials. The resulting session's permissions are the intersection
  1640. // of the role's identity-based policy and the session policies. You can use
  1641. // the role's temporary credentials in subsequent AWS API calls to access resources
  1642. // in the account that owns the role. You cannot use session policies to grant
  1643. // more permissions than those allowed by the identity-based policy of the role
  1644. // that is being assumed. For more information, see Session Policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session)
  1645. // in the IAM User Guide.
  1646. //
  1647. // The plain text that you use for both inline and managed session policies
  1648. // can't exceed 2,048 characters. The JSON policy characters can be any ASCII
  1649. // character from the space character to the end of the valid character list
  1650. // (\u0020 through \u00FF). It can also include the tab (\u0009), linefeed (\u000A),
  1651. // and carriage return (\u000D) characters.
  1652. //
  1653. // An AWS conversion compresses the passed session policies and session tags
  1654. // into a packed binary format that has a separate limit. Your request can fail
  1655. // for this limit even if your plain text meets the other requirements. The
  1656. // PackedPolicySize response element indicates by percentage how close the policies
  1657. // and tags for your request are to the upper size limit.
  1658. Policy *string `min:"1" type:"string"`
  1659. // The Amazon Resource Names (ARNs) of the IAM managed policies that you want
  1660. // to use as managed session policies. The policies must exist in the same account
  1661. // as the role.
  1662. //
  1663. // This parameter is optional. You can provide up to 10 managed policy ARNs.
  1664. // However, the plain text that you use for both inline and managed session
  1665. // policies can't exceed 2,048 characters. For more information about ARNs,
  1666. // see Amazon Resource Names (ARNs) and AWS Service Namespaces (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html)
  1667. // in the AWS General Reference.
  1668. //
  1669. // An AWS conversion compresses the passed session policies and session tags
  1670. // into a packed binary format that has a separate limit. Your request can fail
  1671. // for this limit even if your plain text meets the other requirements. The
  1672. // PackedPolicySize response element indicates by percentage how close the policies
  1673. // and tags for your request are to the upper size limit.
  1674. //
  1675. // Passing policies to this operation returns new temporary credentials. The
  1676. // resulting session's permissions are the intersection of the role's identity-based
  1677. // policy and the session policies. You can use the role's temporary credentials
  1678. // in subsequent AWS API calls to access resources in the account that owns
  1679. // the role. You cannot use session policies to grant more permissions than
  1680. // those allowed by the identity-based policy of the role that is being assumed.
  1681. // For more information, see Session Policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session)
  1682. // in the IAM User Guide.
  1683. PolicyArns []*PolicyDescriptorType `type:"list"`
  1684. // The Amazon Resource Name (ARN) of the SAML provider in IAM that describes
  1685. // the IdP.
  1686. //
  1687. // PrincipalArn is a required field
  1688. PrincipalArn *string `min:"20" type:"string" required:"true"`
  1689. // The Amazon Resource Name (ARN) of the role that the caller is assuming.
  1690. //
  1691. // RoleArn is a required field
  1692. RoleArn *string `min:"20" type:"string" required:"true"`
  1693. // The base-64 encoded SAML authentication response provided by the IdP.
  1694. //
  1695. // For more information, see Configuring a Relying Party and Adding Claims (https://docs.aws.amazon.com/IAM/latest/UserGuide/create-role-saml-IdP-tasks.html)
  1696. // in the IAM User Guide.
  1697. //
  1698. // SAMLAssertion is a required field
  1699. SAMLAssertion *string `min:"4" type:"string" required:"true" sensitive:"true"`
  1700. }
  1701. // String returns the string representation
  1702. func (s AssumeRoleWithSAMLInput) String() string {
  1703. return awsutil.Prettify(s)
  1704. }
  1705. // GoString returns the string representation
  1706. func (s AssumeRoleWithSAMLInput) GoString() string {
  1707. return s.String()
  1708. }
  1709. // Validate inspects the fields of the type to determine if they are valid.
  1710. func (s *AssumeRoleWithSAMLInput) Validate() error {
  1711. invalidParams := request.ErrInvalidParams{Context: "AssumeRoleWithSAMLInput"}
  1712. if s.DurationSeconds != nil && *s.DurationSeconds < 900 {
  1713. invalidParams.Add(request.NewErrParamMinValue("DurationSeconds", 900))
  1714. }
  1715. if s.Policy != nil && len(*s.Policy) < 1 {
  1716. invalidParams.Add(request.NewErrParamMinLen("Policy", 1))
  1717. }
  1718. if s.PrincipalArn == nil {
  1719. invalidParams.Add(request.NewErrParamRequired("PrincipalArn"))
  1720. }
  1721. if s.PrincipalArn != nil && len(*s.PrincipalArn) < 20 {
  1722. invalidParams.Add(request.NewErrParamMinLen("PrincipalArn", 20))
  1723. }
  1724. if s.RoleArn == nil {
  1725. invalidParams.Add(request.NewErrParamRequired("RoleArn"))
  1726. }
  1727. if s.RoleArn != nil && len(*s.RoleArn) < 20 {
  1728. invalidParams.Add(request.NewErrParamMinLen("RoleArn", 20))
  1729. }
  1730. if s.SAMLAssertion == nil {
  1731. invalidParams.Add(request.NewErrParamRequired("SAMLAssertion"))
  1732. }
  1733. if s.SAMLAssertion != nil && len(*s.SAMLAssertion) < 4 {
  1734. invalidParams.Add(request.NewErrParamMinLen("SAMLAssertion", 4))
  1735. }
  1736. if s.PolicyArns != nil {
  1737. for i, v := range s.PolicyArns {
  1738. if v == nil {
  1739. continue
  1740. }
  1741. if err := v.Validate(); err != nil {
  1742. invalidParams.AddNested(fmt.Sprintf("%s[%v]", "PolicyArns", i), err.(request.ErrInvalidParams))
  1743. }
  1744. }
  1745. }
  1746. if invalidParams.Len() > 0 {
  1747. return invalidParams
  1748. }
  1749. return nil
  1750. }
  1751. // SetDurationSeconds sets the DurationSeconds field's value.
  1752. func (s *AssumeRoleWithSAMLInput) SetDurationSeconds(v int64) *AssumeRoleWithSAMLInput {
  1753. s.DurationSeconds = &v
  1754. return s
  1755. }
  1756. // SetPolicy sets the Policy field's value.
  1757. func (s *AssumeRoleWithSAMLInput) SetPolicy(v string) *AssumeRoleWithSAMLInput {
  1758. s.Policy = &v
  1759. return s
  1760. }
  1761. // SetPolicyArns sets the PolicyArns field's value.
  1762. func (s *AssumeRoleWithSAMLInput) SetPolicyArns(v []*PolicyDescriptorType) *AssumeRoleWithSAMLInput {
  1763. s.PolicyArns = v
  1764. return s
  1765. }
  1766. // SetPrincipalArn sets the PrincipalArn field's value.
  1767. func (s *AssumeRoleWithSAMLInput) SetPrincipalArn(v string) *AssumeRoleWithSAMLInput {
  1768. s.PrincipalArn = &v
  1769. return s
  1770. }
  1771. // SetRoleArn sets the RoleArn field's value.
  1772. func (s *AssumeRoleWithSAMLInput) SetRoleArn(v string) *AssumeRoleWithSAMLInput {
  1773. s.RoleArn = &v
  1774. return s
  1775. }
  1776. // SetSAMLAssertion sets the SAMLAssertion field's value.
  1777. func (s *AssumeRoleWithSAMLInput) SetSAMLAssertion(v string) *AssumeRoleWithSAMLInput {
  1778. s.SAMLAssertion = &v
  1779. return s
  1780. }
  1781. // Contains the response to a successful AssumeRoleWithSAML request, including
  1782. // temporary AWS credentials that can be used to make AWS requests.
  1783. type AssumeRoleWithSAMLOutput struct {
  1784. _ struct{} `type:"structure"`
  1785. // The identifiers for the temporary security credentials that the operation
  1786. // returns.
  1787. AssumedRoleUser *AssumedRoleUser `type:"structure"`
  1788. // The value of the Recipient attribute of the SubjectConfirmationData element
  1789. // of the SAML assertion.
  1790. Audience *string `type:"string"`
  1791. // The temporary security credentials, which include an access key ID, a secret
  1792. // access key, and a security (or session) token.
  1793. //
  1794. // The size of the security token that STS API operations return is not fixed.
  1795. // We strongly recommend that you make no assumptions about the maximum size.
  1796. Credentials *Credentials `type:"structure"`
  1797. // The value of the Issuer element of the SAML assertion.
  1798. Issuer *string `type:"string"`
  1799. // A hash value based on the concatenation of the Issuer response value, the
  1800. // AWS account ID, and the friendly name (the last part of the ARN) of the SAML
  1801. // provider in IAM. The combination of NameQualifier and Subject can be used
  1802. // to uniquely identify a federated user.
  1803. //
  1804. // The following pseudocode shows how the hash value is calculated:
  1805. //
  1806. // BASE64 ( SHA1 ( "https://example.com/saml" + "123456789012" + "/MySAMLIdP"
  1807. // ) )
  1808. NameQualifier *string `type:"string"`
  1809. // A percentage value that indicates the packed size of the session policies
  1810. // and session tags combined passed in the request. The request fails if the
  1811. // packed size is greater than 100 percent, which means the policies and tags
  1812. // exceeded the allowed space.
  1813. PackedPolicySize *int64 `type:"integer"`
  1814. // The value of the NameID element in the Subject element of the SAML assertion.
  1815. Subject *string `type:"string"`
  1816. // The format of the name ID, as defined by the Format attribute in the NameID
  1817. // element of the SAML assertion. Typical examples of the format are transient
  1818. // or persistent.
  1819. //
  1820. // If the format includes the prefix urn:oasis:names:tc:SAML:2.0:nameid-format,
  1821. // that prefix is removed. For example, urn:oasis:names:tc:SAML:2.0:nameid-format:transient
  1822. // is returned as transient. If the format includes any other prefix, the format
  1823. // is returned with no modifications.
  1824. SubjectType *string `type:"string"`
  1825. }
  1826. // String returns the string representation
  1827. func (s AssumeRoleWithSAMLOutput) String() string {
  1828. return awsutil.Prettify(s)
  1829. }
  1830. // GoString returns the string representation
  1831. func (s AssumeRoleWithSAMLOutput) GoString() string {
  1832. return s.String()
  1833. }
  1834. // SetAssumedRoleUser sets the AssumedRoleUser field's value.
  1835. func (s *AssumeRoleWithSAMLOutput) SetAssumedRoleUser(v *AssumedRoleUser) *AssumeRoleWithSAMLOutput {
  1836. s.AssumedRoleUser = v
  1837. return s
  1838. }
  1839. // SetAudience sets the Audience field's value.
  1840. func (s *AssumeRoleWithSAMLOutput) SetAudience(v string) *AssumeRoleWithSAMLOutput {
  1841. s.Audience = &v
  1842. return s
  1843. }
  1844. // SetCredentials sets the Credentials field's value.
  1845. func (s *AssumeRoleWithSAMLOutput) SetCredentials(v *Credentials) *AssumeRoleWithSAMLOutput {
  1846. s.Credentials = v
  1847. return s
  1848. }
  1849. // SetIssuer sets the Issuer field's value.
  1850. func (s *AssumeRoleWithSAMLOutput) SetIssuer(v string) *AssumeRoleWithSAMLOutput {
  1851. s.Issuer = &v
  1852. return s
  1853. }
  1854. // SetNameQualifier sets the NameQualifier field's value.
  1855. func (s *AssumeRoleWithSAMLOutput) SetNameQualifier(v string) *AssumeRoleWithSAMLOutput {
  1856. s.NameQualifier = &v
  1857. return s
  1858. }
  1859. // SetPackedPolicySize sets the PackedPolicySize field's value.
  1860. func (s *AssumeRoleWithSAMLOutput) SetPackedPolicySize(v int64) *AssumeRoleWithSAMLOutput {
  1861. s.PackedPolicySize = &v
  1862. return s
  1863. }
  1864. // SetSubject sets the Subject field's value.
  1865. func (s *AssumeRoleWithSAMLOutput) SetSubject(v string) *AssumeRoleWithSAMLOutput {
  1866. s.Subject = &v
  1867. return s
  1868. }
  1869. // SetSubjectType sets the SubjectType field's value.
  1870. func (s *AssumeRoleWithSAMLOutput) SetSubjectType(v string) *AssumeRoleWithSAMLOutput {
  1871. s.SubjectType = &v
  1872. return s
  1873. }
  1874. type AssumeRoleWithWebIdentityInput struct {
  1875. _ struct{} `type:"structure"`
  1876. // The duration, in seconds, of the role session. The value can range from 900
  1877. // seconds (15 minutes) up to the maximum session duration setting for the role.
  1878. // This setting can have a value from 1 hour to 12 hours. If you specify a value
  1879. // higher than this setting, the operation fails. For example, if you specify
  1880. // a session duration of 12 hours, but your administrator set the maximum session
  1881. // duration to 6 hours, your operation fails. To learn how to view the maximum
  1882. // value for your role, see View the Maximum Session Duration Setting for a
  1883. // Role (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html#id_roles_use_view-role-max-session)
  1884. // in the IAM User Guide.
  1885. //
  1886. // By default, the value is set to 3600 seconds.
  1887. //
  1888. // The DurationSeconds parameter is separate from the duration of a console
  1889. // session that you might request using the returned credentials. The request
  1890. // to the federation endpoint for a console sign-in token takes a SessionDuration
  1891. // parameter that specifies the maximum length of the console session. For more
  1892. // information, see Creating a URL that Enables Federated Users to Access the
  1893. // AWS Management Console (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_enable-console-custom-url.html)
  1894. // in the IAM User Guide.
  1895. DurationSeconds *int64 `min:"900" type:"integer"`
  1896. // An IAM policy in JSON format that you want to use as an inline session policy.
  1897. //
  1898. // This parameter is optional. Passing policies to this operation returns new
  1899. // temporary credentials. The resulting session's permissions are the intersection
  1900. // of the role's identity-based policy and the session policies. You can use
  1901. // the role's temporary credentials in subsequent AWS API calls to access resources
  1902. // in the account that owns the role. You cannot use session policies to grant
  1903. // more permissions than those allowed by the identity-based policy of the role
  1904. // that is being assumed. For more information, see Session Policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session)
  1905. // in the IAM User Guide.
  1906. //
  1907. // The plain text that you use for both inline and managed session policies
  1908. // can't exceed 2,048 characters. The JSON policy characters can be any ASCII
  1909. // character from the space character to the end of the valid character list
  1910. // (\u0020 through \u00FF). It can also include the tab (\u0009), linefeed (\u000A),
  1911. // and carriage return (\u000D) characters.
  1912. //
  1913. // An AWS conversion compresses the passed session policies and session tags
  1914. // into a packed binary format that has a separate limit. Your request can fail
  1915. // for this limit even if your plain text meets the other requirements. The
  1916. // PackedPolicySize response element indicates by percentage how close the policies
  1917. // and tags for your request are to the upper size limit.
  1918. Policy *string `min:"1" type:"string"`
  1919. // The Amazon Resource Names (ARNs) of the IAM managed policies that you want
  1920. // to use as managed session policies. The policies must exist in the same account
  1921. // as the role.
  1922. //
  1923. // This parameter is optional. You can provide up to 10 managed policy ARNs.
  1924. // However, the plain text that you use for both inline and managed session
  1925. // policies can't exceed 2,048 characters. For more information about ARNs,
  1926. // see Amazon Resource Names (ARNs) and AWS Service Namespaces (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html)
  1927. // in the AWS General Reference.
  1928. //
  1929. // An AWS conversion compresses the passed session policies and session tags
  1930. // into a packed binary format that has a separate limit. Your request can fail
  1931. // for this limit even if your plain text meets the other requirements. The
  1932. // PackedPolicySize response element indicates by percentage how close the policies
  1933. // and tags for your request are to the upper size limit.
  1934. //
  1935. // Passing policies to this operation returns new temporary credentials. The
  1936. // resulting session's permissions are the intersection of the role's identity-based
  1937. // policy and the session policies. You can use the role's temporary credentials
  1938. // in subsequent AWS API calls to access resources in the account that owns
  1939. // the role. You cannot use session policies to grant more permissions than
  1940. // those allowed by the identity-based policy of the role that is being assumed.
  1941. // For more information, see Session Policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session)
  1942. // in the IAM User Guide.
  1943. PolicyArns []*PolicyDescriptorType `type:"list"`
  1944. // The fully qualified host component of the domain name of the identity provider.
  1945. //
  1946. // Specify this value only for OAuth 2.0 access tokens. Currently www.amazon.com
  1947. // and graph.facebook.com are the only supported identity providers for OAuth
  1948. // 2.0 access tokens. Do not include URL schemes and port numbers.
  1949. //
  1950. // Do not specify this value for OpenID Connect ID tokens.
  1951. ProviderId *string `min:"4" type:"string"`
  1952. // The Amazon Resource Name (ARN) of the role that the caller is assuming.
  1953. //
  1954. // RoleArn is a required field
  1955. RoleArn *string `min:"20" type:"string" required:"true"`
  1956. // An identifier for the assumed role session. Typically, you pass the name
  1957. // or identifier that is associated with the user who is using your application.
  1958. // That way, the temporary security credentials that your application will use
  1959. // are associated with that user. This session name is included as part of the
  1960. // ARN and assumed role ID in the AssumedRoleUser response element.
  1961. //
  1962. // The regex used to validate this parameter is a string of characters consisting
  1963. // of upper- and lower-case alphanumeric characters with no spaces. You can
  1964. // also include underscores or any of the following characters: =,.@-
  1965. //
  1966. // RoleSessionName is a required field
  1967. RoleSessionName *string `min:"2" type:"string" required:"true"`
  1968. // The OAuth 2.0 access token or OpenID Connect ID token that is provided by
  1969. // the identity provider. Your application must get this token by authenticating
  1970. // the user who is using your application with a web identity provider before
  1971. // the application makes an AssumeRoleWithWebIdentity call.
  1972. //
  1973. // WebIdentityToken is a required field
  1974. WebIdentityToken *string `min:"4" type:"string" required:"true" sensitive:"true"`
  1975. }
  1976. // String returns the string representation
  1977. func (s AssumeRoleWithWebIdentityInput) String() string {
  1978. return awsutil.Prettify(s)
  1979. }
  1980. // GoString returns the string representation
  1981. func (s AssumeRoleWithWebIdentityInput) GoString() string {
  1982. return s.String()
  1983. }
  1984. // Validate inspects the fields of the type to determine if they are valid.
  1985. func (s *AssumeRoleWithWebIdentityInput) Validate() error {
  1986. invalidParams := request.ErrInvalidParams{Context: "AssumeRoleWithWebIdentityInput"}
  1987. if s.DurationSeconds != nil && *s.DurationSeconds < 900 {
  1988. invalidParams.Add(request.NewErrParamMinValue("DurationSeconds", 900))
  1989. }
  1990. if s.Policy != nil && len(*s.Policy) < 1 {
  1991. invalidParams.Add(request.NewErrParamMinLen("Policy", 1))
  1992. }
  1993. if s.ProviderId != nil && len(*s.ProviderId) < 4 {
  1994. invalidParams.Add(request.NewErrParamMinLen("ProviderId", 4))
  1995. }
  1996. if s.RoleArn == nil {
  1997. invalidParams.Add(request.NewErrParamRequired("RoleArn"))
  1998. }
  1999. if s.RoleArn != nil && len(*s.RoleArn) < 20 {
  2000. invalidParams.Add(request.NewErrParamMinLen("RoleArn", 20))
  2001. }
  2002. if s.RoleSessionName == nil {
  2003. invalidParams.Add(request.NewErrParamRequired("RoleSessionName"))
  2004. }
  2005. if s.RoleSessionName != nil && len(*s.RoleSessionName) < 2 {
  2006. invalidParams.Add(request.NewErrParamMinLen("RoleSessionName", 2))
  2007. }
  2008. if s.WebIdentityToken == nil {
  2009. invalidParams.Add(request.NewErrParamRequired("WebIdentityToken"))
  2010. }
  2011. if s.WebIdentityToken != nil && len(*s.WebIdentityToken) < 4 {
  2012. invalidParams.Add(request.NewErrParamMinLen("WebIdentityToken", 4))
  2013. }
  2014. if s.PolicyArns != nil {
  2015. for i, v := range s.PolicyArns {
  2016. if v == nil {
  2017. continue
  2018. }
  2019. if err := v.Validate(); err != nil {
  2020. invalidParams.AddNested(fmt.Sprintf("%s[%v]", "PolicyArns", i), err.(request.ErrInvalidParams))
  2021. }
  2022. }
  2023. }
  2024. if invalidParams.Len() > 0 {
  2025. return invalidParams
  2026. }
  2027. return nil
  2028. }
  2029. // SetDurationSeconds sets the DurationSeconds field's value.
  2030. func (s *AssumeRoleWithWebIdentityInput) SetDurationSeconds(v int64) *AssumeRoleWithWebIdentityInput {
  2031. s.DurationSeconds = &v
  2032. return s
  2033. }
  2034. // SetPolicy sets the Policy field's value.
  2035. func (s *AssumeRoleWithWebIdentityInput) SetPolicy(v string) *AssumeRoleWithWebIdentityInput {
  2036. s.Policy = &v
  2037. return s
  2038. }
  2039. // SetPolicyArns sets the PolicyArns field's value.
  2040. func (s *AssumeRoleWithWebIdentityInput) SetPolicyArns(v []*PolicyDescriptorType) *AssumeRoleWithWebIdentityInput {
  2041. s.PolicyArns = v
  2042. return s
  2043. }
  2044. // SetProviderId sets the ProviderId field's value.
  2045. func (s *AssumeRoleWithWebIdentityInput) SetProviderId(v string) *AssumeRoleWithWebIdentityInput {
  2046. s.ProviderId = &v
  2047. return s
  2048. }
  2049. // SetRoleArn sets the RoleArn field's value.
  2050. func (s *AssumeRoleWithWebIdentityInput) SetRoleArn(v string) *AssumeRoleWithWebIdentityInput {
  2051. s.RoleArn = &v
  2052. return s
  2053. }
  2054. // SetRoleSessionName sets the RoleSessionName field's value.
  2055. func (s *AssumeRoleWithWebIdentityInput) SetRoleSessionName(v string) *AssumeRoleWithWebIdentityInput {
  2056. s.RoleSessionName = &v
  2057. return s
  2058. }
  2059. // SetWebIdentityToken sets the WebIdentityToken field's value.
  2060. func (s *AssumeRoleWithWebIdentityInput) SetWebIdentityToken(v string) *AssumeRoleWithWebIdentityInput {
  2061. s.WebIdentityToken = &v
  2062. return s
  2063. }
  2064. // Contains the response to a successful AssumeRoleWithWebIdentity request,
  2065. // including temporary AWS credentials that can be used to make AWS requests.
  2066. type AssumeRoleWithWebIdentityOutput struct {
  2067. _ struct{} `type:"structure"`
  2068. // The Amazon Resource Name (ARN) and the assumed role ID, which are identifiers
  2069. // that you can use to refer to the resulting temporary security credentials.
  2070. // For example, you can reference these credentials as a principal in a resource-based
  2071. // policy by using the ARN or assumed role ID. The ARN and ID include the RoleSessionName
  2072. // that you specified when you called AssumeRole.
  2073. AssumedRoleUser *AssumedRoleUser `type:"structure"`
  2074. // The intended audience (also known as client ID) of the web identity token.
  2075. // This is traditionally the client identifier issued to the application that
  2076. // requested the web identity token.
  2077. Audience *string `type:"string"`
  2078. // The temporary security credentials, which include an access key ID, a secret
  2079. // access key, and a security token.
  2080. //
  2081. // The size of the security token that STS API operations return is not fixed.
  2082. // We strongly recommend that you make no assumptions about the maximum size.
  2083. Credentials *Credentials `type:"structure"`
  2084. // A percentage value that indicates the packed size of the session policies
  2085. // and session tags combined passed in the request. The request fails if the
  2086. // packed size is greater than 100 percent, which means the policies and tags
  2087. // exceeded the allowed space.
  2088. PackedPolicySize *int64 `type:"integer"`
  2089. // The issuing authority of the web identity token presented. For OpenID Connect
  2090. // ID tokens, this contains the value of the iss field. For OAuth 2.0 access
  2091. // tokens, this contains the value of the ProviderId parameter that was passed
  2092. // in the AssumeRoleWithWebIdentity request.
  2093. Provider *string `type:"string"`
  2094. // The unique user identifier that is returned by the identity provider. This
  2095. // identifier is associated with the WebIdentityToken that was submitted with
  2096. // the AssumeRoleWithWebIdentity call. The identifier is typically unique to
  2097. // the user and the application that acquired the WebIdentityToken (pairwise
  2098. // identifier). For OpenID Connect ID tokens, this field contains the value
  2099. // returned by the identity provider as the token's sub (Subject) claim.
  2100. SubjectFromWebIdentityToken *string `min:"6" type:"string"`
  2101. }
  2102. // String returns the string representation
  2103. func (s AssumeRoleWithWebIdentityOutput) String() string {
  2104. return awsutil.Prettify(s)
  2105. }
  2106. // GoString returns the string representation
  2107. func (s AssumeRoleWithWebIdentityOutput) GoString() string {
  2108. return s.String()
  2109. }
  2110. // SetAssumedRoleUser sets the AssumedRoleUser field's value.
  2111. func (s *AssumeRoleWithWebIdentityOutput) SetAssumedRoleUser(v *AssumedRoleUser) *AssumeRoleWithWebIdentityOutput {
  2112. s.AssumedRoleUser = v
  2113. return s
  2114. }
  2115. // SetAudience sets the Audience field's value.
  2116. func (s *AssumeRoleWithWebIdentityOutput) SetAudience(v string) *AssumeRoleWithWebIdentityOutput {
  2117. s.Audience = &v
  2118. return s
  2119. }
  2120. // SetCredentials sets the Credentials field's value.
  2121. func (s *AssumeRoleWithWebIdentityOutput) SetCredentials(v *Credentials) *AssumeRoleWithWebIdentityOutput {
  2122. s.Credentials = v
  2123. return s
  2124. }
  2125. // SetPackedPolicySize sets the PackedPolicySize field's value.
  2126. func (s *AssumeRoleWithWebIdentityOutput) SetPackedPolicySize(v int64) *AssumeRoleWithWebIdentityOutput {
  2127. s.PackedPolicySize = &v
  2128. return s
  2129. }
  2130. // SetProvider sets the Provider field's value.
  2131. func (s *AssumeRoleWithWebIdentityOutput) SetProvider(v string) *AssumeRoleWithWebIdentityOutput {
  2132. s.Provider = &v
  2133. return s
  2134. }
  2135. // SetSubjectFromWebIdentityToken sets the SubjectFromWebIdentityToken field's value.
  2136. func (s *AssumeRoleWithWebIdentityOutput) SetSubjectFromWebIdentityToken(v string) *AssumeRoleWithWebIdentityOutput {
  2137. s.SubjectFromWebIdentityToken = &v
  2138. return s
  2139. }
  2140. // The identifiers for the temporary security credentials that the operation
  2141. // returns.
  2142. type AssumedRoleUser struct {
  2143. _ struct{} `type:"structure"`
  2144. // The ARN of the temporary security credentials that are returned from the
  2145. // AssumeRole action. For more information about ARNs and how to use them in
  2146. // policies, see IAM Identifiers (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html)
  2147. // in the IAM User Guide.
  2148. //
  2149. // Arn is a required field
  2150. Arn *string `min:"20" type:"string" required:"true"`
  2151. // A unique identifier that contains the role ID and the role session name of
  2152. // the role that is being assumed. The role ID is generated by AWS when the
  2153. // role is created.
  2154. //
  2155. // AssumedRoleId is a required field
  2156. AssumedRoleId *string `min:"2" type:"string" required:"true"`
  2157. }
  2158. // String returns the string representation
  2159. func (s AssumedRoleUser) String() string {
  2160. return awsutil.Prettify(s)
  2161. }
  2162. // GoString returns the string representation
  2163. func (s AssumedRoleUser) GoString() string {
  2164. return s.String()
  2165. }
  2166. // SetArn sets the Arn field's value.
  2167. func (s *AssumedRoleUser) SetArn(v string) *AssumedRoleUser {
  2168. s.Arn = &v
  2169. return s
  2170. }
  2171. // SetAssumedRoleId sets the AssumedRoleId field's value.
  2172. func (s *AssumedRoleUser) SetAssumedRoleId(v string) *AssumedRoleUser {
  2173. s.AssumedRoleId = &v
  2174. return s
  2175. }
  2176. // AWS credentials for API authentication.
  2177. type Credentials struct {
  2178. _ struct{} `type:"structure"`
  2179. // The access key ID that identifies the temporary security credentials.
  2180. //
  2181. // AccessKeyId is a required field
  2182. AccessKeyId *string `min:"16" type:"string" required:"true"`
  2183. // The date on which the current credentials expire.
  2184. //
  2185. // Expiration is a required field
  2186. Expiration *time.Time `type:"timestamp" required:"true"`
  2187. // The secret access key that can be used to sign requests.
  2188. //
  2189. // SecretAccessKey is a required field
  2190. SecretAccessKey *string `type:"string" required:"true"`
  2191. // The token that users must pass to the service API to use the temporary credentials.
  2192. //
  2193. // SessionToken is a required field
  2194. SessionToken *string `type:"string" required:"true"`
  2195. }
  2196. // String returns the string representation
  2197. func (s Credentials) String() string {
  2198. return awsutil.Prettify(s)
  2199. }
  2200. // GoString returns the string representation
  2201. func (s Credentials) GoString() string {
  2202. return s.String()
  2203. }
  2204. // SetAccessKeyId sets the AccessKeyId field's value.
  2205. func (s *Credentials) SetAccessKeyId(v string) *Credentials {
  2206. s.AccessKeyId = &v
  2207. return s
  2208. }
  2209. // SetExpiration sets the Expiration field's value.
  2210. func (s *Credentials) SetExpiration(v time.Time) *Credentials {
  2211. s.Expiration = &v
  2212. return s
  2213. }
  2214. // SetSecretAccessKey sets the SecretAccessKey field's value.
  2215. func (s *Credentials) SetSecretAccessKey(v string) *Credentials {
  2216. s.SecretAccessKey = &v
  2217. return s
  2218. }
  2219. // SetSessionToken sets the SessionToken field's value.
  2220. func (s *Credentials) SetSessionToken(v string) *Credentials {
  2221. s.SessionToken = &v
  2222. return s
  2223. }
  2224. type DecodeAuthorizationMessageInput struct {
  2225. _ struct{} `type:"structure"`
  2226. // The encoded message that was returned with the response.
  2227. //
  2228. // EncodedMessage is a required field
  2229. EncodedMessage *string `min:"1" type:"string" required:"true"`
  2230. }
  2231. // String returns the string representation
  2232. func (s DecodeAuthorizationMessageInput) String() string {
  2233. return awsutil.Prettify(s)
  2234. }
  2235. // GoString returns the string representation
  2236. func (s DecodeAuthorizationMessageInput) GoString() string {
  2237. return s.String()
  2238. }
  2239. // Validate inspects the fields of the type to determine if they are valid.
  2240. func (s *DecodeAuthorizationMessageInput) Validate() error {
  2241. invalidParams := request.ErrInvalidParams{Context: "DecodeAuthorizationMessageInput"}
  2242. if s.EncodedMessage == nil {
  2243. invalidParams.Add(request.NewErrParamRequired("EncodedMessage"))
  2244. }
  2245. if s.EncodedMessage != nil && len(*s.EncodedMessage) < 1 {
  2246. invalidParams.Add(request.NewErrParamMinLen("EncodedMessage", 1))
  2247. }
  2248. if invalidParams.Len() > 0 {
  2249. return invalidParams
  2250. }
  2251. return nil
  2252. }
  2253. // SetEncodedMessage sets the EncodedMessage field's value.
  2254. func (s *DecodeAuthorizationMessageInput) SetEncodedMessage(v string) *DecodeAuthorizationMessageInput {
  2255. s.EncodedMessage = &v
  2256. return s
  2257. }
  2258. // A document that contains additional information about the authorization status
  2259. // of a request from an encoded message that is returned in response to an AWS
  2260. // request.
  2261. type DecodeAuthorizationMessageOutput struct {
  2262. _ struct{} `type:"structure"`
  2263. // An XML document that contains the decoded message.
  2264. DecodedMessage *string `type:"string"`
  2265. }
  2266. // String returns the string representation
  2267. func (s DecodeAuthorizationMessageOutput) String() string {
  2268. return awsutil.Prettify(s)
  2269. }
  2270. // GoString returns the string representation
  2271. func (s DecodeAuthorizationMessageOutput) GoString() string {
  2272. return s.String()
  2273. }
  2274. // SetDecodedMessage sets the DecodedMessage field's value.
  2275. func (s *DecodeAuthorizationMessageOutput) SetDecodedMessage(v string) *DecodeAuthorizationMessageOutput {
  2276. s.DecodedMessage = &v
  2277. return s
  2278. }
  2279. // Identifiers for the federated user that is associated with the credentials.
  2280. type FederatedUser struct {
  2281. _ struct{} `type:"structure"`
  2282. // The ARN that specifies the federated user that is associated with the credentials.
  2283. // For more information about ARNs and how to use them in policies, see IAM
  2284. // Identifiers (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html)
  2285. // in the IAM User Guide.
  2286. //
  2287. // Arn is a required field
  2288. Arn *string `min:"20" type:"string" required:"true"`
  2289. // The string that identifies the federated user associated with the credentials,
  2290. // similar to the unique ID of an IAM user.
  2291. //
  2292. // FederatedUserId is a required field
  2293. FederatedUserId *string `min:"2" type:"string" required:"true"`
  2294. }
  2295. // String returns the string representation
  2296. func (s FederatedUser) String() string {
  2297. return awsutil.Prettify(s)
  2298. }
  2299. // GoString returns the string representation
  2300. func (s FederatedUser) GoString() string {
  2301. return s.String()
  2302. }
  2303. // SetArn sets the Arn field's value.
  2304. func (s *FederatedUser) SetArn(v string) *FederatedUser {
  2305. s.Arn = &v
  2306. return s
  2307. }
  2308. // SetFederatedUserId sets the FederatedUserId field's value.
  2309. func (s *FederatedUser) SetFederatedUserId(v string) *FederatedUser {
  2310. s.FederatedUserId = &v
  2311. return s
  2312. }
  2313. type GetAccessKeyInfoInput struct {
  2314. _ struct{} `type:"structure"`
  2315. // The identifier of an access key.
  2316. //
  2317. // This parameter allows (through its regex pattern) a string of characters
  2318. // that can consist of any upper- or lowercase letter or digit.
  2319. //
  2320. // AccessKeyId is a required field
  2321. AccessKeyId *string `min:"16" type:"string" required:"true"`
  2322. }
  2323. // String returns the string representation
  2324. func (s GetAccessKeyInfoInput) String() string {
  2325. return awsutil.Prettify(s)
  2326. }
  2327. // GoString returns the string representation
  2328. func (s GetAccessKeyInfoInput) GoString() string {
  2329. return s.String()
  2330. }
  2331. // Validate inspects the fields of the type to determine if they are valid.
  2332. func (s *GetAccessKeyInfoInput) Validate() error {
  2333. invalidParams := request.ErrInvalidParams{Context: "GetAccessKeyInfoInput"}
  2334. if s.AccessKeyId == nil {
  2335. invalidParams.Add(request.NewErrParamRequired("AccessKeyId"))
  2336. }
  2337. if s.AccessKeyId != nil && len(*s.AccessKeyId) < 16 {
  2338. invalidParams.Add(request.NewErrParamMinLen("AccessKeyId", 16))
  2339. }
  2340. if invalidParams.Len() > 0 {
  2341. return invalidParams
  2342. }
  2343. return nil
  2344. }
  2345. // SetAccessKeyId sets the AccessKeyId field's value.
  2346. func (s *GetAccessKeyInfoInput) SetAccessKeyId(v string) *GetAccessKeyInfoInput {
  2347. s.AccessKeyId = &v
  2348. return s
  2349. }
  2350. type GetAccessKeyInfoOutput struct {
  2351. _ struct{} `type:"structure"`
  2352. // The number used to identify the AWS account.
  2353. Account *string `type:"string"`
  2354. }
  2355. // String returns the string representation
  2356. func (s GetAccessKeyInfoOutput) String() string {
  2357. return awsutil.Prettify(s)
  2358. }
  2359. // GoString returns the string representation
  2360. func (s GetAccessKeyInfoOutput) GoString() string {
  2361. return s.String()
  2362. }
  2363. // SetAccount sets the Account field's value.
  2364. func (s *GetAccessKeyInfoOutput) SetAccount(v string) *GetAccessKeyInfoOutput {
  2365. s.Account = &v
  2366. return s
  2367. }
  2368. type GetCallerIdentityInput struct {
  2369. _ struct{} `type:"structure"`
  2370. }
  2371. // String returns the string representation
  2372. func (s GetCallerIdentityInput) String() string {
  2373. return awsutil.Prettify(s)
  2374. }
  2375. // GoString returns the string representation
  2376. func (s GetCallerIdentityInput) GoString() string {
  2377. return s.String()
  2378. }
  2379. // Contains the response to a successful GetCallerIdentity request, including
  2380. // information about the entity making the request.
  2381. type GetCallerIdentityOutput struct {
  2382. _ struct{} `type:"structure"`
  2383. // The AWS account ID number of the account that owns or contains the calling
  2384. // entity.
  2385. Account *string `type:"string"`
  2386. // The AWS ARN associated with the calling entity.
  2387. Arn *string `min:"20" type:"string"`
  2388. // The unique identifier of the calling entity. The exact value depends on the
  2389. // type of entity that is making the call. The values returned are those listed
  2390. // in the aws:userid column in the Principal table (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_variables.html#principaltable)
  2391. // found on the Policy Variables reference page in the IAM User Guide.
  2392. UserId *string `type:"string"`
  2393. }
  2394. // String returns the string representation
  2395. func (s GetCallerIdentityOutput) String() string {
  2396. return awsutil.Prettify(s)
  2397. }
  2398. // GoString returns the string representation
  2399. func (s GetCallerIdentityOutput) GoString() string {
  2400. return s.String()
  2401. }
  2402. // SetAccount sets the Account field's value.
  2403. func (s *GetCallerIdentityOutput) SetAccount(v string) *GetCallerIdentityOutput {
  2404. s.Account = &v
  2405. return s
  2406. }
  2407. // SetArn sets the Arn field's value.
  2408. func (s *GetCallerIdentityOutput) SetArn(v string) *GetCallerIdentityOutput {
  2409. s.Arn = &v
  2410. return s
  2411. }
  2412. // SetUserId sets the UserId field's value.
  2413. func (s *GetCallerIdentityOutput) SetUserId(v string) *GetCallerIdentityOutput {
  2414. s.UserId = &v
  2415. return s
  2416. }
  2417. type GetFederationTokenInput struct {
  2418. _ struct{} `type:"structure"`
  2419. // The duration, in seconds, that the session should last. Acceptable durations
  2420. // for federation sessions range from 900 seconds (15 minutes) to 129,600 seconds
  2421. // (36 hours), with 43,200 seconds (12 hours) as the default. Sessions obtained
  2422. // using AWS account root user credentials are restricted to a maximum of 3,600
  2423. // seconds (one hour). If the specified duration is longer than one hour, the
  2424. // session obtained by using root user credentials defaults to one hour.
  2425. DurationSeconds *int64 `min:"900" type:"integer"`
  2426. // The name of the federated user. The name is used as an identifier for the
  2427. // temporary security credentials (such as Bob). For example, you can reference
  2428. // the federated user name in a resource-based policy, such as in an Amazon
  2429. // S3 bucket policy.
  2430. //
  2431. // The regex used to validate this parameter is a string of characters consisting
  2432. // of upper- and lower-case alphanumeric characters with no spaces. You can
  2433. // also include underscores or any of the following characters: =,.@-
  2434. //
  2435. // Name is a required field
  2436. Name *string `min:"2" type:"string" required:"true"`
  2437. // An IAM policy in JSON format that you want to use as an inline session policy.
  2438. //
  2439. // You must pass an inline or managed session policy (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session)
  2440. // to this operation. You can pass a single JSON policy document to use as an
  2441. // inline session policy. You can also specify up to 10 managed policies to
  2442. // use as managed session policies.
  2443. //
  2444. // This parameter is optional. However, if you do not pass any session policies,
  2445. // then the resulting federated user session has no permissions.
  2446. //
  2447. // When you pass session policies, the session permissions are the intersection
  2448. // of the IAM user policies and the session policies that you pass. This gives
  2449. // you a way to further restrict the permissions for a federated user. You cannot
  2450. // use session policies to grant more permissions than those that are defined
  2451. // in the permissions policy of the IAM user. For more information, see Session
  2452. // Policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session)
  2453. // in the IAM User Guide.
  2454. //
  2455. // The resulting credentials can be used to access a resource that has a resource-based
  2456. // policy. If that policy specifically references the federated user session
  2457. // in the Principal element of the policy, the session has the permissions allowed
  2458. // by the policy. These permissions are granted in addition to the permissions
  2459. // that are granted by the session policies.
  2460. //
  2461. // The plain text that you use for both inline and managed session policies
  2462. // can't exceed 2,048 characters. The JSON policy characters can be any ASCII
  2463. // character from the space character to the end of the valid character list
  2464. // (\u0020 through \u00FF). It can also include the tab (\u0009), linefeed (\u000A),
  2465. // and carriage return (\u000D) characters.
  2466. //
  2467. // An AWS conversion compresses the passed session policies and session tags
  2468. // into a packed binary format that has a separate limit. Your request can fail
  2469. // for this limit even if your plain text meets the other requirements. The
  2470. // PackedPolicySize response element indicates by percentage how close the policies
  2471. // and tags for your request are to the upper size limit.
  2472. Policy *string `min:"1" type:"string"`
  2473. // The Amazon Resource Names (ARNs) of the IAM managed policies that you want
  2474. // to use as a managed session policy. The policies must exist in the same account
  2475. // as the IAM user that is requesting federated access.
  2476. //
  2477. // You must pass an inline or managed session policy (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session)
  2478. // to this operation. You can pass a single JSON policy document to use as an
  2479. // inline session policy. You can also specify up to 10 managed policies to
  2480. // use as managed session policies. The plain text that you use for both inline
  2481. // and managed session policies can't exceed 2,048 characters. You can provide
  2482. // up to 10 managed policy ARNs. For more information about ARNs, see Amazon
  2483. // Resource Names (ARNs) and AWS Service Namespaces (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html)
  2484. // in the AWS General Reference.
  2485. //
  2486. // This parameter is optional. However, if you do not pass any session policies,
  2487. // then the resulting federated user session has no permissions.
  2488. //
  2489. // When you pass session policies, the session permissions are the intersection
  2490. // of the IAM user policies and the session policies that you pass. This gives
  2491. // you a way to further restrict the permissions for a federated user. You cannot
  2492. // use session policies to grant more permissions than those that are defined
  2493. // in the permissions policy of the IAM user. For more information, see Session
  2494. // Policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session)
  2495. // in the IAM User Guide.
  2496. //
  2497. // The resulting credentials can be used to access a resource that has a resource-based
  2498. // policy. If that policy specifically references the federated user session
  2499. // in the Principal element of the policy, the session has the permissions allowed
  2500. // by the policy. These permissions are granted in addition to the permissions
  2501. // that are granted by the session policies.
  2502. //
  2503. // An AWS conversion compresses the passed session policies and session tags
  2504. // into a packed binary format that has a separate limit. Your request can fail
  2505. // for this limit even if your plain text meets the other requirements. The
  2506. // PackedPolicySize response element indicates by percentage how close the policies
  2507. // and tags for your request are to the upper size limit.
  2508. PolicyArns []*PolicyDescriptorType `type:"list"`
  2509. // A list of session tags. Each session tag consists of a key name and an associated
  2510. // value. For more information about session tags, see Passing Session Tags
  2511. // in STS (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html)
  2512. // in the IAM User Guide.
  2513. //
  2514. // This parameter is optional. You can pass up to 50 session tags. The plain
  2515. // text session tag keys can’t exceed 128 characters and the values can’t
  2516. // exceed 256 characters. For these and additional limits, see IAM and STS Character
  2517. // Limits (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_iam-limits.html#reference_iam-limits-entity-length)
  2518. // in the IAM User Guide.
  2519. //
  2520. // An AWS conversion compresses the passed session policies and session tags
  2521. // into a packed binary format that has a separate limit. Your request can fail
  2522. // for this limit even if your plain text meets the other requirements. The
  2523. // PackedPolicySize response element indicates by percentage how close the policies
  2524. // and tags for your request are to the upper size limit.
  2525. //
  2526. // You can pass a session tag with the same key as a tag that is already attached
  2527. // to the user you are federating. When you do, session tags override a user
  2528. // tag with the same key.
  2529. //
  2530. // Tag key–value pairs are not case sensitive, but case is preserved. This
  2531. // means that you cannot have separate Department and department tag keys. Assume
  2532. // that the role has the Department=Marketing tag and you pass the department=engineering
  2533. // session tag. Department and department are not saved as separate tags, and
  2534. // the session tag passed in the request takes precedence over the role tag.
  2535. Tags []*Tag `type:"list"`
  2536. }
  2537. // String returns the string representation
  2538. func (s GetFederationTokenInput) String() string {
  2539. return awsutil.Prettify(s)
  2540. }
  2541. // GoString returns the string representation
  2542. func (s GetFederationTokenInput) GoString() string {
  2543. return s.String()
  2544. }
  2545. // Validate inspects the fields of the type to determine if they are valid.
  2546. func (s *GetFederationTokenInput) Validate() error {
  2547. invalidParams := request.ErrInvalidParams{Context: "GetFederationTokenInput"}
  2548. if s.DurationSeconds != nil && *s.DurationSeconds < 900 {
  2549. invalidParams.Add(request.NewErrParamMinValue("DurationSeconds", 900))
  2550. }
  2551. if s.Name == nil {
  2552. invalidParams.Add(request.NewErrParamRequired("Name"))
  2553. }
  2554. if s.Name != nil && len(*s.Name) < 2 {
  2555. invalidParams.Add(request.NewErrParamMinLen("Name", 2))
  2556. }
  2557. if s.Policy != nil && len(*s.Policy) < 1 {
  2558. invalidParams.Add(request.NewErrParamMinLen("Policy", 1))
  2559. }
  2560. if s.PolicyArns != nil {
  2561. for i, v := range s.PolicyArns {
  2562. if v == nil {
  2563. continue
  2564. }
  2565. if err := v.Validate(); err != nil {
  2566. invalidParams.AddNested(fmt.Sprintf("%s[%v]", "PolicyArns", i), err.(request.ErrInvalidParams))
  2567. }
  2568. }
  2569. }
  2570. if s.Tags != nil {
  2571. for i, v := range s.Tags {
  2572. if v == nil {
  2573. continue
  2574. }
  2575. if err := v.Validate(); err != nil {
  2576. invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Tags", i), err.(request.ErrInvalidParams))
  2577. }
  2578. }
  2579. }
  2580. if invalidParams.Len() > 0 {
  2581. return invalidParams
  2582. }
  2583. return nil
  2584. }
  2585. // SetDurationSeconds sets the DurationSeconds field's value.
  2586. func (s *GetFederationTokenInput) SetDurationSeconds(v int64) *GetFederationTokenInput {
  2587. s.DurationSeconds = &v
  2588. return s
  2589. }
  2590. // SetName sets the Name field's value.
  2591. func (s *GetFederationTokenInput) SetName(v string) *GetFederationTokenInput {
  2592. s.Name = &v
  2593. return s
  2594. }
  2595. // SetPolicy sets the Policy field's value.
  2596. func (s *GetFederationTokenInput) SetPolicy(v string) *GetFederationTokenInput {
  2597. s.Policy = &v
  2598. return s
  2599. }
  2600. // SetPolicyArns sets the PolicyArns field's value.
  2601. func (s *GetFederationTokenInput) SetPolicyArns(v []*PolicyDescriptorType) *GetFederationTokenInput {
  2602. s.PolicyArns = v
  2603. return s
  2604. }
  2605. // SetTags sets the Tags field's value.
  2606. func (s *GetFederationTokenInput) SetTags(v []*Tag) *GetFederationTokenInput {
  2607. s.Tags = v
  2608. return s
  2609. }
  2610. // Contains the response to a successful GetFederationToken request, including
  2611. // temporary AWS credentials that can be used to make AWS requests.
  2612. type GetFederationTokenOutput struct {
  2613. _ struct{} `type:"structure"`
  2614. // The temporary security credentials, which include an access key ID, a secret
  2615. // access key, and a security (or session) token.
  2616. //
  2617. // The size of the security token that STS API operations return is not fixed.
  2618. // We strongly recommend that you make no assumptions about the maximum size.
  2619. Credentials *Credentials `type:"structure"`
  2620. // Identifiers for the federated user associated with the credentials (such
  2621. // as arn:aws:sts::123456789012:federated-user/Bob or 123456789012:Bob). You
  2622. // can use the federated user's ARN in your resource-based policies, such as
  2623. // an Amazon S3 bucket policy.
  2624. FederatedUser *FederatedUser `type:"structure"`
  2625. // A percentage value that indicates the packed size of the session policies
  2626. // and session tags combined passed in the request. The request fails if the
  2627. // packed size is greater than 100 percent, which means the policies and tags
  2628. // exceeded the allowed space.
  2629. PackedPolicySize *int64 `type:"integer"`
  2630. }
  2631. // String returns the string representation
  2632. func (s GetFederationTokenOutput) String() string {
  2633. return awsutil.Prettify(s)
  2634. }
  2635. // GoString returns the string representation
  2636. func (s GetFederationTokenOutput) GoString() string {
  2637. return s.String()
  2638. }
  2639. // SetCredentials sets the Credentials field's value.
  2640. func (s *GetFederationTokenOutput) SetCredentials(v *Credentials) *GetFederationTokenOutput {
  2641. s.Credentials = v
  2642. return s
  2643. }
  2644. // SetFederatedUser sets the FederatedUser field's value.
  2645. func (s *GetFederationTokenOutput) SetFederatedUser(v *FederatedUser) *GetFederationTokenOutput {
  2646. s.FederatedUser = v
  2647. return s
  2648. }
  2649. // SetPackedPolicySize sets the PackedPolicySize field's value.
  2650. func (s *GetFederationTokenOutput) SetPackedPolicySize(v int64) *GetFederationTokenOutput {
  2651. s.PackedPolicySize = &v
  2652. return s
  2653. }
  2654. type GetSessionTokenInput struct {
  2655. _ struct{} `type:"structure"`
  2656. // The duration, in seconds, that the credentials should remain valid. Acceptable
  2657. // durations for IAM user sessions range from 900 seconds (15 minutes) to 129,600
  2658. // seconds (36 hours), with 43,200 seconds (12 hours) as the default. Sessions
  2659. // for AWS account owners are restricted to a maximum of 3,600 seconds (one
  2660. // hour). If the duration is longer than one hour, the session for AWS account
  2661. // owners defaults to one hour.
  2662. DurationSeconds *int64 `min:"900" type:"integer"`
  2663. // The identification number of the MFA device that is associated with the IAM
  2664. // user who is making the GetSessionToken call. Specify this value if the IAM
  2665. // user has a policy that requires MFA authentication. The value is either the
  2666. // serial number for a hardware device (such as GAHT12345678) or an Amazon Resource
  2667. // Name (ARN) for a virtual device (such as arn:aws:iam::123456789012:mfa/user).
  2668. // You can find the device for an IAM user by going to the AWS Management Console
  2669. // and viewing the user's security credentials.
  2670. //
  2671. // The regex used to validate this parameter is a string of characters consisting
  2672. // of upper- and lower-case alphanumeric characters with no spaces. You can
  2673. // also include underscores or any of the following characters: =,.@:/-
  2674. SerialNumber *string `min:"9" type:"string"`
  2675. // The value provided by the MFA device, if MFA is required. If any policy requires
  2676. // the IAM user to submit an MFA code, specify this value. If MFA authentication
  2677. // is required, the user must provide a code when requesting a set of temporary
  2678. // security credentials. A user who fails to provide the code receives an "access
  2679. // denied" response when requesting resources that require MFA authentication.
  2680. //
  2681. // The format for this parameter, as described by its regex pattern, is a sequence
  2682. // of six numeric digits.
  2683. TokenCode *string `min:"6" type:"string"`
  2684. }
  2685. // String returns the string representation
  2686. func (s GetSessionTokenInput) String() string {
  2687. return awsutil.Prettify(s)
  2688. }
  2689. // GoString returns the string representation
  2690. func (s GetSessionTokenInput) GoString() string {
  2691. return s.String()
  2692. }
  2693. // Validate inspects the fields of the type to determine if they are valid.
  2694. func (s *GetSessionTokenInput) Validate() error {
  2695. invalidParams := request.ErrInvalidParams{Context: "GetSessionTokenInput"}
  2696. if s.DurationSeconds != nil && *s.DurationSeconds < 900 {
  2697. invalidParams.Add(request.NewErrParamMinValue("DurationSeconds", 900))
  2698. }
  2699. if s.SerialNumber != nil && len(*s.SerialNumber) < 9 {
  2700. invalidParams.Add(request.NewErrParamMinLen("SerialNumber", 9))
  2701. }
  2702. if s.TokenCode != nil && len(*s.TokenCode) < 6 {
  2703. invalidParams.Add(request.NewErrParamMinLen("TokenCode", 6))
  2704. }
  2705. if invalidParams.Len() > 0 {
  2706. return invalidParams
  2707. }
  2708. return nil
  2709. }
  2710. // SetDurationSeconds sets the DurationSeconds field's value.
  2711. func (s *GetSessionTokenInput) SetDurationSeconds(v int64) *GetSessionTokenInput {
  2712. s.DurationSeconds = &v
  2713. return s
  2714. }
  2715. // SetSerialNumber sets the SerialNumber field's value.
  2716. func (s *GetSessionTokenInput) SetSerialNumber(v string) *GetSessionTokenInput {
  2717. s.SerialNumber = &v
  2718. return s
  2719. }
  2720. // SetTokenCode sets the TokenCode field's value.
  2721. func (s *GetSessionTokenInput) SetTokenCode(v string) *GetSessionTokenInput {
  2722. s.TokenCode = &v
  2723. return s
  2724. }
  2725. // Contains the response to a successful GetSessionToken request, including
  2726. // temporary AWS credentials that can be used to make AWS requests.
  2727. type GetSessionTokenOutput struct {
  2728. _ struct{} `type:"structure"`
  2729. // The temporary security credentials, which include an access key ID, a secret
  2730. // access key, and a security (or session) token.
  2731. //
  2732. // The size of the security token that STS API operations return is not fixed.
  2733. // We strongly recommend that you make no assumptions about the maximum size.
  2734. Credentials *Credentials `type:"structure"`
  2735. }
  2736. // String returns the string representation
  2737. func (s GetSessionTokenOutput) String() string {
  2738. return awsutil.Prettify(s)
  2739. }
  2740. // GoString returns the string representation
  2741. func (s GetSessionTokenOutput) GoString() string {
  2742. return s.String()
  2743. }
  2744. // SetCredentials sets the Credentials field's value.
  2745. func (s *GetSessionTokenOutput) SetCredentials(v *Credentials) *GetSessionTokenOutput {
  2746. s.Credentials = v
  2747. return s
  2748. }
  2749. // A reference to the IAM managed policy that is passed as a session policy
  2750. // for a role session or a federated user session.
  2751. type PolicyDescriptorType struct {
  2752. _ struct{} `type:"structure"`
  2753. // The Amazon Resource Name (ARN) of the IAM managed policy to use as a session
  2754. // policy for the role. For more information about ARNs, see Amazon Resource
  2755. // Names (ARNs) and AWS Service Namespaces (https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html)
  2756. // in the AWS General Reference.
  2757. Arn *string `locationName:"arn" min:"20" type:"string"`
  2758. }
  2759. // String returns the string representation
  2760. func (s PolicyDescriptorType) String() string {
  2761. return awsutil.Prettify(s)
  2762. }
  2763. // GoString returns the string representation
  2764. func (s PolicyDescriptorType) GoString() string {
  2765. return s.String()
  2766. }
  2767. // Validate inspects the fields of the type to determine if they are valid.
  2768. func (s *PolicyDescriptorType) Validate() error {
  2769. invalidParams := request.ErrInvalidParams{Context: "PolicyDescriptorType"}
  2770. if s.Arn != nil && len(*s.Arn) < 20 {
  2771. invalidParams.Add(request.NewErrParamMinLen("Arn", 20))
  2772. }
  2773. if invalidParams.Len() > 0 {
  2774. return invalidParams
  2775. }
  2776. return nil
  2777. }
  2778. // SetArn sets the Arn field's value.
  2779. func (s *PolicyDescriptorType) SetArn(v string) *PolicyDescriptorType {
  2780. s.Arn = &v
  2781. return s
  2782. }
  2783. // You can pass custom key-value pair attributes when you assume a role or federate
  2784. // a user. These are called session tags. You can then use the session tags
  2785. // to control access to resources. For more information, see Tagging AWS STS
  2786. // Sessions (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html)
  2787. // in the IAM User Guide.
  2788. type Tag struct {
  2789. _ struct{} `type:"structure"`
  2790. // The key for a session tag.
  2791. //
  2792. // You can pass up to 50 session tags. The plain text session tag keys can’t
  2793. // exceed 128 characters. For these and additional limits, see IAM and STS Character
  2794. // Limits (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_iam-limits.html#reference_iam-limits-entity-length)
  2795. // in the IAM User Guide.
  2796. //
  2797. // Key is a required field
  2798. Key *string `min:"1" type:"string" required:"true"`
  2799. // The value for a session tag.
  2800. //
  2801. // You can pass up to 50 session tags. The plain text session tag values can’t
  2802. // exceed 256 characters. For these and additional limits, see IAM and STS Character
  2803. // Limits (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_iam-limits.html#reference_iam-limits-entity-length)
  2804. // in the IAM User Guide.
  2805. //
  2806. // Value is a required field
  2807. Value *string `type:"string" required:"true"`
  2808. }
  2809. // String returns the string representation
  2810. func (s Tag) String() string {
  2811. return awsutil.Prettify(s)
  2812. }
  2813. // GoString returns the string representation
  2814. func (s Tag) GoString() string {
  2815. return s.String()
  2816. }
  2817. // Validate inspects the fields of the type to determine if they are valid.
  2818. func (s *Tag) Validate() error {
  2819. invalidParams := request.ErrInvalidParams{Context: "Tag"}
  2820. if s.Key == nil {
  2821. invalidParams.Add(request.NewErrParamRequired("Key"))
  2822. }
  2823. if s.Key != nil && len(*s.Key) < 1 {
  2824. invalidParams.Add(request.NewErrParamMinLen("Key", 1))
  2825. }
  2826. if s.Value == nil {
  2827. invalidParams.Add(request.NewErrParamRequired("Value"))
  2828. }
  2829. if invalidParams.Len() > 0 {
  2830. return invalidParams
  2831. }
  2832. return nil
  2833. }
  2834. // SetKey sets the Key field's value.
  2835. func (s *Tag) SetKey(v string) *Tag {
  2836. s.Key = &v
  2837. return s
  2838. }
  2839. // SetValue sets the Value field's value.
  2840. func (s *Tag) SetValue(v string) *Tag {
  2841. s.Value = &v
  2842. return s
  2843. }