/* * Copyright 2010-2014 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ /* * Do not modify this file. This file is generated from the sts-2011-06-15.normal.json service model. */ using System; using System.Collections.Generic; using System.Net; using Amazon.SecurityToken.Model; using Amazon.SecurityToken.Model.Internal.MarshallTransformations; using Amazon.SecurityToken.Internal; using Amazon.Runtime; using Amazon.Runtime.Internal; using Amazon.Runtime.Internal.Auth; using Amazon.Runtime.Internal.Transform; namespace Amazon.SecurityToken { /// /// Implementation for accessing SecurityTokenService /// /// AWS Security Token Service /// /// The AWS Security Token Service (STS) is a web service that enables you to request /// temporary, limited-privilege credentials for AWS Identity and Access Management (IAM) /// users or for users that you authenticate (federated users). This guide provides descriptions /// of the STS API. For more detailed information about using this service, go to Temporary /// Security Credentials. /// /// /// /// For information about setting up signatures and authorization through the API, go /// to Signing /// AWS API Requests in the AWS General Reference. For general information /// about the Query API, go to Making /// Query Requests in Using IAM. For information about using security tokens /// with other AWS products, go to AWS /// Services That Work with IAM in the IAM User Guide. /// /// /// /// If you're new to AWS and need additional technical information about a specific AWS /// product, you can find the product's technical documentation at http://aws.amazon.com/documentation/. /// /// /// /// /// Endpoints /// /// /// /// By default, AWS Security Token Service (STS) is available as a global service, and /// all AWS STS requests go to a single endpoint at https://sts.amazonaws.com. /// Global requests map to the US East (N. Virginia) region. AWS recommends using Regional /// AWS STS endpoints instead of the global endpoint to reduce latency, build in redundancy, /// and increase session token validity. For more information, see Managing /// AWS STS in an AWS Region in the IAM User Guide. /// /// /// /// Most AWS Regions are enabled for operations in all AWS services by default. Those /// Regions are automatically activated for use with AWS STS. Some Regions, such as Asia /// Pacific (Hong Kong), must be manually enabled. To learn more about enabling and disabling /// AWS Regions, see Managing /// AWS Regions in the AWS General Reference. When you enable these AWS Regions, /// they are automatically activated for use with AWS STS. You cannot activate the STS /// endpoint for a Region that is disabled. Tokens that are valid in all AWS Regions are /// longer than tokens that are valid in Regions that are enabled by default. Changing /// this setting might affect existing systems where you temporarily store tokens. For /// more information, see Managing /// Global Endpoint Session Tokens in the IAM User Guide. /// /// /// /// After you activate a Region for use with AWS STS, you can direct AWS STS API calls /// to that Region. AWS STS recommends that you provide both the Region and endpoint when /// you make calls to a Regional endpoint. You can provide the Region alone for manually /// enabled Regions, such as Asia Pacific (Hong Kong). In this case, the calls are directed /// to the STS Regional endpoint. However, if you provide the Region alone for Regions /// enabled by default, the calls are directed to the global endpoint of https://sts.amazonaws.com. /// /// /// /// To view the list of AWS STS endpoints and whether they are active by default, see /// Writing /// Code to Use AWS STS Regions in the IAM User Guide. /// /// /// /// Recording API requests /// /// /// /// STS supports AWS CloudTrail, which is a service that records AWS calls for your AWS /// account and delivers log files to an Amazon S3 bucket. By using information collected /// by CloudTrail, you can determine what requests were successfully made to STS, who /// made the request, when it was made, and so on. /// /// /// /// If you activate AWS STS endpoints in Regions other than the default global endpoint, /// then you must also turn on CloudTrail logging in those Regions. This is necessary /// to record any AWS STS API calls that are made in those Regions. For more information, /// see Turning /// On CloudTrail in Additional Regions in the AWS CloudTrail User Guide. /// /// /// /// AWS Security Token Service (STS) is a global service with a single endpoint at https://sts.amazonaws.com. /// Calls to this endpoint are logged as calls to a global service. However, because this /// endpoint is physically located in the US East (N. Virginia) Region, your logs list /// us-east-1 as the event Region. CloudTrail does not write these logs to /// the US East (Ohio) Region unless you choose to include global service logs in that /// Region. CloudTrail writes calls to all Regional endpoints to their respective Regions. /// For example, calls to sts.us-east-2.amazonaws.com are published to the US East (Ohio) /// Region and calls to sts.eu-central-1.amazonaws.com are published to the EU (Frankfurt) /// Region. /// /// /// /// To learn more about CloudTrail, including how to turn it on and find your log files, /// see the AWS /// CloudTrail User Guide. /// /// public partial class AmazonSecurityTokenServiceClient : AmazonServiceClient, IAmazonSecurityTokenService { private static IServiceMetadata serviceMetadata = new AmazonSecurityTokenServiceMetadata(); #region Constructors /// /// Constructs AmazonSecurityTokenServiceClient with AWS Credentials /// /// AWS Credentials public AmazonSecurityTokenServiceClient(AWSCredentials credentials) : this(credentials, new AmazonSecurityTokenServiceConfig()) { } /// /// Constructs AmazonSecurityTokenServiceClient with AWS Credentials /// /// AWS Credentials /// The region to connect. public AmazonSecurityTokenServiceClient(AWSCredentials credentials, RegionEndpoint region) : this(credentials, new AmazonSecurityTokenServiceConfig{RegionEndpoint = region}) { } /// /// Constructs AmazonSecurityTokenServiceClient with AWS Credentials and an /// AmazonSecurityTokenServiceClient Configuration object. /// /// AWS Credentials /// The AmazonSecurityTokenServiceClient Configuration Object public AmazonSecurityTokenServiceClient(AWSCredentials credentials, AmazonSecurityTokenServiceConfig clientConfig) : base(credentials, clientConfig) { } /// /// Constructs AmazonSecurityTokenServiceClient with AWS Access Key ID and AWS Secret Key /// /// AWS Access Key ID /// AWS Secret Access Key public AmazonSecurityTokenServiceClient(string awsAccessKeyId, string awsSecretAccessKey) : this(awsAccessKeyId, awsSecretAccessKey, new AmazonSecurityTokenServiceConfig()) { } /// /// Constructs AmazonSecurityTokenServiceClient with AWS Access Key ID and AWS Secret Key /// /// AWS Access Key ID /// AWS Secret Access Key /// The region to connect. public AmazonSecurityTokenServiceClient(string awsAccessKeyId, string awsSecretAccessKey, RegionEndpoint region) : this(awsAccessKeyId, awsSecretAccessKey, new AmazonSecurityTokenServiceConfig() {RegionEndpoint=region}) { } /// /// Constructs AmazonSecurityTokenServiceClient with AWS Access Key ID, AWS Secret Key and an /// AmazonSecurityTokenServiceClient Configuration object. /// /// AWS Access Key ID /// AWS Secret Access Key /// The AmazonSecurityTokenServiceClient Configuration Object public AmazonSecurityTokenServiceClient(string awsAccessKeyId, string awsSecretAccessKey, AmazonSecurityTokenServiceConfig clientConfig) : base(awsAccessKeyId, awsSecretAccessKey, clientConfig) { } /// /// Constructs AmazonSecurityTokenServiceClient with AWS Access Key ID and AWS Secret Key /// /// AWS Access Key ID /// AWS Secret Access Key /// AWS Session Token public AmazonSecurityTokenServiceClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken) : this(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, new AmazonSecurityTokenServiceConfig()) { } /// /// Constructs AmazonSecurityTokenServiceClient with AWS Access Key ID and AWS Secret Key /// /// AWS Access Key ID /// AWS Secret Access Key /// AWS Session Token /// The region to connect. public AmazonSecurityTokenServiceClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken, RegionEndpoint region) : this(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, new AmazonSecurityTokenServiceConfig{RegionEndpoint = region}) { } /// /// Constructs AmazonSecurityTokenServiceClient with AWS Access Key ID, AWS Secret Key and an /// AmazonSecurityTokenServiceClient Configuration object. /// /// AWS Access Key ID /// AWS Secret Access Key /// AWS Session Token /// The AmazonSecurityTokenServiceClient Configuration Object public AmazonSecurityTokenServiceClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken, AmazonSecurityTokenServiceConfig clientConfig) : base(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, clientConfig) { } #endregion #region Overrides /// /// Creates the signer for the service. /// protected override AbstractAWSSigner CreateSigner() { return new AWS4Signer(); } /// /// Capture metadata for the service. /// protected override IServiceMetadata ServiceMetadata { get { return serviceMetadata; } } #endregion #region Dispose /// /// Disposes the service client. /// protected override void Dispose(bool disposing) { base.Dispose(disposing); } #endregion #region AssumeRole internal virtual AssumeRoleResponse AssumeRole(AssumeRoleRequest request) { var options = new InvokeOptions(); options.RequestMarshaller = AssumeRoleRequestMarshaller.Instance; options.ResponseUnmarshaller = AssumeRoleResponseUnmarshaller.Instance; return Invoke(request, options); } /// /// Initiates the asynchronous execution of the AssumeRole operation. /// /// /// Container for the necessary parameters to execute the AssumeRole operation on AmazonSecurityTokenServiceClient. /// An Action delegate that is invoked when the operation completes. /// A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property. /// REST API Reference for AssumeRole Operation public virtual void AssumeRoleAsync(AssumeRoleRequest request, AmazonServiceCallback callback, AsyncOptions options = null) { options = options == null?new AsyncOptions():options; var invokeOptions = new InvokeOptions(); invokeOptions.RequestMarshaller = AssumeRoleRequestMarshaller.Instance; invokeOptions.ResponseUnmarshaller = AssumeRoleResponseUnmarshaller.Instance; Action callbackHelper = null; if(callback !=null ) callbackHelper = (AmazonWebServiceRequest req, AmazonWebServiceResponse res, Exception ex, AsyncOptions ao) => { AmazonServiceResult responseObject = new AmazonServiceResult((AssumeRoleRequest)req, (AssumeRoleResponse)res, ex , ao.State); callback(responseObject); }; BeginInvoke(request, invokeOptions, options, callbackHelper); } #endregion #region AssumeRoleWithSAML internal virtual AssumeRoleWithSAMLResponse AssumeRoleWithSAML(AssumeRoleWithSAMLRequest request) { var options = new InvokeOptions(); options.RequestMarshaller = AssumeRoleWithSAMLRequestMarshaller.Instance; options.ResponseUnmarshaller = AssumeRoleWithSAMLResponseUnmarshaller.Instance; return Invoke(request, options); } /// /// Initiates the asynchronous execution of the AssumeRoleWithSAML operation. /// /// /// Container for the necessary parameters to execute the AssumeRoleWithSAML operation on AmazonSecurityTokenServiceClient. /// An Action delegate that is invoked when the operation completes. /// A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property. /// REST API Reference for AssumeRoleWithSAML Operation public virtual void AssumeRoleWithSAMLAsync(AssumeRoleWithSAMLRequest request, AmazonServiceCallback callback, AsyncOptions options = null) { options = options == null?new AsyncOptions():options; var invokeOptions = new InvokeOptions(); invokeOptions.RequestMarshaller = AssumeRoleWithSAMLRequestMarshaller.Instance; invokeOptions.ResponseUnmarshaller = AssumeRoleWithSAMLResponseUnmarshaller.Instance; Action callbackHelper = null; if(callback !=null ) callbackHelper = (AmazonWebServiceRequest req, AmazonWebServiceResponse res, Exception ex, AsyncOptions ao) => { AmazonServiceResult responseObject = new AmazonServiceResult((AssumeRoleWithSAMLRequest)req, (AssumeRoleWithSAMLResponse)res, ex , ao.State); callback(responseObject); }; BeginInvoke(request, invokeOptions, options, callbackHelper); } #endregion #region AssumeRoleWithWebIdentity internal virtual AssumeRoleWithWebIdentityResponse AssumeRoleWithWebIdentity(AssumeRoleWithWebIdentityRequest request) { var options = new InvokeOptions(); options.RequestMarshaller = AssumeRoleWithWebIdentityRequestMarshaller.Instance; options.ResponseUnmarshaller = AssumeRoleWithWebIdentityResponseUnmarshaller.Instance; return Invoke(request, options); } /// /// Initiates the asynchronous execution of the AssumeRoleWithWebIdentity operation. /// /// /// Container for the necessary parameters to execute the AssumeRoleWithWebIdentity operation on AmazonSecurityTokenServiceClient. /// An Action delegate that is invoked when the operation completes. /// A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property. /// REST API Reference for AssumeRoleWithWebIdentity Operation public virtual void AssumeRoleWithWebIdentityAsync(AssumeRoleWithWebIdentityRequest request, AmazonServiceCallback callback, AsyncOptions options = null) { options = options == null?new AsyncOptions():options; var invokeOptions = new InvokeOptions(); invokeOptions.RequestMarshaller = AssumeRoleWithWebIdentityRequestMarshaller.Instance; invokeOptions.ResponseUnmarshaller = AssumeRoleWithWebIdentityResponseUnmarshaller.Instance; Action callbackHelper = null; if(callback !=null ) callbackHelper = (AmazonWebServiceRequest req, AmazonWebServiceResponse res, Exception ex, AsyncOptions ao) => { AmazonServiceResult responseObject = new AmazonServiceResult((AssumeRoleWithWebIdentityRequest)req, (AssumeRoleWithWebIdentityResponse)res, ex , ao.State); callback(responseObject); }; BeginInvoke(request, invokeOptions, options, callbackHelper); } #endregion #region DecodeAuthorizationMessage internal virtual DecodeAuthorizationMessageResponse DecodeAuthorizationMessage(DecodeAuthorizationMessageRequest request) { var options = new InvokeOptions(); options.RequestMarshaller = DecodeAuthorizationMessageRequestMarshaller.Instance; options.ResponseUnmarshaller = DecodeAuthorizationMessageResponseUnmarshaller.Instance; return Invoke(request, options); } /// /// Initiates the asynchronous execution of the DecodeAuthorizationMessage operation. /// /// /// Container for the necessary parameters to execute the DecodeAuthorizationMessage operation on AmazonSecurityTokenServiceClient. /// An Action delegate that is invoked when the operation completes. /// A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property. /// REST API Reference for DecodeAuthorizationMessage Operation public virtual void DecodeAuthorizationMessageAsync(DecodeAuthorizationMessageRequest request, AmazonServiceCallback callback, AsyncOptions options = null) { options = options == null?new AsyncOptions():options; var invokeOptions = new InvokeOptions(); invokeOptions.RequestMarshaller = DecodeAuthorizationMessageRequestMarshaller.Instance; invokeOptions.ResponseUnmarshaller = DecodeAuthorizationMessageResponseUnmarshaller.Instance; Action callbackHelper = null; if(callback !=null ) callbackHelper = (AmazonWebServiceRequest req, AmazonWebServiceResponse res, Exception ex, AsyncOptions ao) => { AmazonServiceResult responseObject = new AmazonServiceResult((DecodeAuthorizationMessageRequest)req, (DecodeAuthorizationMessageResponse)res, ex , ao.State); callback(responseObject); }; BeginInvoke(request, invokeOptions, options, callbackHelper); } #endregion #region GetAccessKeyInfo internal virtual GetAccessKeyInfoResponse GetAccessKeyInfo(GetAccessKeyInfoRequest request) { var options = new InvokeOptions(); options.RequestMarshaller = GetAccessKeyInfoRequestMarshaller.Instance; options.ResponseUnmarshaller = GetAccessKeyInfoResponseUnmarshaller.Instance; return Invoke(request, options); } /// /// Initiates the asynchronous execution of the GetAccessKeyInfo operation. /// /// /// Container for the necessary parameters to execute the GetAccessKeyInfo operation on AmazonSecurityTokenServiceClient. /// An Action delegate that is invoked when the operation completes. /// A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property. /// REST API Reference for GetAccessKeyInfo Operation public virtual void GetAccessKeyInfoAsync(GetAccessKeyInfoRequest request, AmazonServiceCallback callback, AsyncOptions options = null) { options = options == null?new AsyncOptions():options; var invokeOptions = new InvokeOptions(); invokeOptions.RequestMarshaller = GetAccessKeyInfoRequestMarshaller.Instance; invokeOptions.ResponseUnmarshaller = GetAccessKeyInfoResponseUnmarshaller.Instance; Action callbackHelper = null; if(callback !=null ) callbackHelper = (AmazonWebServiceRequest req, AmazonWebServiceResponse res, Exception ex, AsyncOptions ao) => { AmazonServiceResult responseObject = new AmazonServiceResult((GetAccessKeyInfoRequest)req, (GetAccessKeyInfoResponse)res, ex , ao.State); callback(responseObject); }; BeginInvoke(request, invokeOptions, options, callbackHelper); } #endregion #region GetCallerIdentity internal virtual GetCallerIdentityResponse GetCallerIdentity(GetCallerIdentityRequest request) { var options = new InvokeOptions(); options.RequestMarshaller = GetCallerIdentityRequestMarshaller.Instance; options.ResponseUnmarshaller = GetCallerIdentityResponseUnmarshaller.Instance; return Invoke(request, options); } /// /// Initiates the asynchronous execution of the GetCallerIdentity operation. /// /// /// Container for the necessary parameters to execute the GetCallerIdentity operation on AmazonSecurityTokenServiceClient. /// An Action delegate that is invoked when the operation completes. /// A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property. /// REST API Reference for GetCallerIdentity Operation public virtual void GetCallerIdentityAsync(GetCallerIdentityRequest request, AmazonServiceCallback callback, AsyncOptions options = null) { options = options == null?new AsyncOptions():options; var invokeOptions = new InvokeOptions(); invokeOptions.RequestMarshaller = GetCallerIdentityRequestMarshaller.Instance; invokeOptions.ResponseUnmarshaller = GetCallerIdentityResponseUnmarshaller.Instance; Action callbackHelper = null; if(callback !=null ) callbackHelper = (AmazonWebServiceRequest req, AmazonWebServiceResponse res, Exception ex, AsyncOptions ao) => { AmazonServiceResult responseObject = new AmazonServiceResult((GetCallerIdentityRequest)req, (GetCallerIdentityResponse)res, ex , ao.State); callback(responseObject); }; BeginInvoke(request, invokeOptions, options, callbackHelper); } #endregion #region GetFederationToken internal virtual GetFederationTokenResponse GetFederationToken(GetFederationTokenRequest request) { var options = new InvokeOptions(); options.RequestMarshaller = GetFederationTokenRequestMarshaller.Instance; options.ResponseUnmarshaller = GetFederationTokenResponseUnmarshaller.Instance; return Invoke(request, options); } /// /// Initiates the asynchronous execution of the GetFederationToken operation. /// /// /// Container for the necessary parameters to execute the GetFederationToken operation on AmazonSecurityTokenServiceClient. /// An Action delegate that is invoked when the operation completes. /// A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property. /// REST API Reference for GetFederationToken Operation public virtual void GetFederationTokenAsync(GetFederationTokenRequest request, AmazonServiceCallback callback, AsyncOptions options = null) { options = options == null?new AsyncOptions():options; var invokeOptions = new InvokeOptions(); invokeOptions.RequestMarshaller = GetFederationTokenRequestMarshaller.Instance; invokeOptions.ResponseUnmarshaller = GetFederationTokenResponseUnmarshaller.Instance; Action callbackHelper = null; if(callback !=null ) callbackHelper = (AmazonWebServiceRequest req, AmazonWebServiceResponse res, Exception ex, AsyncOptions ao) => { AmazonServiceResult responseObject = new AmazonServiceResult((GetFederationTokenRequest)req, (GetFederationTokenResponse)res, ex , ao.State); callback(responseObject); }; BeginInvoke(request, invokeOptions, options, callbackHelper); } #endregion #region GetSessionToken /// /// Returns a set of temporary credentials for an AWS account or IAM user. The credentials /// consist of an access key ID, a secret access key, and a security token. Typically, /// you use GetSessionToken if you want to use MFA to protect programmatic /// calls to specific AWS API operations like Amazon EC2 StopInstances. MFA-enabled /// IAM users would need to call GetSessionToken and submit an MFA code that /// is associated with their MFA device. Using the temporary security credentials that /// are returned from the call, IAM users can then make programmatic calls to API operations /// that require MFA authentication. If you do not supply a correct MFA code, then the /// API returns an access denied error. For a comparison of GetSessionToken /// with the other API operations that produce temporary credentials, see Requesting /// Temporary Security Credentials and Comparing /// the AWS STS API operations in the IAM User Guide. /// /// /// /// Session Duration /// /// /// /// The GetSessionToken operation must be called by using the long-term AWS /// security credentials of the AWS account root user or an IAM user. Credentials that /// are created by IAM users are valid for the duration that you specify. This duration /// can range from 900 seconds (15 minutes) up to a maximum of 129,600 seconds (36 hours), /// with a default of 43,200 seconds (12 hours). Credentials based on account credentials /// can range from 900 seconds (15 minutes) up to 3,600 seconds (1 hour), with a default /// of 1 hour. /// /// /// /// Permissions /// /// /// /// The temporary security credentials created by GetSessionToken can be /// used to make API calls to any AWS service with the following exceptions: /// ///
  • /// /// You cannot call any IAM API operations unless MFA authentication information is included /// in the request. /// ///
  • /// /// You cannot call any STS API except AssumeRole or GetCallerIdentity. /// ///
/// /// We recommend that you do not call GetSessionToken with AWS account root /// user credentials. Instead, follow our best /// practices by creating one or more IAM users, giving them the necessary permissions, /// and using IAM users for everyday interaction with AWS. /// /// /// /// The credentials that are returned by GetSessionToken are based on permissions /// associated with the user whose credentials were used to call the operation. If GetSessionToken /// is called using AWS account root user credentials, the temporary credentials have /// root user permissions. Similarly, if GetSessionToken is called using /// the credentials of an IAM user, the temporary credentials have the same permissions /// as the IAM user. /// /// /// /// For more information about using GetSessionToken to create temporary /// credentials, go to Temporary /// Credentials for Users in Untrusted Environments in the IAM User Guide. /// /// ///
/// /// The response from the GetSessionToken service method, as returned by SecurityTokenService. /// /// STS is not activated in the requested region for the account that is being asked to /// generate credentials. The account administrator must use the IAM console to activate /// STS in that region. For more information, see Activating /// and Deactivating AWS STS in an AWS Region in the IAM User Guide. /// /// REST API Reference for GetSessionToken Operation internal virtual GetSessionTokenResponse GetSessionToken() { return GetSessionToken(new GetSessionTokenRequest()); } internal virtual GetSessionTokenResponse GetSessionToken(GetSessionTokenRequest request) { var options = new InvokeOptions(); options.RequestMarshaller = GetSessionTokenRequestMarshaller.Instance; options.ResponseUnmarshaller = GetSessionTokenResponseUnmarshaller.Instance; return Invoke(request, options); } /// /// Returns a set of temporary credentials for an AWS account or IAM user. The credentials /// consist of an access key ID, a secret access key, and a security token. Typically, /// you use GetSessionToken if you want to use MFA to protect programmatic /// calls to specific AWS API operations like Amazon EC2 StopInstances. MFA-enabled /// IAM users would need to call GetSessionToken and submit an MFA code that /// is associated with their MFA device. Using the temporary security credentials that /// are returned from the call, IAM users can then make programmatic calls to API operations /// that require MFA authentication. If you do not supply a correct MFA code, then the /// API returns an access denied error. For a comparison of GetSessionToken /// with the other API operations that produce temporary credentials, see Requesting /// Temporary Security Credentials and Comparing /// the AWS STS API operations in the IAM User Guide. /// /// /// /// Session Duration /// /// /// /// The GetSessionToken operation must be called by using the long-term AWS /// security credentials of the AWS account root user or an IAM user. Credentials that /// are created by IAM users are valid for the duration that you specify. This duration /// can range from 900 seconds (15 minutes) up to a maximum of 129,600 seconds (36 hours), /// with a default of 43,200 seconds (12 hours). Credentials based on account credentials /// can range from 900 seconds (15 minutes) up to 3,600 seconds (1 hour), with a default /// of 1 hour. /// /// /// /// Permissions /// /// /// /// The temporary security credentials created by GetSessionToken can be /// used to make API calls to any AWS service with the following exceptions: /// ///
  • /// /// You cannot call any IAM API operations unless MFA authentication information is included /// in the request. /// ///
  • /// /// You cannot call any STS API except AssumeRole or GetCallerIdentity. /// ///
/// /// We recommend that you do not call GetSessionToken with AWS account root /// user credentials. Instead, follow our best /// practices by creating one or more IAM users, giving them the necessary permissions, /// and using IAM users for everyday interaction with AWS. /// /// /// /// The credentials that are returned by GetSessionToken are based on permissions /// associated with the user whose credentials were used to call the operation. If GetSessionToken /// is called using AWS account root user credentials, the temporary credentials have /// root user permissions. Similarly, if GetSessionToken is called using /// the credentials of an IAM user, the temporary credentials have the same permissions /// as the IAM user. /// /// /// /// For more information about using GetSessionToken to create temporary /// credentials, go to Temporary /// Credentials for Users in Untrusted Environments in the IAM User Guide. /// /// ///
/// An Action delegate that is invoked when the operation completes. /// /// A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property. /// /// /// The response from the GetSessionToken service method, as returned by SecurityTokenService. /// /// STS is not activated in the requested region for the account that is being asked to /// generate credentials. The account administrator must use the IAM console to activate /// STS in that region. For more information, see Activating /// and Deactivating AWS STS in an AWS Region in the IAM User Guide. /// /// REST API Reference for GetSessionToken Operation public virtual void GetSessionTokenAsync(AmazonServiceCallback callback, AsyncOptions options = null) { GetSessionTokenAsync(new GetSessionTokenRequest(), callback, options); } /// /// Initiates the asynchronous execution of the GetSessionToken operation. /// /// /// Container for the necessary parameters to execute the GetSessionToken operation on AmazonSecurityTokenServiceClient. /// An Action delegate that is invoked when the operation completes. /// A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property. /// REST API Reference for GetSessionToken Operation public virtual void GetSessionTokenAsync(GetSessionTokenRequest request, AmazonServiceCallback callback, AsyncOptions options = null) { options = options == null?new AsyncOptions():options; var invokeOptions = new InvokeOptions(); invokeOptions.RequestMarshaller = GetSessionTokenRequestMarshaller.Instance; invokeOptions.ResponseUnmarshaller = GetSessionTokenResponseUnmarshaller.Instance; Action callbackHelper = null; if(callback !=null ) callbackHelper = (AmazonWebServiceRequest req, AmazonWebServiceResponse res, Exception ex, AsyncOptions ao) => { AmazonServiceResult responseObject = new AmazonServiceResult((GetSessionTokenRequest)req, (GetSessionTokenResponse)res, ex , ao.State); callback(responseObject); }; BeginInvoke(request, invokeOptions, options, callbackHelper); } #endregion } }