Container for the parameters to the EnableMFADevice operation. Enables the specified MFA device and associates it with the specified IAM user. When enabled, the MFA device is required for every subsequent login by the IAM user associated with the device.
Inheritance: AmazonIdentityManagementServiceRequest
Exemple #1
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.IdentityManagement.Model.EnableMFADeviceRequest();

            if (cmdletContext.AuthenticationCode1 != null)
            {
                request.AuthenticationCode1 = cmdletContext.AuthenticationCode1;
            }
            if (cmdletContext.AuthenticationCode2 != null)
            {
                request.AuthenticationCode2 = cmdletContext.AuthenticationCode2;
            }
            if (cmdletContext.SerialNumber != null)
            {
                request.SerialNumber = cmdletContext.SerialNumber;
            }
            if (cmdletContext.UserName != null)
            {
                request.UserName = cmdletContext.UserName;
            }

            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>
        /// Initiates the asynchronous execution of the EnableMFADevice operation.
        /// <seealso cref="Amazon.IdentityManagement.IAmazonIdentityManagementService"/>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the EnableMFADevice 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<EnableMFADeviceResponse> EnableMFADeviceAsync(EnableMFADeviceRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new EnableMFADeviceRequestMarshaller();
            var unmarshaller = EnableMFADeviceResponseUnmarshaller.Instance;

            return InvokeAsync<EnableMFADeviceRequest,EnableMFADeviceResponse>(request, marshaller, 
                unmarshaller, cancellationToken);
        }
        internal EnableMFADeviceResponse EnableMFADevice(EnableMFADeviceRequest request)
        {
            var marshaller = new EnableMFADeviceRequestMarshaller();
            var unmarshaller = EnableMFADeviceResponseUnmarshaller.Instance;

            return Invoke<EnableMFADeviceRequest,EnableMFADeviceResponse>(request, marshaller, unmarshaller);
        }
 /// <summary>
 /// Initiates the asynchronous execution of the EnableMFADevice operation.
 /// <seealso cref="Amazon.IdentityManagement.AmazonIdentityManagementService.EnableMFADevice"/>
 /// </summary>
 /// 
 /// <param name="enableMFADeviceRequest">Container for the necessary parameters to execute the EnableMFADevice operation on
 ///          AmazonIdentityManagementService.</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>
 public IAsyncResult BeginEnableMFADevice(EnableMFADeviceRequest enableMFADeviceRequest, AsyncCallback callback, object state)
 {
     return invokeEnableMFADevice(enableMFADeviceRequest, callback, state, false);
 }
 IAsyncResult invokeEnableMFADevice(EnableMFADeviceRequest enableMFADeviceRequest, AsyncCallback callback, object state, bool synchronized)
 {
     IRequest irequest = new EnableMFADeviceRequestMarshaller().Marshall(enableMFADeviceRequest);
     var unmarshaller = EnableMFADeviceResponseUnmarshaller.GetInstance();
     AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller);
     Invoke(result);
     return result;
 }
 /// <summary>
 /// <para>Enables the specified MFA device and associates it with the specified user name. When enabled, the MFA device is required for every
 /// subsequent login by the user name associated with the device.</para>
 /// </summary>
 /// 
 /// <param name="enableMFADeviceRequest">Container for the necessary parameters to execute the EnableMFADevice service method on
 ///          AmazonIdentityManagementService.</param>
 /// 
 /// <exception cref="EntityTemporarilyUnmodifiableException"/>
 /// <exception cref="NoSuchEntityException"/>
 /// <exception cref="InvalidAuthenticationCodeException"/>
 /// <exception cref="LimitExceededException"/>
 /// <exception cref="EntityAlreadyExistsException"/>
 public EnableMFADeviceResponse EnableMFADevice(EnableMFADeviceRequest enableMFADeviceRequest)
 {
     IAsyncResult asyncResult = invokeEnableMFADevice(enableMFADeviceRequest, null, null, true);
     return EndEnableMFADevice(asyncResult);
 }
        /// <summary>
        /// Initiates the asynchronous execution of the EnableMFADevice operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the EnableMFADevice operation on AmazonIdentityManagementServiceClient.</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 EndEnableMFADevice
        ///         operation.</returns>
        public IAsyncResult BeginEnableMFADevice(EnableMFADeviceRequest request, AsyncCallback callback, object state)
        {
            var marshaller = new EnableMFADeviceRequestMarshaller();
            var unmarshaller = EnableMFADeviceResponseUnmarshaller.Instance;

            return BeginInvoke<EnableMFADeviceRequest>(request, marshaller, unmarshaller,
                callback, state);
        }
 /// <summary>
 /// <para>Enables the specified MFA device and associates it with the
 /// specified User name. Once enabled, the MFA device is required for
 /// every subsequent login by the User name associated with the
 /// device.</para>
 /// </summary>
 /// 
 /// <param name="enableMFADeviceRequest">Container for the necessary
 ///           parameters to execute the EnableMFADevice service method on
 ///           AmazonIdentityManagementService.</param>
 /// 
 /// <exception cref="EntityTemporarilyUnmodifiableException"/>
 /// <exception cref="NoSuchEntityException"/>
 /// <exception cref="InvalidAuthenticationCodeException"/>
 /// <exception cref="LimitExceededException"/>
 /// <exception cref="EntityAlreadyExistsException"/>
 public EnableMFADeviceResponse EnableMFADevice(EnableMFADeviceRequest enableMFADeviceRequest)
 {
     IRequest<EnableMFADeviceRequest> request = new EnableMFADeviceRequestMarshaller().Marshall(enableMFADeviceRequest);
     EnableMFADeviceResponse response = Invoke<EnableMFADeviceRequest, EnableMFADeviceResponse> (request, this.signer, EnableMFADeviceResponseUnmarshaller.GetInstance());
     return response;
 }
 /// <summary>
 /// Initiates the asynchronous execution of the EnableMFADevice operation.
 /// </summary>
 /// 
 /// <param name="request">Container for the necessary parameters to execute the EnableMFADevice operation on AmazonIdentityManagementServiceClient.</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 EnableMFADeviceAsync(EnableMFADeviceRequest request, AmazonServiceCallback<EnableMFADeviceRequest, EnableMFADeviceResponse> callback, AsyncOptions options = null)
 {
     options = options == null?new AsyncOptions():options;
     var marshaller = new EnableMFADeviceRequestMarshaller();
     var unmarshaller = EnableMFADeviceResponseUnmarshaller.Instance;
     Action<AmazonWebServiceRequest, AmazonWebServiceResponse, Exception, AsyncOptions> callbackHelper = null;
     if(callback !=null )
         callbackHelper = (AmazonWebServiceRequest req, AmazonWebServiceResponse res, Exception ex, AsyncOptions ao) => { 
             AmazonServiceResult<EnableMFADeviceRequest,EnableMFADeviceResponse> responseObject 
                     = new AmazonServiceResult<EnableMFADeviceRequest,EnableMFADeviceResponse>((EnableMFADeviceRequest)req, (EnableMFADeviceResponse)res, ex , ao.State);    
                 callback(responseObject); 
         };
     BeginInvoke<EnableMFADeviceRequest>(request, marshaller, unmarshaller, options, callbackHelper);
 }
        /// <summary>
        /// Initiates the asynchronous execution of the EnableMFADevice operation.
        /// <seealso cref="Amazon.IdentityManagement.IAmazonIdentityManagementService.EnableMFADevice"/>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the EnableMFADevice 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 async Task<EnableMFADeviceResponse> EnableMFADeviceAsync(EnableMFADeviceRequest request, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new EnableMFADeviceRequestMarshaller();
            var unmarshaller = EnableMFADeviceResponseUnmarshaller.GetInstance();
            var response = await Invoke<IRequest, EnableMFADeviceRequest, EnableMFADeviceResponse>(request, marshaller, unmarshaller, signer, cancellationToken)
                .ConfigureAwait(continueOnCapturedContext: false);
            return response;
        }
        /// <summary>
        /// <para>Enables the specified MFA device and associates it with the specified user name. When enabled, the MFA device is required for every
        /// subsequent login by the user name associated with the device.</para>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the EnableMFADevice service method on
        /// AmazonIdentityManagementService.</param>
        /// 
        /// <exception cref="T:Amazon.IdentityManagement.Model.EntityTemporarilyUnmodifiableException" />
        /// <exception cref="T:Amazon.IdentityManagement.Model.NoSuchEntityException" />
        /// <exception cref="T:Amazon.IdentityManagement.Model.InvalidAuthenticationCodeException" />
        /// <exception cref="T:Amazon.IdentityManagement.Model.LimitExceededException" />
        /// <exception cref="T:Amazon.IdentityManagement.Model.EntityAlreadyExistsException" />
		public EnableMFADeviceResponse EnableMFADevice(EnableMFADeviceRequest request)
        {
            var task = EnableMFADeviceAsync(request);
            try
            {
                return task.Result;
            }
            catch(AggregateException e)
            {
                throw e.InnerException;
            }
        }
Exemple #12
0
        /// <summary>
        /// <para>Enables the specified MFA device and associates it with the specified user name. When enabled, the MFA device is required for every
        /// subsequent login by the user name associated with the device.</para>
        /// </summary>
        /// 
        /// <param name="enableMFADeviceRequest">Container for the necessary parameters to execute the EnableMFADevice service method on
        /// AmazonIdentityManagementService.</param>
        /// 
        /// <exception cref="T:Amazon.IdentityManagement.Model.EntityTemporarilyUnmodifiableException" />
        /// <exception cref="T:Amazon.IdentityManagement.Model.NoSuchEntityException" />
        /// <exception cref="T:Amazon.IdentityManagement.Model.InvalidAuthenticationCodeException" />
        /// <exception cref="T:Amazon.IdentityManagement.Model.LimitExceededException" />
        /// <exception cref="T:Amazon.IdentityManagement.Model.EntityAlreadyExistsException" />
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
		public Task<EnableMFADeviceResponse> EnableMFADeviceAsync(EnableMFADeviceRequest enableMFADeviceRequest, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new EnableMFADeviceRequestMarshaller();
            var unmarshaller = EnableMFADeviceResponseUnmarshaller.GetInstance();
            return Invoke<IRequest, EnableMFADeviceRequest, EnableMFADeviceResponse>(enableMFADeviceRequest, marshaller, unmarshaller, signer, cancellationToken);
        }
Exemple #13
0
		internal EnableMFADeviceResponse EnableMFADevice(EnableMFADeviceRequest request)
        {
            var task = EnableMFADeviceAsync(request);
            try
            {
                return task.Result;
            }
            catch(AggregateException e)
            {
                ExceptionDispatchInfo.Capture(e.InnerException).Throw();
                return null;
            }
        }
        IAsyncResult invokeEnableMFADevice(EnableMFADeviceRequest request, AsyncCallback callback, object state, bool synchronized)
        {
            var marshaller = new EnableMFADeviceRequestMarshaller();
            var unmarshaller = EnableMFADeviceResponseUnmarshaller.Instance;

            return Invoke(request, callback, state, synchronized, marshaller, unmarshaller, signer);
        }
Exemple #15
0
 private Amazon.IdentityManagement.Model.EnableMFADeviceResponse CallAWSServiceOperation(IAmazonIdentityManagementService client, Amazon.IdentityManagement.Model.EnableMFADeviceRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Identity and Access Management", "EnableMFADevice");
     try
     {
         #if DESKTOP
         return(client.EnableMFADevice(request));
         #elif CORECLR
         return(client.EnableMFADeviceAsync(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;
     }
 }