Container for the parameters to the DeleteCertificate operation. Deletes the specified certificate.

A certificate cannot be deleted if it has a policy attached to it or if its status is set to ACTIVE. To delete a certificate, first use the DetachPrincipalPolicy API to detach all policies. Next, use the UpdateCertificate API to set the certificate to the INACTIVE status.

Inheritance: AmazonIoTRequest
コード例 #1
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.IoT.Model.DeleteCertificateRequest();

            if (cmdletContext.CertificateId != null)
            {
                request.CertificateId = cmdletContext.CertificateId;
            }
            if (cmdletContext.DeleteWithForce != null)
            {
                request.ForceDelete = cmdletContext.DeleteWithForce.Value;
            }

            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);
        }
コード例 #2
0
 private Amazon.IoT.Model.DeleteCertificateResponse CallAWSServiceOperation(IAmazonIoT client, Amazon.IoT.Model.DeleteCertificateRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS IoT", "DeleteCertificate");
     try
     {
         #if DESKTOP
         return(client.DeleteCertificate(request));
         #elif CORECLR
         return(client.DeleteCertificateAsync(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;
     }
 }
コード例 #3
0
ファイル: AmazonIoTClient.cs プロジェクト: srz2/aws-sdk-net
        /// <summary>
        /// Initiates the asynchronous execution of the DeleteCertificate operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the DeleteCertificate 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<DeleteCertificateResponse> DeleteCertificateAsync(DeleteCertificateRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new DeleteCertificateRequestMarshaller();
            var unmarshaller = DeleteCertificateResponseUnmarshaller.Instance;

            return InvokeAsync<DeleteCertificateRequest,DeleteCertificateResponse>(request, marshaller, 
                unmarshaller, cancellationToken);
        }
コード例 #4
0
ファイル: AmazonIoTClient.cs プロジェクト: srz2/aws-sdk-net
 /// <summary>
 /// Deletes the specified certificate.
 /// 
 ///  
 /// <para>
 /// A certificate cannot be deleted if it has a policy attached to it or if its status
 /// is set to ACTIVE. To delete a certificate, first detach all policies using the <a>DetachPrincipalPolicy</a>
 /// API. Next use the <a>UpdateCertificate</a> API to set the certificate to the INACTIVE
 /// status.
 /// </para>
 /// </summary>
 /// <param name="certificateId">The ID of the certificate.</param>
 /// <param name="cancellationToken">
 ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
 /// </param>
 /// 
 /// <returns>The response from the DeleteCertificate service method, as returned by IoT.</returns>
 /// <exception cref="Amazon.IoT.Model.CertificateStateException">
 /// The certificate operation is not allowed.
 /// </exception>
 /// <exception cref="Amazon.IoT.Model.DeleteConflictException">
 /// You can't delete the resource because it is attached to one or more resources.
 /// </exception>
 /// <exception cref="Amazon.IoT.Model.ResourceNotFoundException">
 /// The specified resource does not exist.
 /// </exception>
 public Task<DeleteCertificateResponse> DeleteCertificateAsync(string certificateId, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
 {
     var request = new DeleteCertificateRequest();
     request.CertificateId = certificateId;
     return DeleteCertificateAsync(request, cancellationToken);
 }
コード例 #5
0
ファイル: AmazonIoTClient.cs プロジェクト: srz2/aws-sdk-net
        /// <summary>
        /// Deletes the specified certificate.
        /// 
        ///  
        /// <para>
        /// A certificate cannot be deleted if it has a policy attached to it or if its status
        /// is set to ACTIVE. To delete a certificate, first detach all policies using the <a>DetachPrincipalPolicy</a>
        /// API. Next use the <a>UpdateCertificate</a> API to set the certificate to the INACTIVE
        /// status.
        /// </para>
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the DeleteCertificate service method.</param>
        /// 
        /// <returns>The response from the DeleteCertificate service method, as returned by IoT.</returns>
        /// <exception cref="Amazon.IoT.Model.CertificateStateException">
        /// The certificate operation is not allowed.
        /// </exception>
        /// <exception cref="Amazon.IoT.Model.DeleteConflictException">
        /// You can't delete the resource because it is attached to one or more resources.
        /// </exception>
        /// <exception cref="Amazon.IoT.Model.ResourceNotFoundException">
        /// The specified resource does not exist.
        /// </exception>
        public DeleteCertificateResponse DeleteCertificate(DeleteCertificateRequest request)
        {
            var marshaller = new DeleteCertificateRequestMarshaller();
            var unmarshaller = DeleteCertificateResponseUnmarshaller.Instance;

            return Invoke<DeleteCertificateRequest,DeleteCertificateResponse>(request, marshaller, unmarshaller);
        }
コード例 #6
0
ファイル: AmazonIoTClient.cs プロジェクト: srz2/aws-sdk-net
 /// <summary>
 /// Deletes the specified certificate.
 /// 
 ///  
 /// <para>
 /// A certificate cannot be deleted if it has a policy attached to it or if its status
 /// is set to ACTIVE. To delete a certificate, first detach all policies using the <a>DetachPrincipalPolicy</a>
 /// API. Next use the <a>UpdateCertificate</a> API to set the certificate to the INACTIVE
 /// status.
 /// </para>
 /// </summary>
 /// <param name="certificateId">The ID of the certificate.</param>
 /// 
 /// <returns>The response from the DeleteCertificate service method, as returned by IoT.</returns>
 /// <exception cref="Amazon.IoT.Model.CertificateStateException">
 /// The certificate operation is not allowed.
 /// </exception>
 /// <exception cref="Amazon.IoT.Model.DeleteConflictException">
 /// You can't delete the resource because it is attached to one or more resources.
 /// </exception>
 /// <exception cref="Amazon.IoT.Model.ResourceNotFoundException">
 /// The specified resource does not exist.
 /// </exception>
 public DeleteCertificateResponse DeleteCertificate(string certificateId)
 {
     var request = new DeleteCertificateRequest();
     request.CertificateId = certificateId;
     return DeleteCertificate(request);
 }
コード例 #7
0
        /// <summary>
        /// Initiates the asynchronous execution of the DeleteCertificate operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the DeleteCertificate operation on AmazonIoTClient.</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 EndDeleteCertificate
        ///         operation.</returns>
        public IAsyncResult BeginDeleteCertificate(DeleteCertificateRequest request, AsyncCallback callback, object state)
        {
            var marshaller = new DeleteCertificateRequestMarshaller();
            var unmarshaller = DeleteCertificateResponseUnmarshaller.Instance;

            return BeginInvoke<DeleteCertificateRequest>(request, marshaller, unmarshaller,
                callback, state);
        }