Removes the specified role from the specified instance profile.
public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.IdentityManagement.Model.RemoveRoleFromInstanceProfileRequest(); if (cmdletContext.InstanceProfileName != null) { request.InstanceProfileName = cmdletContext.InstanceProfileName; } if (cmdletContext.RoleName != null) { request.RoleName = cmdletContext.RoleName; } 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); }
private Amazon.IdentityManagement.Model.RemoveRoleFromInstanceProfileResponse CallAWSServiceOperation(IAmazonIdentityManagementService client, Amazon.IdentityManagement.Model.RemoveRoleFromInstanceProfileRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Identity and Access Management", "RemoveRoleFromInstanceProfile"); try { #if DESKTOP return(client.RemoveRoleFromInstanceProfile(request)); #elif CORECLR return(client.RemoveRoleFromInstanceProfileAsync(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; } }
/// <summary> /// Initiates the asynchronous execution of the RemoveRoleFromInstanceProfile operation. /// <seealso cref="Amazon.IdentityManagement.IAmazonIdentityManagementService"/> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the RemoveRoleFromInstanceProfile 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<RemoveRoleFromInstanceProfileResponse> RemoveRoleFromInstanceProfileAsync(RemoveRoleFromInstanceProfileRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new RemoveRoleFromInstanceProfileRequestMarshaller(); var unmarshaller = RemoveRoleFromInstanceProfileResponseUnmarshaller.Instance; return InvokeAsync<RemoveRoleFromInstanceProfileRequest,RemoveRoleFromInstanceProfileResponse>(request, marshaller, unmarshaller, cancellationToken); }
IAsyncResult invokeRemoveRoleFromInstanceProfile(RemoveRoleFromInstanceProfileRequest removeRoleFromInstanceProfileRequest, AsyncCallback callback, object state, bool synchronized) { IRequest irequest = new RemoveRoleFromInstanceProfileRequestMarshaller().Marshall(removeRoleFromInstanceProfileRequest); var unmarshaller = RemoveRoleFromInstanceProfileResponseUnmarshaller.GetInstance(); AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller); Invoke(result); return result; }
internal RemoveRoleFromInstanceProfileResponse RemoveRoleFromInstanceProfile(RemoveRoleFromInstanceProfileRequest request) { var marshaller = new RemoveRoleFromInstanceProfileRequestMarshaller(); var unmarshaller = RemoveRoleFromInstanceProfileResponseUnmarshaller.Instance; return Invoke<RemoveRoleFromInstanceProfileRequest,RemoveRoleFromInstanceProfileResponse>(request, marshaller, unmarshaller); }
/// <summary> /// Initiates the asynchronous execution of the RemoveRoleFromInstanceProfile operation. /// <seealso cref="Amazon.IdentityManagement.AmazonIdentityManagementService.RemoveRoleFromInstanceProfile"/> /// </summary> /// /// <param name="removeRoleFromInstanceProfileRequest">Container for the necessary parameters to execute the RemoveRoleFromInstanceProfile /// 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 BeginRemoveRoleFromInstanceProfile(RemoveRoleFromInstanceProfileRequest removeRoleFromInstanceProfileRequest, AsyncCallback callback, object state) { return invokeRemoveRoleFromInstanceProfile(removeRoleFromInstanceProfileRequest, callback, state, false); }
/// <summary> /// <para>Removes the specified role from the specified instance profile.</para> /// </summary> /// /// <param name="removeRoleFromInstanceProfileRequest">Container for the necessary parameters to execute the RemoveRoleFromInstanceProfile /// service method on AmazonIdentityManagementService.</param> /// /// <exception cref="NoSuchEntityException"/> public RemoveRoleFromInstanceProfileResponse RemoveRoleFromInstanceProfile(RemoveRoleFromInstanceProfileRequest removeRoleFromInstanceProfileRequest) { IAsyncResult asyncResult = invokeRemoveRoleFromInstanceProfile(removeRoleFromInstanceProfileRequest, null, null, true); return EndRemoveRoleFromInstanceProfile(asyncResult); }
/// <summary> /// Initiates the asynchronous execution of the RemoveRoleFromInstanceProfile operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the RemoveRoleFromInstanceProfile 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 RemoveRoleFromInstanceProfileAsync(RemoveRoleFromInstanceProfileRequest request, AmazonServiceCallback<RemoveRoleFromInstanceProfileRequest, RemoveRoleFromInstanceProfileResponse> callback, AsyncOptions options = null) { options = options == null?new AsyncOptions():options; var marshaller = new RemoveRoleFromInstanceProfileRequestMarshaller(); var unmarshaller = RemoveRoleFromInstanceProfileResponseUnmarshaller.Instance; Action<AmazonWebServiceRequest, AmazonWebServiceResponse, Exception, AsyncOptions> callbackHelper = null; if(callback !=null ) callbackHelper = (AmazonWebServiceRequest req, AmazonWebServiceResponse res, Exception ex, AsyncOptions ao) => { AmazonServiceResult<RemoveRoleFromInstanceProfileRequest,RemoveRoleFromInstanceProfileResponse> responseObject = new AmazonServiceResult<RemoveRoleFromInstanceProfileRequest,RemoveRoleFromInstanceProfileResponse>((RemoveRoleFromInstanceProfileRequest)req, (RemoveRoleFromInstanceProfileResponse)res, ex , ao.State); callback(responseObject); }; BeginInvoke<RemoveRoleFromInstanceProfileRequest>(request, marshaller, unmarshaller, options, callbackHelper); }
/// <summary> /// Initiates the asynchronous execution of the RemoveRoleFromInstanceProfile operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the RemoveRoleFromInstanceProfile 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 EndRemoveRoleFromInstanceProfile /// operation.</returns> public IAsyncResult BeginRemoveRoleFromInstanceProfile(RemoveRoleFromInstanceProfileRequest request, AsyncCallback callback, object state) { var marshaller = new RemoveRoleFromInstanceProfileRequestMarshaller(); var unmarshaller = RemoveRoleFromInstanceProfileResponseUnmarshaller.Instance; return BeginInvoke<RemoveRoleFromInstanceProfileRequest>(request, marshaller, unmarshaller, callback, state); }
/// <summary> /// Initiates the asynchronous execution of the RemoveRoleFromInstanceProfile operation. /// <seealso cref="Amazon.IdentityManagement.IAmazonIdentityManagementService.RemoveRoleFromInstanceProfile"/> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the RemoveRoleFromInstanceProfile 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<RemoveRoleFromInstanceProfileResponse> RemoveRoleFromInstanceProfileAsync(RemoveRoleFromInstanceProfileRequest request, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new RemoveRoleFromInstanceProfileRequestMarshaller(); var unmarshaller = RemoveRoleFromInstanceProfileResponseUnmarshaller.GetInstance(); var response = await Invoke<IRequest, RemoveRoleFromInstanceProfileRequest, RemoveRoleFromInstanceProfileResponse>(request, marshaller, unmarshaller, signer, cancellationToken) .ConfigureAwait(continueOnCapturedContext: false); return response; }
/// <summary> /// <para>Removes the specified role from the specified instance profile.</para> <para><b>IMPORTANT:</b>Make sure you do not have any Amazon EC2 /// instances running with the role you are about to remove from the instance profile. Removing a role from an instance profile that is /// associated with a running instance will break any applications running on the instance.</para> <para>For more information about roles, go to /// <a href="http://docs.aws.amazon.com/IAM/latest/UserGuide/WorkingWithRoles.html">Working with Roles</a> . /// For more information about instance profiles, go to <a href="http://docs.aws.amazon.com/IAM/latest/UserGuide/AboutInstanceProfiles.html">About Instance Profiles</a> .</para> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the RemoveRoleFromInstanceProfile /// service method on AmazonIdentityManagementService.</param> /// /// <exception cref="T:Amazon.IdentityManagement.Model.NoSuchEntityException" /> /// <exception cref="T:Amazon.IdentityManagement.Model.LimitExceededException" /> public RemoveRoleFromInstanceProfileResponse RemoveRoleFromInstanceProfile(RemoveRoleFromInstanceProfileRequest request) { var task = RemoveRoleFromInstanceProfileAsync(request); try { return task.Result; } catch(AggregateException e) { throw e.InnerException; } }
/// <summary> /// <para>Removes the specified role from the specified instance profile.</para> <para><b>IMPORTANT:</b>Make sure you do not have any Amazon EC2 /// instances running with the role you are about to remove from the instance profile. Removing a role from an instance profile that is /// associated with a running instance will break any applications running on the instance.</para> <para>For more information about roles, go to /// <a href="http://docs.aws.amazon.com/IAM/latest/UserGuide/WorkingWithRoles.html">Working with Roles</a> . /// For more information about instance profiles, go to <a href="http://docs.aws.amazon.com/IAM/latest/UserGuide/AboutInstanceProfiles.html">About Instance Profiles</a> .</para> /// </summary> /// /// <param name="removeRoleFromInstanceProfileRequest">Container for the necessary parameters to execute the RemoveRoleFromInstanceProfile /// service method on AmazonIdentityManagementService.</param> /// /// <exception cref="T:Amazon.IdentityManagement.Model.NoSuchEntityException" /> /// <exception cref="T:Amazon.IdentityManagement.Model.LimitExceededException" /> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> public Task<RemoveRoleFromInstanceProfileResponse> RemoveRoleFromInstanceProfileAsync(RemoveRoleFromInstanceProfileRequest removeRoleFromInstanceProfileRequest, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new RemoveRoleFromInstanceProfileRequestMarshaller(); var unmarshaller = RemoveRoleFromInstanceProfileResponseUnmarshaller.GetInstance(); return Invoke<IRequest, RemoveRoleFromInstanceProfileRequest, RemoveRoleFromInstanceProfileResponse>(removeRoleFromInstanceProfileRequest, marshaller, unmarshaller, signer, cancellationToken); }
internal RemoveRoleFromInstanceProfileResponse RemoveRoleFromInstanceProfile(RemoveRoleFromInstanceProfileRequest request) { var task = RemoveRoleFromInstanceProfileAsync(request); try { return task.Result; } catch(AggregateException e) { ExceptionDispatchInfo.Capture(e.InnerException).Throw(); return null; } }
IAsyncResult invokeRemoveRoleFromInstanceProfile(RemoveRoleFromInstanceProfileRequest request, AsyncCallback callback, object state, bool synchronized) { var marshaller = new RemoveRoleFromInstanceProfileRequestMarshaller(); var unmarshaller = RemoveRoleFromInstanceProfileResponseUnmarshaller.Instance; return Invoke(request, callback, state, synchronized, marshaller, unmarshaller, signer); }