api.go 138 KB

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