Container for the parameters to the SetIdentityPoolRoles operation. Sets the roles for an identity pool. These roles are used when making calls to GetCredentialsForIdentity action.

You must use AWS Developer credentials to call this API.

Inheritance: AmazonCognitoIdentityRequest
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.CognitoIdentity.Model.SetIdentityPoolRolesRequest();

            if (cmdletContext.IdentityPoolId != null)
            {
                request.IdentityPoolId = cmdletContext.IdentityPoolId;
            }
            if (cmdletContext.RoleMapping != null)
            {
                request.RoleMappings = cmdletContext.RoleMapping;
            }
            if (cmdletContext.Role != null)
            {
                request.Roles = cmdletContext.Role;
            }

            CmdletOutput output;

            // issue call
            var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint);

            try
            {
                var    response       = CallAWSServiceOperation(client, request);
                object pipelineOutput = null;
                pipelineOutput = cmdletContext.Select(response, this);
                output         = new CmdletOutput
                {
                    PipelineOutput  = pipelineOutput,
                    ServiceResponse = response
                };
            }
            catch (Exception e)
            {
                output = new CmdletOutput {
                    ErrorResponse = e
                };
            }

            return(output);
        }
        /// <summary>
        /// Sets the roles for an identity pool. These roles are used when making calls to <code>GetCredentialsForIdentity</code>
        /// action.
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the SetIdentityPoolRoles service method.</param>
        /// 
        /// <returns>The response from the SetIdentityPoolRoles service method, as returned by CognitoIdentity.</returns>
        /// <exception cref="Amazon.CognitoIdentity.Model.InternalErrorException">
        /// Thrown when the service encounters an error during processing the request.
        /// </exception>
        /// <exception cref="Amazon.CognitoIdentity.Model.InvalidParameterException">
        /// Thrown for missing or bad input parameter(s).
        /// </exception>
        /// <exception cref="Amazon.CognitoIdentity.Model.NotAuthorizedException">
        /// Thrown when a user is not authorized to access the requested resource.
        /// </exception>
        /// <exception cref="Amazon.CognitoIdentity.Model.ResourceConflictException">
        /// Thrown when a user tries to use a login which is already linked to another account.
        /// </exception>
        /// <exception cref="Amazon.CognitoIdentity.Model.ResourceNotFoundException">
        /// Thrown when the requested resource (for example, a dataset or record) does not exist.
        /// </exception>
        /// <exception cref="Amazon.CognitoIdentity.Model.TooManyRequestsException">
        /// Thrown when a request is throttled.
        /// </exception>
        internal SetIdentityPoolRolesResponse SetIdentityPoolRoles(SetIdentityPoolRolesRequest request)
        {
            var marshaller = new SetIdentityPoolRolesRequestMarshaller();
            var unmarshaller = SetIdentityPoolRolesResponseUnmarshaller.Instance;

            return Invoke<SetIdentityPoolRolesRequest,SetIdentityPoolRolesResponse>(request, marshaller, unmarshaller);
        }
 /// <summary>
 /// Initiates the asynchronous execution of the SetIdentityPoolRoles operation.
 /// </summary>
 /// 
 /// <param name="request">Container for the necessary parameters to execute the SetIdentityPoolRoles operation on AmazonCognitoIdentityClient.</param>
 /// <param name="callback">An Action delegate that is invoked when the operation completes.</param>
 /// <param name="options">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
 ///          procedure using the AsyncState property.</param>
 public void SetIdentityPoolRolesAsync(SetIdentityPoolRolesRequest request, AmazonServiceCallback<SetIdentityPoolRolesRequest, SetIdentityPoolRolesResponse> callback, AsyncOptions options = null)
 {
     options = options == null?new AsyncOptions():options;
     var marshaller = new SetIdentityPoolRolesRequestMarshaller();
     var unmarshaller = SetIdentityPoolRolesResponseUnmarshaller.Instance;
     Action<AmazonWebServiceRequest, AmazonWebServiceResponse, Exception, AsyncOptions> callbackHelper = null;
     if(callback !=null )
         callbackHelper = (AmazonWebServiceRequest req, AmazonWebServiceResponse res, Exception ex, AsyncOptions ao) => { 
             AmazonServiceResult<SetIdentityPoolRolesRequest,SetIdentityPoolRolesResponse> responseObject 
                     = new AmazonServiceResult<SetIdentityPoolRolesRequest,SetIdentityPoolRolesResponse>((SetIdentityPoolRolesRequest)req, (SetIdentityPoolRolesResponse)res, ex , ao.State);    
                 callback(responseObject); 
         };
     BeginInvoke<SetIdentityPoolRolesRequest>(request, marshaller, unmarshaller, options, callbackHelper);
 }
 /// <summary>
 /// Sets the roles for an identity pool. These roles are used when making calls to <code>GetCredentialsForIdentity</code>
 /// action.
 /// </summary>
 /// <param name="identityPoolId">An identity pool ID in the format REGION:GUID.</param>
 /// <param name="roles">The map of roles associated with this pool. Currently only authenticated and unauthenticated roles are supported.</param>
 /// 
 /// <returns>The response from the SetIdentityPoolRoles service method, as returned by CognitoIdentity.</returns>
 /// <exception cref="Amazon.CognitoIdentity.Model.InternalErrorException">
 /// Thrown when the service encounters an error during processing the request.
 /// </exception>
 /// <exception cref="Amazon.CognitoIdentity.Model.InvalidParameterException">
 /// Thrown for missing or bad input parameter(s).
 /// </exception>
 /// <exception cref="Amazon.CognitoIdentity.Model.NotAuthorizedException">
 /// Thrown when a user is not authorized to access the requested resource.
 /// </exception>
 /// <exception cref="Amazon.CognitoIdentity.Model.ResourceConflictException">
 /// Thrown when a user tries to use a login which is already linked to another account.
 /// </exception>
 /// <exception cref="Amazon.CognitoIdentity.Model.ResourceNotFoundException">
 /// Thrown when the requested resource (for example, a dataset or record) does not exist.
 /// </exception>
 /// <exception cref="Amazon.CognitoIdentity.Model.TooManyRequestsException">
 /// Thrown when a request is throttled.
 /// </exception>
 public void SetIdentityPoolRolesAsync(string identityPoolId, Dictionary<string, string> roles, AmazonServiceCallback<SetIdentityPoolRolesRequest, SetIdentityPoolRolesResponse> callback, AsyncOptions options = null)
 {
     var request = new SetIdentityPoolRolesRequest();
     request.IdentityPoolId = identityPoolId;
     request.Roles = roles;
     SetIdentityPoolRolesAsync(request, callback, options);
 }
        /// <summary>
        /// Initiates the asynchronous execution of the SetIdentityPoolRoles operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the SetIdentityPoolRoles operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        public Task<SetIdentityPoolRolesResponse> SetIdentityPoolRolesAsync(SetIdentityPoolRolesRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new SetIdentityPoolRolesRequestMarshaller();
            var unmarshaller = SetIdentityPoolRolesResponseUnmarshaller.Instance;

            return InvokeAsync<SetIdentityPoolRolesRequest,SetIdentityPoolRolesResponse>(request, marshaller, 
                unmarshaller, cancellationToken);
        }
 /// <summary>
 /// Sets the roles for an identity pool. These roles are used when making calls to <code>GetCredentialsForIdentity</code>
 /// action.
 /// 
 ///  
 /// <para>
 /// You must use AWS Developer credentials to call this API.
 /// </para>
 /// </summary>
 /// <param name="identityPoolId">An identity pool ID in the format REGION:GUID.</param>
 /// <param name="roles">The map of roles associated with this pool. For a given role, the key will be either "authenticated" or "unauthenticated" and the value will be the Role ARN.</param>
 /// <param name="cancellationToken">
 ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
 /// </param>
 /// 
 /// <returns>The response from the SetIdentityPoolRoles service method, as returned by CognitoIdentity.</returns>
 /// <exception cref="Amazon.CognitoIdentity.Model.ConcurrentModificationException">
 /// Thrown if there are parallel requests to modify a resource.
 /// </exception>
 /// <exception cref="Amazon.CognitoIdentity.Model.InternalErrorException">
 /// Thrown when the service encounters an error during processing the request.
 /// </exception>
 /// <exception cref="Amazon.CognitoIdentity.Model.InvalidParameterException">
 /// Thrown for missing or bad input parameter(s).
 /// </exception>
 /// <exception cref="Amazon.CognitoIdentity.Model.NotAuthorizedException">
 /// Thrown when a user is not authorized to access the requested resource.
 /// </exception>
 /// <exception cref="Amazon.CognitoIdentity.Model.ResourceConflictException">
 /// Thrown when a user tries to use a login which is already linked to another account.
 /// </exception>
 /// <exception cref="Amazon.CognitoIdentity.Model.ResourceNotFoundException">
 /// Thrown when the requested resource (for example, a dataset or record) does not exist.
 /// </exception>
 /// <exception cref="Amazon.CognitoIdentity.Model.TooManyRequestsException">
 /// Thrown when a request is throttled.
 /// </exception>
 public Task<SetIdentityPoolRolesResponse> SetIdentityPoolRolesAsync(string identityPoolId, Dictionary<string, string> roles, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
 {
     var request = new SetIdentityPoolRolesRequest();
     request.IdentityPoolId = identityPoolId;
     request.Roles = roles;
     return SetIdentityPoolRolesAsync(request, cancellationToken);
 }
 /// <summary>
 /// Sets the roles for an identity pool. These roles are used when making calls to <code>GetCredentialsForIdentity</code>
 /// action.
 /// 
 ///  
 /// <para>
 /// You must use AWS Developer credentials to call this API.
 /// </para>
 /// </summary>
 /// <param name="identityPoolId">An identity pool ID in the format REGION:GUID.</param>
 /// <param name="roles">The map of roles associated with this pool. For a given role, the key will be either "authenticated" or "unauthenticated" and the value will be the Role ARN.</param>
 /// 
 /// <returns>The response from the SetIdentityPoolRoles service method, as returned by CognitoIdentity.</returns>
 /// <exception cref="Amazon.CognitoIdentity.Model.ConcurrentModificationException">
 /// Thrown if there are parallel requests to modify a resource.
 /// </exception>
 /// <exception cref="Amazon.CognitoIdentity.Model.InternalErrorException">
 /// Thrown when the service encounters an error during processing the request.
 /// </exception>
 /// <exception cref="Amazon.CognitoIdentity.Model.InvalidParameterException">
 /// Thrown for missing or bad input parameter(s).
 /// </exception>
 /// <exception cref="Amazon.CognitoIdentity.Model.NotAuthorizedException">
 /// Thrown when a user is not authorized to access the requested resource.
 /// </exception>
 /// <exception cref="Amazon.CognitoIdentity.Model.ResourceConflictException">
 /// Thrown when a user tries to use a login which is already linked to another account.
 /// </exception>
 /// <exception cref="Amazon.CognitoIdentity.Model.ResourceNotFoundException">
 /// Thrown when the requested resource (for example, a dataset or record) does not exist.
 /// </exception>
 /// <exception cref="Amazon.CognitoIdentity.Model.TooManyRequestsException">
 /// Thrown when a request is throttled.
 /// </exception>
 public SetIdentityPoolRolesResponse SetIdentityPoolRoles(string identityPoolId, Dictionary<string, string> roles)
 {
     var request = new SetIdentityPoolRolesRequest();
     request.IdentityPoolId = identityPoolId;
     request.Roles = roles;
     return SetIdentityPoolRoles(request);
 }
        /// <summary>
        /// Initiates the asynchronous execution of the SetIdentityPoolRoles operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the SetIdentityPoolRoles operation on AmazonCognitoIdentityClient.</param>
        /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
        /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
        ///          procedure using the AsyncState property.</param>
        /// 
        /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndSetIdentityPoolRoles
        ///         operation.</returns>
        public IAsyncResult BeginSetIdentityPoolRoles(SetIdentityPoolRolesRequest request, AsyncCallback callback, object state)
        {
            var marshaller = new SetIdentityPoolRolesRequestMarshaller();
            var unmarshaller = SetIdentityPoolRolesResponseUnmarshaller.Instance;

            return BeginInvoke<SetIdentityPoolRolesRequest>(request, marshaller, unmarshaller,
                callback, state);
        }
 private Amazon.CognitoIdentity.Model.SetIdentityPoolRolesResponse CallAWSServiceOperation(IAmazonCognitoIdentity client, Amazon.CognitoIdentity.Model.SetIdentityPoolRolesRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Cognito Identity", "SetIdentityPoolRoles");
     try
     {
         #if DESKTOP
         return(client.SetIdentityPoolRoles(request));
         #elif CORECLR
         return(client.SetIdentityPoolRolesAsync(request).GetAwaiter().GetResult());
         #else
                 #error "Unknown build edition"
         #endif
     }
     catch (AmazonServiceException exc)
     {
         var webException = exc.InnerException as System.Net.WebException;
         if (webException != null)
         {
             throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException);
         }
         throw;
     }
 }