public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.IdentityManagement.Model.DeleteUserRequest(); 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 DeleteUser operation. /// <seealso cref="Amazon.IdentityManagement.IAmazonIdentityManagementService"/> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DeleteUser 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<DeleteUserResponse> DeleteUserAsync(DeleteUserRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new DeleteUserRequestMarshaller(); var unmarshaller = DeleteUserResponseUnmarshaller.Instance; return InvokeAsync<DeleteUserRequest,DeleteUserResponse>(request, marshaller, unmarshaller, cancellationToken); }
internal DeleteUserResponse DeleteUser(DeleteUserRequest request) { var marshaller = new DeleteUserRequestMarshaller(); var unmarshaller = DeleteUserResponseUnmarshaller.Instance; return Invoke<DeleteUserRequest,DeleteUserResponse>(request, marshaller, unmarshaller); }
/// <summary> /// Initiates the asynchronous execution of the DeleteUser operation. /// <seealso cref="Amazon.IdentityManagement.AmazonIdentityManagementService.DeleteUser"/> /// </summary> /// /// <param name="deleteUserRequest">Container for the necessary parameters to execute the DeleteUser 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 BeginDeleteUser(DeleteUserRequest deleteUserRequest, AsyncCallback callback, object state) { return invokeDeleteUser(deleteUserRequest, callback, state, false); }
IAsyncResult invokeDeleteUser(DeleteUserRequest deleteUserRequest, AsyncCallback callback, object state, bool synchronized) { IRequest irequest = new DeleteUserRequestMarshaller().Marshall(deleteUserRequest); var unmarshaller = DeleteUserResponseUnmarshaller.GetInstance(); AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller); Invoke(result); return result; }
/// <summary> /// <para>Deletes the specified user. The user must not belong to any groups, have any keys or signing certificates, or have any attached /// policies.</para> /// </summary> /// /// <param name="deleteUserRequest">Container for the necessary parameters to execute the DeleteUser service method on /// AmazonIdentityManagementService.</param> /// /// <exception cref="NoSuchEntityException"/> /// <exception cref="DeleteConflictException"/> public DeleteUserResponse DeleteUser(DeleteUserRequest deleteUserRequest) { IAsyncResult asyncResult = invokeDeleteUser(deleteUserRequest, null, null, true); return EndDeleteUser(asyncResult); }
/// <summary> /// Initiates the asynchronous execution of the DeleteUser operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DeleteUser 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 EndDeleteUser /// operation.</returns> public IAsyncResult BeginDeleteUser(DeleteUserRequest request, AsyncCallback callback, object state) { var marshaller = new DeleteUserRequestMarshaller(); var unmarshaller = DeleteUserResponseUnmarshaller.Instance; return BeginInvoke<DeleteUserRequest>(request, marshaller, unmarshaller, callback, state); }
/// <summary> /// <para>Deletes the specified User. The User must not belong to any /// groups, have any keys or signing certificates, or have any attached /// policies.</para> /// </summary> /// /// <param name="deleteUserRequest">Container for the necessary parameters /// to execute the DeleteUser service method on /// AmazonIdentityManagementService.</param> /// /// <exception cref="NoSuchEntityException"/> /// <exception cref="DeleteConflictException"/> public DeleteUserResponse DeleteUser(DeleteUserRequest deleteUserRequest) { IRequest<DeleteUserRequest> request = new DeleteUserRequestMarshaller().Marshall(deleteUserRequest); DeleteUserResponse response = Invoke<DeleteUserRequest, DeleteUserResponse> (request, this.signer, DeleteUserResponseUnmarshaller.GetInstance()); return response; }
/// <summary> /// Initiates the asynchronous execution of the DeleteUser operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DeleteUser 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 DeleteUserAsync(DeleteUserRequest request, AmazonServiceCallback<DeleteUserRequest, DeleteUserResponse> callback, AsyncOptions options = null) { options = options == null?new AsyncOptions():options; var marshaller = new DeleteUserRequestMarshaller(); var unmarshaller = DeleteUserResponseUnmarshaller.Instance; Action<AmazonWebServiceRequest, AmazonWebServiceResponse, Exception, AsyncOptions> callbackHelper = null; if(callback !=null ) callbackHelper = (AmazonWebServiceRequest req, AmazonWebServiceResponse res, Exception ex, AsyncOptions ao) => { AmazonServiceResult<DeleteUserRequest,DeleteUserResponse> responseObject = new AmazonServiceResult<DeleteUserRequest,DeleteUserResponse>((DeleteUserRequest)req, (DeleteUserResponse)res, ex , ao.State); callback(responseObject); }; BeginInvoke<DeleteUserRequest>(request, marshaller, unmarshaller, options, callbackHelper); }
/// <summary> /// Initiates the asynchronous execution of the DeleteUser operation. /// <seealso cref="Amazon.IdentityManagement.IAmazonIdentityManagementService.DeleteUser"/> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DeleteUser 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<DeleteUserResponse> DeleteUserAsync(DeleteUserRequest request, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new DeleteUserRequestMarshaller(); var unmarshaller = DeleteUserResponseUnmarshaller.GetInstance(); var response = await Invoke<IRequest, DeleteUserRequest, DeleteUserResponse>(request, marshaller, unmarshaller, signer, cancellationToken) .ConfigureAwait(continueOnCapturedContext: false); return response; }
/// <summary> /// <para>Deletes the specified user. The user must not belong to any groups, have any keys or signing certificates, or have any attached /// policies.</para> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DeleteUser service method on /// AmazonIdentityManagementService.</param> /// /// <exception cref="T:Amazon.IdentityManagement.Model.NoSuchEntityException" /> /// <exception cref="T:Amazon.IdentityManagement.Model.DeleteConflictException" /> /// <exception cref="T:Amazon.IdentityManagement.Model.LimitExceededException" /> public DeleteUserResponse DeleteUser(DeleteUserRequest request) { var task = DeleteUserAsync(request); try { return task.Result; } catch(AggregateException e) { throw e.InnerException; } }
public override async Task Delete( IResourceIdentifier resourceIdentifier, string correlationIdentifier) { if (null == resourceIdentifier) { throw new ArgumentNullException(AmazonWebServicesProvider.ArgumentNameResourceIdentifier); } if (string.IsNullOrWhiteSpace(correlationIdentifier)) { throw new ArgumentNullException(AmazonWebServicesProvider.ArgumentNameCorrelationIdentifier); } if (string.IsNullOrWhiteSpace(resourceIdentifier.Identifier)) { throw new ArgumentException(ProvisioningAgentResources.ExceptionInvalidResource); } if (string.IsNullOrWhiteSpace(resourceIdentifier.SchemaIdentifier)) { throw new ArgumentException(ProvisioningAgentResources.ExceptionInvalidResource); } string informationStarting = string.Format( CultureInfo.InvariantCulture, AmazonProvisioningAgentResources.InformationDeleting, resourceIdentifier.SchemaIdentifier, resourceIdentifier.Identifier); ProvisioningAgentMonitor.Instance.Inform(informationStarting, true, correlationIdentifier); IAmazonIdentityManagementService proxy = null; try { proxy = AWSClientFactory.CreateAmazonIdentityManagementServiceClient(this.credentials); string warning; switch (resourceIdentifier.SchemaIdentifier) { case SchemaIdentifiers.Core2EnterpriseUser: Amazon.IdentityManagement.Model.User user = await this.RetrieveUser(resourceIdentifier.Identifier, proxy); if (null == user || string.IsNullOrWhiteSpace(user.UserName)) { warning = string.Format( CultureInfo.InvariantCulture, AmazonProvisioningAgentResources.WarningEntryNotFoundTemplate, typeof(Amazon.IdentityManagement.Model.User).Name, resourceIdentifier.Identifier); ProvisioningAgentMonitor.Instance.Warn(warning, correlationIdentifier); return; } DeleteUserRequest deleteRequestUser = new DeleteUserRequest(user.UserName); await proxy.DeleteUserAsync(deleteRequestUser); return; case SchemaIdentifiers.WindowsAzureActiveDirectoryGroup: Group group = await this.RetrieveGroup(resourceIdentifier.Identifier, proxy); if (null == group || string.IsNullOrWhiteSpace(group.GroupName)) { warning = string.Format( CultureInfo.InvariantCulture, AmazonProvisioningAgentResources.WarningEntryNotFoundTemplate, typeof(Group).Name, resourceIdentifier.Identifier); ProvisioningAgentMonitor.Instance.Warn(warning, correlationIdentifier); return; } DeleteGroupRequest deleteRequestGroup = new DeleteGroupRequest(group.GroupName); await proxy.DeleteGroupAsync(deleteRequestGroup); return; default: throw new NotSupportedException(resourceIdentifier.SchemaIdentifier); } } finally { if (proxy != null) { proxy.Dispose(); proxy = null; } } }
/// <summary> /// <para>Deletes the specified user. The user must not belong to any groups, have any keys or signing certificates, or have any attached /// policies.</para> /// </summary> /// /// <param name="deleteUserRequest">Container for the necessary parameters to execute the DeleteUser service method on /// AmazonIdentityManagementService.</param> /// /// <exception cref="T:Amazon.IdentityManagement.Model.NoSuchEntityException" /> /// <exception cref="T:Amazon.IdentityManagement.Model.DeleteConflictException" /> /// <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<DeleteUserResponse> DeleteUserAsync(DeleteUserRequest deleteUserRequest, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new DeleteUserRequestMarshaller(); var unmarshaller = DeleteUserResponseUnmarshaller.GetInstance(); return Invoke<IRequest, DeleteUserRequest, DeleteUserResponse>(deleteUserRequest, marshaller, unmarshaller, signer, cancellationToken); }
internal DeleteUserResponse DeleteUser(DeleteUserRequest request) { var task = DeleteUserAsync(request); try { return task.Result; } catch(AggregateException e) { ExceptionDispatchInfo.Capture(e.InnerException).Throw(); return null; } }
private Amazon.IdentityManagement.Model.DeleteUserResponse CallAWSServiceOperation(IAmazonIdentityManagementService client, Amazon.IdentityManagement.Model.DeleteUserRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Identity and Access Management", "DeleteUser"); try { #if DESKTOP return(client.DeleteUser(request)); #elif CORECLR return(client.DeleteUserAsync(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; } }
IAsyncResult invokeDeleteUser(DeleteUserRequest request, AsyncCallback callback, object state, bool synchronized) { var marshaller = new DeleteUserRequestMarshaller(); var unmarshaller = DeleteUserResponseUnmarshaller.Instance; return Invoke(request, callback, state, synchronized, marshaller, unmarshaller, signer); }