Há mais AWS SDK exemplos disponíveis no GitHub repositório AWS Doc SDK Examples
As traduções são geradas por tradução automática. Em caso de conflito entre o conteúdo da tradução e da versão original em inglês, a versão em inglês prevalecerá.
Use DeleteCertificate
com um AWS SDK ou CLI
Os exemplos de código a seguir mostram como usar o DeleteCertificate
.
Exemplos de ações são trechos de código de programas maiores e devem ser executados em contexto. É possível ver essa ação no contexto no seguinte exemplo de código:
- C++
-
- SDKpara C++
-
nota
Tem mais sobre GitHub. Encontre o exemplo completo e saiba como configurar e executar no Repositório de exemplos de código da AWS
. //! Delete an AWS Certificate Manager (ACM) certificate. /*! \param certificateArn: The Amazon Resource Name (ARN) of a certificate. \param clientConfiguration: AWS client configuration. \return bool: Function succeeded. */ bool AwsDoc::ACM::deleteCertificate(const Aws::String &certificateArn, const Aws::Client::ClientConfiguration &clientConfiguration) { Aws::ACM::ACMClient acmClient(clientConfiguration); Aws::ACM::Model::DeleteCertificateRequest request; request.WithCertificateArn(certificateArn); Aws::ACM::Model::DeleteCertificateOutcome outcome = acmClient.DeleteCertificate(request); if (!outcome.IsSuccess()) { std::cerr << "Error: DeleteCertificate: " << outcome.GetError().GetMessage() << std::endl; } else { std::cout << "Success: The certificate with the ARN '" << certificateArn << "' is deleted." << std::endl; } return outcome.IsSuccess(); }
-
Para API obter detalhes, consulte DeleteCertificateem AWS SDK for C++ APIReferência.
-
- CLI
-
- AWS CLI
-
Para excluir um ACM certificado da sua conta
O
delete-certificate
comando a seguir exclui o certificado com o especificadoARN:aws acm delete-certificate --certificate-arn
arn:aws:acm:region:account:certificate/12345678-1234-1234-1234-123456789012
-
Para API obter detalhes, consulte DeleteCertificate
na Referência de AWS CLI Comandos.
-
- PowerShell
-
- Ferramentas para PowerShell
-
Exemplo 1: Exclui o certificado identificado pela chave privada fornecida ARN e pela chave privada associada. O cmdlet solicitará a confirmação antes de continuar; adicione a opção -Force para suprimir a confirmação.
Remove-ACMCertificate -CertificateArn "arn:aws:acm:us-east-1:123456789012:certificate/12345678-1234-1234-1234-123456789012"
-
Para API obter detalhes, consulte DeleteCertificateem Referência de AWS Tools for PowerShell cmdlet.
-
- Python
-
- SDKpara Python (Boto3)
-
nota
Tem mais sobre GitHub. Encontre o exemplo completo e saiba como configurar e executar no Repositório de exemplos de código da AWS
. class AcmCertificate: """ Encapsulates ACM functions. """ def __init__(self, acm_client): """ :param acm_client: A Boto3 ACM client. """ self.acm_client = acm_client def remove(self, certificate_arn): """ Removes a certificate. :param certificate_arn: The ARN of the certificate to remove. """ try: self.acm_client.delete_certificate(CertificateArn=certificate_arn) logger.info("Removed certificate %s.", certificate_arn) except ClientError: logger.exception("Couldn't remove certificate %s.", certificate_arn) raise
-
Para API obter detalhes, consulte a DeleteCertificateReferência AWS SDK do Python (Boto3). API
-