api.go 104 KB

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