api.go 106 KB

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