api.go 103 KB

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