public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.IdentityManagement.Model.DeletePolicyRequest(); if (cmdletContext.PolicyArn != null) { request.PolicyArn = cmdletContext.PolicyArn; } 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 DeletePolicy operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DeletePolicy 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 EndDeletePolicy /// operation.</returns> public IAsyncResult BeginDeletePolicy(DeletePolicyRequest request, AsyncCallback callback, object state) { var marshaller = new DeletePolicyRequestMarshaller(); var unmarshaller = DeletePolicyResponseUnmarshaller.Instance; return BeginInvoke<DeletePolicyRequest>(request, marshaller, unmarshaller, callback, state); }
/// <summary> /// Deletes the specified managed policy. /// /// /// <para> /// Before you can delete a managed policy, you must detach the policy from all users, /// groups, and roles that it is attached to, and you must delete all of the policy's /// versions. The following steps describe the process for deleting a managed policy: /// <ol> <li>Detach the policy from all users, groups, and roles that the policy is attached /// to, using the <a>DetachUserPolicy</a>, <a>DetachGroupPolicy</a>, or <a>DetachRolePolicy</a> /// APIs. To list all the users, groups, and roles that a policy is attached to, use <a>ListEntitiesForPolicy</a>. /// </li> <li>Delete all versions of the policy using <a>DeletePolicyVersion</a>. To list /// the policy's versions, use <a>ListPolicyVersions</a>. You cannot use <a>DeletePolicyVersion</a> /// to delete the version that is marked as the default version. You delete the policy's /// default version in the next step of the process. </li> <li>Delete the policy (this /// automatically deletes the policy's default version) using this API. </li> </ol> /// </para> /// /// <para> /// For information about managed policies, refer to <a href="http://docs.aws.amazon.com/IAM/latest/UserGuide/policies-managed-vs-inline.html">Managed /// Policies and Inline Policies</a> in the <i>IAM User Guide</i>. /// </para> /// </summary> /// <param name="request">Container for the necessary parameters to execute the DeletePolicy service method.</param> /// /// <returns>The response from the DeletePolicy service method, as returned by IdentityManagementService.</returns> /// <exception cref="Amazon.IdentityManagement.Model.DeleteConflictException"> /// The request was rejected because it attempted to delete a resource that has attached /// subordinate entities. The error message describes these entities. /// </exception> /// <exception cref="Amazon.IdentityManagement.Model.InvalidInputException"> /// The request was rejected because an invalid or out-of-range value was supplied for /// an input parameter. /// </exception> /// <exception cref="Amazon.IdentityManagement.Model.LimitExceededException"> /// The request was rejected because it attempted to create resources beyond the current /// AWS account limits. The error message describes the limit exceeded. /// </exception> /// <exception cref="Amazon.IdentityManagement.Model.NoSuchEntityException"> /// The request was rejected because it referenced an entity that does not exist. The /// error message describes the entity. /// </exception> /// <exception cref="Amazon.IdentityManagement.Model.ServiceFailureException"> /// The request processing has failed because of an unknown error, exception or failure. /// </exception> public DeletePolicyResponse DeletePolicy(DeletePolicyRequest request) { var marshaller = new DeletePolicyRequestMarshaller(); var unmarshaller = DeletePolicyResponseUnmarshaller.Instance; return Invoke<DeletePolicyRequest,DeletePolicyResponse>(request, marshaller, unmarshaller); }
/// <summary> /// Initiates the asynchronous execution of the DeletePolicy operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DeletePolicy 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<DeletePolicyResponse> DeletePolicyAsync(DeletePolicyRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new DeletePolicyRequestMarshaller(); var unmarshaller = DeletePolicyResponseUnmarshaller.Instance; return InvokeAsync<DeletePolicyRequest,DeletePolicyResponse>(request, marshaller, unmarshaller, cancellationToken); }
/// <summary> /// Initiates the asynchronous execution of the DeletePolicy operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DeletePolicy 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 DeletePolicyAsync(DeletePolicyRequest request, AmazonServiceCallback<DeletePolicyRequest, DeletePolicyResponse> callback, AsyncOptions options = null) { options = options == null?new AsyncOptions():options; var marshaller = new DeletePolicyRequestMarshaller(); var unmarshaller = DeletePolicyResponseUnmarshaller.Instance; Action<AmazonWebServiceRequest, AmazonWebServiceResponse, Exception, AsyncOptions> callbackHelper = null; if(callback !=null ) callbackHelper = (AmazonWebServiceRequest req, AmazonWebServiceResponse res, Exception ex, AsyncOptions ao) => { AmazonServiceResult<DeletePolicyRequest,DeletePolicyResponse> responseObject = new AmazonServiceResult<DeletePolicyRequest,DeletePolicyResponse>((DeletePolicyRequest)req, (DeletePolicyResponse)res, ex , ao.State); callback(responseObject); }; BeginInvoke<DeletePolicyRequest>(request, marshaller, unmarshaller, options, callbackHelper); }
private Amazon.IdentityManagement.Model.DeletePolicyResponse CallAWSServiceOperation(IAmazonIdentityManagementService client, Amazon.IdentityManagement.Model.DeletePolicyRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Identity and Access Management", "DeletePolicy"); try { #if DESKTOP return(client.DeletePolicy(request)); #elif CORECLR return(client.DeletePolicyAsync(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; } }