public final class CertificateClient extends Object
certifcates
in the Azure Key Vault. The client
supports creating, retrieving, updating, merging, deleting, purging, backing up, restoring and listing the
certificates
. The client also supports listing deleted certificates
for
a soft-delete enabled Azure Key Vault.
The client further allows creating, retrieving, updating, deleting and listing the certificate issuers
. The client also supports
creating, listing and deleting certificate contacts
Samples to construct the sync client
CertificateClient certificateClient = new CertificateClientBuilder() .credential(new DefaultAzureCredentialBuilder().build()) .vaultUrl("https://myvault.vault.azure.net/") .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BODY_AND_HEADERS)) .buildClient();
CertificateClientBuilder
,
PagedIterable
Modifier and Type | Method and Description |
---|---|
byte[] |
backupCertificate(String certificateName)
Requests that a backup of the specified certificate be downloaded to the client.
|
com.azure.core.http.rest.Response<byte[]> |
backupCertificateWithResponse(String certificateName,
com.azure.core.util.Context context)
Requests that a backup of the specified certificate be downloaded to the client.
|
com.azure.core.util.polling.SyncPoller<CertificateOperation,KeyVaultCertificateWithPolicy> |
beginCreateCertificate(String certificateName,
CertificatePolicy policy)
Creates a new certificate.
|
com.azure.core.util.polling.SyncPoller<CertificateOperation,KeyVaultCertificateWithPolicy> |
beginCreateCertificate(String certificateName,
CertificatePolicy policy,
Boolean isEnabled,
Map<String,String> tags)
Creates a new certificate.
|
com.azure.core.util.polling.SyncPoller<DeletedCertificate,Void> |
beginDeleteCertificate(String certificateName)
Deletes a certificate from a specified key vault.
|
com.azure.core.util.polling.SyncPoller<KeyVaultCertificateWithPolicy,Void> |
beginRecoverDeletedCertificate(String certificateName)
Recovers the deleted certificate back to its current version under /certificates and can only be performed on a soft-delete enabled vault.
|
CertificateOperation |
cancelCertificateOperation(String certificateName)
Cancels a certificate creation operation that is already in progress.
|
com.azure.core.http.rest.Response<CertificateOperation> |
cancelCertificateOperationWithResponse(String certificateName,
com.azure.core.util.Context context)
Cancels a certificate creation operation that is already in progress.
|
CertificateIssuer |
createIssuer(CertificateIssuer issuer)
Creates the specified certificate issuer.
|
com.azure.core.http.rest.Response<CertificateIssuer> |
createIssuerWithResponse(CertificateIssuer issuer,
com.azure.core.util.Context context)
Creates the specified certificate issuer.
|
CertificateOperation |
deleteCertificateOperation(String certificateName)
Deletes the creation operation for the specified certificate that is in the process of being created.
|
com.azure.core.http.rest.Response<CertificateOperation> |
deleteCertificateOperationWithResponse(String certificateName,
com.azure.core.util.Context context)
Deletes the creation operation for the specified certificate that is in the process of being created.
|
com.azure.core.http.rest.PagedIterable<CertificateContact> |
deleteContacts()
Deletes the certificate contacts in the key vault.
|
com.azure.core.http.rest.PagedIterable<CertificateContact> |
deleteContacts(com.azure.core.util.Context context)
Deletes the certificate contacts in the key vault.
|
CertificateIssuer |
deleteIssuer(String issuerName)
Deletes the specified certificate issuer.
|
com.azure.core.http.rest.Response<CertificateIssuer> |
deleteIssuerWithResponse(String issuerName,
com.azure.core.util.Context context)
Deletes the specified certificate issuer.
|
KeyVaultCertificateWithPolicy |
getCertificate(String certificateName)
Gets information about the latest version of the specified certificate.
|
com.azure.core.util.polling.SyncPoller<CertificateOperation,KeyVaultCertificateWithPolicy> |
getCertificateOperation(String certificateName)
Gets a pending
CertificateOperation from the key vault. |
CertificatePolicy |
getCertificatePolicy(String certificateName)
Retrieves the policy of the specified certificate in the key vault.
|
com.azure.core.http.rest.Response<CertificatePolicy> |
getCertificatePolicyWithResponse(String certificateName,
com.azure.core.util.Context context)
Retrieves the policy of the specified certificate in the key vault.
|
KeyVaultCertificate |
getCertificateVersion(String certificateName,
String version)
Gets information about the specified version of the specified certificate.
|
com.azure.core.http.rest.Response<KeyVaultCertificate> |
getCertificateVersionWithResponse(String certificateName,
String version,
com.azure.core.util.Context context)
Gets information about the latest version of the specified certificate.
|
com.azure.core.http.rest.Response<KeyVaultCertificateWithPolicy> |
getCertificateWithResponse(String certificateName,
com.azure.core.util.Context context)
Gets information about the latest version of the specified certificate.
|
DeletedCertificate |
getDeletedCertificate(String certificateName)
Retrieves information about the specified deleted certificate.
|
com.azure.core.http.rest.Response<DeletedCertificate> |
getDeletedCertificateWithResponse(String certificateName,
com.azure.core.util.Context context)
Retrieves information about the specified deleted certificate.
|
CertificateIssuer |
getIssuer(String issuerName)
Retrieves the specified certificate issuer from the key vault.
|
com.azure.core.http.rest.Response<CertificateIssuer> |
getIssuerWithResponse(String issuerName,
com.azure.core.util.Context context)
Retrieves the specified certificate issuer from the key vault.
|
String |
getVaultUrl()
Get the vault endpoint url to which service requests are sent to.
|
KeyVaultCertificateWithPolicy |
importCertificate(ImportCertificateOptions importCertificateOptions)
Imports a pre-existing certificate to the key vault.
|
com.azure.core.http.rest.Response<KeyVaultCertificateWithPolicy> |
importCertificateWithResponse(ImportCertificateOptions importCertificateOptions,
com.azure.core.util.Context context)
Imports a pre-existing certificate to the key vault.
|
com.azure.core.http.rest.PagedIterable<CertificateContact> |
listContacts()
Lists the certificate contacts in the key vault.
|
com.azure.core.http.rest.PagedIterable<CertificateContact> |
listContacts(com.azure.core.util.Context context)
Lists the certificate contacts in the key vault.
|
com.azure.core.http.rest.PagedIterable<DeletedCertificate> |
listDeletedCertificates()
Lists the
deleted certificates in the key vault currently available for recovery. |
com.azure.core.http.rest.PagedIterable<DeletedCertificate> |
listDeletedCertificates(boolean includePending,
com.azure.core.util.Context context)
Lists the
deleted certificates in the key vault currently available for recovery. |
com.azure.core.http.rest.PagedIterable<CertificateProperties> |
listPropertiesOfCertificates()
List certificates in a the key vault.
|
com.azure.core.http.rest.PagedIterable<CertificateProperties> |
listPropertiesOfCertificates(boolean includePending,
com.azure.core.util.Context context)
List certificates in a the key vault.
|
com.azure.core.http.rest.PagedIterable<CertificateProperties> |
listPropertiesOfCertificateVersions(String certificateName)
List all versions of the specified certificate.
|
com.azure.core.http.rest.PagedIterable<CertificateProperties> |
listPropertiesOfCertificateVersions(String certificateName,
com.azure.core.util.Context context)
List all versions of the specified certificate.
|
com.azure.core.http.rest.PagedIterable<IssuerProperties> |
listPropertiesOfIssuers()
List all the certificate issuers resources in the key vault.
|
com.azure.core.http.rest.PagedIterable<IssuerProperties> |
listPropertiesOfIssuers(com.azure.core.util.Context context)
List all the certificate issuers resources in the key vault.
|
KeyVaultCertificateWithPolicy |
mergeCertificate(MergeCertificateOptions mergeCertificateOptions)
Merges a certificate or a certificate chain with a key pair currently available in the service.
|
com.azure.core.http.rest.Response<KeyVaultCertificateWithPolicy> |
mergeCertificateWithResponse(MergeCertificateOptions mergeCertificateOptions,
com.azure.core.util.Context context)
Merges a certificate or a certificate chain with a key pair currently available in the service.
|
void |
purgeDeletedCertificate(String certificateName)
Permanently deletes the specified deleted certificate without possibility for recovery.
|
com.azure.core.http.rest.Response<Void> |
purgeDeletedCertificateWithResponse(String certificateName,
com.azure.core.util.Context context)
Permanently deletes the specified deleted certificate without possibility for recovery.
|
KeyVaultCertificateWithPolicy |
restoreCertificateBackup(byte[] backup)
Restores a backed up certificate to the vault.
|
com.azure.core.http.rest.Response<KeyVaultCertificateWithPolicy> |
restoreCertificateBackupWithResponse(byte[] backup,
com.azure.core.util.Context context)
Restores a backed up certificate to the vault.
|
com.azure.core.http.rest.PagedIterable<CertificateContact> |
setContacts(List<CertificateContact> contacts)
Sets the certificate contacts on the key vault.
|
com.azure.core.http.rest.PagedIterable<CertificateContact> |
setContacts(List<CertificateContact> contacts,
com.azure.core.util.Context context)
Sets the certificate contacts on the key vault.
|
CertificatePolicy |
updateCertificatePolicy(String certificateName,
CertificatePolicy policy)
Updates the policy for a certificate.
|
com.azure.core.http.rest.Response<CertificatePolicy> |
updateCertificatePolicyWithResponse(String certificateName,
CertificatePolicy policy,
com.azure.core.util.Context context)
Updates the policy for a certificate.
|
KeyVaultCertificate |
updateCertificateProperties(CertificateProperties properties)
Updates the specified attributes associated with the specified certificate.
|
com.azure.core.http.rest.Response<KeyVaultCertificate> |
updateCertificatePropertiesWithResponse(CertificateProperties properties,
com.azure.core.util.Context context)
Updates the specified attributes associated with the specified certificate.
|
CertificateIssuer |
updateIssuer(CertificateIssuer issuer)
Updates the specified certificate issuer.
|
com.azure.core.http.rest.Response<CertificateIssuer> |
updateIssuerWithResponse(CertificateIssuer issuer,
com.azure.core.util.Context context)
Updates the specified certificate issuer.
|
public String getVaultUrl()
public com.azure.core.util.polling.SyncPoller<CertificateOperation,KeyVaultCertificateWithPolicy> beginCreateCertificate(String certificateName, CertificatePolicy policy, Boolean isEnabled, Map<String,String> tags)
Create certificate is a long running operation. It indefinitely waits for the create certificate operation to complete on service side.
Code Samples
Create certificate is a long running operation. The createCertificate indefinitely waits for the operation to complete and returns its last status. The details of the last certificate operation status are printed when a response is received
CertificatePolicy certificatePolicyPkcsSelf = new CertificatePolicy("Self", "CN=SelfSignedJavaPkcs12"); SyncPoller<CertificateOperation, KeyVaultCertificateWithPolicy> certPoller = certificateClient .beginCreateCertificate("certificateName", certificatePolicyPkcsSelf, true, new HashMap<>()); certPoller.waitUntil(LongRunningOperationStatus.SUCCESSFULLY_COMPLETED); KeyVaultCertificate cert = certPoller.getFinalResult(); System.out.printf("Certificate created with name %s", cert.getName());
certificateName
- The name of the certificate to be created.policy
- The policy of the certificate to be created.isEnabled
- The enabled status of the certificate.tags
- The application specific metadata to set.SyncPoller
to poll on the create certificate operation status.com.azure.core.exception.ResourceModifiedException
- when invalid certificate policy configuration is provided.public com.azure.core.util.polling.SyncPoller<CertificateOperation,KeyVaultCertificateWithPolicy> beginCreateCertificate(String certificateName, CertificatePolicy policy)
Code Samples
Create certificate is a long running operation. The createCertificate indefinitely waits for the operation to complete and returns its last status. The details of the last certificate operation status are printed when a response is received
CertificatePolicy certificatePolicy = new CertificatePolicy("Self", "CN=SelfSignedJavaPkcs12"); SyncPoller<CertificateOperation, KeyVaultCertificateWithPolicy> certificatePoller = certificateClient .beginCreateCertificate("certificateName", certificatePolicy); certificatePoller.waitUntil(LongRunningOperationStatus.SUCCESSFULLY_COMPLETED); KeyVaultCertificate certificate = certificatePoller.getFinalResult(); System.out.printf("Certificate created with name %s", certificate.getName());
certificateName
- The name of the certificate to be created.policy
- The policy of the certificate to be created.SyncPoller
to poll on the create certificate operation status.com.azure.core.exception.ResourceModifiedException
- when invalid certificate policy configuration is provided.public com.azure.core.util.polling.SyncPoller<CertificateOperation,KeyVaultCertificateWithPolicy> getCertificateOperation(String certificateName)
CertificateOperation
from the key vault. This operation requires the certificates/get permission.
Code Samples
Geta a pending certificate operation. The poller
allows users to automatically poll on the certificate
operation status.
SyncPoller<CertificateOperation, KeyVaultCertificateWithPolicy> certPoller = certificateClient .getCertificateOperation("certificateName"); certPoller.waitUntil(LongRunningOperationStatus.SUCCESSFULLY_COMPLETED); KeyVaultCertificate cert = certPoller.getFinalResult(); System.out.printf("Certificate created with name %s", cert.getName());
certificateName
- The name of the certificate.SyncPoller
to poll on the certificate operation status.com.azure.core.exception.ResourceNotFoundException
- when a certificate operation for a certificate with certificateName
doesn't exist.public KeyVaultCertificateWithPolicy getCertificate(String certificateName)
Code Samples
Gets a specific version of the certificate in the key vault. Prints out the returned certificate details when a response has been received.
KeyVaultCertificateWithPolicy certificate = certificateClient.getCertificate("certificateName"); System.out.printf("Received certificate with name %s and version %s and secret id", certificate.getProperties().getName(), certificate.getProperties().getVersion(), certificate.getSecretId());
certificateName
- The name of the certificate to retrieve, cannot be nullcertificate
.com.azure.core.exception.ResourceNotFoundException
- when a certificate with certificateName
doesn't exist in the key vault.com.azure.core.exception.HttpRequestException
- if certificateName
is empty string.public com.azure.core.http.rest.Response<KeyVaultCertificateWithPolicy> getCertificateWithResponse(String certificateName, com.azure.core.util.Context context)
Code Samples
Gets a specific version of the certificate in the key vault. Prints out the returned certificate details when a response has been received.
Response<KeyVaultCertificateWithPolicy> certificateWithResponse = certificateClient .getCertificateWithResponse("certificateName", new Context(key1, value1)); System.out.printf("Received certificate with name %s and version %s and secret id", certificateWithResponse.getValue().getProperties().getName(), certificateWithResponse.getValue().getProperties().getVersion(), certificate.getSecretId());
certificateName
- The name of the certificate to retrieve, cannot be nullcontext
- Additional context that is passed through the Http pipeline during the service call.Response
whose value
contains the requested certificate
.com.azure.core.exception.ResourceNotFoundException
- when a certificate with certificateName
doesn't exist in the key vault.com.azure.core.exception.HttpRequestException
- if certificateName
is empty string.public com.azure.core.http.rest.Response<KeyVaultCertificate> getCertificateVersionWithResponse(String certificateName, String version, com.azure.core.util.Context context)
Code Samples
Gets a specific version of the certificate in the key vault. Prints out the returned certificate details when a response has been received.
Response<KeyVaultCertificate> returnedCertificateWithResponse = certificateClient .getCertificateVersionWithResponse("certificateName", "certificateVersion", new Context(key1, value1)); System.out.printf("Received certificate with name %s and version %s and secret id", returnedCertificateWithResponse.getValue().getProperties().getName(), returnedCertificateWithResponse.getValue().getProperties().getVersion(), returnedCertificateWithResponse.getValue().getSecretId());
certificateName
- The name of the certificate to retrieve, cannot be nullversion
- The version of the certificate to retrieve. If this is an empty String or null then latest version of the certificate is retrieved.context
- Additional context that is passed through the Http pipeline during the service call.Response
whose value
contains the requested certificate
.com.azure.core.exception.ResourceNotFoundException
- when a certificate with certificateName
doesn't exist in the key vault.com.azure.core.exception.HttpRequestException
- if certificateName
is empty string.public KeyVaultCertificate getCertificateVersion(String certificateName, String version)
Code Samples
Gets a specific version of the certificate in the key vault. Prints out the returned certificate details when a response has been received.
KeyVaultCertificate returnedCertificate = certificateClient.getCertificateVersion("certificateName", "certificateVersion"); System.out.printf("Received certificate with name %s and version %s and secret id", returnedCertificate.getProperties().getName(), returnedCertificate.getProperties().getVersion(), returnedCertificate.getSecretId());
certificateName
- The name of the certificate to retrieve, cannot be nullversion
- The version of the certificate to retrieve. If this is an empty String or null then latest version of the certificate is retrieved.certificate
.com.azure.core.exception.ResourceNotFoundException
- when a certificate with certificateName
doesn't exist in the key vault.com.azure.core.exception.HttpRequestException
- if certificateName
is empty string.public KeyVaultCertificate updateCertificateProperties(CertificateProperties properties)
Code Samples
Gets latest version of the certificate, changes its tags and enabled status and then updates it in the Azure Key Vault. Prints out the returned certificate details when a response has been received.
KeyVaultCertificate certificate = certificateClient.getCertificate("certificateName"); // Update certificate enabled status certificate.getProperties().setEnabled(false); KeyVaultCertificate updatedCertificate = certificateClient.updateCertificateProperties(certificate.getProperties()); System.out.printf("Updated Certificate with name %s and enabled status %s", updatedCertificate.getProperties().getName(), updatedCertificate.getProperties().isEnabled());
properties
- The CertificateProperties
object with updated properties.updated certificate
.NullPointerException
- if certificate
is null
.com.azure.core.exception.ResourceNotFoundException
- when a certificate with certificateName
and version
doesn't exist in the key vault.com.azure.core.exception.HttpRequestException
- if certificateName
or version
is empty string.public com.azure.core.http.rest.Response<KeyVaultCertificate> updateCertificatePropertiesWithResponse(CertificateProperties properties, com.azure.core.util.Context context)
Code Samples
Gets latest version of the certificate, changes its tags and enabled status and then updates it in the Azure Key Vault. Prints out the returned certificate details when a response has been received.
KeyVaultCertificate certificateToUpdate = certificateClient.getCertificate("certificateName"); // Update certificate enabled status certificateToUpdate.getProperties().setEnabled(false); Response<KeyVaultCertificate> updatedCertificateResponse = certificateClient. updateCertificatePropertiesWithResponse(certificateToUpdate.getProperties(), new Context(key1, value1)); System.out.printf("Updated Certificate with name %s and enabled status %s", updatedCertificateResponse.getValue().getProperties().getName(), updatedCertificateResponse.getValue().getProperties().isEnabled());
properties
- The CertificateProperties
object with updated properties.context
- Additional context that is passed through the Http pipeline during the service call.Response
whose value
contains the updated certificate
.NullPointerException
- if certificate
is null
.com.azure.core.exception.ResourceNotFoundException
- when a certificate with certificateName
and version
doesn't exist in the key vault.com.azure.core.exception.HttpRequestException
- if certificateName
or version
is empty string.public com.azure.core.util.polling.SyncPoller<DeletedCertificate,Void> beginDeleteCertificate(String certificateName)
Code Samples
Deletes the certificate in the Azure Key Vault. Prints out the deleted certificate details when a response has been received.
SyncPoller<DeletedCertificate, Void> deleteCertificatePoller = certificateClient.beginDeleteCertificate("certificateName"); // Deleted Certificate is accessible as soon as polling beings. PollResponse<DeletedCertificate> pollResponse = deleteCertificatePoller.poll(); System.out.printf("Deleted certitifcate with name %s and recovery id %s", pollResponse.getValue().getName(), pollResponse.getValue().getRecoveryId()); deleteCertificatePoller.waitForCompletion();
certificateName
- The name of the certificate to be deleted.SyncPoller
to poll on and retrieve deleted certificate
.com.azure.core.exception.ResourceNotFoundException
- when a certificate with certificateName
doesn't exist in the key vault.com.azure.core.exception.HttpRequestException
- when a certificate with certificateName
is empty string.public DeletedCertificate getDeletedCertificate(String certificateName)
Code Samples
Gets the deleted certificate from the key vault enabled for soft-delete. Prints out the deleted certificate details when a response has been received.
DeletedCertificate deletedCertificate = certificateClient.getDeletedCertificate("certificateName"); System.out.printf("Deleted certificate with name %s and recovery id %s", deletedCertificate.getName(), deletedCertificate.getRecoveryId());
certificateName
- The name of the deleted certificate.deleted certificate
.com.azure.core.exception.ResourceNotFoundException
- when a certificate with certificateName
doesn't exist in the key vault.com.azure.core.exception.HttpRequestException
- when a certificate with certificateName
is empty string.public com.azure.core.http.rest.Response<DeletedCertificate> getDeletedCertificateWithResponse(String certificateName, com.azure.core.util.Context context)
Code Samples
Gets the deleted certificate from the key vault enabled for soft-delete. Prints out the deleted certificate details when a response has been received.
Response<DeletedCertificate> deletedCertificateWithResponse = certificateClient .getDeletedCertificateWithResponse("certificateName", new Context(key1, value1)); System.out.printf("Deleted certificate with name %s and recovery id %s", deletedCertificateWithResponse.getValue().getName(), deletedCertificateWithResponse.getValue().getRecoveryId());
certificateName
- The name of the deleted certificate.context
- Additional context that is passed through the Http pipeline during the service call.Response
whose value
contains the deleted certificate
.com.azure.core.exception.ResourceNotFoundException
- when a certificate with certificateName
doesn't exist in the key vault.com.azure.core.exception.HttpRequestException
- when a certificate with certificateName
is empty string.public void purgeDeletedCertificate(String certificateName)
Code Samples
Purges the deleted certificate from the key vault enabled for soft-delete. Prints out the status code from the server response when a response has been received.
certificateClient.purgeDeletedCertificate("certificateName");
certificateName
- The name of the deleted certificate.com.azure.core.exception.ResourceNotFoundException
- when a certificate with certificateName
doesn't exist in the key vault.com.azure.core.exception.HttpRequestException
- when a certificate with certificateName
is empty string.public com.azure.core.http.rest.Response<Void> purgeDeletedCertificateWithResponse(String certificateName, com.azure.core.util.Context context)
Code Samples
Purges the deleted certificate from the key vault enabled for soft-delete. Prints out the status code from the server response when a response has been received.
Response<Void> purgeResponse = certificateClient.purgeDeletedCertificateWithResponse("certificateName", new Context(key1, value1)); System.out.printf("Purged Deleted certificate with status %d %n", purgeResponse.getStatusCode());
certificateName
- The name of the deleted certificate.context
- Additional context that is passed through the Http pipeline during the service call.com.azure.core.exception.ResourceNotFoundException
- when a certificate with certificateName
doesn't exist in the key vault.com.azure.core.exception.HttpRequestException
- when a certificate with certificateName
is empty string.public com.azure.core.util.polling.SyncPoller<KeyVaultCertificateWithPolicy,Void> beginRecoverDeletedCertificate(String certificateName)
Code Samples
Recovers the deleted certificate from the key vault enabled for soft-delete. Prints out the recovered certificate details when a response has been received.
SyncPoller<KeyVaultCertificateWithPolicy, Void> recoverCertPoller = certificateClient .beginRecoverDeletedCertificate("deletedCertificateName"); // Recovered certificate is accessible as soon as polling beings PollResponse<KeyVaultCertificateWithPolicy> pollResponse = recoverCertPoller.poll(); System.out.printf(" Recovered Deleted certificate with name %s and id %s", pollResponse.getValue() .getProperties().getName(), pollResponse.getValue().getProperties().getId()); recoverCertPoller.waitForCompletion();
certificateName
- The name of the deleted certificate to be recovered.SyncPoller
to poll on and retrieve recovered certificate
.com.azure.core.exception.ResourceNotFoundException
- when a certificate with certificateName
doesn't exist in the certificate vault.com.azure.core.exception.HttpRequestException
- when a certificate with certificateName
is empty string.public byte[] backupCertificate(String certificateName)
Code Samples
Backs up the certificate from the key vault. Prints out the length of the certificate's backup byte array returned in the response.
byte[] certificateBackup = certificateClient.backupCertificate("certificateName"); System.out.printf("Backed up certificate with back up blob length %d", certificateBackup.length);
certificateName
- The name of the certificate.com.azure.core.exception.ResourceNotFoundException
- when a certificate with certificateName
doesn't exist in the key vault.com.azure.core.exception.HttpRequestException
- when a certificate with certificateName
is empty string.public com.azure.core.http.rest.Response<byte[]> backupCertificateWithResponse(String certificateName, com.azure.core.util.Context context)
Code Samples
Backs up the certificate from the key vault. Prints out the length of the certificate's backup byte array returned in the response.
Response<byte[]> certificateBackupWithResponse = certificateClient .backupCertificateWithResponse("certificateName", new Context(key1, value1)); System.out.printf("Backed up certificate with back up blob length %d", certificateBackupWithResponse.getValue().length);
certificateName
- The certificateName of the certificate.context
- Additional context that is passed through the Http pipeline during the service call.Response
whose value
contains the backed up certificate blob.com.azure.core.exception.ResourceNotFoundException
- when a certificate with certificateName
doesn't exist in the key vault.com.azure.core.exception.HttpRequestException
- when a certificate with certificateName
is empty string.public KeyVaultCertificateWithPolicy restoreCertificateBackup(byte[] backup)
Code Samples
Restores the certificate in the key vault from its backup. Prints out the restored certificate details when a response has been received.
byte[] certificateBackupBlob = {}; KeyVaultCertificate certificate = certificateClient.restoreCertificateBackup(certificateBackupBlob); System.out.printf(" Restored certificate with name %s and id %s", certificate.getProperties().getName(), certificate.getProperties().getId());
backup
- The backup blob associated with the certificate.restored certificate
.com.azure.core.exception.ResourceModifiedException
- when backup
blob is malformed.public com.azure.core.http.rest.Response<KeyVaultCertificateWithPolicy> restoreCertificateBackupWithResponse(byte[] backup, com.azure.core.util.Context context)
Code Samples
Restores the certificate in the key vault from its backup. Prints out the restored certificate details when a response has been received.
byte[] certificateBackupBlobArray = {}; Response<KeyVaultCertificateWithPolicy> certificateResponse = certificateClient .restoreCertificateBackupWithResponse(certificateBackupBlobArray, new Context(key1, value1)); System.out.printf(" Restored certificate with name %s and id %s", certificateResponse.getValue().getProperties().getName(), certificateResponse.getValue().getProperties().getId());
backup
- The backup blob associated with the certificate.context
- Additional context that is passed through the Http pipeline during the service call.Response
whose value
contains the restored certificate
.com.azure.core.exception.ResourceModifiedException
- when backup
blob is malformed.public com.azure.core.http.rest.PagedIterable<CertificateProperties> listPropertiesOfCertificates()
CertificateProperties
as only the certificate identifier, thumbprint,
attributes and tags are provided in the response. The policy and individual certificate versions are not listed in
the response. This operation requires the certificates/list permission.
It is possible to get certificates with all the properties excluding the policy from this information. Loop over the CertificateProperties
and
call CertificateClient.getCertificateVersion(String, String)
. This will return the certificate
with all its properties excluding the policy.
for (CertificateProperties certificateProperties : certificateClient.listPropertiesOfCertificates()) { KeyVaultCertificate certificateWithAllProperties = certificateClient .getCertificateVersion(certificateProperties.getName(), certificateProperties.getVersion()); System.out.printf("Received certificate with name %s and secret id %s", certificateWithAllProperties.getProperties().getName(), certificateWithAllProperties.getSecretId()); }
PagedIterable
containing certificate
for all the certificates in the vault.public com.azure.core.http.rest.PagedIterable<CertificateProperties> listPropertiesOfCertificates(boolean includePending, com.azure.core.util.Context context)
CertificateProperties
as only the certificate identifier, thumbprint,
attributes and tags are provided in the response. The policy and individual certificate versions are not listed in
the response. This operation requires the certificates/list permission.
It is possible to get certificates with all the properties excluding the policy from this information. Loop over the CertificateProperties
and
call CertificateClient.getCertificateVersion(String, String)
. This will return the certificate
with all its properties excluding the policy.
for (CertificateProperties certificateProperties : certificateClient .listPropertiesOfCertificates(true, new Context(key1, value1))) { KeyVaultCertificate certificateWithAllProperties = certificateClient .getCertificateVersion(certificateProperties.getName(), certificateProperties.getVersion()); System.out.printf("Received certificate with name %s and secret id %s", certificateWithAllProperties.getProperties().getName(), certificateWithAllProperties.getSecretId()); }
includePending
- indicate if pending certificates should be included in the results.context
- Additional context that is passed through the Http pipeline during the service call.PagedIterable
containing certificate
for all the certificates in the vault.public com.azure.core.http.rest.PagedIterable<DeletedCertificate> listDeletedCertificates()
deleted certificates
in the key vault currently available for recovery. This operation includes
deletion-specific information and is applicable for vaults enabled for soft-delete. This operation requires the
certificates/get/list
permission.
Code Samples
Lists the deleted certificates in the key vault. Prints out the recovery id of each deleted certificate when a response has been received.
for (DeletedCertificate deletedCertificate : certificateClient.listDeletedCertificates()) { System.out.printf("Deleted certificate's recovery Id %s", deletedCertificate.getRecoveryId()); }
PagedIterable
containing all of the deleted certificates
in the vault.public com.azure.core.http.rest.PagedIterable<DeletedCertificate> listDeletedCertificates(boolean includePending, com.azure.core.util.Context context)
deleted certificates
in the key vault currently available for recovery. This operation includes
deletion-specific information and is applicable for vaults enabled for soft-delete. This operation requires the
certificates/get/list
permission.
Code Samples
Lists the deleted certificates in the key vault. Prints out the recovery id of each deleted certificate when a response has been received.
for (DeletedCertificate deletedCertificate : certificateClient .listDeletedCertificates(true, new Context(key1, value1))) { System.out.printf("Deleted certificate's recovery Id %s", deletedCertificate.getRecoveryId()); }
includePending
- indicate if pending deleted certificates should be included in the results.context
- Additional context that is passed through the Http pipeline during the service call.PagedIterable
containing all of the deleted certificates
in the vault.public com.azure.core.http.rest.PagedIterable<CertificateProperties> listPropertiesOfCertificateVersions(String certificateName)
CertificateProperties
as only the certificate identifier, thumbprint, attributes and tags are provided in the response. The policy is not listed in
the response. This operation requires the certificates/list permission.
It is possible to get the certificates with properties excluding the policy for all the versions from this information. Loop over the CertificateProperties
and
call CertificateClient.getCertificateVersion(String, String)
. This will return the certificate
with all its properties excluding the policy.
for (CertificateProperties certificateProperties : certificateClient .listPropertiesOfCertificateVersions("certificateName")) { KeyVaultCertificate certificateWithAllProperites = certificateClient .getCertificateVersion(certificateProperties.getName(), certificateProperties.getVersion()); System.out.printf("Received certificate's version with name %s, version %s and secret id %s", certificateWithAllProperites.getProperties().getName(), certificateWithAllProperites.getProperties().getVersion(), certificateWithAllProperites.getSecretId()); }
certificateName
- The name of the certificate.PagedIterable
containing certificate
of all the versions of the specified certificate in the vault. Paged Iterable is empty if certificate with certificateName
does not exist in key vault.com.azure.core.exception.ResourceNotFoundException
- when a certificate with certificateName
doesn't exist in the key vault.com.azure.core.exception.HttpRequestException
- when a certificate with certificateName
is empty string.public com.azure.core.http.rest.PagedIterable<CertificateProperties> listPropertiesOfCertificateVersions(String certificateName, com.azure.core.util.Context context)
CertificateProperties
as only the certificate identifier, thumbprint, attributes and tags are provided in the response. The policy is not listed in
the response. This operation requires the certificates/list permission.
It is possible to get the certificates with properties excluding the policy for all the versions from this information. Loop over the CertificateProperties
and
call CertificateClient.getCertificateVersion(String, String)
. This will return the certificate
with all its properties excluding the policy.
for (CertificateProperties certificateProperties : certificateClient .listPropertiesOfCertificateVersions("certificateName")) { KeyVaultCertificate certificateWithAllProperites = certificateClient .getCertificateVersion(certificateProperties.getName(), certificateProperties.getVersion()); System.out.printf("Received certificate's version with name %s, version %s and secret id %s", certificateWithAllProperites.getProperties().getName(), certificateWithAllProperites.getProperties().getVersion(), certificateWithAllProperites.getSecretId()); }
certificateName
- The name of the certificate.context
- Additional context that is passed through the Http pipeline during the service call.PagedIterable
containing certificate
of all the versions of the specified certificate in the vault. Iterable is empty if certificate with certificateName
does not exist in key vault.com.azure.core.exception.ResourceNotFoundException
- when a certificate with certificateName
doesn't exist in the key vault.com.azure.core.exception.HttpRequestException
- when a certificate with certificateName
is empty string.public CertificatePolicy getCertificatePolicy(String certificateName)
certificates/get
permission.
Code Samples
Gets the policy of a certirifcate in the key vault. Prints out the returned certificate policy details when a response has been received.
CertificatePolicy policy = certificateClient.getCertificatePolicy("certificateName"); System.out.printf("Received policy with subject name %s", policy.getSubject());
certificateName
- The name of the certificate whose policy is to be retrieved, cannot be nullcertificate policy
.com.azure.core.exception.ResourceNotFoundException
- when a certificate with certificateName
doesn't exist in the key vault.com.azure.core.exception.HttpRequestException
- if certificateName
is empty string.public com.azure.core.http.rest.Response<CertificatePolicy> getCertificatePolicyWithResponse(String certificateName, com.azure.core.util.Context context)
certificates/get
permission.
Code Samples
Gets the policy of a certirifcate in the key vault. Prints out the returned certificate policy details when a response has been received.
Response<CertificatePolicy> returnedPolicyWithResponse = certificateClient.getCertificatePolicyWithResponse( "certificateName", new Context(key1, value1)); System.out.printf("Received policy with subject name %s", returnedPolicyWithResponse.getValue().getSubject());
certificateName
- The name of the certificate whose policy is to be retrieved, cannot be nullcontext
- Additional context that is passed through the Http pipeline during the service call.Response
whose value
contains the requested certificate policy
.com.azure.core.exception.ResourceNotFoundException
- when a certificate with certificateName
doesn't exist in the key vault.com.azure.core.exception.HttpRequestException
- if certificateName
is empty string.public CertificatePolicy updateCertificatePolicy(String certificateName, CertificatePolicy policy)
certificates/update
permission.
Code Samples
Gets the certificate policy, changes its properties and then updates it in the Azure Key Vault. Prints out the returned policy details when a response has been received.
CertificatePolicy certificatePolicy = certificateClient.getCertificatePolicy("certificateName"); //Update the certificate policy cert transparency property. certificatePolicy.setCertificateTransparent(true); CertificatePolicy updatedCertPolicy = certificateClient.updateCertificatePolicy("certificateName", certificatePolicy); System.out.printf("Updated Certificate Policy transparency status %s", updatedCertPolicy.isCertificateTransparent());
certificateName
- The name of the certificate whose policy is to be updated.policy
- The certificate policy to be updated.certificate policy
.NullPointerException
- if policy
is null
.com.azure.core.exception.ResourceNotFoundException
- when a certificate with certificateName
doesn't exist in the key vault.com.azure.core.exception.HttpRequestException
- if certificateName
is empty string or if policy
is invalid.public com.azure.core.http.rest.Response<CertificatePolicy> updateCertificatePolicyWithResponse(String certificateName, CertificatePolicy policy, com.azure.core.util.Context context)
certificates/update
permission.
Code Samples
Gets the certificate policy, changes its properties and then updates it in the Azure Key Vault. Prints out the returned policy details when a response has been received.
CertificatePolicy certificatePolicyToUpdate = certificateClient.getCertificatePolicy("certificateName"); //Update the certificate policy cert transparency property. certificatePolicyToUpdate.setCertificateTransparent(true); Response<CertificatePolicy> updatedCertPolicyWithResponse = certificateClient .updateCertificatePolicyWithResponse("certificateName", certificatePolicyToUpdate, new Context(key1, value1)); System.out.printf("Updated Certificate Policy transparency status %s", updatedCertPolicyWithResponse .getValue().isCertificateTransparent());
certificateName
- The certificateName of the certificate whose policy is to be updated.policy
- The certificate policy to be updated.context
- Additional context that is passed through the Http pipeline during the service call.Response
whose value
contains the updated certificate policy
.NullPointerException
- if policy
is null
.com.azure.core.exception.ResourceNotFoundException
- when a certificate with certificateName
doesn't exist in the key vault.com.azure.core.exception.HttpRequestException
- if certificateName
is empty string or if policy
is invalid.public CertificateIssuer createIssuer(CertificateIssuer issuer)
Code Samples
Creates a new certificate issuer in the key vault. Prints out the created certificate issuer details when a response has been received.
CertificateIssuer issuerToCreate = new CertificateIssuer("myissuer", "myProvider") .setAccountId("testAccount") .setAdministratorContacts(Arrays.asList(new AdministratorContact().setFirstName("test").setLastName("name") .setEmail("test{@literal @}example.com"))); CertificateIssuer returnedIssuer = certificateClient.createIssuer(issuerToCreate); System.out.printf("Created Issuer with name %s provider %s", returnedIssuer.getName(), returnedIssuer.getProvider());
issuer
- The configuration of the certificate issuer to be created.certificate issuer
.com.azure.core.exception.ResourceModifiedException
- when invalid certificate issuer issuer
configuration is provided.com.azure.core.exception.HttpRequestException
- when a certificate issuer with name
is empty string.public com.azure.core.http.rest.Response<CertificateIssuer> createIssuerWithResponse(CertificateIssuer issuer, com.azure.core.util.Context context)
Code Samples
Creates a new certificate issuer in the key vault. Prints out the created certificate issuer details when a response has been received.
CertificateIssuer issuer = new CertificateIssuer("issuerName", "myProvider") .setAccountId("testAccount") .setAdministratorContacts(Arrays.asList(new AdministratorContact().setFirstName("test").setLastName("name") .setEmail("test{@literal @}example.com"))); Response<CertificateIssuer> issuerResponse = certificateClient.createIssuerWithResponse(issuer, new Context(key1, value1)); System.out.printf("Created Issuer with name %s provider %s", issuerResponse.getValue().getName(), issuerResponse.getValue().getProvider());
issuer
- The configuration of the certificate issuer to be created.context
- Additional context that is passed through the Http pipeline during the service call.Response
whose value
contains the created certificate issuer
.com.azure.core.exception.ResourceModifiedException
- when invalid certificate issuer issuer
configuration is provided.com.azure.core.exception.HttpRequestException
- when a certificate issuer with name
is empty string.public com.azure.core.http.rest.Response<CertificateIssuer> getIssuerWithResponse(String issuerName, com.azure.core.util.Context context)
Code Samples
Gets the specificed certifcate issuer in the key vault. Prints out the returned certificate issuer details when a response has been received.
Response<CertificateIssuer> issuerResponse = certificateClient.getIssuerWithResponse("issuerName", new Context(key1, value1)); System.out.printf("Retrieved issuer with name %s and prodier %s", issuerResponse.getValue().getName(), issuerResponse.getValue().getProvider());
issuerName
- The name of the certificate issuer to retrieve, cannot be nullcontext
- Additional context that is passed through the Http pipeline during the service call.Response
whose value
contains the requested certificate issuer
.com.azure.core.exception.ResourceNotFoundException
- when a certificate issuer with issuerName
doesn't exist in the key vault.com.azure.core.exception.HttpRequestException
- if issuerName
is empty string.public CertificateIssuer getIssuer(String issuerName)
Code Samples
Gets the specified certificate issuer in the key vault. Prints out the returned certificate issuer details when a response has been received.
CertificateIssuer returnedIssuer = certificateClient.getIssuer("issuerName"); System.out.printf("Retrieved issuer with name %s and prodier %s", returnedIssuer.getName(), returnedIssuer.getProvider());
issuerName
- The name of the certificate issuer to retrieve, cannot be nullcertificate issuer
.com.azure.core.exception.ResourceNotFoundException
- when a certificate issuer with issuerName
doesn't exist in the key vault.com.azure.core.exception.HttpRequestException
- if issuerName
is empty string.public com.azure.core.http.rest.Response<CertificateIssuer> deleteIssuerWithResponse(String issuerName, com.azure.core.util.Context context)
certificates/manageissuers/deleteissuers permission
.
Code Samples
Deletes the certificate issuer in the Azure Key Vault. Prints out the deleted certificate details when a response has been received.
CertificateIssuer deletedIssuer = certificateClient.deleteIssuer("certificateName"); System.out.printf("Deleted certificate issuer with name %s and provider id %s", deletedIssuer.getName(), deletedIssuer.getProvider());
issuerName
- The name of the certificate issuer to be deleted.context
- Additional context that is passed through the Http pipeline during the service call.Response
whose value
contains the deleted issuer
.com.azure.core.exception.ResourceNotFoundException
- when a certificate issuer with issuerName
doesn't exist in the key vault.com.azure.core.exception.HttpRequestException
- when a certificate issuer with issuerName
is empty string.public CertificateIssuer deleteIssuer(String issuerName)
certificates/manageissuers/deleteissuers permission
.
Code Samples
Deletes the certificate issuer in the Azure Key Vault. Prints out the deleted certificate details when a response has been received.
Response<CertificateIssuer> deletedIssuerWithResponse = certificateClient. deleteIssuerWithResponse("certificateName", new Context(key1, value1)); System.out.printf("Deleted certificate issuer with name %s and provider id %s", deletedIssuerWithResponse.getValue().getName(), deletedIssuerWithResponse.getValue().getProvider());
issuerName
- The name of the certificate issuer to be deleted.deleted issuer
.com.azure.core.exception.ResourceNotFoundException
- when a certificate issuer with issuerName
doesn't exist in the key vault.com.azure.core.exception.HttpRequestException
- when a certificate issuer with issuerName
is empty string.public com.azure.core.http.rest.PagedIterable<IssuerProperties> listPropertiesOfIssuers()
IssuerProperties
as only the certificate issuer identifier and provider are provided in the response. This operation requires the
certificates/manageissuers/getissuers
permission.
It is possible to get the certificate issuer with all of its properties from this information. Loop over the issuerProperties
and
call CertificateClient.getIssuer(String)
. This will return the issuer
with all its properties.
for (IssuerProperties issuer : certificateClient.listPropertiesOfIssuers()) { CertificateIssuer retrievedIssuer = certificateClient.getIssuer(issuer.getName()); System.out.printf("Received issuer with name %s and provider %s", retrievedIssuer.getName(), retrievedIssuer.getProvider()); }
PagedIterable
containing all of the certificate issuers
in the vault.public com.azure.core.http.rest.PagedIterable<IssuerProperties> listPropertiesOfIssuers(com.azure.core.util.Context context)
IssuerProperties
as only the certificate issuer identifier and provider are provided in the response. This operation requires the
certificates/manageissuers/getissuers
permission.
It is possible to get the certificate issuer with all of its properties from this information. Loop over the issuerProperties
and
call CertificateClient.getIssuer(String)
. This will return the issuer
with all its properties.
for (IssuerProperties issuer : certificateClient.listPropertiesOfIssuers(new Context(key1, value1))) { CertificateIssuer retrievedIssuer = certificateClient.getIssuer(issuer.getName()); System.out.printf("Received issuer with name %s and provider %s", retrievedIssuer.getName(), retrievedIssuer.getProvider()); }
context
- Additional context that is passed through the Http pipeline during the service call.PagedIterable
containing all of the certificate issuers
in the vault.public CertificateIssuer updateIssuer(CertificateIssuer issuer)
Code Samples
Gets the certificate issuer, changes its attributes/properties then updates it in the Azure Key Vault. Prints out the returned certificate issuer details when a response has been received.
CertificateIssuer returnedIssuer = certificateClient.getIssuer("issuerName"); returnedIssuer.setAccountId("newAccountId"); CertificateIssuer updatedIssuer = certificateClient.updateIssuer(returnedIssuer); System.out.printf("Updated issuer with name %s, provider %s and account Id %s", updatedIssuer.getName(), updatedIssuer.getProvider(), updatedIssuer.getAccountId());
issuer
- The issuer
with updated properties.updated issuer
.NullPointerException
- if issuer
is null
.com.azure.core.exception.ResourceNotFoundException
- when a certificate issuer with name
doesn't exist in the key vault.com.azure.core.exception.HttpRequestException
- if name
is empty string.public com.azure.core.http.rest.Response<CertificateIssuer> updateIssuerWithResponse(CertificateIssuer issuer, com.azure.core.util.Context context)
Code Samples
Gets the certificate issuer, changes its attributes/properties then updates it in the Azure Key Vault. Prints out the returned certificate issuer details when a response has been received.
CertificateIssuer issuer = certificateClient.getIssuer("issuerName"); returnedIssuer.setAccountId("newAccountId"); Response<CertificateIssuer> updatedIssuerWithResponse = certificateClient.updateIssuerWithResponse(issuer, new Context(key1, value1)); System.out.printf("Updated issuer with name %s, provider %s and account Id %s", updatedIssuerWithResponse.getValue().getName(), updatedIssuerWithResponse.getValue().getProvider(), updatedIssuerWithResponse.getValue().getAccountId());
issuer
- The issuer
with updated properties.context
- Additional context that is passed through the Http pipeline during the service call.Response
whose value
contains the updated issuer
.NullPointerException
- if issuer
is null
.com.azure.core.exception.ResourceNotFoundException
- when a certificate issuer with name
doesn't exist in the key vault.com.azure.core.exception.HttpRequestException
- if name
is empty string.public com.azure.core.http.rest.PagedIterable<CertificateContact> setContacts(List<CertificateContact> contacts)
certificates/managecontacts
permission.
The LifetimeAction
of type CertificatePolicyAction.EMAIL_CONTACTS
set on a CertificatePolicy
emails the contacts set on the vault when triggered.
Code Samples
Sets the certificate contacts in the Azure Key Vault. Prints out the returned contacts details.
CertificateContact contactToAdd = new CertificateContact().setName("user").setEmail("useremail{@literal @}exmaple.com"); for (CertificateContact contact : certificateClient.setContacts(Arrays.asList(contactToAdd))) { System.out.printf("Added contact with name %s and email %s to key vault", contact.getName(), contact.getEmail()); }
contacts
- The list of contacts to set on the vault.PagedIterable
containing all of the certificate contacts
in the vault.com.azure.core.exception.HttpRequestException
- when a contact information provided is invalid/incomplete.public com.azure.core.http.rest.PagedIterable<CertificateContact> setContacts(List<CertificateContact> contacts, com.azure.core.util.Context context)
certificates/managecontacts
permission.
The LifetimeAction
of type CertificatePolicyAction.EMAIL_CONTACTS
set on a CertificatePolicy
emails the contacts set on the vault when triggered.
Code Samples
Sets the certificate contacts in the Azure Key Vault. Prints out the returned contacts details.
CertificateContact sampleContact = new CertificateContact().setName("user").setEmail("useremail{@literal @}exmaple.com"); for (CertificateContact contact : certificateClient.setContacts(Arrays.asList(sampleContact), new Context(key1, value1))) { System.out.printf("Added contact with name %s and email %s to key vault", contact.getName(), contact.getEmail()); }
contacts
- The list of contacts to set on the vault.context
- Additional context that is passed through the Http pipeline during the service call.PagedIterable
containing all of the certificate contacts
in the vault.com.azure.core.exception.HttpRequestException
- when a contact information provided is invalid/incomplete.public com.azure.core.http.rest.PagedIterable<CertificateContact> listContacts()
Code Samples
Lists the certificate contacts in the Azure Key Vault. Prints out the returned contacts details in the response.
for (CertificateContact contact : certificateClient.listContacts()) { System.out.printf("Added contact with name %s and email %s to key vault", contact.getName(), contact.getEmail()); }
PagedIterable
containing all of the certificate contacts
in the vault.public com.azure.core.http.rest.PagedIterable<CertificateContact> listContacts(com.azure.core.util.Context context)
Code Samples
Lists the certificate contacts in the Azure Key Vault. Prints out the returned contacts details in the response.
for (CertificateContact contact : certificateClient.listContacts(new Context(key1, value1))) { System.out.printf("Added contact with name %s and email %s to key vault", contact.getName(), contact.getEmail()); }
context
- Additional context that is passed through the Http pipeline during the service call.PagedIterable
containing all of the certificate contacts
in the vault.public com.azure.core.http.rest.PagedIterable<CertificateContact> deleteContacts()
certificates/managecontacts
permission.
Code Samples
Deletes the certificate contacts in the Azure Key Vault. Subscribes to the call and prints out the deleted contacts details.
for (CertificateContact contact : certificateClient.deleteContacts()) { System.out.printf("Deleted contact with name %s and email %s from key vault", contact.getName(), contact.getEmail()); }
PagedIterable
containing all of the deleted certificate contacts
in the vault.public com.azure.core.http.rest.PagedIterable<CertificateContact> deleteContacts(com.azure.core.util.Context context)
certificates/managecontacts
permission.
Code Samples
Deletes the certificate contacts in the Azure Key Vault. Prints out the deleted contacts details in the response.
for (CertificateContact contact : certificateClient.deleteContacts(new Context(key1, value1))) { System.out.printf("Deleted contact with name %s and email %s from key vault", contact.getName(), contact.getEmail()); }
context
- Additional context that is passed through the Http pipeline during the service call.PagedIterable
containing all of the deleted certificate contacts
in the vault.public CertificateOperation deleteCertificateOperation(String certificateName)
certificates/update permission
.
Code Samples
Triggers certificate creation and then deletes the certificate creation operation in the Azure Key Vault. Subscribes to the call and prints out the deleted certificate operation details when a response has been received.
Response<CertificateOperation> deletedCertificateOperationWithResponse = certificateClient .deleteCertificateOperationWithResponse("certificateName", new Context(key1, value1)); System.out.printf("Deleted Certificate Operation's last status %s", deletedCertificateOperationWithResponse.getValue().getStatus());
certificateName
- The name of the certificate.certificate operation
.com.azure.core.exception.ResourceNotFoundException
- when a certificate operation for a certificate with certificateName
doesn't exist in the key vault.com.azure.core.exception.HttpRequestException
- when the certificateName
is empty string.public com.azure.core.http.rest.Response<CertificateOperation> deleteCertificateOperationWithResponse(String certificateName, com.azure.core.util.Context context)
certificates/update permission
.
Code Samples
Triggers certificate creation and then deletes the certificate creation operation in the Azure Key Vault. Subscribes to the call and prints out the deleted certificate operation details when a response has been received.
CertificateOperation deletedCertificateOperation = certificateClient .deleteCertificateOperation("certificateName"); System.out.printf("Deleted Certificate Operation's last status %s", deletedCertificateOperation.getStatus());
certificateName
- The name of the certificate.context
- Additional context that is passed through the Http pipeline during the service call.Response
whose value
contains the deleted certificate operation
.com.azure.core.exception.ResourceNotFoundException
- when a certificate operation for a certificate with certificateName
doesn't exist in the key vault.com.azure.core.exception.HttpRequestException
- when the certificateName
is empty string.public CertificateOperation cancelCertificateOperation(String certificateName)
certificates/update
permission.
Code Samples
Triggers certificate creation and then cancels the certificate creation operation in the Azure Key Vault. Subscribes to the call and prints out the updated certificate operation details when a response has been received.
CertificateOperation certificateOperation = certificateClient .cancelCertificateOperation("certificateName"); System.out.printf("Certificate Operation status %s", certificateOperation.getStatus());
certificateName
- The name of the certificate which is in the process of being created.Response
whose value
contains the cancelled certificate operation
.com.azure.core.exception.ResourceNotFoundException
- when a certificate operation for a certificate with name
doesn't exist in the key vault.com.azure.core.exception.HttpRequestException
- when the name
is empty string.public com.azure.core.http.rest.Response<CertificateOperation> cancelCertificateOperationWithResponse(String certificateName, com.azure.core.util.Context context)
certificates/update
permission.
Code Samples
Triggers certificate creation and then cancels the certificate creation operation in the Azure Key Vault. Subscribes to the call and prints out the updated certificate operation details when a response has been received.
Response<CertificateOperation> certificateOperationWithResponse = certificateClient .cancelCertificateOperationWithResponse("certificateName", new Context(key1, value1)); System.out.printf("Certificate Operation status %s", certificateOperationWithResponse.getValue().getStatus());
certificateName
- The name of the certificate which is in the process of being created.context
- Additional context that is passed through the Http pipeline during the service call.Response
whose value
contains the cancelled certificate operation
.com.azure.core.exception.ResourceNotFoundException
- when a certificate operation for a certificate with name
doesn't exist in the key vault.com.azure.core.exception.HttpRequestException
- when the name
is empty string.public KeyVaultCertificateWithPolicy mergeCertificate(MergeCertificateOptions mergeCertificateOptions)
certificates/create
permission.
Code Samples
Merges a certificate with a kay pair available in the service.
List<byte[]> x509CertificatesToMerge = new ArrayList<>(); MergeCertificateOptions config = new MergeCertificateOptions("certificateName", x509CertificatesToMerge) .setEnabled(false); KeyVaultCertificate mergedCertificate = certificateClient.mergeCertificate(config); System.out.printf("Received Certificate with name %s and key id %s", mergedCertificate.getProperties().getName(), mergedCertificate.getKeyId());
mergeCertificateOptions
- the merge certificate configuration holding the x509 certificates.NullPointerException
- when mergeCertificateOptions
is null.com.azure.core.exception.HttpRequestException
- if mergeCertificateOptions
is invalid/corrupt.public com.azure.core.http.rest.Response<KeyVaultCertificateWithPolicy> mergeCertificateWithResponse(MergeCertificateOptions mergeCertificateOptions, com.azure.core.util.Context context)
certificates/create
permission.
Code Samples
Merges a certificate with a kay pair available in the service.
List<byte[]> x509CertsToMerge = new ArrayList<>(); MergeCertificateOptions mergeConfig = new MergeCertificateOptions("certificateName", x509CertsToMerge) .setEnabled(false); Response<KeyVaultCertificateWithPolicy> mergedCertificateWithResponse = certificateClient.mergeCertificateWithResponse(mergeConfig, new Context(key2, value2)); System.out.printf("Received Certificate with name %s and key id %s", mergedCertificateWithResponse.getValue().getProperties().getName(), mergedCertificateWithResponse.getValue().getKeyId());
mergeCertificateOptions
- the merge certificate configuration holding the x509 certificates.context
- Additional context that is passed through the Http pipeline during the service call.Response
whose value
contains the merged certificate.NullPointerException
- when mergeCertificateOptions
is null.com.azure.core.exception.HttpRequestException
- if mergeCertificateOptions
is invalid/corrupt.public KeyVaultCertificateWithPolicy importCertificate(ImportCertificateOptions importCertificateOptions)
certificates/import
permission.
Code Samples
Imports a certificate into the key vault.
byte[] certificateToImport = new byte[100]; ImportCertificateOptions config = new ImportCertificateOptions("certificateName", certificateToImport).setEnabled(false); KeyVaultCertificate importedCertificate = certificateClient.importCertificate(config); System.out.printf("Received Certificate with name %s and key id %s", importedCertificate.getProperties().getName(), importedCertificate.getKeyId());
importCertificateOptions
- The details of the certificate to import to the key vaultimported certificate
.com.azure.core.exception.HttpRequestException
- when the importCertificateOptions
are invalid.public com.azure.core.http.rest.Response<KeyVaultCertificateWithPolicy> importCertificateWithResponse(ImportCertificateOptions importCertificateOptions, com.azure.core.util.Context context)
certificates/import
permission.
Code Samples
Imports a certificate into the key vault.
byte[] certToImport = new byte[100]; ImportCertificateOptions importCertificateOptions = new ImportCertificateOptions("certificateName", certToImport).setEnabled(false); Response<KeyVaultCertificateWithPolicy> importedCertificateWithResponse = certificateClient.importCertificateWithResponse(importCertificateOptions, new Context(key2, value2)); System.out.printf("Received Certificate with name %s and key id %s", importedCertificateWithResponse.getValue().getProperties().getName(), importedCertificateWithResponse.getValue().getKeyId());
importCertificateOptions
- The details of the certificate to import to the key vaultcontext
- Additional context that is passed through the Http pipeline during the service call.Response
whose value
contains the imported certificate
.com.azure.core.exception.HttpRequestException
- when the importCertificateOptions
are invalid.Copyright © 2020 Microsoft Corporation. All rights reserved.