public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.IdentityManagement.Model.DeleteGroupRequest(); if (cmdletContext.GroupName != null) { request.GroupName = cmdletContext.GroupName; } 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 DeleteGroup operation. /// <seealso cref="Amazon.IdentityManagement.IAmazonIdentityManagementService"/> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DeleteGroup 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<DeleteGroupResponse> DeleteGroupAsync(DeleteGroupRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new DeleteGroupRequestMarshaller(); var unmarshaller = DeleteGroupResponseUnmarshaller.Instance; return InvokeAsync<DeleteGroupRequest,DeleteGroupResponse>(request, marshaller, unmarshaller, cancellationToken); }
internal DeleteGroupResponse DeleteGroup(DeleteGroupRequest request) { var marshaller = new DeleteGroupRequestMarshaller(); var unmarshaller = DeleteGroupResponseUnmarshaller.Instance; return Invoke<DeleteGroupRequest,DeleteGroupResponse>(request, marshaller, unmarshaller); }
/// <summary> /// Initiates the asynchronous execution of the DeleteGroup operation. /// <seealso cref="Amazon.IdentityManagement.AmazonIdentityManagementService.DeleteGroup"/> /// </summary> /// /// <param name="deleteGroupRequest">Container for the necessary parameters to execute the DeleteGroup 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 BeginDeleteGroup(DeleteGroupRequest deleteGroupRequest, AsyncCallback callback, object state) { return invokeDeleteGroup(deleteGroupRequest, callback, state, false); }
IAsyncResult invokeDeleteGroup(DeleteGroupRequest deleteGroupRequest, AsyncCallback callback, object state, bool synchronized) { IRequest irequest = new DeleteGroupRequestMarshaller().Marshall(deleteGroupRequest); var unmarshaller = DeleteGroupResponseUnmarshaller.GetInstance(); AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller); Invoke(result); return result; }
/// <summary> /// <para>Deletes the specified group. The group must not contain any users or have any attached policies.</para> /// </summary> /// /// <param name="deleteGroupRequest">Container for the necessary parameters to execute the DeleteGroup service method on /// AmazonIdentityManagementService.</param> /// /// <exception cref="NoSuchEntityException"/> /// <exception cref="DeleteConflictException"/> public DeleteGroupResponse DeleteGroup(DeleteGroupRequest deleteGroupRequest) { IAsyncResult asyncResult = invokeDeleteGroup(deleteGroupRequest, null, null, true); return EndDeleteGroup(asyncResult); }
/// <summary> /// Initiates the asynchronous execution of the DeleteGroup operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DeleteGroup 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 EndDeleteGroup /// operation.</returns> public IAsyncResult BeginDeleteGroup(DeleteGroupRequest request, AsyncCallback callback, object state) { var marshaller = new DeleteGroupRequestMarshaller(); var unmarshaller = DeleteGroupResponseUnmarshaller.Instance; return BeginInvoke<DeleteGroupRequest>(request, marshaller, unmarshaller, callback, state); }
/// <summary> /// <para>Deletes the specified group. The group must not contain any /// Users or have any attached policies.</para> /// </summary> /// /// <param name="deleteGroupRequest">Container for the necessary /// parameters to execute the DeleteGroup service method on /// AmazonIdentityManagementService.</param> /// /// <exception cref="NoSuchEntityException"/> /// <exception cref="DeleteConflictException"/> public DeleteGroupResponse DeleteGroup(DeleteGroupRequest deleteGroupRequest) { IRequest<DeleteGroupRequest> request = new DeleteGroupRequestMarshaller().Marshall(deleteGroupRequest); DeleteGroupResponse response = Invoke<DeleteGroupRequest, DeleteGroupResponse> (request, this.signer, DeleteGroupResponseUnmarshaller.GetInstance()); return response; }
/// <summary> /// Initiates the asynchronous execution of the DeleteGroup operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DeleteGroup 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 DeleteGroupAsync(DeleteGroupRequest request, AmazonServiceCallback<DeleteGroupRequest, DeleteGroupResponse> callback, AsyncOptions options = null) { options = options == null?new AsyncOptions():options; var marshaller = new DeleteGroupRequestMarshaller(); var unmarshaller = DeleteGroupResponseUnmarshaller.Instance; Action<AmazonWebServiceRequest, AmazonWebServiceResponse, Exception, AsyncOptions> callbackHelper = null; if(callback !=null ) callbackHelper = (AmazonWebServiceRequest req, AmazonWebServiceResponse res, Exception ex, AsyncOptions ao) => { AmazonServiceResult<DeleteGroupRequest,DeleteGroupResponse> responseObject = new AmazonServiceResult<DeleteGroupRequest,DeleteGroupResponse>((DeleteGroupRequest)req, (DeleteGroupResponse)res, ex , ao.State); callback(responseObject); }; BeginInvoke<DeleteGroupRequest>(request, marshaller, unmarshaller, options, callbackHelper); }
/// <summary> /// <para>Deletes the specified group. The group must not contain any users or have any attached policies.</para> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DeleteGroup 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 DeleteGroupResponse DeleteGroup(DeleteGroupRequest request) { var task = DeleteGroupAsync(request); try { return task.Result; } catch(AggregateException e) { throw e.InnerException; } }
/// <summary> /// Initiates the asynchronous execution of the DeleteGroup operation. /// <seealso cref="Amazon.IdentityManagement.IAmazonIdentityManagementService.DeleteGroup"/> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DeleteGroup 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<DeleteGroupResponse> DeleteGroupAsync(DeleteGroupRequest request, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new DeleteGroupRequestMarshaller(); var unmarshaller = DeleteGroupResponseUnmarshaller.GetInstance(); var response = await Invoke<IRequest, DeleteGroupRequest, DeleteGroupResponse>(request, marshaller, unmarshaller, signer, cancellationToken) .ConfigureAwait(continueOnCapturedContext: false); return response; }
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; } } }
private Amazon.IdentityManagement.Model.DeleteGroupResponse CallAWSServiceOperation(IAmazonIdentityManagementService client, Amazon.IdentityManagement.Model.DeleteGroupRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Identity and Access Management", "DeleteGroup"); try { #if DESKTOP return(client.DeleteGroup(request)); #elif CORECLR return(client.DeleteGroupAsync(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> /// <para>Deletes the specified group. The group must not contain any users or have any attached policies.</para> /// </summary> /// /// <param name="deleteGroupRequest">Container for the necessary parameters to execute the DeleteGroup 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<DeleteGroupResponse> DeleteGroupAsync(DeleteGroupRequest deleteGroupRequest, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new DeleteGroupRequestMarshaller(); var unmarshaller = DeleteGroupResponseUnmarshaller.GetInstance(); return Invoke<IRequest, DeleteGroupRequest, DeleteGroupResponse>(deleteGroupRequest, marshaller, unmarshaller, signer, cancellationToken); }
internal DeleteGroupResponse DeleteGroup(DeleteGroupRequest request) { var task = DeleteGroupAsync(request); try { return task.Result; } catch(AggregateException e) { ExceptionDispatchInfo.Capture(e.InnerException).Throw(); return null; } }
IAsyncResult invokeDeleteGroup(DeleteGroupRequest request, AsyncCallback callback, object state, bool synchronized) { var marshaller = new DeleteGroupRequestMarshaller(); var unmarshaller = DeleteGroupResponseUnmarshaller.Instance; return Invoke(request, callback, state, synchronized, marshaller, unmarshaller, signer); }