api.go 156 KB

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