diff --git a/sdk/keyvault/azure-security-keyvault-certificates/assets.json b/sdk/keyvault/azure-security-keyvault-certificates/assets.json index 7235a61b39fcb..844a429cde241 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/assets.json +++ b/sdk/keyvault/azure-security-keyvault-certificates/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "java", "TagPrefix": "java/keyvault/azure-security-keyvault-certificates", - "Tag": "java/keyvault/azure-security-keyvault-certificates_e018897fab" + "Tag": "java/keyvault/azure-security-keyvault-certificates_f79afcd807" } diff --git a/sdk/keyvault/azure-security-keyvault-certificates/checkstyle-suppressions.xml b/sdk/keyvault/azure-security-keyvault-certificates/checkstyle-suppressions.xml index 5c4942a1773d0..a8c684ad9237e 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/checkstyle-suppressions.xml +++ b/sdk/keyvault/azure-security-keyvault-certificates/checkstyle-suppressions.xml @@ -3,6 +3,7 @@ + diff --git a/sdk/keyvault/azure-security-keyvault-certificates/spotbugs-exclude.xml b/sdk/keyvault/azure-security-keyvault-certificates/spotbugs-exclude.xml index 4c1d8e4609b6f..81d4f396414a3 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/spotbugs-exclude.xml +++ b/sdk/keyvault/azure-security-keyvault-certificates/spotbugs-exclude.xml @@ -20,6 +20,8 @@ + + @@ -59,6 +61,7 @@ + diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateAsyncClient.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateAsyncClient.java index 826e0b66ab379..9eac01c0fd6f6 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateAsyncClient.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateAsyncClient.java @@ -13,8 +13,10 @@ import com.azure.core.http.rest.PagedFlux; import com.azure.core.http.rest.PagedResponse; import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.RequestOptions; import com.azure.core.http.rest.Response; import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.BinaryData; import com.azure.core.util.FluxUtil; import com.azure.core.util.logging.ClientLogger; import com.azure.core.util.polling.LongRunningOperationStatus; @@ -29,13 +31,23 @@ import com.azure.security.keyvault.certificates.implementation.DeletedCertificateHelper; import com.azure.security.keyvault.certificates.implementation.IssuerPropertiesHelper; import com.azure.security.keyvault.certificates.implementation.KeyVaultCertificateWithPolicyHelper; +import com.azure.security.keyvault.certificates.implementation.models.BackupCertificateResult; import com.azure.security.keyvault.certificates.implementation.models.CertificateAttributes; +import com.azure.security.keyvault.certificates.implementation.models.CertificateBundle; +import com.azure.security.keyvault.certificates.implementation.models.CertificateCreateParameters; +import com.azure.security.keyvault.certificates.implementation.models.CertificateImportParameters; import com.azure.security.keyvault.certificates.implementation.models.CertificateIssuerItem; +import com.azure.security.keyvault.certificates.implementation.models.CertificateIssuerSetParameters; +import com.azure.security.keyvault.certificates.implementation.models.CertificateIssuerUpdateParameters; import com.azure.security.keyvault.certificates.implementation.models.CertificateItem; +import com.azure.security.keyvault.certificates.implementation.models.CertificateMergeParameters; +import com.azure.security.keyvault.certificates.implementation.models.CertificateOperationUpdateParameter; +import com.azure.security.keyvault.certificates.implementation.models.CertificateRestoreParameters; +import com.azure.security.keyvault.certificates.implementation.models.CertificateUpdateParameters; import com.azure.security.keyvault.certificates.implementation.models.Contacts; +import com.azure.security.keyvault.certificates.implementation.models.DeletedCertificateBundle; import com.azure.security.keyvault.certificates.implementation.models.DeletedCertificateItem; import com.azure.security.keyvault.certificates.implementation.models.IssuerBundle; -import com.azure.security.keyvault.certificates.implementation.models.KeyVaultErrorException; import com.azure.security.keyvault.certificates.models.CertificateContact; import com.azure.security.keyvault.certificates.models.CertificateContentType; import com.azure.security.keyvault.certificates.models.CertificateIssuer; @@ -63,13 +75,13 @@ import java.util.function.Function; import static com.azure.core.util.FluxUtil.monoError; +import static com.azure.core.util.FluxUtil.pagedFluxError; import static com.azure.security.keyvault.certificates.implementation.CertificateIssuerHelper.createCertificateIssuer; import static com.azure.security.keyvault.certificates.implementation.CertificateIssuerHelper.getIssuerBundle; import static com.azure.security.keyvault.certificates.implementation.CertificateOperationHelper.createCertificateOperation; import static com.azure.security.keyvault.certificates.implementation.CertificatePolicyHelper.createCertificatePolicy; import static com.azure.security.keyvault.certificates.implementation.CertificatePolicyHelper.getImplCertificatePolicy; import static com.azure.security.keyvault.certificates.implementation.DeletedCertificateHelper.createDeletedCertificate; -import static com.azure.security.keyvault.certificates.implementation.IssuerPropertiesHelper.createIssuerProperties; import static com.azure.security.keyvault.certificates.implementation.KeyVaultCertificateWithPolicyHelper.createCertificateWithPolicy; /** @@ -194,6 +206,7 @@ serviceInterfaces = CertificateClientImpl.CertificateClientService.class) public final class CertificateAsyncClient { private static final ClientLogger LOGGER = new ClientLogger(CertificateAsyncClient.class); + static final RequestOptions EMPTY_OPTIONS = new RequestOptions(); private final CertificateClientImpl implClient; private final String vaultUrl; @@ -261,52 +274,79 @@ HttpPipeline getHttpPipeline() { @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public PollerFlux beginCreateCertificate( String certificateName, CertificatePolicy policy, Boolean isEnabled, Map tags) { - if (policy == null) { - return PollerFlux.error(LOGGER.logExceptionAsError(new NullPointerException("'policy' cannot be null."))); - } - return new PollerFlux<>(Duration.ofSeconds(1), - ignored -> createCertificateActivation(certificateName, policy, isEnabled, tags), - ignored -> certificatePollOperation(certificateName), - (ignored1, ignored2) -> certificateCancellationOperation(certificateName), - ignored -> fetchCertificateOperation(certificateName)); + try { + if (policy == null) { + return PollerFlux + .error(LOGGER.logExceptionAsError(new NullPointerException("'policy' cannot be null."))); + } + + return new PollerFlux<>(Duration.ofSeconds(1), + ignored -> createCertificateActivation(certificateName, policy, isEnabled, tags), + ignored -> certificatePollOperation(certificateName), + (ignored1, ignored2) -> certificateCancellationOperation(certificateName), + ignored -> fetchCertificateOperation(certificateName)); + } catch (RuntimeException e) { + return PollerFlux.error(e); + } } private Mono createCertificateActivation(String certificateName, CertificatePolicy policy, Boolean isEnabled, Map tags) { - com.azure.security.keyvault.certificates.implementation.models.CertificatePolicy implPolicy - = CertificatePolicyHelper.getImplCertificatePolicy(policy); - return implClient - .createCertificateAsync(vaultUrl, certificateName, implPolicy, - new CertificateAttributes().setEnabled(isEnabled), tags) - .onErrorMap(KeyVaultErrorException.class, CertificateAsyncClient::mapCreateCertificateException) - .map(CertificateOperationHelper::createCertificateOperation); + + CertificateCreateParameters certificateCreateParameters = new CertificateCreateParameters() + .setCertificatePolicy(CertificatePolicyHelper.getImplCertificatePolicy(policy)) + .setCertificateAttributes(new CertificateAttributes().setEnabled(isEnabled)) + .setTags(tags); + + try { + return implClient + .createCertificateWithResponseAsync(certificateName, BinaryData.fromObject(certificateCreateParameters), + EMPTY_OPTIONS) + .onErrorMap(HttpResponseException.class, CertificateAsyncClient::mapCreateCertificateException) + .flatMap(FluxUtil::toMono) + .map(binaryData -> CertificateOperationHelper.createCertificateOperation(binaryData.toObject( + com.azure.security.keyvault.certificates.implementation.models.CertificateOperation.class))); + } catch (RuntimeException e) { + return monoError(LOGGER, e); + } } - static HttpResponseException mapCreateCertificateException(KeyVaultErrorException ex) { - return ex.getResponse().getStatusCode() == 400 - ? new ResourceModifiedException(ex.getMessage(), ex.getResponse(), ex.getValue()) - : ex; + /** + * Maps a {@link HttpResponseException} to a {@link ResourceModifiedException} when the status code is 400. + * + * @param e The {@link HttpResponseException} to map. + * @return A {@link ResourceModifiedException} created from the {@link HttpResponseException}. + */ + static HttpResponseException mapCreateCertificateException(HttpResponseException e) { + return e.getResponse().getStatusCode() == 400 + ? new ResourceModifiedException(e.getMessage(), e.getResponse(), e.getValue()) + : e; } private Mono> certificatePollOperation(String certificateName) { - return implClient.getCertificateOperationAsync(vaultUrl, certificateName) - .onErrorMap(KeyVaultErrorException.class, CertificateAsyncClient::mapGetCertificateOperationException) - .map(CertificateAsyncClient::processCertificateOperationResponse); - } - - static HttpResponseException mapGetCertificateOperationException(KeyVaultErrorException ex) { - if (ex.getResponse().getStatusCode() == 404) { - return new ResourceNotFoundException(ex.getMessage(), ex.getResponse(), ex.getValue()); - } else if (ex.getResponse().getStatusCode() == 400) { - return new ResourceModifiedException(ex.getMessage(), ex.getResponse(), ex.getValue()); - } else { - return ex; - } + return implClient.getCertificateOperationWithResponseAsync(certificateName, EMPTY_OPTIONS) + .onErrorMap(HttpResponseException.class, CertificateAsyncClient::mapGetCertificateOperationException) + .flatMap(FluxUtil::toMono) + .map(binaryData -> CertificateAsyncClient.processCertificateOperationResponse(binaryData + .toObject(com.azure.security.keyvault.certificates.implementation.models.CertificateOperation.class))); + } + + /** + * Maps a {@link HttpResponseException} to a {@link ResourceModifiedException} when the status code is 400. + * + * @param e The {@link HttpResponseException} to map. + * @return A {@link ResourceModifiedException} created from the {@link HttpResponseException}. + */ + static HttpResponseException mapGetCertificateOperationException(HttpResponseException e) { + return e.getResponse().getStatusCode() == 400 + ? new ResourceModifiedException(e.getMessage(), e.getResponse(), e.getValue()) + : e; } static PollResponse processCertificateOperationResponse( com.azure.security.keyvault.certificates.implementation.models.CertificateOperation impl) { + return new PollResponse<>(mapStatus(impl.getStatus()), CertificateOperationHelper.createCertificateOperation(impl)); } @@ -328,35 +368,36 @@ private static LongRunningOperationStatus mapStatus(String status) { } private Mono certificateCancellationOperation(String certificateName) { - return implClient.updateCertificateOperationAsync(vaultUrl, certificateName, true) - .onErrorMap(KeyVaultErrorException.class, CertificateAsyncClient::mapUpdateCertificateOperationException) - .map(CertificateOperationHelper::createCertificateOperation); - } - - static HttpResponseException mapUpdateCertificateOperationException(KeyVaultErrorException ex) { - if (ex.getResponse().getStatusCode() == 404) { - return new ResourceNotFoundException(ex.getMessage(), ex.getResponse(), ex.getValue()); - } else if (ex.getResponse().getStatusCode() == 400) { - return new ResourceModifiedException(ex.getMessage(), ex.getResponse(), ex.getValue()); - } else { - return ex; - } + CertificateOperationUpdateParameter certificateOperationUpdateParameter + = new CertificateOperationUpdateParameter(true); + + return implClient + .updateCertificateOperationWithResponseAsync(certificateName, + BinaryData.fromObject(certificateOperationUpdateParameter), EMPTY_OPTIONS) + .onErrorMap(HttpResponseException.class, CertificateAsyncClient::mapUpdateCertificateOperationException) + .flatMap(FluxUtil::toMono) + .map(binaryData -> CertificateOperationHelper.createCertificateOperation(binaryData + .toObject(com.azure.security.keyvault.certificates.implementation.models.CertificateOperation.class))); + } + + static HttpResponseException mapUpdateCertificateOperationException(HttpResponseException e) { + return e.getResponse().getStatusCode() == 400 + ? new ResourceModifiedException(e.getMessage(), e.getResponse(), e.getValue()) + : e; } private Mono fetchCertificateOperation(String certificateName) { - return implClient.getCertificateAsync(vaultUrl, certificateName, null) - .onErrorMap(KeyVaultErrorException.class, CertificateAsyncClient::mapGetCertificateException) - .map(KeyVaultCertificateWithPolicyHelper::createCertificateWithPolicy); - } - - static HttpResponseException mapGetCertificateException(KeyVaultErrorException ex) { - if (ex.getResponse().getStatusCode() == 404) { - return new ResourceNotFoundException(ex.getMessage(), ex.getResponse(), ex.getValue()); - } else if (ex.getResponse().getStatusCode() == 403) { - return new ResourceModifiedException(ex.getMessage(), ex.getResponse(), ex.getValue()); - } else { - return ex; - } + return implClient.getCertificateWithResponseAsync(certificateName, null, EMPTY_OPTIONS) + .onErrorMap(HttpResponseException.class, CertificateAsyncClient::mapGetCertificateException) + .flatMap(FluxUtil::toMono) + .map(binaryData -> KeyVaultCertificateWithPolicyHelper + .createCertificateWithPolicy(binaryData.toObject(CertificateBundle.class))); + } + + static HttpResponseException mapGetCertificateException(HttpResponseException e) { + return e.getResponse().getStatusCode() == 403 + ? new ResourceModifiedException(e.getMessage(), e.getResponse(), e.getValue()) + : e; } /** @@ -390,6 +431,7 @@ static HttpResponseException mapGetCertificateException(KeyVaultErrorException e @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public PollerFlux beginCreateCertificate(String certificateName, CertificatePolicy policy) { + return beginCreateCertificate(certificateName, policy, true, null); } @@ -422,10 +464,15 @@ static HttpResponseException mapGetCertificateException(KeyVaultErrorException e @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public PollerFlux getCertificateOperation(String certificateName) { - return new PollerFlux<>(Duration.ofSeconds(1), pollingContext -> Mono.empty(), - ignored -> certificatePollOperation(certificateName), - (ignored1, ignored2) -> certificateCancellationOperation(certificateName), - ignored -> fetchCertificateOperation(certificateName)); + + try { + return new PollerFlux<>(Duration.ofSeconds(1), pollingContext -> Mono.empty(), + ignored -> certificatePollOperation(certificateName), + (ignored1, ignored2) -> certificateCancellationOperation(certificateName), + ignored -> fetchCertificateOperation(certificateName)); + } catch (RuntimeException e) { + return PollerFlux.error(e); + } } /** @@ -484,11 +531,12 @@ public Mono getCertificate(String certificateName @ServiceMethod(returns = ReturnType.SINGLE) public Mono> getCertificateWithResponse(String certificateName) { try { - return implClient.getCertificateWithResponseAsync(vaultUrl, certificateName, null) - .onErrorMap(KeyVaultErrorException.class, CertificateAsyncClient::mapGetCertificateException) - .map(response -> new SimpleResponse<>(response, createCertificateWithPolicy(response.getValue()))); - } catch (RuntimeException ex) { - return monoError(LOGGER, ex); + return implClient.getCertificateWithResponseAsync(certificateName, null, EMPTY_OPTIONS) + .onErrorMap(HttpResponseException.class, CertificateAsyncClient::mapGetCertificateException) + .map(response -> new SimpleResponse<>(response, + createCertificateWithPolicy(response.getValue().toObject(CertificateBundle.class)))); + } catch (RuntimeException e) { + return monoError(LOGGER, e); } } @@ -523,12 +571,14 @@ public Mono> getCertificateWithResponse( @ServiceMethod(returns = ReturnType.SINGLE) public Mono> getCertificateVersionWithResponse(String certificateName, String version) { + try { - return implClient.getCertificateWithResponseAsync(vaultUrl, certificateName, version) - .onErrorMap(KeyVaultErrorException.class, CertificateAsyncClient::mapGetCertificateException) - .map(response -> new SimpleResponse<>(response, createCertificateWithPolicy(response.getValue()))); - } catch (RuntimeException ex) { - return monoError(LOGGER, ex); + return implClient.getCertificateWithResponseAsync(certificateName, version, EMPTY_OPTIONS) + .onErrorMap(HttpResponseException.class, CertificateAsyncClient::mapGetCertificateException) + .map(response -> new SimpleResponse<>(response, + createCertificateWithPolicy(response.getValue().toObject(CertificateBundle.class)))); + } catch (RuntimeException e) { + return monoError(LOGGER, e); } } @@ -637,6 +687,7 @@ public Mono updateCertificateProperties(CertificateProperti @ServiceMethod(returns = ReturnType.SINGLE) public Mono> updateCertificatePropertiesWithResponse(CertificateProperties properties) { + if (properties == null) { return monoError(LOGGER, new NullPointerException("'properties' cannot be null.")); } @@ -646,12 +697,17 @@ public Mono updateCertificateProperties(CertificateProperti .setExpires(properties.getExpiresOn()) .setNotBefore(properties.getNotBefore()); + CertificateUpdateParameters certificateUpdateParameters + = new CertificateUpdateParameters().setCertificateAttributes(certificateAttributes) + .setTags(properties.getTags()); + return implClient - .updateCertificateWithResponseAsync(vaultUrl, properties.getName(), properties.getVersion(), null, - certificateAttributes, properties.getTags()) - .map(response -> new SimpleResponse<>(response, createCertificateWithPolicy(response.getValue()))); - } catch (RuntimeException ex) { - return monoError(LOGGER, ex); + .updateCertificateWithResponseAsync(properties.getName(), properties.getVersion(), + BinaryData.fromObject(certificateUpdateParameters), EMPTY_OPTIONS) + .map(response -> new SimpleResponse<>(response, + createCertificateWithPolicy(response.getValue().toObject(CertificateBundle.class)))); + } catch (RuntimeException e) { + return monoError(LOGGER, e); } } @@ -684,30 +740,36 @@ public Mono updateCertificateProperties(CertificateProperti */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public PollerFlux beginDeleteCertificate(String certificateName) { - return new PollerFlux<>(Duration.ofSeconds(1), ignored -> deleteCertificateActivation(certificateName), - pollingContext -> deleteCertificatePollOperation(certificateName, pollingContext), - (pollingContext, firstResponse) -> Mono.empty(), pollingContext -> Mono.empty()); + try { + return new PollerFlux<>(Duration.ofSeconds(1), ignored -> deleteCertificateActivation(certificateName), + pollingContext -> deleteCertificatePollOperation(certificateName, pollingContext), + (pollingContext, firstResponse) -> Mono.empty(), pollingContext -> Mono.empty()); + } catch (RuntimeException e) { + return PollerFlux.error(e); + } } private Mono deleteCertificateActivation(String certificateName) { - return implClient.deleteCertificateAsync(vaultUrl, certificateName) - .onErrorMap(KeyVaultErrorException.class, CertificateAsyncClient::mapDeleteCertificateException) - .map(DeletedCertificateHelper::createDeletedCertificate); + return implClient.deleteCertificateWithResponseAsync(certificateName, EMPTY_OPTIONS) + .flatMap(FluxUtil::toMono) + .map(binaryData -> DeletedCertificateHelper + .createDeletedCertificate(binaryData.toObject(DeletedCertificateBundle.class))); } - static HttpResponseException mapDeleteCertificateException(KeyVaultErrorException ex) { - return ex.getResponse().getStatusCode() == 404 - ? new ResourceNotFoundException(ex.getMessage(), ex.getResponse(), ex.getValue()) - : ex; + static HttpResponseException mapDeleteCertificateException(HttpResponseException e) { + return e.getResponse().getStatusCode() == 404 + ? new ResourceNotFoundException(e.getMessage(), e.getResponse(), e.getValue()) + : e; } private Mono> deleteCertificatePollOperation(String certificateName, PollingContext pollingContext) { - return implClient.getDeletedCertificateAsync(vaultUrl, certificateName) - .map(bundle -> new PollResponse<>(LongRunningOperationStatus.SUCCESSFULLY_COMPLETED, - createDeletedCertificate(bundle))) - .onErrorResume(KeyVaultErrorException.class, ex -> { - if (ex.getResponse().getStatusCode() == HttpURLConnection.HTTP_NOT_FOUND) { + return implClient.getDeletedCertificateWithResponseAsync(certificateName, EMPTY_OPTIONS) + .flatMap(FluxUtil::toMono) + .map(binaryData -> new PollResponse<>(LongRunningOperationStatus.SUCCESSFULLY_COMPLETED, + createDeletedCertificate(binaryData.toObject(DeletedCertificateBundle.class)))) + .onErrorResume(HttpResponseException.class, e -> { + if (e.getResponse().getStatusCode() == HttpURLConnection.HTTP_NOT_FOUND) { return Mono.just(new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, pollingContext.getLatestResponse().getValue())); } else { @@ -783,20 +845,14 @@ public Mono getDeletedCertificate(String certificateName) { @ServiceMethod(returns = ReturnType.SINGLE) public Mono> getDeletedCertificateWithResponse(String certificateName) { try { - return implClient.getDeletedCertificateWithResponseAsync(vaultUrl, certificateName) - .onErrorMap(KeyVaultErrorException.class, CertificateAsyncClient::mapGetDeletedCertificateException) - .map(response -> new SimpleResponse<>(response, createDeletedCertificate(response.getValue()))); - } catch (RuntimeException ex) { - return monoError(LOGGER, ex); + return implClient.getDeletedCertificateWithResponseAsync(certificateName, EMPTY_OPTIONS) + .map(response -> new SimpleResponse<>(response, + createDeletedCertificate(response.getValue().toObject(DeletedCertificateBundle.class)))); + } catch (RuntimeException e) { + return monoError(LOGGER, e); } } - static HttpResponseException mapGetDeletedCertificateException(KeyVaultErrorException ex) { - return ex.getResponse().getStatusCode() == 404 - ? new ResourceNotFoundException(ex.getMessage(), ex.getResponse(), ex.getValue()) - : ex; - } - /** * Permanently deletes the specified deleted certificate without possibility for recovery. The Purge Deleted * Certificate operation is applicable for soft-delete enabled vaults and is not available if the recovery level @@ -851,19 +907,12 @@ public Mono purgeDeletedCertificate(String certificateName) { @ServiceMethod(returns = ReturnType.SINGLE) public Mono> purgeDeletedCertificateWithResponse(String certificateName) { try { - return implClient.purgeDeletedCertificateWithResponseAsync(vaultUrl, certificateName) - .onErrorMap(KeyVaultErrorException.class, CertificateAsyncClient::mapPurgeDeletedCertificateException); - } catch (RuntimeException ex) { - return monoError(LOGGER, ex); + return implClient.purgeDeletedCertificateWithResponseAsync(certificateName, EMPTY_OPTIONS); + } catch (RuntimeException e) { + return monoError(LOGGER, e); } } - static HttpResponseException mapPurgeDeletedCertificateException(KeyVaultErrorException ex) { - return ex.getResponse().getStatusCode() == 404 - ? new ResourceNotFoundException(ex.getMessage(), ex.getResponse(), ex.getValue()) - : ex; - } - /** * Recovers the deleted certificate back to its current version under /certificates and can only be performed on a * soft-delete enabled vault. The RecoverDeletedCertificate operation performs the reversal of the Delete operation @@ -899,24 +948,24 @@ public PollerFlux beginRecoverDeletedCertif } private Mono recoverDeletedCertificateActivation(String certificateName) { - return implClient.recoverDeletedCertificateAsync(vaultUrl, certificateName) - .onErrorMap(KeyVaultErrorException.class, CertificateAsyncClient::mapRecoverDeletedCertificateException) - .map(KeyVaultCertificateWithPolicyHelper::createCertificateWithPolicy); - } - - static HttpResponseException mapRecoverDeletedCertificateException(KeyVaultErrorException ex) { - return ex.getResponse().getStatusCode() == 404 - ? new ResourceNotFoundException(ex.getMessage(), ex.getResponse(), ex.getValue()) - : ex; + try { + return implClient.recoverDeletedCertificateWithResponseAsync(certificateName, EMPTY_OPTIONS) + .flatMap(FluxUtil::toMono) + .map(binaryData -> KeyVaultCertificateWithPolicyHelper + .createCertificateWithPolicy(binaryData.toObject(CertificateBundle.class))); + } catch (RuntimeException e) { + return monoError(LOGGER, e); + } } private Mono> recoverDeletedCertificatePollOperation( String certificateName, PollingContext pollingContext) { - return implClient.getCertificateAsync(vaultUrl, certificateName, null) - .map(bundle -> new PollResponse<>(LongRunningOperationStatus.SUCCESSFULLY_COMPLETED, - createCertificateWithPolicy(bundle))) - .onErrorResume(KeyVaultErrorException.class, ex -> { - if (ex.getResponse().getStatusCode() == HttpURLConnection.HTTP_NOT_FOUND) { + return implClient.getCertificateWithResponseAsync(certificateName, null, EMPTY_OPTIONS) + .flatMap(FluxUtil::toMono) + .map(binaryData -> new PollResponse<>(LongRunningOperationStatus.SUCCESSFULLY_COMPLETED, + createCertificateWithPolicy(binaryData.toObject(CertificateBundle.class)))) + .onErrorResume(HttpResponseException.class, e -> { + if (e.getResponse().getStatusCode() == HttpURLConnection.HTTP_NOT_FOUND) { return Mono.just(new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, pollingContext.getLatestResponse().getValue())); } else { @@ -988,20 +1037,14 @@ public Mono backupCertificate(String certificateName) { @ServiceMethod(returns = ReturnType.SINGLE) public Mono> backupCertificateWithResponse(String certificateName) { try { - return implClient.backupCertificateWithResponseAsync(vaultUrl, certificateName) - .onErrorMap(KeyVaultErrorException.class, CertificateAsyncClient::mapBackupCertificateException) - .map(response -> new SimpleResponse<>(response, response.getValue().getValue())); - } catch (RuntimeException ex) { - return monoError(LOGGER, ex); + return implClient.backupCertificateWithResponseAsync(certificateName, EMPTY_OPTIONS) + .map(response -> new SimpleResponse<>(response, + response.getValue().toObject(BackupCertificateResult.class).getValue())); + } catch (RuntimeException e) { + return monoError(LOGGER, e); } } - static HttpResponseException mapBackupCertificateException(KeyVaultErrorException ex) { - return ex.getResponse().getStatusCode() == 404 - ? new ResourceNotFoundException(ex.getMessage(), ex.getResponse(), ex.getValue()) - : ex; - } - /** * Restores a backed up certificate to the vault. All the versions of the certificate are restored to the vault. * This operation requires the certificates/restore permission. @@ -1055,18 +1098,22 @@ public Mono restoreCertificateBackup(byte[] backu @ServiceMethod(returns = ReturnType.SINGLE) public Mono> restoreCertificateBackupWithResponse(byte[] backup) { try { - return implClient.restoreCertificateWithResponseAsync(vaultUrl, backup) - .onErrorMap(KeyVaultErrorException.class, CertificateAsyncClient::mapRestoreCertificateException) - .map(response -> new SimpleResponse<>(response, createCertificateWithPolicy(response.getValue()))); - } catch (RuntimeException ex) { - return monoError(LOGGER, ex); + CertificateRestoreParameters certificateRestoreParameters = new CertificateRestoreParameters(backup); + + return implClient + .restoreCertificateWithResponseAsync(BinaryData.fromObject(certificateRestoreParameters), EMPTY_OPTIONS) + .onErrorMap(HttpResponseException.class, CertificateAsyncClient::mapRestoreCertificateException) + .map(response -> new SimpleResponse<>(response, + createCertificateWithPolicy(response.getValue().toObject(CertificateBundle.class)))); + } catch (RuntimeException e) { + return monoError(LOGGER, e); } } - static HttpResponseException mapRestoreCertificateException(KeyVaultErrorException ex) { - return ex.getResponse().getStatusCode() == 400 - ? new ResourceModifiedException(ex.getMessage(), ex.getResponse(), ex.getValue()) - : ex; + static HttpResponseException mapRestoreCertificateException(HttpResponseException e) { + return e.getResponse().getStatusCode() == 400 + ? new ResourceModifiedException(e.getMessage(), e.getResponse(), e.getValue()) + : e; } /** @@ -1097,12 +1144,24 @@ static HttpResponseException mapRestoreCertificateException(KeyVaultErrorExcepti */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedFlux listPropertiesOfCertificates(boolean includePending) { - return new PagedFlux<>( - maxResults -> implClient.getCertificatesSinglePageAsync(vaultUrl, maxResults, includePending) - .map(CertificateAsyncClient::mapCertificateItemPage), - (continuationToken, maxResults) -> implClient - .getCertificatesNextSinglePageAsync(continuationToken, vaultUrl) - .map(CertificateAsyncClient::mapCertificateItemPage)); + try { + RequestOptions requestOptions + = new RequestOptions().addQueryParam("includePending", String.valueOf(includePending), false); + + PagedFlux pagedFluxResponse = implClient.getCertificatesAsync(requestOptions); + + return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { + Flux> pagedResponseFlux = (continuationTokenParam == null) + ? pagedFluxResponse.byPage().take(1) + : pagedFluxResponse.byPage(continuationTokenParam).take(1); + + return pagedResponseFlux + .map(pagedResponse -> mapPagedResponse(pagedResponse, binaryData -> CertificatePropertiesHelper + .createCertificateProperties(binaryData.toObject(CertificateItem.class)))); + }); + } catch (RuntimeException e) { + return pagedFluxError(LOGGER, e); + } } /** @@ -1183,16 +1242,24 @@ public PagedFlux listDeletedCertificates() { */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedFlux listDeletedCertificates(boolean includePending) { - return new PagedFlux<>( - maxResults -> implClient.getDeletedCertificatesSinglePageAsync(vaultUrl, maxResults, includePending) - .map(CertificateAsyncClient::mapDeletedCertificateItemPage), - (continuationToken, maxResults) -> implClient - .getDeletedCertificatesNextSinglePageAsync(continuationToken, vaultUrl) - .map(CertificateAsyncClient::mapDeletedCertificateItemPage)); - } - - static PagedResponse mapDeletedCertificateItemPage(PagedResponse page) { - return mapPagedResponse(page, DeletedCertificateHelper::createDeletedCertificate); + try { + RequestOptions requestOptions + = new RequestOptions().addQueryParam("includePending", String.valueOf(includePending), false); + + PagedFlux pagedFluxResponse = implClient.getDeletedCertificatesAsync(requestOptions); + + return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { + Flux> pagedResponseFlux = (continuationTokenParam == null) + ? pagedFluxResponse.byPage().take(1) + : pagedFluxResponse.byPage(continuationTokenParam).take(1); + + return pagedResponseFlux + .map(pagedResponse -> mapPagedResponse(pagedResponse, binaryData -> DeletedCertificateHelper + .createDeletedCertificate(binaryData.toObject(DeletedCertificateItem.class)))); + }); + } catch (RuntimeException e) { + return pagedFluxError(LOGGER, e); + } } /** @@ -1225,20 +1292,27 @@ static PagedResponse mapDeletedCertificateItemPage(PagedResp */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedFlux listPropertiesOfCertificateVersions(String certificateName) { - return new PagedFlux<>( - maxResults -> implClient.getCertificateVersionsSinglePageAsync(vaultUrl, certificateName, maxResults) - .map(CertificateAsyncClient::mapCertificateItemPage), - (continuationToken, maxResults) -> implClient - .getCertificateVersionsNextSinglePageAsync(continuationToken, vaultUrl) - .map(CertificateAsyncClient::mapCertificateItemPage)); - } - - static PagedResponse mapCertificateItemPage(PagedResponse page) { - return mapPagedResponse(page, CertificatePropertiesHelper::createCertificateProperties); + try { + PagedFlux pagedFluxResponse + = implClient.getCertificateVersionsAsync(certificateName, EMPTY_OPTIONS); + + return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { + Flux> pagedResponseFlux = (continuationTokenParam == null) + ? pagedFluxResponse.byPage().take(1) + : pagedFluxResponse.byPage(continuationTokenParam).take(1); + + return pagedResponseFlux + .map(pagedResponse -> mapPagedResponse(pagedResponse, binaryData -> CertificatePropertiesHelper + .createCertificateProperties(binaryData.toObject(CertificateItem.class)))); + }); + } catch (RuntimeException e) { + return pagedFluxError(LOGGER, e); + } } private static PagedResponse mapPagedResponse(PagedResponse page, Function itemMapper) { List mappedValues = new ArrayList<>(page.getValue().size()); + for (T item : page.getValue()) { mappedValues.add(itemMapper.apply(item)); } @@ -1304,19 +1378,25 @@ public Mono mergeCertificate(MergeCertificateOptions mergeC @ServiceMethod(returns = ReturnType.SINGLE) public Mono> mergeCertificateWithResponse(MergeCertificateOptions mergeCertificateOptions) { + if (mergeCertificateOptions == null) { return monoError(LOGGER, new NullPointerException("'mergeCertificateOptions' cannot be null.")); } try { + CertificateMergeParameters certificateMergeParameters + = new CertificateMergeParameters(mergeCertificateOptions.getX509Certificates()) + .setCertificateAttributes( + new CertificateAttributes().setEnabled(mergeCertificateOptions.isEnabled())) + .setTags(mergeCertificateOptions.getTags()); + return implClient - .mergeCertificateWithResponseAsync(vaultUrl, mergeCertificateOptions.getName(), - mergeCertificateOptions.getX509Certificates(), - new CertificateAttributes().setEnabled(mergeCertificateOptions.isEnabled()), - mergeCertificateOptions.getTags()) - .map(response -> new SimpleResponse<>(response, createCertificateWithPolicy(response.getValue()))); - } catch (RuntimeException ex) { - return monoError(LOGGER, ex); + .mergeCertificateWithResponseAsync(mergeCertificateOptions.getName(), + BinaryData.fromObject(certificateMergeParameters), EMPTY_OPTIONS) + .map(response -> new SimpleResponse<>(response, + createCertificateWithPolicy(response.getValue().toObject(CertificateBundle.class)))); + } catch (RuntimeException e) { + return monoError(LOGGER, e); } } @@ -1375,22 +1455,21 @@ public Mono getCertificatePolicy(String certificateName) { @ServiceMethod(returns = ReturnType.SINGLE) public Mono> getCertificatePolicyWithResponse(String certificateName) { try { - return implClient.getCertificatePolicyWithResponseAsync(vaultUrl, certificateName) - .onErrorMap(KeyVaultErrorException.class, CertificateAsyncClient::mapGetCertificatePolicyException) - .map(response -> new SimpleResponse<>(response, createCertificatePolicy(response.getValue()))); - } catch (RuntimeException ex) { - return monoError(LOGGER, ex); + return implClient.getCertificatePolicyWithResponseAsync(certificateName, EMPTY_OPTIONS) + .onErrorMap(HttpResponseException.class, CertificateAsyncClient::mapGetCertificatePolicyException) + .map(response -> new SimpleResponse<>(response, + createCertificatePolicy(response.getValue() + .toObject( + com.azure.security.keyvault.certificates.implementation.models.CertificatePolicy.class)))); + } catch (RuntimeException e) { + return monoError(LOGGER, e); } } - static HttpResponseException mapGetCertificatePolicyException(KeyVaultErrorException ex) { - if (ex.getResponse().getStatusCode() == 404) { - return new ResourceNotFoundException(ex.getMessage(), ex.getResponse(), ex.getValue()); - } else if (ex.getResponse().getStatusCode() == 403) { - return new ResourceModifiedException(ex.getMessage(), ex.getResponse(), ex.getValue()); - } else { - return ex; - } + static HttpResponseException mapGetCertificatePolicyException(HttpResponseException e) { + return e.getResponse().getStatusCode() == 403 + ? new ResourceModifiedException(e.getMessage(), e.getResponse(), e.getValue()) + : e; } /** @@ -1467,26 +1546,27 @@ public Mono updateCertificatePolicy(String certificateName, C @ServiceMethod(returns = ReturnType.SINGLE) public Mono> updateCertificatePolicyWithResponse(String certificateName, CertificatePolicy policy) { + if (policy == null) { return monoError(LOGGER, new NullPointerException("'policy' cannot be null.")); } try { + CertificateUpdateParameters certificateUpdateParameters + = new CertificateUpdateParameters().setCertificatePolicy(getImplCertificatePolicy(policy)); + return implClient - .updateCertificatePolicyWithResponseAsync(vaultUrl, certificateName, getImplCertificatePolicy(policy)) - .onErrorMap(KeyVaultErrorException.class, CertificateAsyncClient::mapUpdateCertificatePolicyException) - .map(response -> new SimpleResponse<>(response, createCertificatePolicy(response.getValue()))); - } catch (RuntimeException ex) { - return monoError(LOGGER, ex); + .updateCertificatePolicyWithResponseAsync(certificateName, + BinaryData.fromObject(certificateUpdateParameters), EMPTY_OPTIONS) + .map(response -> new SimpleResponse<>(response, + createCertificatePolicy(response.getValue() + .toObject( + com.azure.security.keyvault.certificates.implementation.models.CertificatePolicy.class)))); + } catch (RuntimeException e) { + return monoError(LOGGER, e); } } - static HttpResponseException mapUpdateCertificatePolicyException(KeyVaultErrorException ex) { - return (ex.getResponse().getStatusCode() == 404) - ? new ResourceNotFoundException(ex.getMessage(), ex.getResponse(), ex.getValue()) - : ex; - } - /** * Creates the specified certificate issuer. The SetCertificateIssuer operation updates the specified certificate * issuer if it already exists or adds it if it doesn't exist. This operation requires the certificates/setissuers @@ -1561,12 +1641,18 @@ public Mono> createIssuerWithResponse(CertificateIss try { IssuerBundle issuerBundle = getIssuerBundle(issuer); + CertificateIssuerSetParameters certificateIssuerSetParameters + = new CertificateIssuerSetParameters(issuer.getProvider()).setAttributes(issuerBundle.getAttributes()) + .setCredentials(issuerBundle.getCredentials()) + .setOrganizationDetails(issuerBundle.getOrganizationDetails()); + return implClient - .setCertificateIssuerWithResponseAsync(vaultUrl, issuer.getName(), issuer.getProvider(), - issuerBundle.getCredentials(), issuerBundle.getOrganizationDetails(), issuerBundle.getAttributes()) - .map(response -> new SimpleResponse<>(response, createCertificateIssuer(response.getValue()))); - } catch (RuntimeException ex) { - return monoError(LOGGER, ex); + .setCertificateIssuerWithResponseAsync(issuer.getName(), + BinaryData.fromObject(certificateIssuerSetParameters), EMPTY_OPTIONS) + .map(response -> new SimpleResponse<>(response, + createCertificateIssuer(response.getValue().toObject(IssuerBundle.class)))); + } catch (RuntimeException e) { + return monoError(LOGGER, e); } } @@ -1599,10 +1685,11 @@ public Mono> createIssuerWithResponse(CertificateIss @ServiceMethod(returns = ReturnType.SINGLE) public Mono> getIssuerWithResponse(String issuerName) { try { - return implClient.getCertificateIssuerWithResponseAsync(vaultUrl, issuerName) - .map(response -> new SimpleResponse<>(response, createCertificateIssuer(response.getValue()))); - } catch (RuntimeException ex) { - return monoError(LOGGER, ex); + return implClient.getCertificateIssuerWithResponseAsync(issuerName, EMPTY_OPTIONS) + .map(response -> new SimpleResponse<>(response, + createCertificateIssuer(response.getValue().toObject(IssuerBundle.class)))); + } catch (RuntimeException e) { + return monoError(LOGGER, e); } } @@ -1664,20 +1751,14 @@ public Mono getIssuer(String issuerName) { @ServiceMethod(returns = ReturnType.SINGLE) public Mono> deleteIssuerWithResponse(String issuerName) { try { - return implClient.deleteCertificateIssuerWithResponseAsync(vaultUrl, issuerName) - .onErrorMap(KeyVaultErrorException.class, CertificateAsyncClient::mapDeleteCertificateIssuerException) - .map(response -> new SimpleResponse<>(response, createCertificateIssuer(response.getValue()))); - } catch (RuntimeException ex) { - return monoError(LOGGER, ex); + return implClient.deleteCertificateIssuerWithResponseAsync(issuerName, EMPTY_OPTIONS) + .map(response -> new SimpleResponse<>(response, + createCertificateIssuer(response.getValue().toObject(IssuerBundle.class)))); + } catch (RuntimeException e) { + return monoError(LOGGER, e); } } - static HttpResponseException mapDeleteCertificateIssuerException(KeyVaultErrorException ex) { - return (ex.getResponse().getStatusCode() == 404) - ? new ResourceNotFoundException(ex.getMessage(), ex.getResponse(), ex.getValue()) - : ex; - } - /** * Deletes the specified certificate issuer. The DeleteCertificateIssuer operation permanently removes the specified * certificate issuer from the key vault. This operation requires the certificates/manageissuers/deleteissuers @@ -1730,16 +1811,21 @@ public Mono deleteIssuer(String issuerName) { */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedFlux listPropertiesOfIssuers() { - return new PagedFlux<>( - maxResults -> implClient.getCertificateIssuersSinglePageAsync(vaultUrl, maxResults) - .map(CertificateAsyncClient::mapIssuersPagedResponse), - (continuationToken, maxResults) -> implClient - .getCertificateIssuersNextSinglePageAsync(continuationToken, vaultUrl) - .map(CertificateAsyncClient::mapIssuersPagedResponse)); - } - - static PagedResponse mapIssuersPagedResponse(PagedResponse page) { - return mapPagedResponse(page, IssuerPropertiesHelper::createIssuerProperties); + try { + PagedFlux pagedFluxResponse = implClient.getCertificateIssuersAsync(EMPTY_OPTIONS); + + return PagedFlux.create(() -> (continuationTokenParam, pageSizeParam) -> { + Flux> pagedResponseFlux = (continuationTokenParam == null) + ? pagedFluxResponse.byPage().take(1) + : pagedFluxResponse.byPage(continuationTokenParam).take(1); + + return pagedResponseFlux + .map(pagedResponse -> mapPagedResponse(pagedResponse, binaryData -> IssuerPropertiesHelper + .createIssuerProperties(binaryData.toObject(CertificateIssuerItem.class)))); + }); + } catch (RuntimeException e) { + return pagedFluxError(LOGGER, e); + } } /** @@ -1819,12 +1905,19 @@ public Mono> updateIssuerWithResponse(CertificateIss try { IssuerBundle issuerBundle = CertificateIssuerHelper.getIssuerBundle(issuer); + CertificateIssuerUpdateParameters certificateIssuerUpdateParameters + = new CertificateIssuerUpdateParameters().setProvider(issuer.getProvider()) + .setAttributes(issuerBundle.getAttributes()) + .setCredentials(issuerBundle.getCredentials()) + .setOrganizationDetails(issuerBundle.getOrganizationDetails()); + return implClient - .updateCertificateIssuerWithResponseAsync(vaultUrl, issuer.getName(), issuer.getProvider(), - issuerBundle.getCredentials(), issuerBundle.getOrganizationDetails(), issuerBundle.getAttributes()) - .map(response -> new SimpleResponse<>(response, createCertificateIssuer(response.getValue()))); - } catch (RuntimeException ex) { - return monoError(LOGGER, ex); + .updateCertificateIssuerWithResponseAsync(issuer.getName(), + BinaryData.fromObject(certificateIssuerUpdateParameters), EMPTY_OPTIONS) + .map(response -> new SimpleResponse<>(response, + createCertificateIssuer(response.getValue().toObject(IssuerBundle.class)))); + } catch (RuntimeException e) { + return monoError(LOGGER, e); } } @@ -1854,7 +1947,9 @@ public Mono> updateIssuerWithResponse(CertificateIss @ServiceMethod(returns = ReturnType.COLLECTION) public PagedFlux setContacts(List contacts) { return new PagedFlux<>( - () -> implClient.setCertificateContactsWithResponseAsync(vaultUrl, new Contacts().setContactList(contacts)) + () -> implClient + .setCertificateContactsWithResponseAsync(BinaryData.fromObject(new Contacts().setContactList(contacts)), + EMPTY_OPTIONS) .map(CertificateAsyncClient::mapContactsToPagedResponse)); } @@ -1877,7 +1972,7 @@ public PagedFlux setContacts(List contac */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedFlux listContacts() { - return new PagedFlux<>(() -> implClient.getCertificateContactsWithResponseAsync(vaultUrl) + return new PagedFlux<>(() -> implClient.getCertificateContactsWithResponseAsync(EMPTY_OPTIONS) .map(CertificateAsyncClient::mapContactsToPagedResponse)); } @@ -1901,13 +1996,13 @@ public PagedFlux listContacts() { */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedFlux deleteContacts() { - return new PagedFlux<>(() -> implClient.deleteCertificateContactsWithResponseAsync(vaultUrl) + return new PagedFlux<>(() -> implClient.deleteCertificateContactsWithResponseAsync(EMPTY_OPTIONS) .map(CertificateAsyncClient::mapContactsToPagedResponse)); } - static PagedResponse mapContactsToPagedResponse(Response response) { + static PagedResponse mapContactsToPagedResponse(Response response) { return new PagedResponseBase<>(response.getRequest(), response.getStatusCode(), response.getHeaders(), - response.getValue().getContactList(), null, null); + response.getValue().toObject(Contacts.class).getContactList(), null, null); } /** @@ -1963,23 +2058,19 @@ public Mono deleteCertificateOperation(String certificateN @ServiceMethod(returns = ReturnType.SINGLE) public Mono> deleteCertificateOperationWithResponse(String certificateName) { try { - return implClient.deleteCertificateOperationWithResponseAsync(vaultUrl, certificateName) - .onErrorMap(KeyVaultErrorException.class, - CertificateAsyncClient::mapDeleteCertificateOperationException) - .map(response -> new SimpleResponse<>(response, createCertificateOperation(response.getValue()))); - } catch (RuntimeException ex) { - return monoError(LOGGER, ex); + return implClient.deleteCertificateOperationWithResponseAsync(certificateName, EMPTY_OPTIONS) + .map(response -> new SimpleResponse<>(response, createCertificateOperation(response.getValue() + .toObject( + com.azure.security.keyvault.certificates.implementation.models.CertificateOperation.class)))); + } catch (RuntimeException e) { + return monoError(LOGGER, e); } } - static HttpResponseException mapDeleteCertificateOperationException(KeyVaultErrorException ex) { - if (ex.getResponse().getStatusCode() == 400) { - return new ResourceModifiedException(ex.getMessage(), ex.getResponse(), ex.getValue()); - } else if (ex.getResponse().getStatusCode() == 404) { - return new ResourceNotFoundException(ex.getMessage(), ex.getResponse(), ex.getValue()); - } else { - return ex; - } + static HttpResponseException mapDeleteCertificateOperationException(HttpResponseException e) { + return e.getResponse().getStatusCode() == 400 + ? new ResourceModifiedException(e.getMessage(), e.getResponse(), e.getValue()) + : e; } /** @@ -2036,12 +2127,18 @@ public Mono cancelCertificateOperation(String certificateN @ServiceMethod(returns = ReturnType.SINGLE) public Mono> cancelCertificateOperationWithResponse(String certificateName) { try { - return implClient.updateCertificateOperationWithResponseAsync(vaultUrl, certificateName, true) - .onErrorMap(KeyVaultErrorException.class, - CertificateAsyncClient::mapUpdateCertificateOperationException) - .map(response -> new SimpleResponse<>(response, createCertificateOperation(response.getValue()))); - } catch (RuntimeException ex) { - return monoError(LOGGER, ex); + CertificateOperationUpdateParameter certificateOperationUpdateParameter + = new CertificateOperationUpdateParameter(true); + + return implClient + .updateCertificateOperationWithResponseAsync(certificateName, + BinaryData.fromObject(certificateOperationUpdateParameter), EMPTY_OPTIONS) + .onErrorMap(HttpResponseException.class, CertificateAsyncClient::mapUpdateCertificateOperationException) + .map(response -> new SimpleResponse<>(response, createCertificateOperation(response.getValue() + .toObject( + com.azure.security.keyvault.certificates.implementation.models.CertificateOperation.class)))); + } catch (RuntimeException e) { + return monoError(LOGGER, e); } } @@ -2104,20 +2201,27 @@ public Mono importCertificate(ImportCertificateOp @ServiceMethod(returns = ReturnType.SINGLE) public Mono> importCertificateWithResponse(ImportCertificateOptions importCertificateOptions) { + if (importCertificateOptions == null) { return monoError(LOGGER, new NullPointerException("'importCertificateOptions' cannot be null.")); } try { - com.azure.security.keyvault.certificates.implementation.models.CertificatePolicy implPolicy - = getImplCertificatePolicy(importCertificateOptions.getPolicy()); - - return implClient.importCertificateWithResponseAsync(vaultUrl, importCertificateOptions.getName(), - transformCertificateForImport(importCertificateOptions), importCertificateOptions.getPassword(), - implPolicy, implPolicy == null ? null : implPolicy.getAttributes(), importCertificateOptions.getTags()) - .map(response -> new SimpleResponse<>(response, createCertificateWithPolicy(response.getValue()))); - } catch (RuntimeException ex) { - return monoError(LOGGER, ex); + CertificateImportParameters certificateImportParameters + = new CertificateImportParameters(transformCertificateForImport(importCertificateOptions)) + .setCertificatePolicy(getImplCertificatePolicy(importCertificateOptions.getPolicy())) + .setPassword(importCertificateOptions.getPassword()) + .setTags(importCertificateOptions.getTags()) + .setCertificateAttributes( + new CertificateAttributes().setEnabled(importCertificateOptions.isEnabled())); + + return implClient + .importCertificateWithResponseAsync(importCertificateOptions.getName(), + BinaryData.fromObject(certificateImportParameters), EMPTY_OPTIONS) + .map(response -> new SimpleResponse<>(response, + createCertificateWithPolicy(response.getValue().toObject(CertificateBundle.class)))); + } catch (RuntimeException e) { + return monoError(LOGGER, e); } } diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateClient.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateClient.java index 4b9f28fde1550..0b27db28a3c8d 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateClient.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateClient.java @@ -11,8 +11,10 @@ import com.azure.core.exception.ResourceModifiedException; import com.azure.core.exception.ResourceNotFoundException; import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.RequestOptions; import com.azure.core.http.rest.Response; import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.BinaryData; import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; import com.azure.core.util.polling.LongRunningOperationStatus; @@ -21,16 +23,24 @@ import com.azure.core.util.polling.SyncPoller; import com.azure.security.keyvault.certificates.implementation.CertificateClientImpl; import com.azure.security.keyvault.certificates.implementation.CertificateIssuerHelper; -import com.azure.security.keyvault.certificates.implementation.CertificateOperationHelper; -import com.azure.security.keyvault.certificates.implementation.CertificatePolicyHelper; +import com.azure.security.keyvault.certificates.implementation.CertificatePropertiesHelper; import com.azure.security.keyvault.certificates.implementation.DeletedCertificateHelper; -import com.azure.security.keyvault.certificates.implementation.KeyVaultCertificateWithPolicyHelper; import com.azure.security.keyvault.certificates.implementation.models.BackupCertificateResult; import com.azure.security.keyvault.certificates.implementation.models.CertificateAttributes; import com.azure.security.keyvault.certificates.implementation.models.CertificateBundle; +import com.azure.security.keyvault.certificates.implementation.models.CertificateCreateParameters; +import com.azure.security.keyvault.certificates.implementation.models.CertificateImportParameters; +import com.azure.security.keyvault.certificates.implementation.models.CertificateIssuerSetParameters; +import com.azure.security.keyvault.certificates.implementation.models.CertificateIssuerUpdateParameters; +import com.azure.security.keyvault.certificates.implementation.models.CertificateItem; +import com.azure.security.keyvault.certificates.implementation.models.CertificateMergeParameters; +import com.azure.security.keyvault.certificates.implementation.models.CertificateOperationUpdateParameter; +import com.azure.security.keyvault.certificates.implementation.models.CertificateRestoreParameters; +import com.azure.security.keyvault.certificates.implementation.models.CertificateUpdateParameters; import com.azure.security.keyvault.certificates.implementation.models.Contacts; +import com.azure.security.keyvault.certificates.implementation.models.DeletedCertificateBundle; +import com.azure.security.keyvault.certificates.implementation.models.DeletedCertificateItem; import com.azure.security.keyvault.certificates.implementation.models.IssuerBundle; -import com.azure.security.keyvault.certificates.implementation.models.KeyVaultErrorException; import com.azure.security.keyvault.certificates.models.CertificateContact; import com.azure.security.keyvault.certificates.models.CertificateIssuer; import com.azure.security.keyvault.certificates.models.CertificateOperation; @@ -52,14 +62,14 @@ import java.util.function.Function; import java.util.function.Supplier; -import static com.azure.security.keyvault.certificates.CertificateAsyncClient.mapCertificateItemPage; +import static com.azure.security.keyvault.certificates.CertificateAsyncClient.EMPTY_OPTIONS; import static com.azure.security.keyvault.certificates.CertificateAsyncClient.mapContactsToPagedResponse; -import static com.azure.security.keyvault.certificates.CertificateAsyncClient.mapDeletedCertificateItemPage; -import static com.azure.security.keyvault.certificates.CertificateAsyncClient.mapIssuersPagedResponse; import static com.azure.security.keyvault.certificates.CertificateAsyncClient.processCertificateOperationResponse; import static com.azure.security.keyvault.certificates.CertificateAsyncClient.transformCertificateForImport; +import static com.azure.security.keyvault.certificates.implementation.CertificateIssuerHelper.createCertificateIssuer; import static com.azure.security.keyvault.certificates.implementation.CertificateIssuerHelper.getIssuerBundle; import static com.azure.security.keyvault.certificates.implementation.CertificateOperationHelper.createCertificateOperation; +import static com.azure.security.keyvault.certificates.implementation.CertificatePolicyHelper.createCertificatePolicy; import static com.azure.security.keyvault.certificates.implementation.CertificatePolicyHelper.getImplCertificatePolicy; import static com.azure.security.keyvault.certificates.implementation.DeletedCertificateHelper.createDeletedCertificate; import static com.azure.security.keyvault.certificates.implementation.KeyVaultCertificateWithPolicyHelper.createCertificateWithPolicy; @@ -239,6 +249,7 @@ public String getVaultUrl() { @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller beginCreateCertificate( String certificateName, CertificatePolicy policy, Boolean isEnabled, Map tags) { + if (policy == null) { throw LOGGER.logExceptionAsError(new NullPointerException("'policy' cannot be null.")); } @@ -252,32 +263,49 @@ public SyncPoller beginCrea private PollResponse createCertificateActivation(String certificateName, CertificatePolicy policy, Boolean isEnabled, Map tags) { - com.azure.security.keyvault.certificates.implementation.models.CertificatePolicy implPolicy - = getImplCertificatePolicy(policy); + + CertificateCreateParameters certificateCreateParameters + = new CertificateCreateParameters().setCertificatePolicy(getImplCertificatePolicy(policy)) + .setCertificateAttributes(new CertificateAttributes().setEnabled(isEnabled)) + .setTags(tags); return new PollResponse<>(LongRunningOperationStatus.NOT_STARTED, createCertificateOperation(callWithMappedException( - () -> implClient.createCertificate(vaultUrl, certificateName, implPolicy, - new CertificateAttributes().setEnabled(isEnabled), tags), + () -> implClient + .createCertificateWithResponse(certificateName, BinaryData.fromObject(certificateCreateParameters), + EMPTY_OPTIONS) + .getValue() + .toObject( + com.azure.security.keyvault.certificates.implementation.models.CertificateOperation.class), CertificateAsyncClient::mapCreateCertificateException))); } private PollResponse certificatePollOperation(String certificateName) { - return processCertificateOperationResponse( - callWithMappedException(() -> implClient.getCertificateOperation(vaultUrl, certificateName), - CertificateAsyncClient::mapGetCertificateOperationException)); + return processCertificateOperationResponse(callWithMappedException( + () -> implClient.getCertificateOperationWithResponse(certificateName, EMPTY_OPTIONS) + .getValue() + .toObject(com.azure.security.keyvault.certificates.implementation.models.CertificateOperation.class), + CertificateAsyncClient::mapGetCertificateOperationException)); } private CertificateOperation certificateCancellationOperation(String certificateName) { - return createCertificateOperation( - callWithMappedException(() -> implClient.updateCertificateOperation(vaultUrl, certificateName, true), - CertificateAsyncClient::mapUpdateCertificateOperationException)); + CertificateOperationUpdateParameter certificateOperationUpdateParameter + = new CertificateOperationUpdateParameter(true); + + return createCertificateOperation(callWithMappedException( + () -> implClient + .updateCertificateOperationWithResponse(certificateName, + BinaryData.fromObject(certificateOperationUpdateParameter), EMPTY_OPTIONS) + .getValue() + .toObject(com.azure.security.keyvault.certificates.implementation.models.CertificateOperation.class), + CertificateAsyncClient::mapUpdateCertificateOperationException)); } private KeyVaultCertificateWithPolicy fetchCertificateOperation(String certificateName) { return createCertificateWithPolicy( - callWithMappedException(() -> implClient.getCertificate(vaultUrl, certificateName, null), - CertificateAsyncClient::mapGetCertificateException)); + callWithMappedException(() -> implClient.getCertificateWithResponse(certificateName, null, EMPTY_OPTIONS) + .getValue() + .toObject(CertificateBundle.class), CertificateAsyncClient::mapGetCertificateException)); } /** @@ -313,6 +341,7 @@ private KeyVaultCertificateWithPolicy fetchCertificateOperation(String certifica @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller beginCreateCertificate(String certificateName, CertificatePolicy policy) { + return beginCreateCertificate(certificateName, policy, true, null); } @@ -342,6 +371,7 @@ private KeyVaultCertificateWithPolicy fetchCertificateOperation(String certifica @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller getCertificateOperation(String certificateName) { + return SyncPoller.createPoller(Duration.ofSeconds(1), ignored -> new PollResponse<>(LongRunningOperationStatus.NOT_STARTED, null), ignored -> certificatePollOperation(certificateName), @@ -404,8 +434,9 @@ public KeyVaultCertificateWithPolicy getCertificate(String certificateName) { @ServiceMethod(returns = ReturnType.SINGLE) public Response getCertificateWithResponse(String certificateName, Context context) { return callWithMappedResponseAndException( - () -> implClient.getCertificateWithResponse(vaultUrl, certificateName, null, context), - KeyVaultCertificateWithPolicyHelper::createCertificateWithPolicy, + () -> implClient.getCertificateWithResponse(certificateName, null, + new RequestOptions().setContext(context)), + binaryData -> createCertificateWithPolicy(binaryData.toObject(CertificateBundle.class)), CertificateAsyncClient::mapGetCertificateException); } @@ -442,8 +473,9 @@ public Response getCertificateWithResponse(String public Response getCertificateVersionWithResponse(String certificateName, String version, Context context) { return callWithMappedResponseAndException( - () -> implClient.getCertificateWithResponse(vaultUrl, certificateName, version, context), - KeyVaultCertificateWithPolicyHelper::createCertificateWithPolicy, + () -> implClient.getCertificateWithResponse(certificateName, version, + new RequestOptions().setContext(context)), + binaryData -> createCertificateWithPolicy(binaryData.toObject(CertificateBundle.class)), CertificateAsyncClient::mapGetCertificateException); } @@ -544,6 +576,7 @@ public KeyVaultCertificate updateCertificateProperties(CertificateProperties pro @ServiceMethod(returns = ReturnType.SINGLE) public Response updateCertificatePropertiesWithResponse(CertificateProperties properties, Context context) { + if (properties == null) { throw LOGGER.logExceptionAsError(new NullPointerException("'properties' cannot be null.")); } @@ -552,10 +585,16 @@ public Response updateCertificatePropertiesWithResponse(Cer .setExpires(properties.getExpiresOn()) .setNotBefore(properties.getNotBefore()); - Response response = implClient.updateCertificateWithResponse(vaultUrl, properties.getName(), - properties.getVersion(), null, certificateAttributes, properties.getTags(), context); + CertificateUpdateParameters certificateUpdateParameters + = new CertificateUpdateParameters().setCertificateAttributes(certificateAttributes) + .setTags(properties.getTags()); - return new SimpleResponse<>(response, createCertificateWithPolicy(response.getValue())); + Response response + = implClient.updateCertificateWithResponse(properties.getName(), properties.getVersion(), + BinaryData.fromObject(certificateUpdateParameters), new RequestOptions().setContext(context)); + + return new SimpleResponse<>(response, + createCertificateWithPolicy(response.getValue().toObject(CertificateBundle.class))); } /** @@ -596,7 +635,10 @@ public SyncPoller beginDeleteCertificate(String certif private PollResponse deleteCertificateActivation(String certificateName) { return new PollResponse<>(LongRunningOperationStatus.NOT_STARTED, createDeletedCertificate( - callWithMappedException(() -> implClient.deleteCertificate(vaultUrl, certificateName), + callWithMappedException( + () -> implClient.deleteCertificateWithResponse(certificateName, EMPTY_OPTIONS) + .getValue() + .toObject(DeletedCertificateBundle.class), CertificateAsyncClient::mapDeleteCertificateException))); } @@ -604,9 +646,11 @@ private PollResponse deleteCertificatePollOperation(String c PollingContext pollingContext) { try { return new PollResponse<>(LongRunningOperationStatus.SUCCESSFULLY_COMPLETED, - createDeletedCertificate(implClient.getDeletedCertificate(vaultUrl, certificateName))); - } catch (KeyVaultErrorException ex) { - if (ex.getResponse().getStatusCode() == HttpURLConnection.HTTP_NOT_FOUND) { + createDeletedCertificate(implClient.getDeletedCertificateWithResponse(certificateName, EMPTY_OPTIONS) + .getValue() + .toObject(DeletedCertificateBundle.class))); + } catch (HttpResponseException e) { + if (e.getResponse().getStatusCode() == HttpURLConnection.HTTP_NOT_FOUND) { return new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, pollingContext.getLatestResponse().getValue()); } else { @@ -616,7 +660,7 @@ private PollResponse deleteCertificatePollOperation(String c return new PollResponse<>(LongRunningOperationStatus.SUCCESSFULLY_COMPLETED, pollingContext.getLatestResponse().getValue()); } - } catch (Exception ex) { + } catch (Exception e) { // This means either vault has soft-delete disabled or permission is not granted for the get deleted // certificate operation. In both cases deletion operation was successful when activation operation // succeeded before reaching here. @@ -682,10 +726,11 @@ public DeletedCertificate getDeletedCertificate(String certificateName) { */ @ServiceMethod(returns = ReturnType.SINGLE) public Response getDeletedCertificateWithResponse(String certificateName, Context context) { - return callWithMappedResponseAndException( - () -> implClient.getDeletedCertificateWithResponse(vaultUrl, certificateName, context), - DeletedCertificateHelper::createDeletedCertificate, - CertificateAsyncClient::mapGetDeletedCertificateException); + Response response + = implClient.getDeletedCertificateWithResponse(certificateName, new RequestOptions().setContext(context)); + + return new SimpleResponse<>(response, + createDeletedCertificate(response.getValue().toObject(DeletedCertificateBundle.class))); } /** @@ -737,9 +782,8 @@ public void purgeDeletedCertificate(String certificateName) { */ @ServiceMethod(returns = ReturnType.SINGLE) public Response purgeDeletedCertificateWithResponse(String certificateName, Context context) { - return callWithMappedResponseAndException( - () -> implClient.purgeDeletedCertificateWithResponse(vaultUrl, certificateName, context), t -> t, - CertificateAsyncClient::mapPurgeDeletedCertificateException); + return implClient.purgeDeletedCertificateWithResponse(certificateName, + new RequestOptions().setContext(context)); } /** @@ -781,18 +825,20 @@ public SyncPoller beginRecoverDeletedCertif private PollResponse recoverDeletedCertificateActivation(String certificateName) { return new PollResponse<>(LongRunningOperationStatus.NOT_STARTED, - createCertificateWithPolicy( - callWithMappedException(() -> implClient.recoverDeletedCertificate(vaultUrl, certificateName), - CertificateAsyncClient::mapRecoverDeletedCertificateException))); + createCertificateWithPolicy(implClient.recoverDeletedCertificateWithResponse(certificateName, EMPTY_OPTIONS) + .getValue() + .toObject(CertificateBundle.class))); } private PollResponse recoverDeletedCertificatePollOperation(String certificateName, PollingContext pollingContext) { try { return new PollResponse<>(LongRunningOperationStatus.SUCCESSFULLY_COMPLETED, - createCertificateWithPolicy(implClient.getCertificate(vaultUrl, certificateName, null))); - } catch (KeyVaultErrorException ex) { - if (ex.getResponse().getStatusCode() == HttpURLConnection.HTTP_NOT_FOUND) { + createCertificateWithPolicy(implClient.getCertificateWithResponse(certificateName, null, EMPTY_OPTIONS) + .getValue() + .toObject(CertificateBundle.class))); + } catch (HttpResponseException e) { + if (e.getResponse().getStatusCode() == HttpURLConnection.HTTP_NOT_FOUND) { return new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, pollingContext.getLatestResponse().getValue()); } else { @@ -802,7 +848,7 @@ private PollResponse recoverDeletedCertificatePol return new PollResponse<>(LongRunningOperationStatus.SUCCESSFULLY_COMPLETED, pollingContext.getLatestResponse().getValue()); } - } catch (Exception ex) { + } catch (Exception e) { // This means permission is not granted for the get deleted key operation. // In both cases deletion operation was successful when activation operation succeeded before reaching // here. @@ -861,9 +907,10 @@ public byte[] backupCertificate(String certificateName) { */ @ServiceMethod(returns = ReturnType.SINGLE) public Response backupCertificateWithResponse(String certificateName, Context context) { - return callWithMappedResponseAndException( - () -> implClient.backupCertificateWithResponse(vaultUrl, certificateName, context), - BackupCertificateResult::getValue, CertificateAsyncClient::mapBackupCertificateException); + Response response + = implClient.backupCertificateWithResponse(certificateName, new RequestOptions().setContext(context)); + + return new SimpleResponse<>(response, response.getValue().toObject(BackupCertificateResult.class).getValue()); } /** @@ -920,9 +967,13 @@ public KeyVaultCertificateWithPolicy restoreCertificateBackup(byte[] backup) { @ServiceMethod(returns = ReturnType.SINGLE) public Response restoreCertificateBackupWithResponse(byte[] backup, Context context) { + + CertificateRestoreParameters certificateRestoreParameters = new CertificateRestoreParameters(backup); + return callWithMappedResponseAndException( - () -> implClient.restoreCertificateWithResponse(vaultUrl, backup, context), - KeyVaultCertificateWithPolicyHelper::createCertificateWithPolicy, + () -> implClient.restoreCertificateWithResponse(BinaryData.fromObject(certificateRestoreParameters), + new RequestOptions().setContext(context)), + binaryData -> createCertificateWithPolicy(binaryData.toObject(CertificateBundle.class)), CertificateAsyncClient::mapRestoreCertificateException); } @@ -986,11 +1037,12 @@ public PagedIterable listPropertiesOfCertificates() { */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listPropertiesOfCertificates(boolean includePending, Context context) { - return new PagedIterable<>( - maxResults -> mapCertificateItemPage( - implClient.getCertificatesSinglePage(vaultUrl, maxResults, includePending, context)), - (continuationToken, maxResults) -> mapCertificateItemPage( - implClient.getCertificatesNextSinglePage(continuationToken, vaultUrl, context))); + RequestOptions requestOptions = new RequestOptions().setContext(context) + .addQueryParam("includePending", String.valueOf(includePending), false); + + return implClient.getCertificates(requestOptions) + .mapPage(binaryData -> CertificatePropertiesHelper + .createCertificateProperties(binaryData.toObject(CertificateItem.class))); } /** @@ -1043,11 +1095,12 @@ public PagedIterable listDeletedCertificates() { */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listDeletedCertificates(boolean includePending, Context context) { - return new PagedIterable<>( - maxResults -> mapDeletedCertificateItemPage( - implClient.getDeletedCertificatesSinglePage(vaultUrl, maxResults, includePending, context)), - (continuationToken, maxResults) -> mapDeletedCertificateItemPage( - implClient.getDeletedCertificatesNextSinglePage(continuationToken, vaultUrl, context))); + RequestOptions requestOptions = new RequestOptions().setContext(context) + .addQueryParam("includePending", String.valueOf(includePending), false); + + return implClient.getDeletedCertificates(requestOptions) + .mapPage(binaryData -> DeletedCertificateHelper + .createDeletedCertificate(binaryData.toObject(DeletedCertificateItem.class))); } /** @@ -1121,11 +1174,10 @@ public PagedIterable listPropertiesOfCertificateVersions( @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listPropertiesOfCertificateVersions(String certificateName, Context context) { - return new PagedIterable<>( - maxResults -> mapCertificateItemPage( - implClient.getCertificateVersionsSinglePage(vaultUrl, certificateName, maxResults, context)), - (continuationToken, maxResults) -> mapCertificateItemPage( - implClient.getCertificateVersionsNextSinglePage(continuationToken, vaultUrl, context))); + + return implClient.getCertificateVersions(certificateName, new RequestOptions().setContext(context)) + .mapPage(binaryData -> CertificatePropertiesHelper + .createCertificateProperties(binaryData.toObject(CertificateItem.class))); } /** @@ -1172,16 +1224,19 @@ public CertificatePolicy getCertificatePolicy(String certificateName) { * * @param certificateName The name of the certificate whose policy is to be retrieved, cannot be null * @param context Additional context that is passed through the Http pipeline during the service call. - * @throws ResourceNotFoundException when a certificate with {@code certificateName} doesn't exist in the key vault. - * @throws HttpRequestException if {@code certificateName} is empty string. * @return A {@link Response} whose {@link Response#getValue() value} contains the requested * {@link CertificatePolicy certificate policy}. + * @throws ResourceNotFoundException when a certificate with {@code certificateName} doesn't exist in the key vault. + * @throws HttpRequestException if {@code certificateName} is empty string. */ @ServiceMethod(returns = ReturnType.SINGLE) public Response getCertificatePolicyWithResponse(String certificateName, Context context) { return callWithMappedResponseAndException( - () -> implClient.getCertificatePolicyWithResponse(vaultUrl, certificateName, context), - CertificatePolicyHelper::createCertificatePolicy, CertificateAsyncClient::mapGetCertificatePolicyException); + () -> implClient.getCertificatePolicyWithResponse(certificateName, + new RequestOptions().setContext(context)), + binaryData -> createCertificatePolicy(binaryData + .toObject(com.azure.security.keyvault.certificates.implementation.models.CertificatePolicy.class)), + CertificateAsyncClient::mapGetCertificatePolicyException); } /** @@ -1251,15 +1306,19 @@ public CertificatePolicy updateCertificatePolicy(String certificateName, Certifi @ServiceMethod(returns = ReturnType.SINGLE) public Response updateCertificatePolicyWithResponse(String certificateName, CertificatePolicy policy, Context context) { + if (policy == null) { throw LOGGER.logExceptionAsError(new NullPointerException("'policy' cannot be null.")); } - return callWithMappedResponseAndException( - () -> implClient.updateCertificatePolicyWithResponse(vaultUrl, certificateName, - getImplCertificatePolicy(policy), context), - CertificatePolicyHelper::createCertificatePolicy, - CertificateAsyncClient::mapUpdateCertificatePolicyException); + CertificateUpdateParameters certificateUpdateParameters + = new CertificateUpdateParameters().setCertificatePolicy(getImplCertificatePolicy(policy)); + + Response response = implClient.updateCertificatePolicyWithResponse(certificateName, + BinaryData.fromObject(certificateUpdateParameters), new RequestOptions().setContext(context)); + + return new SimpleResponse<>(response, createCertificatePolicy(response.getValue() + .toObject(com.azure.security.keyvault.certificates.implementation.models.CertificatePolicy.class))); } /** @@ -1333,10 +1392,17 @@ public Response createIssuerWithResponse(CertificateIssuer is } IssuerBundle issuerBundle = getIssuerBundle(issuer); - return callWithMappedResponseAndException(() -> implClient.setCertificateIssuerWithResponse(vaultUrl, - issuer.getName(), issuer.getProvider(), issuerBundle.getCredentials(), - issuerBundle.getOrganizationDetails(), issuerBundle.getAttributes(), context), - CertificateIssuerHelper::createCertificateIssuer, ex -> ex); + CertificateIssuerSetParameters certificateIssuerSetParameters + = new CertificateIssuerSetParameters(issuerBundle.getProvider()) + .setOrganizationDetails(issuerBundle.getOrganizationDetails()) + .setCredentials(issuerBundle.getCredentials()) + .setAttributes(issuerBundle.getAttributes()); + + Response response = implClient.setCertificateIssuerWithResponse(issuer.getName(), + BinaryData.fromObject(certificateIssuerSetParameters), new RequestOptions().setContext(context)); + + return new SimpleResponse<>(response, createCertificateIssuer(response.getValue() + .toObject(com.azure.security.keyvault.certificates.implementation.models.IssuerBundle.class))); } /** @@ -1366,9 +1432,11 @@ public Response createIssuerWithResponse(CertificateIssuer is */ @ServiceMethod(returns = ReturnType.SINGLE) public Response getIssuerWithResponse(String issuerName, Context context) { - return callWithMappedResponseAndException( - () -> implClient.getCertificateIssuerWithResponse(vaultUrl, issuerName, context), - CertificateIssuerHelper::createCertificateIssuer, ex -> ex); + Response response + = implClient.getCertificateIssuerWithResponse(issuerName, new RequestOptions().setContext(context)); + + return new SimpleResponse<>(response, + createCertificateIssuer(response.getValue().toObject(IssuerBundle.class))); } /** @@ -1425,10 +1493,11 @@ public CertificateIssuer getIssuer(String issuerName) { */ @ServiceMethod(returns = ReturnType.SINGLE) public Response deleteIssuerWithResponse(String issuerName, Context context) { - return callWithMappedResponseAndException( - () -> implClient.deleteCertificateIssuerWithResponse(vaultUrl, issuerName, context), - CertificateIssuerHelper::createCertificateIssuer, - CertificateAsyncClient::mapDeleteCertificateIssuerException); + Response response + = implClient.deleteCertificateIssuerWithResponse(issuerName, new RequestOptions().setContext(context)); + + return new SimpleResponse<>(response, + createCertificateIssuer(response.getValue().toObject(IssuerBundle.class))); } /** @@ -1511,11 +1580,8 @@ public PagedIterable listPropertiesOfIssuers() { */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listPropertiesOfIssuers(Context context) { - return new PagedIterable<>( - maxResults -> mapIssuersPagedResponse( - implClient.getCertificateIssuersSinglePage(vaultUrl, maxResults, context)), - (continuationToken, maxResults) -> mapIssuersPagedResponse( - implClient.getCertificateIssuersNextSinglePage(continuationToken, vaultUrl, context))); + return implClient.getCertificateIssuers(new RequestOptions().setContext(context)) + .mapPage(issuer -> issuer.toObject(IssuerProperties.class)); } /** @@ -1585,10 +1651,17 @@ public Response updateIssuerWithResponse(CertificateIssuer is } IssuerBundle issuerBundle = CertificateIssuerHelper.getIssuerBundle(issuer); - return callWithMappedResponseAndException(() -> implClient.updateCertificateIssuerWithResponse(vaultUrl, - issuer.getName(), issuer.getProvider(), issuerBundle.getCredentials(), - issuerBundle.getOrganizationDetails(), issuerBundle.getAttributes(), context), - CertificateIssuerHelper::createCertificateIssuer, ex -> ex); + CertificateIssuerUpdateParameters certificateIssuerUpdateParameters + = new CertificateIssuerUpdateParameters().setProvider(issuerBundle.getProvider()) + .setAttributes(issuerBundle.getAttributes()) + .setCredentials(issuerBundle.getCredentials()) + .setOrganizationDetails(issuerBundle.getOrganizationDetails()); + + Response response = implClient.updateCertificateIssuerWithResponse(issuer.getName(), + BinaryData.fromObject(certificateIssuerUpdateParameters), new RequestOptions().setContext(context)); + + return new SimpleResponse<>(response, + createCertificateIssuer(response.getValue().toObject(IssuerBundle.class))); } /** @@ -1650,8 +1723,8 @@ public PagedIterable setContacts(List co */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable setContacts(List contacts, Context context) { - return new PagedIterable<>(() -> mapContactsToPagedResponse( - implClient.setCertificateContactsWithResponse(vaultUrl, new Contacts().setContactList(contacts), context))); + return new PagedIterable<>(() -> mapContactsToPagedResponse(implClient.setCertificateContactsWithResponse( + BinaryData.fromObject(new Contacts().setContactList(contacts)), new RequestOptions().setContext(context)))); } /** @@ -1702,8 +1775,8 @@ public PagedIterable listContacts() { */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listContacts(Context context) { - return new PagedIterable<>( - () -> mapContactsToPagedResponse(implClient.getCertificateContactsWithResponse(vaultUrl, context))); + return new PagedIterable<>(() -> mapContactsToPagedResponse( + implClient.getCertificateContactsWithResponse(new RequestOptions().setContext(context)))); } /** @@ -1754,8 +1827,8 @@ public PagedIterable deleteContacts() { */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable deleteContacts(Context context) { - return new PagedIterable<>( - () -> mapContactsToPagedResponse(implClient.deleteCertificateContactsWithResponse(vaultUrl, context))); + return new PagedIterable<>(() -> mapContactsToPagedResponse( + implClient.deleteCertificateContactsWithResponse(new RequestOptions().setContext(context)))); } /** @@ -1815,9 +1888,12 @@ public CertificateOperation deleteCertificateOperation(String certificateName) { @ServiceMethod(returns = ReturnType.SINGLE) public Response deleteCertificateOperationWithResponse(String certificateName, Context context) { + return callWithMappedResponseAndException( - () -> implClient.deleteCertificateOperationWithResponse(vaultUrl, certificateName, context), - CertificateOperationHelper::createCertificateOperation, + () -> implClient.deleteCertificateOperationWithResponse(certificateName, + new RequestOptions().setContext(context)), + binaryData -> createCertificateOperation(binaryData + .toObject(com.azure.security.keyvault.certificates.implementation.models.CertificateOperation.class)), CertificateAsyncClient::mapDeleteCertificateOperationException); } @@ -1878,9 +1954,15 @@ public CertificateOperation cancelCertificateOperation(String certificateName) { @ServiceMethod(returns = ReturnType.SINGLE) public Response cancelCertificateOperationWithResponse(String certificateName, Context context) { + + CertificateOperationUpdateParameter certificateOperationUpdateParameter + = new CertificateOperationUpdateParameter(true); + return callWithMappedResponseAndException( - () -> implClient.updateCertificateOperationWithResponse(vaultUrl, certificateName, true, context), - CertificateOperationHelper::createCertificateOperation, + () -> implClient.updateCertificateOperationWithResponse(certificateName, + BinaryData.fromObject(certificateOperationUpdateParameter), new RequestOptions().setContext(context)), + binaryData -> createCertificateOperation(binaryData + .toObject(com.azure.security.keyvault.certificates.implementation.models.CertificateOperation.class)), CertificateAsyncClient::mapUpdateCertificateOperationException); } @@ -1943,16 +2025,21 @@ public KeyVaultCertificateWithPolicy mergeCertificate(MergeCertificateOptions me @ServiceMethod(returns = ReturnType.SINGLE) public Response mergeCertificateWithResponse(MergeCertificateOptions mergeCertificateOptions, Context context) { + if (mergeCertificateOptions == null) { throw LOGGER.logExceptionAsError(new NullPointerException("'mergeCertificateOptions' cannot be null.")); } - return callWithMappedResponseAndException( - () -> implClient.mergeCertificateWithResponse(vaultUrl, mergeCertificateOptions.getName(), - mergeCertificateOptions.getX509Certificates(), - new CertificateAttributes().setEnabled(mergeCertificateOptions.isEnabled()), - mergeCertificateOptions.getTags(), context), - KeyVaultCertificateWithPolicyHelper::createCertificateWithPolicy, ex -> ex); + CertificateMergeParameters certificateMergeParameters + = new CertificateMergeParameters(mergeCertificateOptions.getX509Certificates()) + .setTags(mergeCertificateOptions.getTags()) + .setCertificateAttributes(new CertificateAttributes().setEnabled(mergeCertificateOptions.isEnabled())); + + Response response = implClient.mergeCertificateWithResponse(mergeCertificateOptions.getName(), + BinaryData.fromObject(certificateMergeParameters), new RequestOptions().setContext(context)); + + return new SimpleResponse<>(response, createCertificateWithPolicy(response.getValue() + .toObject(com.azure.security.keyvault.certificates.implementation.models.CertificateBundle.class))); } /** @@ -2022,29 +2109,39 @@ public KeyVaultCertificateWithPolicy importCertificate(ImportCertificateOptions com.azure.security.keyvault.certificates.implementation.models.CertificatePolicy implPolicy = getImplCertificatePolicy(importCertificateOptions.getPolicy()); - return callWithMappedResponseAndException(() -> implClient.importCertificateWithResponse(vaultUrl, - importCertificateOptions.getName(), transformCertificateForImport(importCertificateOptions), - importCertificateOptions.getPassword(), implPolicy, implPolicy == null ? null : implPolicy.getAttributes(), - importCertificateOptions.getTags(), context), - KeyVaultCertificateWithPolicyHelper::createCertificateWithPolicy, ex -> ex); + CertificateImportParameters certificateImportParameters + = new CertificateImportParameters(transformCertificateForImport(importCertificateOptions)) + .setPassword(importCertificateOptions.getPassword()) + .setCertificatePolicy(implPolicy) + .setTags(importCertificateOptions.getTags()) + .setCertificateAttributes(new CertificateAttributes().setEnabled(importCertificateOptions.isEnabled())); + + Response response = implClient.importCertificateWithResponse(importCertificateOptions.getName(), + BinaryData.fromObject(certificateImportParameters), new RequestOptions().setContext(context)); + + return new SimpleResponse<>(response, createCertificateWithPolicy(response.getValue() + .toObject(com.azure.security.keyvault.certificates.implementation.models.CertificateBundle.class))); } private static T callWithMappedException(Supplier apiCall, - Function exceptionMapper) { + Function exceptionMapper) { + try { return apiCall.get(); - } catch (KeyVaultErrorException ex) { - throw exceptionMapper.apply(ex); + } catch (HttpResponseException e) { + throw exceptionMapper.apply(e); } } private static Response callWithMappedResponseAndException(Supplier> apiCall, - Function responseValueMapper, Function exceptionMapper) { + Function responseValueMapper, Function exceptionMapper) { + try { - Response responseInn = apiCall.get(); - return new SimpleResponse<>(responseInn, responseValueMapper.apply(responseInn.getValue())); - } catch (KeyVaultErrorException ex) { - throw exceptionMapper.apply(ex); + Response response = apiCall.get(); + + return new SimpleResponse<>(response, responseValueMapper.apply(response.getValue())); + } catch (HttpResponseException e) { + throw exceptionMapper.apply(e); } } } diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateClientBuilder.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateClientBuilder.java index d84a98fed9519..19e520fbcacc2 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateClientBuilder.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/CertificateClientBuilder.java @@ -161,7 +161,7 @@ public CertificateClientBuilder() { * and {@link #retryPolicy(RetryPolicy)} have been set. */ public CertificateClient buildClient() { - return new CertificateClient(buildInnerClient(), vaultUrl); + return new CertificateClient(buildClientImpl(), vaultUrl); } /** @@ -183,10 +183,10 @@ public CertificateClient buildClient() { * and {@link #retryPolicy(RetryPolicy)} have been set. */ public CertificateAsyncClient buildAsyncClient() { - return new CertificateAsyncClient(buildInnerClient(), vaultUrl); + return new CertificateAsyncClient(buildClientImpl(), vaultUrl); } - private CertificateClientImpl buildInnerClient() { + private CertificateClientImpl buildClientImpl() { Configuration buildConfiguration = (configuration != null) ? configuration : Configuration.getGlobalConfiguration().clone(); @@ -197,10 +197,12 @@ private CertificateClientImpl buildInnerClient() { .logExceptionAsError(new IllegalStateException(KeyVaultErrorCodeStrings.VAULT_END_POINT_REQUIRED)); } - CertificateServiceVersion serviceVersion = version != null ? version : CertificateServiceVersion.getLatest(); + if (version == null) { + version = CertificateServiceVersion.getLatest(); + } if (pipeline != null) { - return new CertificateClientImpl(pipeline, serviceVersion.getVersion()); + return new CertificateClientImpl(pipeline, vaultUrl, version); } if (credential == null) { @@ -240,13 +242,13 @@ private CertificateClientImpl buildInnerClient() { Tracer tracer = TracerProvider.getDefaultProvider() .createTracer(CLIENT_NAME, CLIENT_VERSION, KEYVAULT_TRACING_NAMESPACE_VALUE, tracingOptions); - HttpPipeline pipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) + HttpPipeline builtPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0])) .httpClient(httpClient) .tracer(tracer) .clientOptions(localClientOptions) .build(); - return new CertificateClientImpl(pipeline, serviceVersion.getVersion()); + return new CertificateClientImpl(builtPipeline, vaultUrl, version); } /** diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/CertificateClientImpl.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/CertificateClientImpl.java index a479164674881..199ebe4fa6db1 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/CertificateClientImpl.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/CertificateClientImpl.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.security.keyvault.certificates.implementation; @@ -20,6 +20,10 @@ import com.azure.core.annotation.ServiceInterface; import com.azure.core.annotation.ServiceMethod; import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.exception.ClientAuthenticationException; +import com.azure.core.exception.HttpResponseException; +import com.azure.core.exception.ResourceModifiedException; +import com.azure.core.exception.ResourceNotFoundException; import com.azure.core.http.HttpPipeline; import com.azure.core.http.HttpPipelineBuilder; import com.azure.core.http.policy.RetryPolicy; @@ -28,40 +32,18 @@ import com.azure.core.http.rest.PagedIterable; import com.azure.core.http.rest.PagedResponse; import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.RequestOptions; import com.azure.core.http.rest.Response; import com.azure.core.http.rest.RestProxy; +import com.azure.core.util.BinaryData; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; import com.azure.core.util.serializer.JacksonAdapter; import com.azure.core.util.serializer.SerializerAdapter; -import com.azure.security.keyvault.certificates.implementation.models.BackupCertificateResult; -import com.azure.security.keyvault.certificates.implementation.models.CertificateAttributes; -import com.azure.security.keyvault.certificates.implementation.models.CertificateBundle; -import com.azure.security.keyvault.certificates.implementation.models.CertificateCreateParameters; -import com.azure.security.keyvault.certificates.implementation.models.CertificateImportParameters; -import com.azure.security.keyvault.certificates.implementation.models.CertificateIssuerItem; -import com.azure.security.keyvault.certificates.implementation.models.CertificateIssuerListResult; -import com.azure.security.keyvault.certificates.implementation.models.CertificateIssuerSetParameters; -import com.azure.security.keyvault.certificates.implementation.models.CertificateIssuerUpdateParameters; -import com.azure.security.keyvault.certificates.implementation.models.CertificateItem; -import com.azure.security.keyvault.certificates.implementation.models.CertificateListResult; -import com.azure.security.keyvault.certificates.implementation.models.CertificateMergeParameters; -import com.azure.security.keyvault.certificates.implementation.models.CertificateOperation; -import com.azure.security.keyvault.certificates.implementation.models.CertificateOperationUpdateParameter; -import com.azure.security.keyvault.certificates.implementation.models.CertificatePolicy; -import com.azure.security.keyvault.certificates.implementation.models.CertificateRestoreParameters; -import com.azure.security.keyvault.certificates.implementation.models.CertificateUpdateParameters; -import com.azure.security.keyvault.certificates.implementation.models.Contacts; -import com.azure.security.keyvault.certificates.implementation.models.DeletedCertificateBundle; -import com.azure.security.keyvault.certificates.implementation.models.DeletedCertificateItem; -import com.azure.security.keyvault.certificates.implementation.models.DeletedCertificateListResult; -import com.azure.security.keyvault.certificates.implementation.models.IssuerAttributes; -import com.azure.security.keyvault.certificates.implementation.models.IssuerBundle; -import com.azure.security.keyvault.certificates.implementation.models.IssuerCredentials; -import com.azure.security.keyvault.certificates.implementation.models.KeyVaultErrorException; -import com.azure.security.keyvault.certificates.implementation.models.OrganizationDetails; +import com.azure.security.keyvault.certificates.CertificateServiceVersion; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; import reactor.core.publisher.Mono; /** @@ -74,17 +56,30 @@ public final class CertificateClientImpl { private final CertificateClientService service; /** - * Api Version. */ - private final String apiVersion; + private final String vaultBaseUrl; /** - * Gets Api Version. + * Gets. * - * @return the apiVersion value. + * @return the vaultBaseUrl value. */ - public String getApiVersion() { - return this.apiVersion; + public String getVaultBaseUrl() { + return this.vaultBaseUrl; + } + + /** + * Service version. + */ + private final CertificateServiceVersion serviceVersion; + + /** + * Gets Service version. + * + * @return the serviceVersion value. + */ + public CertificateServiceVersion getServiceVersion() { + return this.serviceVersion; } /** @@ -118,21 +113,24 @@ public SerializerAdapter getSerializerAdapter() { /** * Initializes an instance of CertificateClient client. * - * @param apiVersion Api Version. + * @param vaultBaseUrl + * @param serviceVersion Service version. */ - public CertificateClientImpl(String apiVersion) { + public CertificateClientImpl(String vaultBaseUrl, CertificateServiceVersion serviceVersion) { this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(), - JacksonAdapter.createDefaultSerializerAdapter(), apiVersion); + JacksonAdapter.createDefaultSerializerAdapter(), vaultBaseUrl, serviceVersion); } /** * Initializes an instance of CertificateClient client. * * @param httpPipeline The HTTP pipeline to send requests through. - * @param apiVersion Api Version. + * @param vaultBaseUrl + * @param serviceVersion Service version. */ - public CertificateClientImpl(HttpPipeline httpPipeline, String apiVersion) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), apiVersion); + public CertificateClientImpl(HttpPipeline httpPipeline, String vaultBaseUrl, + CertificateServiceVersion serviceVersion) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), vaultBaseUrl, serviceVersion); } /** @@ -140,12 +138,15 @@ public CertificateClientImpl(HttpPipeline httpPipeline, String apiVersion) { * * @param httpPipeline The HTTP pipeline to send requests through. * @param serializerAdapter The serializer to serialize an object into a string. - * @param apiVersion Api Version. + * @param vaultBaseUrl + * @param serviceVersion Service version. */ - public CertificateClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String apiVersion) { + public CertificateClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String vaultBaseUrl, + CertificateServiceVersion serviceVersion) { this.httpPipeline = httpPipeline; this.serializerAdapter = serializerAdapter; - this.apiVersion = apiVersion; + this.vaultBaseUrl = vaultBaseUrl; + this.serviceVersion = serviceVersion; this.service = RestProxy.create(CertificateClientService.class, this.httpPipeline, this.getSerializerAdapter()); } @@ -158,457 +159,657 @@ public CertificateClientImpl(HttpPipeline httpPipeline, SerializerAdapter serial public interface CertificateClientService { @Get("/certificates") @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(KeyVaultErrorException.class) - Mono> getCertificates(@HostParam("vaultBaseUrl") String vaultBaseUrl, - @QueryParam("maxresults") Integer maxresults, @QueryParam("includePending") Boolean includePending, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getCertificates(@HostParam("vaultBaseUrl") String vaultBaseUrl, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); @Get("/certificates") @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(KeyVaultErrorException.class) - Response getCertificatesSync(@HostParam("vaultBaseUrl") String vaultBaseUrl, - @QueryParam("maxresults") Integer maxresults, @QueryParam("includePending") Boolean includePending, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getCertificatesSync(@HostParam("vaultBaseUrl") String vaultBaseUrl, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); @Delete("/certificates/{certificate-name}") @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(KeyVaultErrorException.class) - Mono> deleteCertificate(@HostParam("vaultBaseUrl") String vaultBaseUrl, - @PathParam("certificate-name") String certificateName, @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, Context context); + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> deleteCertificate(@HostParam("vaultBaseUrl") String vaultBaseUrl, + @QueryParam("api-version") String apiVersion, @PathParam("certificate-name") String certificateName, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); @Delete("/certificates/{certificate-name}") @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(KeyVaultErrorException.class) - Response deleteCertificateSync(@HostParam("vaultBaseUrl") String vaultBaseUrl, - @PathParam("certificate-name") String certificateName, @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, Context context); + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response deleteCertificateSync(@HostParam("vaultBaseUrl") String vaultBaseUrl, + @QueryParam("api-version") String apiVersion, @PathParam("certificate-name") String certificateName, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); @Put("/certificates/contacts") @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(KeyVaultErrorException.class) - Mono> setCertificateContacts(@HostParam("vaultBaseUrl") String vaultBaseUrl, - @QueryParam("api-version") String apiVersion, @BodyParam("application/json") Contacts contacts, - @HeaderParam("Accept") String accept, Context context); + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> setCertificateContacts(@HostParam("vaultBaseUrl") String vaultBaseUrl, + @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData contacts, + RequestOptions requestOptions, Context context); @Put("/certificates/contacts") @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(KeyVaultErrorException.class) - Response setCertificateContactsSync(@HostParam("vaultBaseUrl") String vaultBaseUrl, - @QueryParam("api-version") String apiVersion, @BodyParam("application/json") Contacts contacts, - @HeaderParam("Accept") String accept, Context context); + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response setCertificateContactsSync(@HostParam("vaultBaseUrl") String vaultBaseUrl, + @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData contacts, + RequestOptions requestOptions, Context context); @Get("/certificates/contacts") @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(KeyVaultErrorException.class) - Mono> getCertificateContacts(@HostParam("vaultBaseUrl") String vaultBaseUrl, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getCertificateContacts(@HostParam("vaultBaseUrl") String vaultBaseUrl, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); @Get("/certificates/contacts") @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(KeyVaultErrorException.class) - Response getCertificateContactsSync(@HostParam("vaultBaseUrl") String vaultBaseUrl, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getCertificateContactsSync(@HostParam("vaultBaseUrl") String vaultBaseUrl, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); @Delete("/certificates/contacts") @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(KeyVaultErrorException.class) - Mono> deleteCertificateContacts(@HostParam("vaultBaseUrl") String vaultBaseUrl, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> deleteCertificateContacts(@HostParam("vaultBaseUrl") String vaultBaseUrl, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); @Delete("/certificates/contacts") @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(KeyVaultErrorException.class) - Response deleteCertificateContactsSync(@HostParam("vaultBaseUrl") String vaultBaseUrl, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response deleteCertificateContactsSync(@HostParam("vaultBaseUrl") String vaultBaseUrl, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); @Get("/certificates/issuers") @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(KeyVaultErrorException.class) - Mono> getCertificateIssuers( - @HostParam("vaultBaseUrl") String vaultBaseUrl, @QueryParam("maxresults") Integer maxresults, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getCertificateIssuers(@HostParam("vaultBaseUrl") String vaultBaseUrl, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); @Get("/certificates/issuers") @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(KeyVaultErrorException.class) - Response getCertificateIssuersSync(@HostParam("vaultBaseUrl") String vaultBaseUrl, - @QueryParam("maxresults") Integer maxresults, @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, Context context); + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getCertificateIssuersSync(@HostParam("vaultBaseUrl") String vaultBaseUrl, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); @Put("/certificates/issuers/{issuer-name}") @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(KeyVaultErrorException.class) - Mono> setCertificateIssuer(@HostParam("vaultBaseUrl") String vaultBaseUrl, - @PathParam("issuer-name") String issuerName, @QueryParam("api-version") String apiVersion, - @BodyParam("application/json") CertificateIssuerSetParameters parameter, - @HeaderParam("Accept") String accept, Context context); + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> setCertificateIssuer(@HostParam("vaultBaseUrl") String vaultBaseUrl, + @QueryParam("api-version") String apiVersion, @PathParam("issuer-name") String issuerName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData parameter, RequestOptions requestOptions, Context context); @Put("/certificates/issuers/{issuer-name}") @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(KeyVaultErrorException.class) - Response setCertificateIssuerSync(@HostParam("vaultBaseUrl") String vaultBaseUrl, - @PathParam("issuer-name") String issuerName, @QueryParam("api-version") String apiVersion, - @BodyParam("application/json") CertificateIssuerSetParameters parameter, - @HeaderParam("Accept") String accept, Context context); + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response setCertificateIssuerSync(@HostParam("vaultBaseUrl") String vaultBaseUrl, + @QueryParam("api-version") String apiVersion, @PathParam("issuer-name") String issuerName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData parameter, RequestOptions requestOptions, Context context); @Patch("/certificates/issuers/{issuer-name}") @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(KeyVaultErrorException.class) - Mono> updateCertificateIssuer(@HostParam("vaultBaseUrl") String vaultBaseUrl, - @PathParam("issuer-name") String issuerName, @QueryParam("api-version") String apiVersion, - @BodyParam("application/json") CertificateIssuerUpdateParameters parameter, - @HeaderParam("Accept") String accept, Context context); + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> updateCertificateIssuer(@HostParam("vaultBaseUrl") String vaultBaseUrl, + @QueryParam("api-version") String apiVersion, @PathParam("issuer-name") String issuerName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData parameter, RequestOptions requestOptions, Context context); @Patch("/certificates/issuers/{issuer-name}") @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(KeyVaultErrorException.class) - Response updateCertificateIssuerSync(@HostParam("vaultBaseUrl") String vaultBaseUrl, - @PathParam("issuer-name") String issuerName, @QueryParam("api-version") String apiVersion, - @BodyParam("application/json") CertificateIssuerUpdateParameters parameter, - @HeaderParam("Accept") String accept, Context context); + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response updateCertificateIssuerSync(@HostParam("vaultBaseUrl") String vaultBaseUrl, + @QueryParam("api-version") String apiVersion, @PathParam("issuer-name") String issuerName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData parameter, RequestOptions requestOptions, Context context); @Get("/certificates/issuers/{issuer-name}") @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(KeyVaultErrorException.class) - Mono> getCertificateIssuer(@HostParam("vaultBaseUrl") String vaultBaseUrl, - @PathParam("issuer-name") String issuerName, @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, Context context); + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getCertificateIssuer(@HostParam("vaultBaseUrl") String vaultBaseUrl, + @QueryParam("api-version") String apiVersion, @PathParam("issuer-name") String issuerName, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); @Get("/certificates/issuers/{issuer-name}") @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(KeyVaultErrorException.class) - Response getCertificateIssuerSync(@HostParam("vaultBaseUrl") String vaultBaseUrl, - @PathParam("issuer-name") String issuerName, @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, Context context); + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getCertificateIssuerSync(@HostParam("vaultBaseUrl") String vaultBaseUrl, + @QueryParam("api-version") String apiVersion, @PathParam("issuer-name") String issuerName, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); @Delete("/certificates/issuers/{issuer-name}") @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(KeyVaultErrorException.class) - Mono> deleteCertificateIssuer(@HostParam("vaultBaseUrl") String vaultBaseUrl, - @PathParam("issuer-name") String issuerName, @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, Context context); + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> deleteCertificateIssuer(@HostParam("vaultBaseUrl") String vaultBaseUrl, + @QueryParam("api-version") String apiVersion, @PathParam("issuer-name") String issuerName, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); @Delete("/certificates/issuers/{issuer-name}") @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(KeyVaultErrorException.class) - Response deleteCertificateIssuerSync(@HostParam("vaultBaseUrl") String vaultBaseUrl, - @PathParam("issuer-name") String issuerName, @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, Context context); + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response deleteCertificateIssuerSync(@HostParam("vaultBaseUrl") String vaultBaseUrl, + @QueryParam("api-version") String apiVersion, @PathParam("issuer-name") String issuerName, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); @Post("/certificates/{certificate-name}/create") @ExpectedResponses({ 202 }) - @UnexpectedResponseExceptionType(KeyVaultErrorException.class) - Mono> createCertificate(@HostParam("vaultBaseUrl") String vaultBaseUrl, - @PathParam("certificate-name") String certificateName, @QueryParam("api-version") String apiVersion, - @BodyParam("application/json") CertificateCreateParameters parameters, @HeaderParam("Accept") String accept, - Context context); + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> createCertificate(@HostParam("vaultBaseUrl") String vaultBaseUrl, + @QueryParam("api-version") String apiVersion, @PathParam("certificate-name") String certificateName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData parameters, RequestOptions requestOptions, Context context); @Post("/certificates/{certificate-name}/create") @ExpectedResponses({ 202 }) - @UnexpectedResponseExceptionType(KeyVaultErrorException.class) - Response createCertificateSync(@HostParam("vaultBaseUrl") String vaultBaseUrl, - @PathParam("certificate-name") String certificateName, @QueryParam("api-version") String apiVersion, - @BodyParam("application/json") CertificateCreateParameters parameters, @HeaderParam("Accept") String accept, - Context context); + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response createCertificateSync(@HostParam("vaultBaseUrl") String vaultBaseUrl, + @QueryParam("api-version") String apiVersion, @PathParam("certificate-name") String certificateName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData parameters, RequestOptions requestOptions, Context context); @Post("/certificates/{certificate-name}/import") @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(KeyVaultErrorException.class) - Mono> importCertificate(@HostParam("vaultBaseUrl") String vaultBaseUrl, - @PathParam("certificate-name") String certificateName, @QueryParam("api-version") String apiVersion, - @BodyParam("application/json") CertificateImportParameters parameters, @HeaderParam("Accept") String accept, - Context context); + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> importCertificate(@HostParam("vaultBaseUrl") String vaultBaseUrl, + @QueryParam("api-version") String apiVersion, @PathParam("certificate-name") String certificateName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData parameters, RequestOptions requestOptions, Context context); @Post("/certificates/{certificate-name}/import") @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(KeyVaultErrorException.class) - Response importCertificateSync(@HostParam("vaultBaseUrl") String vaultBaseUrl, - @PathParam("certificate-name") String certificateName, @QueryParam("api-version") String apiVersion, - @BodyParam("application/json") CertificateImportParameters parameters, @HeaderParam("Accept") String accept, - Context context); + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response importCertificateSync(@HostParam("vaultBaseUrl") String vaultBaseUrl, + @QueryParam("api-version") String apiVersion, @PathParam("certificate-name") String certificateName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData parameters, RequestOptions requestOptions, Context context); @Get("/certificates/{certificate-name}/versions") @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(KeyVaultErrorException.class) - Mono> getCertificateVersions(@HostParam("vaultBaseUrl") String vaultBaseUrl, - @PathParam("certificate-name") String certificateName, @QueryParam("maxresults") Integer maxresults, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getCertificateVersions(@HostParam("vaultBaseUrl") String vaultBaseUrl, + @QueryParam("api-version") String apiVersion, @PathParam("certificate-name") String certificateName, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); @Get("/certificates/{certificate-name}/versions") @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(KeyVaultErrorException.class) - Response getCertificateVersionsSync(@HostParam("vaultBaseUrl") String vaultBaseUrl, - @PathParam("certificate-name") String certificateName, @QueryParam("maxresults") Integer maxresults, - @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getCertificateVersionsSync(@HostParam("vaultBaseUrl") String vaultBaseUrl, + @QueryParam("api-version") String apiVersion, @PathParam("certificate-name") String certificateName, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); @Get("/certificates/{certificate-name}/policy") @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(KeyVaultErrorException.class) - Mono> getCertificatePolicy(@HostParam("vaultBaseUrl") String vaultBaseUrl, - @PathParam("certificate-name") String certificateName, @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, Context context); + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getCertificatePolicy(@HostParam("vaultBaseUrl") String vaultBaseUrl, + @QueryParam("api-version") String apiVersion, @PathParam("certificate-name") String certificateName, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); @Get("/certificates/{certificate-name}/policy") @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(KeyVaultErrorException.class) - Response getCertificatePolicySync(@HostParam("vaultBaseUrl") String vaultBaseUrl, - @PathParam("certificate-name") String certificateName, @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, Context context); + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getCertificatePolicySync(@HostParam("vaultBaseUrl") String vaultBaseUrl, + @QueryParam("api-version") String apiVersion, @PathParam("certificate-name") String certificateName, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); @Patch("/certificates/{certificate-name}/policy") @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(KeyVaultErrorException.class) - Mono> updateCertificatePolicy(@HostParam("vaultBaseUrl") String vaultBaseUrl, - @PathParam("certificate-name") String certificateName, @QueryParam("api-version") String apiVersion, - @BodyParam("application/json") CertificatePolicy certificatePolicy, @HeaderParam("Accept") String accept, + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> updateCertificatePolicy(@HostParam("vaultBaseUrl") String vaultBaseUrl, + @QueryParam("api-version") String apiVersion, @PathParam("certificate-name") String certificateName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData certificatePolicy, RequestOptions requestOptions, Context context); @Patch("/certificates/{certificate-name}/policy") @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(KeyVaultErrorException.class) - Response updateCertificatePolicySync(@HostParam("vaultBaseUrl") String vaultBaseUrl, - @PathParam("certificate-name") String certificateName, @QueryParam("api-version") String apiVersion, - @BodyParam("application/json") CertificatePolicy certificatePolicy, @HeaderParam("Accept") String accept, + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response updateCertificatePolicySync(@HostParam("vaultBaseUrl") String vaultBaseUrl, + @QueryParam("api-version") String apiVersion, @PathParam("certificate-name") String certificateName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData certificatePolicy, RequestOptions requestOptions, Context context); @Patch("/certificates/{certificate-name}/{certificate-version}") @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(KeyVaultErrorException.class) - Mono> updateCertificate(@HostParam("vaultBaseUrl") String vaultBaseUrl, - @PathParam("certificate-name") String certificateName, - @PathParam("certificate-version") String certificateVersion, @QueryParam("api-version") String apiVersion, - @BodyParam("application/json") CertificateUpdateParameters parameters, @HeaderParam("Accept") String accept, - Context context); + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> updateCertificate(@HostParam("vaultBaseUrl") String vaultBaseUrl, + @QueryParam("api-version") String apiVersion, @PathParam("certificate-name") String certificateName, + @PathParam("certificate-version") String certificateVersion, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData parameters, RequestOptions requestOptions, Context context); @Patch("/certificates/{certificate-name}/{certificate-version}") @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(KeyVaultErrorException.class) - Response updateCertificateSync(@HostParam("vaultBaseUrl") String vaultBaseUrl, - @PathParam("certificate-name") String certificateName, - @PathParam("certificate-version") String certificateVersion, @QueryParam("api-version") String apiVersion, - @BodyParam("application/json") CertificateUpdateParameters parameters, @HeaderParam("Accept") String accept, - Context context); + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response updateCertificateSync(@HostParam("vaultBaseUrl") String vaultBaseUrl, + @QueryParam("api-version") String apiVersion, @PathParam("certificate-name") String certificateName, + @PathParam("certificate-version") String certificateVersion, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData parameters, RequestOptions requestOptions, Context context); @Get("/certificates/{certificate-name}/{certificate-version}") @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(KeyVaultErrorException.class) - Mono> getCertificate(@HostParam("vaultBaseUrl") String vaultBaseUrl, - @PathParam("certificate-name") String certificateName, - @PathParam("certificate-version") String certificateVersion, @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, Context context); + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getCertificate(@HostParam("vaultBaseUrl") String vaultBaseUrl, + @QueryParam("api-version") String apiVersion, @PathParam("certificate-name") String certificateName, + @PathParam("certificate-version") String certificateVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); @Get("/certificates/{certificate-name}/{certificate-version}") @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(KeyVaultErrorException.class) - Response getCertificateSync(@HostParam("vaultBaseUrl") String vaultBaseUrl, - @PathParam("certificate-name") String certificateName, - @PathParam("certificate-version") String certificateVersion, @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, Context context); + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getCertificateSync(@HostParam("vaultBaseUrl") String vaultBaseUrl, + @QueryParam("api-version") String apiVersion, @PathParam("certificate-name") String certificateName, + @PathParam("certificate-version") String certificateVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); @Patch("/certificates/{certificate-name}/pending") @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(KeyVaultErrorException.class) - Mono> updateCertificateOperation(@HostParam("vaultBaseUrl") String vaultBaseUrl, - @PathParam("certificate-name") String certificateName, @QueryParam("api-version") String apiVersion, - @BodyParam("application/json") CertificateOperationUpdateParameter certificateOperation, - @HeaderParam("Accept") String accept, Context context); + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> updateCertificateOperation(@HostParam("vaultBaseUrl") String vaultBaseUrl, + @QueryParam("api-version") String apiVersion, @PathParam("certificate-name") String certificateName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData certificateOperation, RequestOptions requestOptions, + Context context); @Patch("/certificates/{certificate-name}/pending") @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(KeyVaultErrorException.class) - Response updateCertificateOperationSync(@HostParam("vaultBaseUrl") String vaultBaseUrl, - @PathParam("certificate-name") String certificateName, @QueryParam("api-version") String apiVersion, - @BodyParam("application/json") CertificateOperationUpdateParameter certificateOperation, - @HeaderParam("Accept") String accept, Context context); + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response updateCertificateOperationSync(@HostParam("vaultBaseUrl") String vaultBaseUrl, + @QueryParam("api-version") String apiVersion, @PathParam("certificate-name") String certificateName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData certificateOperation, RequestOptions requestOptions, + Context context); @Get("/certificates/{certificate-name}/pending") @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(KeyVaultErrorException.class) - Mono> getCertificateOperation(@HostParam("vaultBaseUrl") String vaultBaseUrl, - @PathParam("certificate-name") String certificateName, @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, Context context); + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getCertificateOperation(@HostParam("vaultBaseUrl") String vaultBaseUrl, + @QueryParam("api-version") String apiVersion, @PathParam("certificate-name") String certificateName, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); @Get("/certificates/{certificate-name}/pending") @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(KeyVaultErrorException.class) - Response getCertificateOperationSync(@HostParam("vaultBaseUrl") String vaultBaseUrl, - @PathParam("certificate-name") String certificateName, @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, Context context); + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getCertificateOperationSync(@HostParam("vaultBaseUrl") String vaultBaseUrl, + @QueryParam("api-version") String apiVersion, @PathParam("certificate-name") String certificateName, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); @Delete("/certificates/{certificate-name}/pending") @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(KeyVaultErrorException.class) - Mono> deleteCertificateOperation(@HostParam("vaultBaseUrl") String vaultBaseUrl, - @PathParam("certificate-name") String certificateName, @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, Context context); + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> deleteCertificateOperation(@HostParam("vaultBaseUrl") String vaultBaseUrl, + @QueryParam("api-version") String apiVersion, @PathParam("certificate-name") String certificateName, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); @Delete("/certificates/{certificate-name}/pending") @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(KeyVaultErrorException.class) - Response deleteCertificateOperationSync(@HostParam("vaultBaseUrl") String vaultBaseUrl, - @PathParam("certificate-name") String certificateName, @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, Context context); + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response deleteCertificateOperationSync(@HostParam("vaultBaseUrl") String vaultBaseUrl, + @QueryParam("api-version") String apiVersion, @PathParam("certificate-name") String certificateName, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); @Post("/certificates/{certificate-name}/pending/merge") @ExpectedResponses({ 201 }) - @UnexpectedResponseExceptionType(KeyVaultErrorException.class) - Mono> mergeCertificate(@HostParam("vaultBaseUrl") String vaultBaseUrl, - @PathParam("certificate-name") String certificateName, @QueryParam("api-version") String apiVersion, - @BodyParam("application/json") CertificateMergeParameters parameters, @HeaderParam("Accept") String accept, - Context context); + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> mergeCertificate(@HostParam("vaultBaseUrl") String vaultBaseUrl, + @QueryParam("api-version") String apiVersion, @PathParam("certificate-name") String certificateName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData parameters, RequestOptions requestOptions, Context context); @Post("/certificates/{certificate-name}/pending/merge") @ExpectedResponses({ 201 }) - @UnexpectedResponseExceptionType(KeyVaultErrorException.class) - Response mergeCertificateSync(@HostParam("vaultBaseUrl") String vaultBaseUrl, - @PathParam("certificate-name") String certificateName, @QueryParam("api-version") String apiVersion, - @BodyParam("application/json") CertificateMergeParameters parameters, @HeaderParam("Accept") String accept, - Context context); + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response mergeCertificateSync(@HostParam("vaultBaseUrl") String vaultBaseUrl, + @QueryParam("api-version") String apiVersion, @PathParam("certificate-name") String certificateName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BinaryData parameters, RequestOptions requestOptions, Context context); @Post("/certificates/{certificate-name}/backup") @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(KeyVaultErrorException.class) - Mono> backupCertificate(@HostParam("vaultBaseUrl") String vaultBaseUrl, - @PathParam("certificate-name") String certificateName, @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, Context context); + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> backupCertificate(@HostParam("vaultBaseUrl") String vaultBaseUrl, + @QueryParam("api-version") String apiVersion, @PathParam("certificate-name") String certificateName, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); @Post("/certificates/{certificate-name}/backup") @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(KeyVaultErrorException.class) - Response backupCertificateSync(@HostParam("vaultBaseUrl") String vaultBaseUrl, - @PathParam("certificate-name") String certificateName, @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, Context context); + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response backupCertificateSync(@HostParam("vaultBaseUrl") String vaultBaseUrl, + @QueryParam("api-version") String apiVersion, @PathParam("certificate-name") String certificateName, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); @Post("/certificates/restore") @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(KeyVaultErrorException.class) - Mono> restoreCertificate(@HostParam("vaultBaseUrl") String vaultBaseUrl, - @QueryParam("api-version") String apiVersion, - @BodyParam("application/json") CertificateRestoreParameters parameters, - @HeaderParam("Accept") String accept, Context context); + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> restoreCertificate(@HostParam("vaultBaseUrl") String vaultBaseUrl, + @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData parameters, + RequestOptions requestOptions, Context context); @Post("/certificates/restore") @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(KeyVaultErrorException.class) - Response restoreCertificateSync(@HostParam("vaultBaseUrl") String vaultBaseUrl, - @QueryParam("api-version") String apiVersion, - @BodyParam("application/json") CertificateRestoreParameters parameters, - @HeaderParam("Accept") String accept, Context context); + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response restoreCertificateSync(@HostParam("vaultBaseUrl") String vaultBaseUrl, + @QueryParam("api-version") String apiVersion, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") BinaryData parameters, + RequestOptions requestOptions, Context context); @Get("/deletedcertificates") @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(KeyVaultErrorException.class) - Mono> getDeletedCertificates( - @HostParam("vaultBaseUrl") String vaultBaseUrl, @QueryParam("maxresults") Integer maxresults, - @QueryParam("includePending") Boolean includePending, @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, Context context); + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getDeletedCertificates(@HostParam("vaultBaseUrl") String vaultBaseUrl, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); @Get("/deletedcertificates") @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(KeyVaultErrorException.class) - Response getDeletedCertificatesSync( - @HostParam("vaultBaseUrl") String vaultBaseUrl, @QueryParam("maxresults") Integer maxresults, - @QueryParam("includePending") Boolean includePending, @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, Context context); + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getDeletedCertificatesSync(@HostParam("vaultBaseUrl") String vaultBaseUrl, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); @Get("/deletedcertificates/{certificate-name}") @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(KeyVaultErrorException.class) - Mono> getDeletedCertificate(@HostParam("vaultBaseUrl") String vaultBaseUrl, - @PathParam("certificate-name") String certificateName, @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, Context context); + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getDeletedCertificate(@HostParam("vaultBaseUrl") String vaultBaseUrl, + @QueryParam("api-version") String apiVersion, @PathParam("certificate-name") String certificateName, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); @Get("/deletedcertificates/{certificate-name}") @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(KeyVaultErrorException.class) - Response getDeletedCertificateSync(@HostParam("vaultBaseUrl") String vaultBaseUrl, - @PathParam("certificate-name") String certificateName, @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, Context context); + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getDeletedCertificateSync(@HostParam("vaultBaseUrl") String vaultBaseUrl, + @QueryParam("api-version") String apiVersion, @PathParam("certificate-name") String certificateName, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); @Delete("/deletedcertificates/{certificate-name}") @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(KeyVaultErrorException.class) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) Mono> purgeDeletedCertificate(@HostParam("vaultBaseUrl") String vaultBaseUrl, - @PathParam("certificate-name") String certificateName, @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, Context context); + @QueryParam("api-version") String apiVersion, @PathParam("certificate-name") String certificateName, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); @Delete("/deletedcertificates/{certificate-name}") @ExpectedResponses({ 204 }) - @UnexpectedResponseExceptionType(KeyVaultErrorException.class) + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) Response purgeDeletedCertificateSync(@HostParam("vaultBaseUrl") String vaultBaseUrl, - @PathParam("certificate-name") String certificateName, @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, Context context); + @QueryParam("api-version") String apiVersion, @PathParam("certificate-name") String certificateName, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); @Post("/deletedcertificates/{certificate-name}/recover") @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(KeyVaultErrorException.class) - Mono> recoverDeletedCertificate(@HostParam("vaultBaseUrl") String vaultBaseUrl, - @PathParam("certificate-name") String certificateName, @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, Context context); + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> recoverDeletedCertificate(@HostParam("vaultBaseUrl") String vaultBaseUrl, + @QueryParam("api-version") String apiVersion, @PathParam("certificate-name") String certificateName, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); @Post("/deletedcertificates/{certificate-name}/recover") @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(KeyVaultErrorException.class) - Response recoverDeletedCertificateSync(@HostParam("vaultBaseUrl") String vaultBaseUrl, - @PathParam("certificate-name") String certificateName, @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, Context context); + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response recoverDeletedCertificateSync(@HostParam("vaultBaseUrl") String vaultBaseUrl, + @QueryParam("api-version") String apiVersion, @PathParam("certificate-name") String certificateName, + @HeaderParam("Accept") String accept, RequestOptions requestOptions, Context context); @Get("{nextLink}") @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(KeyVaultErrorException.class) - Mono> getCertificatesNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("vaultBaseUrl") String vaultBaseUrl, @HeaderParam("Accept") String accept, Context context); + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getCertificatesNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("vaultBaseUrl") String vaultBaseUrl, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); @Get("{nextLink}") @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(KeyVaultErrorException.class) - Response getCertificatesNextSync( - @PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("vaultBaseUrl") String vaultBaseUrl, @HeaderParam("Accept") String accept, Context context); + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getCertificatesNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("vaultBaseUrl") String vaultBaseUrl, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); @Get("{nextLink}") @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(KeyVaultErrorException.class) - Mono> getCertificateIssuersNext( + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getCertificateIssuersNext( @PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("vaultBaseUrl") String vaultBaseUrl, @HeaderParam("Accept") String accept, Context context); + @HostParam("vaultBaseUrl") String vaultBaseUrl, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); @Get("{nextLink}") @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(KeyVaultErrorException.class) - Response getCertificateIssuersNextSync( + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getCertificateIssuersNextSync( @PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("vaultBaseUrl") String vaultBaseUrl, @HeaderParam("Accept") String accept, Context context); + @HostParam("vaultBaseUrl") String vaultBaseUrl, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); @Get("{nextLink}") @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(KeyVaultErrorException.class) - Mono> getCertificateVersionsNext( + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getCertificateVersionsNext( @PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("vaultBaseUrl") String vaultBaseUrl, @HeaderParam("Accept") String accept, Context context); + @HostParam("vaultBaseUrl") String vaultBaseUrl, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); @Get("{nextLink}") @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(KeyVaultErrorException.class) - Response getCertificateVersionsNextSync( + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getCertificateVersionsNextSync( @PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("vaultBaseUrl") String vaultBaseUrl, @HeaderParam("Accept") String accept, Context context); + @HostParam("vaultBaseUrl") String vaultBaseUrl, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); @Get("{nextLink}") @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(KeyVaultErrorException.class) - Mono> getDeletedCertificatesNext( + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Mono> getDeletedCertificatesNext( @PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("vaultBaseUrl") String vaultBaseUrl, @HeaderParam("Accept") String accept, Context context); + @HostParam("vaultBaseUrl") String vaultBaseUrl, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); @Get("{nextLink}") @ExpectedResponses({ 200 }) - @UnexpectedResponseExceptionType(KeyVaultErrorException.class) - Response getDeletedCertificatesNextSync( + @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 }) + @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 }) + @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 }) + @UnexpectedResponseExceptionType(HttpResponseException.class) + Response getDeletedCertificatesNextSync( @PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("vaultBaseUrl") String vaultBaseUrl, @HeaderParam("Accept") String accept, Context context); + @HostParam("vaultBaseUrl") String vaultBaseUrl, @HeaderParam("Accept") String accept, + RequestOptions requestOptions, Context context); } /** @@ -616,72 +817,54 @@ Response getDeletedCertificatesNextSync( * * The GetCertificates operation returns the set of certificates resources in the specified key vault. This * operation requires the certificates/list permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param maxresults Maximum number of results to return in a page. If not specified the service will return up to - * 25 results. - * @param includePending Specifies whether to include certificates which are not completely provisioned. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
maxresultsIntegerNoMaximum number of results to return in a page. If not + * specified the service will return up to 25 results.
includePendingBooleanNoSpecifies whether to include certificates which are not + * completely provisioned.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     attributes (Optional): {
+     *         enabled: Boolean (Optional)
+     *         nbf: Long (Optional)
+     *         exp: Long (Optional)
+     *         created: Long (Optional)
+     *         updated: Long (Optional)
+     *         recoverableDays: Integer (Optional)
+     *         recoveryLevel: String(Purgeable/Recoverable+Purgeable/Recoverable/Recoverable+ProtectedSubscription/CustomizedRecoverable+Purgeable/CustomizedRecoverable/CustomizedRecoverable+ProtectedSubscription) (Optional)
+     *     }
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     x5t: Base64Url (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. * @return the certificate list result along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getCertificatesSinglePageAsync(String vaultBaseUrl, Integer maxresults, - Boolean includePending) { + private Mono> getCertificatesSinglePageAsync(RequestOptions requestOptions) { final String accept = "application/json"; return FluxUtil - .withContext(context -> service.getCertificates(vaultBaseUrl, maxresults, includePending, - this.getApiVersion(), accept, context)) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().getValue(), res.getValue().getNextLink(), null)); - } - - /** - * List certificates in a specified key vault - * - * The GetCertificates operation returns the set of certificates resources in the specified key vault. This - * operation requires the certificates/list permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param maxresults Maximum number of results to return in a page. If not specified the service will return up to - * 25 results. - * @param includePending Specifies whether to include certificates which are not completely provisioned. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the certificate list result along with {@link PagedResponse} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getCertificatesSinglePageAsync(String vaultBaseUrl, Integer maxresults, - Boolean includePending, Context context) { - final String accept = "application/json"; - return service.getCertificates(vaultBaseUrl, maxresults, includePending, this.getApiVersion(), accept, context) + .withContext(context -> service.getCertificates(this.getVaultBaseUrl(), + this.getServiceVersion().getVersion(), accept, requestOptions, context)) .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().getValue(), res.getValue().getNextLink(), null)); - } - - /** - * List certificates in a specified key vault - * - * The GetCertificates operation returns the set of certificates resources in the specified key vault. This - * operation requires the certificates/list permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param maxresults Maximum number of results to return in a page. If not specified the service will return up to - * 25 results. - * @param includePending Specifies whether to include certificates which are not completely provisioned. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the certificate list result as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux getCertificatesAsync(String vaultBaseUrl, Integer maxresults, - Boolean includePending) { - return new PagedFlux<>(() -> getCertificatesSinglePageAsync(vaultBaseUrl, maxresults, includePending), - nextLink -> getCertificatesNextSinglePageAsync(nextLink, vaultBaseUrl)); + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); } /** @@ -689,47 +872,53 @@ public PagedFlux getCertificatesAsync(String vaultBaseUrl, Inte * * The GetCertificates operation returns the set of certificates resources in the specified key vault. This * operation requires the certificates/list permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param maxresults Maximum number of results to return in a page. If not specified the service will return up to - * 25 results. - * @param includePending Specifies whether to include certificates which are not completely provisioned. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
maxresultsIntegerNoMaximum number of results to return in a page. If not + * specified the service will return up to 25 results.
includePendingBooleanNoSpecifies whether to include certificates which are not + * completely provisioned.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     attributes (Optional): {
+     *         enabled: Boolean (Optional)
+     *         nbf: Long (Optional)
+     *         exp: Long (Optional)
+     *         created: Long (Optional)
+     *         updated: Long (Optional)
+     *         recoverableDays: Integer (Optional)
+     *         recoveryLevel: String(Purgeable/Recoverable+Purgeable/Recoverable/Recoverable+ProtectedSubscription/CustomizedRecoverable+Purgeable/CustomizedRecoverable/CustomizedRecoverable+ProtectedSubscription) (Optional)
+     *     }
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     x5t: Base64Url (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. * @return the certificate list result as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux getCertificatesAsync(String vaultBaseUrl, Integer maxresults, - Boolean includePending, Context context) { - return new PagedFlux<>(() -> getCertificatesSinglePageAsync(vaultBaseUrl, maxresults, includePending, context), - nextLink -> getCertificatesNextSinglePageAsync(nextLink, vaultBaseUrl, context)); - } - - /** - * List certificates in a specified key vault - * - * The GetCertificates operation returns the set of certificates resources in the specified key vault. This - * operation requires the certificates/list permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param maxresults Maximum number of results to return in a page. If not specified the service will return up to - * 25 results. - * @param includePending Specifies whether to include certificates which are not completely provisioned. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the certificate list result along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public PagedResponse getCertificatesSinglePage(String vaultBaseUrl, Integer maxresults, - Boolean includePending) { - final String accept = "application/json"; - Response res = service.getCertificatesSync(vaultBaseUrl, maxresults, includePending, - this.getApiVersion(), accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().getValue(), res.getValue().getNextLink(), null); + public PagedFlux getCertificatesAsync(RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedFlux<>(() -> getCertificatesSinglePageAsync(requestOptions), + nextLink -> getCertificatesNextSinglePageAsync(nextLink, requestOptionsForNextPage)); } /** @@ -737,48 +926,53 @@ public PagedResponse getCertificatesSinglePage(String vaultBase * * The GetCertificates operation returns the set of certificates resources in the specified key vault. This * operation requires the certificates/list permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param maxresults Maximum number of results to return in a page. If not specified the service will return up to - * 25 results. - * @param includePending Specifies whether to include certificates which are not completely provisioned. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
maxresultsIntegerNoMaximum number of results to return in a page. If not + * specified the service will return up to 25 results.
includePendingBooleanNoSpecifies whether to include certificates which are not + * completely provisioned.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     attributes (Optional): {
+     *         enabled: Boolean (Optional)
+     *         nbf: Long (Optional)
+     *         exp: Long (Optional)
+     *         created: Long (Optional)
+     *         updated: Long (Optional)
+     *         recoverableDays: Integer (Optional)
+     *         recoveryLevel: String(Purgeable/Recoverable+Purgeable/Recoverable/Recoverable+ProtectedSubscription/CustomizedRecoverable+Purgeable/CustomizedRecoverable/CustomizedRecoverable+ProtectedSubscription) (Optional)
+     *     }
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     x5t: Base64Url (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. * @return the certificate list result along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public PagedResponse getCertificatesSinglePage(String vaultBaseUrl, Integer maxresults, - Boolean includePending, Context context) { + private PagedResponse getCertificatesSinglePage(RequestOptions requestOptions) { final String accept = "application/json"; - Response res = service.getCertificatesSync(vaultBaseUrl, maxresults, includePending, - this.getApiVersion(), accept, context); + Response res = service.getCertificatesSync(this.getVaultBaseUrl(), + this.getServiceVersion().getVersion(), accept, requestOptions, Context.NONE); return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().getValue(), res.getValue().getNextLink(), null); - } - - /** - * List certificates in a specified key vault - * - * The GetCertificates operation returns the set of certificates resources in the specified key vault. This - * operation requires the certificates/list permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param maxresults Maximum number of results to return in a page. If not specified the service will return up to - * 25 results. - * @param includePending Specifies whether to include certificates which are not completely provisioned. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the certificate list result as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable getCertificates(String vaultBaseUrl, Integer maxresults, - Boolean includePending) { - return new PagedIterable<>( - () -> getCertificatesSinglePage(vaultBaseUrl, maxresults, includePending, Context.NONE), - nextLink -> getCertificatesNextSinglePage(nextLink, vaultBaseUrl)); + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); } /** @@ -786,22 +980,53 @@ public PagedIterable getCertificates(String vaultBaseUrl, Integ * * The GetCertificates operation returns the set of certificates resources in the specified key vault. This * operation requires the certificates/list permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param maxresults Maximum number of results to return in a page. If not specified the service will return up to - * 25 results. - * @param includePending Specifies whether to include certificates which are not completely provisioned. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
maxresultsIntegerNoMaximum number of results to return in a page. If not + * specified the service will return up to 25 results.
includePendingBooleanNoSpecifies whether to include certificates which are not + * completely provisioned.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     attributes (Optional): {
+     *         enabled: Boolean (Optional)
+     *         nbf: Long (Optional)
+     *         exp: Long (Optional)
+     *         created: Long (Optional)
+     *         updated: Long (Optional)
+     *         recoverableDays: Integer (Optional)
+     *         recoveryLevel: String(Purgeable/Recoverable+Purgeable/Recoverable/Recoverable+ProtectedSubscription/CustomizedRecoverable+Purgeable/CustomizedRecoverable/CustomizedRecoverable+ProtectedSubscription) (Optional)
+     *     }
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     x5t: Base64Url (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. * @return the certificate list result as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable getCertificates(String vaultBaseUrl, Integer maxresults, - Boolean includePending, Context context) { - return new PagedIterable<>(() -> getCertificatesSinglePage(vaultBaseUrl, maxresults, includePending, context), - nextLink -> getCertificatesNextSinglePage(nextLink, vaultBaseUrl, context)); + public PagedIterable getCertificates(RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedIterable<>(() -> getCertificatesSinglePage(requestOptions), + nextLink -> getCertificatesNextSinglePage(nextLink, requestOptionsForNextPage)); } /** @@ -810,20 +1035,102 @@ public PagedIterable getCertificates(String vaultBaseUrl, Integ * Deletes all versions of a certificate object along with its associated policy. Delete certificate cannot be used * to remove individual versions of a certificate object. This operation requires the certificates/delete * permission. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     kid: String (Optional)
+     *     sid: String (Optional)
+     *     x5t: Base64Url (Optional)
+     *     policy (Optional): {
+     *         id: String (Optional)
+     *         key_props (Optional): {
+     *             exportable: Boolean (Optional)
+     *             kty: String(EC/EC-HSM/RSA/RSA-HSM/oct/oct-HSM) (Optional)
+     *             key_size: Integer (Optional)
+     *             reuse_key: Boolean (Optional)
+     *             crv: String(P-256/P-384/P-521/P-256K) (Optional)
+     *         }
+     *         secret_props (Optional): {
+     *             contentType: String (Optional)
+     *         }
+     *         x509_props (Optional): {
+     *             subject: String (Optional)
+     *             ekus (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             sans (Optional): {
+     *                 emails (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 dns_names (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 upns (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *             }
+     *             key_usage (Optional): [
+     *                 String(digitalSignature/nonRepudiation/keyEncipherment/dataEncipherment/keyAgreement/keyCertSign/cRLSign/encipherOnly/decipherOnly) (Optional)
+     *             ]
+     *             validity_months: Integer (Optional)
+     *         }
+     *         lifetime_actions (Optional): [
+     *              (Optional){
+     *                 trigger (Optional): {
+     *                     lifetime_percentage: Integer (Optional)
+     *                     days_before_expiry: Integer (Optional)
+     *                 }
+     *                 action (Optional): {
+     *                     action_type: String(EmailContacts/AutoRenew) (Optional)
+     *                 }
+     *             }
+     *         ]
+     *         issuer (Optional): {
+     *             name: String (Optional)
+     *             cty: String (Optional)
+     *             cert_transparency: Boolean (Optional)
+     *         }
+     *         attributes (Optional): {
+     *             enabled: Boolean (Optional)
+     *             nbf: Long (Optional)
+     *             exp: Long (Optional)
+     *             created: Long (Optional)
+     *             updated: Long (Optional)
+     *             recoverableDays: Integer (Optional)
+     *             recoveryLevel: String(Purgeable/Recoverable+Purgeable/Recoverable/Recoverable+ProtectedSubscription/CustomizedRecoverable+Purgeable/CustomizedRecoverable/CustomizedRecoverable+ProtectedSubscription) (Optional)
+     *         }
+     *     }
+     *     cer: byte[] (Optional)
+     *     contentType: String (Optional)
+     *     attributes (Optional): (recursive schema, see attributes above)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     recoveryId: String (Optional)
+     *     scheduledPurgeDate: Long (Optional)
+     *     deletedDate: Long (Optional)
+     * }
+     * }
+     * 
* - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. * @param certificateName The name of the certificate. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. * @return a Deleted Certificate consisting of its previous id, attributes and its tags, as well as information on * when it will be purged along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> deleteCertificateWithResponseAsync(String vaultBaseUrl, - String certificateName) { - return FluxUtil - .withContext(context -> deleteCertificateWithResponseAsync(vaultBaseUrl, certificateName, context)); + public Mono> deleteCertificateWithResponseAsync(String certificateName, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.deleteCertificate(this.getVaultBaseUrl(), + this.getServiceVersion().getVersion(), certificateName, accept, requestOptions, context)); } /** @@ -832,3559 +1139,4222 @@ public Mono> deleteCertificateWithResponseAsy * Deletes all versions of a certificate object along with its associated policy. Delete certificate cannot be used * to remove individual versions of a certificate object. This operation requires the certificates/delete * permission. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     kid: String (Optional)
+     *     sid: String (Optional)
+     *     x5t: Base64Url (Optional)
+     *     policy (Optional): {
+     *         id: String (Optional)
+     *         key_props (Optional): {
+     *             exportable: Boolean (Optional)
+     *             kty: String(EC/EC-HSM/RSA/RSA-HSM/oct/oct-HSM) (Optional)
+     *             key_size: Integer (Optional)
+     *             reuse_key: Boolean (Optional)
+     *             crv: String(P-256/P-384/P-521/P-256K) (Optional)
+     *         }
+     *         secret_props (Optional): {
+     *             contentType: String (Optional)
+     *         }
+     *         x509_props (Optional): {
+     *             subject: String (Optional)
+     *             ekus (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             sans (Optional): {
+     *                 emails (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 dns_names (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 upns (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *             }
+     *             key_usage (Optional): [
+     *                 String(digitalSignature/nonRepudiation/keyEncipherment/dataEncipherment/keyAgreement/keyCertSign/cRLSign/encipherOnly/decipherOnly) (Optional)
+     *             ]
+     *             validity_months: Integer (Optional)
+     *         }
+     *         lifetime_actions (Optional): [
+     *              (Optional){
+     *                 trigger (Optional): {
+     *                     lifetime_percentage: Integer (Optional)
+     *                     days_before_expiry: Integer (Optional)
+     *                 }
+     *                 action (Optional): {
+     *                     action_type: String(EmailContacts/AutoRenew) (Optional)
+     *                 }
+     *             }
+     *         ]
+     *         issuer (Optional): {
+     *             name: String (Optional)
+     *             cty: String (Optional)
+     *             cert_transparency: Boolean (Optional)
+     *         }
+     *         attributes (Optional): {
+     *             enabled: Boolean (Optional)
+     *             nbf: Long (Optional)
+     *             exp: Long (Optional)
+     *             created: Long (Optional)
+     *             updated: Long (Optional)
+     *             recoverableDays: Integer (Optional)
+     *             recoveryLevel: String(Purgeable/Recoverable+Purgeable/Recoverable/Recoverable+ProtectedSubscription/CustomizedRecoverable+Purgeable/CustomizedRecoverable/CustomizedRecoverable+ProtectedSubscription) (Optional)
+     *         }
+     *     }
+     *     cer: byte[] (Optional)
+     *     contentType: String (Optional)
+     *     attributes (Optional): (recursive schema, see attributes above)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     recoveryId: String (Optional)
+     *     scheduledPurgeDate: Long (Optional)
+     *     deletedDate: Long (Optional)
+     * }
+     * }
+     * 
* - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. * @param certificateName The name of the certificate. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. * @return a Deleted Certificate consisting of its previous id, attributes and its tags, as well as information on - * when it will be purged along with {@link Response} on successful completion of {@link Mono}. + * when it will be purged along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> deleteCertificateWithResponseAsync(String vaultBaseUrl, - String certificateName, Context context) { + public Response deleteCertificateWithResponse(String certificateName, RequestOptions requestOptions) { final String accept = "application/json"; - return service.deleteCertificate(vaultBaseUrl, certificateName, this.getApiVersion(), accept, context); + return service.deleteCertificateSync(this.getVaultBaseUrl(), this.getServiceVersion().getVersion(), + certificateName, accept, requestOptions, Context.NONE); } /** - * Deletes a certificate from a specified key vault. + * Sets the certificate contacts for the specified key vault. * - * Deletes all versions of a certificate object along with its associated policy. Delete certificate cannot be used - * to remove individual versions of a certificate object. This operation requires the certificates/delete - * permission. + * Sets the certificate contacts for the specified key vault. This operation requires the + * certificates/managecontacts permission. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     contacts (Optional): [
+     *          (Optional){
+     *             email: String (Optional)
+     *             name: String (Optional)
+     *             phone: String (Optional)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     contacts (Optional): [
+     *          (Optional){
+     *             email: String (Optional)
+     *             name: String (Optional)
+     *             phone: String (Optional)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
* - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a Deleted Certificate consisting of its previous id, attributes and its tags, as well as information on - * when it will be purged on successful completion of {@link Mono}. + * @param contacts The contacts for the key vault certificate. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the contacts for the vault certificates along with {@link Response} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono deleteCertificateAsync(String vaultBaseUrl, String certificateName) { - return deleteCertificateWithResponseAsync(vaultBaseUrl, certificateName) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); + public Mono> setCertificateContactsWithResponseAsync(BinaryData contacts, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.setCertificateContacts(this.getVaultBaseUrl(), + this.getServiceVersion().getVersion(), contentType, accept, contacts, requestOptions, context)); } /** - * Deletes a certificate from a specified key vault. + * Sets the certificate contacts for the specified key vault. * - * Deletes all versions of a certificate object along with its associated policy. Delete certificate cannot be used - * to remove individual versions of a certificate object. This operation requires the certificates/delete - * permission. + * Sets the certificate contacts for the specified key vault. This operation requires the + * certificates/managecontacts permission. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     contacts (Optional): [
+     *          (Optional){
+     *             email: String (Optional)
+     *             name: String (Optional)
+     *             phone: String (Optional)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     contacts (Optional): [
+     *          (Optional){
+     *             email: String (Optional)
+     *             name: String (Optional)
+     *             phone: String (Optional)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
* - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a Deleted Certificate consisting of its previous id, attributes and its tags, as well as information on - * when it will be purged on successful completion of {@link Mono}. + * @param contacts The contacts for the key vault certificate. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the contacts for the vault certificates along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono deleteCertificateAsync(String vaultBaseUrl, String certificateName, - Context context) { - return deleteCertificateWithResponseAsync(vaultBaseUrl, certificateName, context) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); + public Response setCertificateContactsWithResponse(BinaryData contacts, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.setCertificateContactsSync(this.getVaultBaseUrl(), this.getServiceVersion().getVersion(), + contentType, accept, contacts, requestOptions, Context.NONE); } /** - * Deletes a certificate from a specified key vault. - * - * Deletes all versions of a certificate object along with its associated policy. Delete certificate cannot be used - * to remove individual versions of a certificate object. This operation requires the certificates/delete - * permission. + * Lists the certificate contacts for a specified key vault. * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a Deleted Certificate consisting of its previous id, attributes and its tags, as well as information on - * when it will be purged along with {@link Response}. + * The GetCertificateContacts operation returns the set of certificate contact resources in the specified key vault. + * This operation requires the certificates/managecontacts permission. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     contacts (Optional): [
+     *          (Optional){
+     *             email: String (Optional)
+     *             name: String (Optional)
+     *             phone: String (Optional)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the contacts for the vault certificates along with {@link Response} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response deleteCertificateWithResponse(String vaultBaseUrl, String certificateName, - Context context) { + public Mono> getCertificateContactsWithResponseAsync(RequestOptions requestOptions) { final String accept = "application/json"; - return service.deleteCertificateSync(vaultBaseUrl, certificateName, this.getApiVersion(), accept, context); + return FluxUtil.withContext(context -> service.getCertificateContacts(this.getVaultBaseUrl(), + this.getServiceVersion().getVersion(), accept, requestOptions, context)); } /** - * Deletes a certificate from a specified key vault. - * - * Deletes all versions of a certificate object along with its associated policy. Delete certificate cannot be used - * to remove individual versions of a certificate object. This operation requires the certificates/delete - * permission. + * Lists the certificate contacts for a specified key vault. * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a Deleted Certificate consisting of its previous id, attributes and its tags, as well as information on - * when it will be purged. + * The GetCertificateContacts operation returns the set of certificate contact resources in the specified key vault. + * This operation requires the certificates/managecontacts permission. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     contacts (Optional): [
+     *          (Optional){
+     *             email: String (Optional)
+     *             name: String (Optional)
+     *             phone: String (Optional)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the contacts for the vault certificates along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public DeletedCertificateBundle deleteCertificate(String vaultBaseUrl, String certificateName) { - return deleteCertificateWithResponse(vaultBaseUrl, certificateName, Context.NONE).getValue(); + public Response getCertificateContactsWithResponse(RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getCertificateContactsSync(this.getVaultBaseUrl(), this.getServiceVersion().getVersion(), accept, + requestOptions, Context.NONE); } /** - * Sets the certificate contacts for the specified key vault. + * Deletes the certificate contacts for a specified key vault. * - * Sets the certificate contacts for the specified key vault. This operation requires the + * Deletes the certificate contacts for a specified key vault certificate. This operation requires the * certificates/managecontacts permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param contacts The contacts for the key vault certificate. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     contacts (Optional): [
+     *          (Optional){
+     *             email: String (Optional)
+     *             name: String (Optional)
+     *             phone: String (Optional)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. * @return the contacts for the vault certificates along with {@link Response} on successful completion of * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> setCertificateContactsWithResponseAsync(String vaultBaseUrl, Contacts contacts) { - return FluxUtil - .withContext(context -> setCertificateContactsWithResponseAsync(vaultBaseUrl, contacts, context)); + public Mono> deleteCertificateContactsWithResponseAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.deleteCertificateContacts(this.getVaultBaseUrl(), + this.getServiceVersion().getVersion(), accept, requestOptions, context)); } /** - * Sets the certificate contacts for the specified key vault. + * Deletes the certificate contacts for a specified key vault. * - * Sets the certificate contacts for the specified key vault. This operation requires the + * Deletes the certificate contacts for a specified key vault certificate. This operation requires the * certificates/managecontacts permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param contacts The contacts for the key vault certificate. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the contacts for the vault certificates along with {@link Response} on successful completion of - * {@link Mono}. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     contacts (Optional): [
+     *          (Optional){
+     *             email: String (Optional)
+     *             name: String (Optional)
+     *             phone: String (Optional)
+     *         }
+     *     ]
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the contacts for the vault certificates along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> setCertificateContactsWithResponseAsync(String vaultBaseUrl, Contacts contacts, - Context context) { + public Response deleteCertificateContactsWithResponse(RequestOptions requestOptions) { final String accept = "application/json"; - return service.setCertificateContacts(vaultBaseUrl, this.getApiVersion(), contacts, accept, context); + return service.deleteCertificateContactsSync(this.getVaultBaseUrl(), this.getServiceVersion().getVersion(), + accept, requestOptions, Context.NONE); } /** - * Sets the certificate contacts for the specified key vault. - * - * Sets the certificate contacts for the specified key vault. This operation requires the - * certificates/managecontacts permission. + * List certificate issuers for a specified key vault. * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param contacts The contacts for the key vault certificate. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the contacts for the vault certificates on successful completion of {@link Mono}. + * The GetCertificateIssuers operation returns the set of certificate issuer resources in the specified key vault. + * This operation requires the certificates/manageissuers/getissuers permission. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
maxresultsIntegerNoMaximum number of results to return in a page. If not + * specified the service will return up to 25 results.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     provider: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the certificate issuer list result along with {@link PagedResponse} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono setCertificateContactsAsync(String vaultBaseUrl, Contacts contacts) { - return setCertificateContactsWithResponseAsync(vaultBaseUrl, contacts) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); + private Mono> getCertificateIssuersSinglePageAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getCertificateIssuers(this.getVaultBaseUrl(), + this.getServiceVersion().getVersion(), accept, requestOptions, context)) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); } /** - * Sets the certificate contacts for the specified key vault. - * - * Sets the certificate contacts for the specified key vault. This operation requires the - * certificates/managecontacts permission. + * List certificate issuers for a specified key vault. * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param contacts The contacts for the key vault certificate. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the contacts for the vault certificates on successful completion of {@link Mono}. + * The GetCertificateIssuers operation returns the set of certificate issuer resources in the specified key vault. + * This operation requires the certificates/manageissuers/getissuers permission. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
maxresultsIntegerNoMaximum number of results to return in a page. If not + * specified the service will return up to 25 results.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     provider: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the certificate issuer list result as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono setCertificateContactsAsync(String vaultBaseUrl, Contacts contacts, Context context) { - return setCertificateContactsWithResponseAsync(vaultBaseUrl, contacts, context) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux getCertificateIssuersAsync(RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedFlux<>(() -> getCertificateIssuersSinglePageAsync(requestOptions), + nextLink -> getCertificateIssuersNextSinglePageAsync(nextLink, requestOptionsForNextPage)); } /** - * Sets the certificate contacts for the specified key vault. - * - * Sets the certificate contacts for the specified key vault. This operation requires the - * certificates/managecontacts permission. + * List certificate issuers for a specified key vault. * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param contacts The contacts for the key vault certificate. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the contacts for the vault certificates along with {@link Response}. + * The GetCertificateIssuers operation returns the set of certificate issuer resources in the specified key vault. + * This operation requires the certificates/manageissuers/getissuers permission. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
maxresultsIntegerNoMaximum number of results to return in a page. If not + * specified the service will return up to 25 results.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     provider: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the certificate issuer list result along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response setCertificateContactsWithResponse(String vaultBaseUrl, Contacts contacts, - Context context) { + private PagedResponse getCertificateIssuersSinglePage(RequestOptions requestOptions) { final String accept = "application/json"; - return service.setCertificateContactsSync(vaultBaseUrl, this.getApiVersion(), contacts, accept, context); + Response res = service.getCertificateIssuersSync(this.getVaultBaseUrl(), + this.getServiceVersion().getVersion(), accept, requestOptions, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); } /** - * Sets the certificate contacts for the specified key vault. - * - * Sets the certificate contacts for the specified key vault. This operation requires the - * certificates/managecontacts permission. + * List certificate issuers for a specified key vault. * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param contacts The contacts for the key vault certificate. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the contacts for the vault certificates. + * The GetCertificateIssuers operation returns the set of certificate issuer resources in the specified key vault. + * This operation requires the certificates/manageissuers/getissuers permission. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
maxresultsIntegerNoMaximum number of results to return in a page. If not + * specified the service will return up to 25 results.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     provider: String (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the certificate issuer list result as paginated response with {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Contacts setCertificateContacts(String vaultBaseUrl, Contacts contacts) { - return setCertificateContactsWithResponse(vaultBaseUrl, contacts, Context.NONE).getValue(); + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getCertificateIssuers(RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedIterable<>(() -> getCertificateIssuersSinglePage(requestOptions), + nextLink -> getCertificateIssuersNextSinglePage(nextLink, requestOptionsForNextPage)); } /** - * Lists the certificate contacts for a specified key vault. + * Sets the specified certificate issuer. * - * The GetCertificateContacts operation returns the set of certificate contact resources in the specified key vault. - * This operation requires the certificates/managecontacts permission. + * The SetCertificateIssuer operation adds or updates the specified certificate issuer. This operation requires the + * certificates/setissuers permission. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     provider: String (Required)
+     *     credentials (Optional): {
+     *         account_id: String (Optional)
+     *         pwd: String (Optional)
+     *     }
+     *     org_details (Optional): {
+     *         id: String (Optional)
+     *         admin_details (Optional): [
+     *              (Optional){
+     *                 first_name: String (Optional)
+     *                 last_name: String (Optional)
+     *                 email: String (Optional)
+     *                 phone: String (Optional)
+     *             }
+     *         ]
+     *     }
+     *     attributes (Optional): {
+     *         enabled: Boolean (Optional)
+     *         created: Long (Optional)
+     *         updated: Long (Optional)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     provider: String (Optional)
+     *     credentials (Optional): {
+     *         account_id: String (Optional)
+     *         pwd: String (Optional)
+     *     }
+     *     org_details (Optional): {
+     *         id: String (Optional)
+     *         admin_details (Optional): [
+     *              (Optional){
+     *                 first_name: String (Optional)
+     *                 last_name: String (Optional)
+     *                 email: String (Optional)
+     *                 phone: String (Optional)
+     *             }
+     *         ]
+     *     }
+     *     attributes (Optional): {
+     *         enabled: Boolean (Optional)
+     *         created: Long (Optional)
+     *         updated: Long (Optional)
+     *     }
+     * }
+     * }
+     * 
* - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the contacts for the vault certificates along with {@link Response} on successful completion of + * @param issuerName The name of the issuer. The value you provide may be copied globally for the purpose of running + * the service. The value provided should not include personally identifiable or sensitive information. + * @param parameter Certificate issuer set parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the issuer for Key Vault certificate along with {@link Response} on successful completion of * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getCertificateContactsWithResponseAsync(String vaultBaseUrl) { - return FluxUtil.withContext(context -> getCertificateContactsWithResponseAsync(vaultBaseUrl, context)); + public Mono> setCertificateIssuerWithResponseAsync(String issuerName, BinaryData parameter, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.setCertificateIssuer(this.getVaultBaseUrl(), this.getServiceVersion().getVersion(), + issuerName, contentType, accept, parameter, requestOptions, context)); } /** - * Lists the certificate contacts for a specified key vault. + * Sets the specified certificate issuer. * - * The GetCertificateContacts operation returns the set of certificate contact resources in the specified key vault. - * This operation requires the certificates/managecontacts permission. + * The SetCertificateIssuer operation adds or updates the specified certificate issuer. This operation requires the + * certificates/setissuers permission. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     provider: String (Required)
+     *     credentials (Optional): {
+     *         account_id: String (Optional)
+     *         pwd: String (Optional)
+     *     }
+     *     org_details (Optional): {
+     *         id: String (Optional)
+     *         admin_details (Optional): [
+     *              (Optional){
+     *                 first_name: String (Optional)
+     *                 last_name: String (Optional)
+     *                 email: String (Optional)
+     *                 phone: String (Optional)
+     *             }
+     *         ]
+     *     }
+     *     attributes (Optional): {
+     *         enabled: Boolean (Optional)
+     *         created: Long (Optional)
+     *         updated: Long (Optional)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     provider: String (Optional)
+     *     credentials (Optional): {
+     *         account_id: String (Optional)
+     *         pwd: String (Optional)
+     *     }
+     *     org_details (Optional): {
+     *         id: String (Optional)
+     *         admin_details (Optional): [
+     *              (Optional){
+     *                 first_name: String (Optional)
+     *                 last_name: String (Optional)
+     *                 email: String (Optional)
+     *                 phone: String (Optional)
+     *             }
+     *         ]
+     *     }
+     *     attributes (Optional): {
+     *         enabled: Boolean (Optional)
+     *         created: Long (Optional)
+     *         updated: Long (Optional)
+     *     }
+     * }
+     * }
+     * 
* - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the contacts for the vault certificates along with {@link Response} on successful completion of - * {@link Mono}. + * @param issuerName The name of the issuer. The value you provide may be copied globally for the purpose of running + * the service. The value provided should not include personally identifiable or sensitive information. + * @param parameter Certificate issuer set parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the issuer for Key Vault certificate along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getCertificateContactsWithResponseAsync(String vaultBaseUrl, Context context) { + public Response setCertificateIssuerWithResponse(String issuerName, BinaryData parameter, + RequestOptions requestOptions) { + final String contentType = "application/json"; final String accept = "application/json"; - return service.getCertificateContacts(vaultBaseUrl, this.getApiVersion(), accept, context); + return service.setCertificateIssuerSync(this.getVaultBaseUrl(), this.getServiceVersion().getVersion(), + issuerName, contentType, accept, parameter, requestOptions, Context.NONE); } /** - * Lists the certificate contacts for a specified key vault. + * Updates the specified certificate issuer. * - * The GetCertificateContacts operation returns the set of certificate contact resources in the specified key vault. - * This operation requires the certificates/managecontacts permission. + * The UpdateCertificateIssuer operation performs an update on the specified certificate issuer entity. This + * operation requires the certificates/setissuers permission. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     provider: String (Optional)
+     *     credentials (Optional): {
+     *         account_id: String (Optional)
+     *         pwd: String (Optional)
+     *     }
+     *     org_details (Optional): {
+     *         id: String (Optional)
+     *         admin_details (Optional): [
+     *              (Optional){
+     *                 first_name: String (Optional)
+     *                 last_name: String (Optional)
+     *                 email: String (Optional)
+     *                 phone: String (Optional)
+     *             }
+     *         ]
+     *     }
+     *     attributes (Optional): {
+     *         enabled: Boolean (Optional)
+     *         created: Long (Optional)
+     *         updated: Long (Optional)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     provider: String (Optional)
+     *     credentials (Optional): {
+     *         account_id: String (Optional)
+     *         pwd: String (Optional)
+     *     }
+     *     org_details (Optional): {
+     *         id: String (Optional)
+     *         admin_details (Optional): [
+     *              (Optional){
+     *                 first_name: String (Optional)
+     *                 last_name: String (Optional)
+     *                 email: String (Optional)
+     *                 phone: String (Optional)
+     *             }
+     *         ]
+     *     }
+     *     attributes (Optional): {
+     *         enabled: Boolean (Optional)
+     *         created: Long (Optional)
+     *         updated: Long (Optional)
+     *     }
+     * }
+     * }
+     * 
* - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the contacts for the vault certificates on successful completion of {@link Mono}. + * @param issuerName The name of the issuer. + * @param parameter Certificate issuer update parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the issuer for Key Vault certificate along with {@link Response} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getCertificateContactsAsync(String vaultBaseUrl) { - return getCertificateContactsWithResponseAsync(vaultBaseUrl).flatMap(res -> Mono.justOrEmpty(res.getValue())); + public Mono> updateCertificateIssuerWithResponseAsync(String issuerName, BinaryData parameter, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.updateCertificateIssuer(this.getVaultBaseUrl(), this.getServiceVersion().getVersion(), + issuerName, contentType, accept, parameter, requestOptions, context)); } /** - * Lists the certificate contacts for a specified key vault. + * Updates the specified certificate issuer. * - * The GetCertificateContacts operation returns the set of certificate contact resources in the specified key vault. - * This operation requires the certificates/managecontacts permission. + * The UpdateCertificateIssuer operation performs an update on the specified certificate issuer entity. This + * operation requires the certificates/setissuers permission. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     provider: String (Optional)
+     *     credentials (Optional): {
+     *         account_id: String (Optional)
+     *         pwd: String (Optional)
+     *     }
+     *     org_details (Optional): {
+     *         id: String (Optional)
+     *         admin_details (Optional): [
+     *              (Optional){
+     *                 first_name: String (Optional)
+     *                 last_name: String (Optional)
+     *                 email: String (Optional)
+     *                 phone: String (Optional)
+     *             }
+     *         ]
+     *     }
+     *     attributes (Optional): {
+     *         enabled: Boolean (Optional)
+     *         created: Long (Optional)
+     *         updated: Long (Optional)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     provider: String (Optional)
+     *     credentials (Optional): {
+     *         account_id: String (Optional)
+     *         pwd: String (Optional)
+     *     }
+     *     org_details (Optional): {
+     *         id: String (Optional)
+     *         admin_details (Optional): [
+     *              (Optional){
+     *                 first_name: String (Optional)
+     *                 last_name: String (Optional)
+     *                 email: String (Optional)
+     *                 phone: String (Optional)
+     *             }
+     *         ]
+     *     }
+     *     attributes (Optional): {
+     *         enabled: Boolean (Optional)
+     *         created: Long (Optional)
+     *         updated: Long (Optional)
+     *     }
+     * }
+     * }
+     * 
* - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the contacts for the vault certificates on successful completion of {@link Mono}. + * @param issuerName The name of the issuer. + * @param parameter Certificate issuer update parameter. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the issuer for Key Vault certificate along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getCertificateContactsAsync(String vaultBaseUrl, Context context) { - return getCertificateContactsWithResponseAsync(vaultBaseUrl, context) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); + public Response updateCertificateIssuerWithResponse(String issuerName, BinaryData parameter, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateCertificateIssuerSync(this.getVaultBaseUrl(), this.getServiceVersion().getVersion(), + issuerName, contentType, accept, parameter, requestOptions, Context.NONE); } /** - * Lists the certificate contacts for a specified key vault. + * Lists the specified certificate issuer. * - * The GetCertificateContacts operation returns the set of certificate contact resources in the specified key vault. - * This operation requires the certificates/managecontacts permission. + * The GetCertificateIssuer operation returns the specified certificate issuer resources in the specified key vault. + * This operation requires the certificates/manageissuers/getissuers permission. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     provider: String (Optional)
+     *     credentials (Optional): {
+     *         account_id: String (Optional)
+     *         pwd: String (Optional)
+     *     }
+     *     org_details (Optional): {
+     *         id: String (Optional)
+     *         admin_details (Optional): [
+     *              (Optional){
+     *                 first_name: String (Optional)
+     *                 last_name: String (Optional)
+     *                 email: String (Optional)
+     *                 phone: String (Optional)
+     *             }
+     *         ]
+     *     }
+     *     attributes (Optional): {
+     *         enabled: Boolean (Optional)
+     *         created: Long (Optional)
+     *         updated: Long (Optional)
+     *     }
+     * }
+     * }
+     * 
* - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the contacts for the vault certificates along with {@link Response}. + * @param issuerName The name of the issuer. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the issuer for Key Vault certificate along with {@link Response} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response getCertificateContactsWithResponse(String vaultBaseUrl, Context context) { + public Mono> getCertificateIssuerWithResponseAsync(String issuerName, + RequestOptions requestOptions) { final String accept = "application/json"; - return service.getCertificateContactsSync(vaultBaseUrl, this.getApiVersion(), accept, context); + return FluxUtil.withContext(context -> service.getCertificateIssuer(this.getVaultBaseUrl(), + this.getServiceVersion().getVersion(), issuerName, accept, requestOptions, context)); } /** - * Lists the certificate contacts for a specified key vault. + * Lists the specified certificate issuer. * - * The GetCertificateContacts operation returns the set of certificate contact resources in the specified key vault. - * This operation requires the certificates/managecontacts permission. + * The GetCertificateIssuer operation returns the specified certificate issuer resources in the specified key vault. + * This operation requires the certificates/manageissuers/getissuers permission. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     provider: String (Optional)
+     *     credentials (Optional): {
+     *         account_id: String (Optional)
+     *         pwd: String (Optional)
+     *     }
+     *     org_details (Optional): {
+     *         id: String (Optional)
+     *         admin_details (Optional): [
+     *              (Optional){
+     *                 first_name: String (Optional)
+     *                 last_name: String (Optional)
+     *                 email: String (Optional)
+     *                 phone: String (Optional)
+     *             }
+     *         ]
+     *     }
+     *     attributes (Optional): {
+     *         enabled: Boolean (Optional)
+     *         created: Long (Optional)
+     *         updated: Long (Optional)
+     *     }
+     * }
+     * }
+     * 
* - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the contacts for the vault certificates. + * @param issuerName The name of the issuer. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the issuer for Key Vault certificate along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Contacts getCertificateContacts(String vaultBaseUrl) { - return getCertificateContactsWithResponse(vaultBaseUrl, Context.NONE).getValue(); + public Response getCertificateIssuerWithResponse(String issuerName, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getCertificateIssuerSync(this.getVaultBaseUrl(), this.getServiceVersion().getVersion(), + issuerName, accept, requestOptions, Context.NONE); } /** - * Deletes the certificate contacts for a specified key vault. - * - * Deletes the certificate contacts for a specified key vault certificate. This operation requires the - * certificates/managecontacts permission. + * Deletes the specified certificate issuer. * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the contacts for the vault certificates along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> deleteCertificateContactsWithResponseAsync(String vaultBaseUrl) { - return FluxUtil.withContext(context -> deleteCertificateContactsWithResponseAsync(vaultBaseUrl, context)); - } - - /** - * Deletes the certificate contacts for a specified key vault. - * - * Deletes the certificate contacts for a specified key vault certificate. This operation requires the - * certificates/managecontacts permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the contacts for the vault certificates along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> deleteCertificateContactsWithResponseAsync(String vaultBaseUrl, Context context) { - final String accept = "application/json"; - return service.deleteCertificateContacts(vaultBaseUrl, this.getApiVersion(), accept, context); - } - - /** - * Deletes the certificate contacts for a specified key vault. - * - * Deletes the certificate contacts for a specified key vault certificate. This operation requires the - * certificates/managecontacts permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the contacts for the vault certificates on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono deleteCertificateContactsAsync(String vaultBaseUrl) { - return deleteCertificateContactsWithResponseAsync(vaultBaseUrl) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Deletes the certificate contacts for a specified key vault. - * - * Deletes the certificate contacts for a specified key vault certificate. This operation requires the - * certificates/managecontacts permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the contacts for the vault certificates on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono deleteCertificateContactsAsync(String vaultBaseUrl, Context context) { - return deleteCertificateContactsWithResponseAsync(vaultBaseUrl, context) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Deletes the certificate contacts for a specified key vault. - * - * Deletes the certificate contacts for a specified key vault certificate. This operation requires the - * certificates/managecontacts permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the contacts for the vault certificates along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response deleteCertificateContactsWithResponse(String vaultBaseUrl, Context context) { - final String accept = "application/json"; - return service.deleteCertificateContactsSync(vaultBaseUrl, this.getApiVersion(), accept, context); - } - - /** - * Deletes the certificate contacts for a specified key vault. - * - * Deletes the certificate contacts for a specified key vault certificate. This operation requires the - * certificates/managecontacts permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the contacts for the vault certificates. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Contacts deleteCertificateContacts(String vaultBaseUrl) { - return deleteCertificateContactsWithResponse(vaultBaseUrl, Context.NONE).getValue(); - } - - /** - * List certificate issuers for a specified key vault. - * - * The GetCertificateIssuers operation returns the set of certificate issuer resources in the specified key vault. - * This operation requires the certificates/manageissuers/getissuers permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param maxresults Maximum number of results to return in a page. If not specified the service will return up to - * 25 results. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the certificate issuer list result along with {@link PagedResponse} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getCertificateIssuersSinglePageAsync(String vaultBaseUrl, - Integer maxresults) { - final String accept = "application/json"; - return FluxUtil.withContext( - context -> service.getCertificateIssuers(vaultBaseUrl, maxresults, this.getApiVersion(), accept, context)) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().getValue(), res.getValue().getNextLink(), null)); - } - - /** - * List certificate issuers for a specified key vault. - * - * The GetCertificateIssuers operation returns the set of certificate issuer resources in the specified key vault. - * This operation requires the certificates/manageissuers/getissuers permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param maxresults Maximum number of results to return in a page. If not specified the service will return up to - * 25 results. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the certificate issuer list result along with {@link PagedResponse} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getCertificateIssuersSinglePageAsync(String vaultBaseUrl, - Integer maxresults, Context context) { - final String accept = "application/json"; - return service.getCertificateIssuers(vaultBaseUrl, maxresults, this.getApiVersion(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().getValue(), res.getValue().getNextLink(), null)); - } - - /** - * List certificate issuers for a specified key vault. - * - * The GetCertificateIssuers operation returns the set of certificate issuer resources in the specified key vault. - * This operation requires the certificates/manageissuers/getissuers permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param maxresults Maximum number of results to return in a page. If not specified the service will return up to - * 25 results. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the certificate issuer list result as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux getCertificateIssuersAsync(String vaultBaseUrl, Integer maxresults) { - return new PagedFlux<>(() -> getCertificateIssuersSinglePageAsync(vaultBaseUrl, maxresults), - nextLink -> getCertificateIssuersNextSinglePageAsync(nextLink, vaultBaseUrl)); - } - - /** - * List certificate issuers for a specified key vault. - * - * The GetCertificateIssuers operation returns the set of certificate issuer resources in the specified key vault. - * This operation requires the certificates/manageissuers/getissuers permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param maxresults Maximum number of results to return in a page. If not specified the service will return up to - * 25 results. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the certificate issuer list result as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux getCertificateIssuersAsync(String vaultBaseUrl, Integer maxresults, - Context context) { - return new PagedFlux<>(() -> getCertificateIssuersSinglePageAsync(vaultBaseUrl, maxresults, context), - nextLink -> getCertificateIssuersNextSinglePageAsync(nextLink, vaultBaseUrl, context)); - } - - /** - * List certificate issuers for a specified key vault. - * - * The GetCertificateIssuers operation returns the set of certificate issuer resources in the specified key vault. - * This operation requires the certificates/manageissuers/getissuers permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param maxresults Maximum number of results to return in a page. If not specified the service will return up to - * 25 results. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the certificate issuer list result along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public PagedResponse getCertificateIssuersSinglePage(String vaultBaseUrl, - Integer maxresults) { - final String accept = "application/json"; - Response res - = service.getCertificateIssuersSync(vaultBaseUrl, maxresults, this.getApiVersion(), accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().getValue(), res.getValue().getNextLink(), null); - } - - /** - * List certificate issuers for a specified key vault. - * - * The GetCertificateIssuers operation returns the set of certificate issuer resources in the specified key vault. - * This operation requires the certificates/manageissuers/getissuers permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param maxresults Maximum number of results to return in a page. If not specified the service will return up to - * 25 results. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the certificate issuer list result along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public PagedResponse getCertificateIssuersSinglePage(String vaultBaseUrl, Integer maxresults, - Context context) { - final String accept = "application/json"; - Response res - = service.getCertificateIssuersSync(vaultBaseUrl, maxresults, this.getApiVersion(), accept, context); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().getValue(), res.getValue().getNextLink(), null); - } - - /** - * List certificate issuers for a specified key vault. - * - * The GetCertificateIssuers operation returns the set of certificate issuer resources in the specified key vault. - * This operation requires the certificates/manageissuers/getissuers permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param maxresults Maximum number of results to return in a page. If not specified the service will return up to - * 25 results. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the certificate issuer list result as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable getCertificateIssuers(String vaultBaseUrl, Integer maxresults) { - return new PagedIterable<>(() -> getCertificateIssuersSinglePage(vaultBaseUrl, maxresults, Context.NONE), - nextLink -> getCertificateIssuersNextSinglePage(nextLink, vaultBaseUrl)); - } - - /** - * List certificate issuers for a specified key vault. - * - * The GetCertificateIssuers operation returns the set of certificate issuer resources in the specified key vault. - * This operation requires the certificates/manageissuers/getissuers permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param maxresults Maximum number of results to return in a page. If not specified the service will return up to - * 25 results. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the certificate issuer list result as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable getCertificateIssuers(String vaultBaseUrl, Integer maxresults, - Context context) { - return new PagedIterable<>(() -> getCertificateIssuersSinglePage(vaultBaseUrl, maxresults, context), - nextLink -> getCertificateIssuersNextSinglePage(nextLink, vaultBaseUrl, context)); - } - - /** - * Sets the specified certificate issuer. - * - * The SetCertificateIssuer operation adds or updates the specified certificate issuer. This operation requires the - * certificates/setissuers permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param issuerName The name of the issuer. The value you provide may be copied globally for the purpose of running - * the service. The value provided should not include personally identifiable or sensitive information. - * @param provider The issuer provider. - * @param credentials The credentials to be used for the issuer. - * @param organizationDetails Details of the organization as provided to the issuer. - * @param attributes Attributes of the issuer object. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the issuer for Key Vault certificate along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> setCertificateIssuerWithResponseAsync(String vaultBaseUrl, String issuerName, - String provider, IssuerCredentials credentials, OrganizationDetails organizationDetails, - IssuerAttributes attributes) { - return FluxUtil.withContext(context -> setCertificateIssuerWithResponseAsync(vaultBaseUrl, issuerName, provider, - credentials, organizationDetails, attributes, context)); - } - - /** - * Sets the specified certificate issuer. - * - * The SetCertificateIssuer operation adds or updates the specified certificate issuer. This operation requires the - * certificates/setissuers permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param issuerName The name of the issuer. The value you provide may be copied globally for the purpose of running - * the service. The value provided should not include personally identifiable or sensitive information. - * @param provider The issuer provider. - * @param credentials The credentials to be used for the issuer. - * @param organizationDetails Details of the organization as provided to the issuer. - * @param attributes Attributes of the issuer object. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the issuer for Key Vault certificate along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> setCertificateIssuerWithResponseAsync(String vaultBaseUrl, String issuerName, - String provider, IssuerCredentials credentials, OrganizationDetails organizationDetails, - IssuerAttributes attributes, Context context) { - final String accept = "application/json"; - CertificateIssuerSetParameters parameter = new CertificateIssuerSetParameters(); - parameter.setProvider(provider); - parameter.setCredentials(credentials); - parameter.setOrganizationDetails(organizationDetails); - parameter.setAttributes(attributes); - return service.setCertificateIssuer(vaultBaseUrl, issuerName, this.getApiVersion(), parameter, accept, context); - } - - /** - * Sets the specified certificate issuer. - * - * The SetCertificateIssuer operation adds or updates the specified certificate issuer. This operation requires the - * certificates/setissuers permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param issuerName The name of the issuer. The value you provide may be copied globally for the purpose of running - * the service. The value provided should not include personally identifiable or sensitive information. - * @param provider The issuer provider. - * @param credentials The credentials to be used for the issuer. - * @param organizationDetails Details of the organization as provided to the issuer. - * @param attributes Attributes of the issuer object. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the issuer for Key Vault certificate on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono setCertificateIssuerAsync(String vaultBaseUrl, String issuerName, String provider, - IssuerCredentials credentials, OrganizationDetails organizationDetails, IssuerAttributes attributes) { - return setCertificateIssuerWithResponseAsync(vaultBaseUrl, issuerName, provider, credentials, - organizationDetails, attributes).flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Sets the specified certificate issuer. - * - * The SetCertificateIssuer operation adds or updates the specified certificate issuer. This operation requires the - * certificates/setissuers permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param issuerName The name of the issuer. The value you provide may be copied globally for the purpose of running - * the service. The value provided should not include personally identifiable or sensitive information. - * @param provider The issuer provider. - * @param credentials The credentials to be used for the issuer. - * @param organizationDetails Details of the organization as provided to the issuer. - * @param attributes Attributes of the issuer object. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the issuer for Key Vault certificate on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono setCertificateIssuerAsync(String vaultBaseUrl, String issuerName, String provider, - IssuerCredentials credentials, OrganizationDetails organizationDetails, IssuerAttributes attributes, - Context context) { - return setCertificateIssuerWithResponseAsync(vaultBaseUrl, issuerName, provider, credentials, - organizationDetails, attributes, context).flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Sets the specified certificate issuer. - * - * The SetCertificateIssuer operation adds or updates the specified certificate issuer. This operation requires the - * certificates/setissuers permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param issuerName The name of the issuer. The value you provide may be copied globally for the purpose of running - * the service. The value provided should not include personally identifiable or sensitive information. - * @param provider The issuer provider. - * @param credentials The credentials to be used for the issuer. - * @param organizationDetails Details of the organization as provided to the issuer. - * @param attributes Attributes of the issuer object. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the issuer for Key Vault certificate along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response setCertificateIssuerWithResponse(String vaultBaseUrl, String issuerName, - String provider, IssuerCredentials credentials, OrganizationDetails organizationDetails, - IssuerAttributes attributes, Context context) { - final String accept = "application/json"; - CertificateIssuerSetParameters parameter = new CertificateIssuerSetParameters(); - parameter.setProvider(provider); - parameter.setCredentials(credentials); - parameter.setOrganizationDetails(organizationDetails); - parameter.setAttributes(attributes); - return service.setCertificateIssuerSync(vaultBaseUrl, issuerName, this.getApiVersion(), parameter, accept, - context); - } - - /** - * Sets the specified certificate issuer. - * - * The SetCertificateIssuer operation adds or updates the specified certificate issuer. This operation requires the - * certificates/setissuers permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param issuerName The name of the issuer. The value you provide may be copied globally for the purpose of running - * the service. The value provided should not include personally identifiable or sensitive information. - * @param provider The issuer provider. - * @param credentials The credentials to be used for the issuer. - * @param organizationDetails Details of the organization as provided to the issuer. - * @param attributes Attributes of the issuer object. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the issuer for Key Vault certificate. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public IssuerBundle setCertificateIssuer(String vaultBaseUrl, String issuerName, String provider, - IssuerCredentials credentials, OrganizationDetails organizationDetails, IssuerAttributes attributes) { - return setCertificateIssuerWithResponse(vaultBaseUrl, issuerName, provider, credentials, organizationDetails, - attributes, Context.NONE).getValue(); - } - - /** - * Updates the specified certificate issuer. - * - * The UpdateCertificateIssuer operation performs an update on the specified certificate issuer entity. This - * operation requires the certificates/setissuers permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param issuerName The name of the issuer. - * @param provider The issuer provider. - * @param credentials The credentials to be used for the issuer. - * @param organizationDetails Details of the organization as provided to the issuer. - * @param attributes Attributes of the issuer object. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the issuer for Key Vault certificate along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> updateCertificateIssuerWithResponseAsync(String vaultBaseUrl, String issuerName, - String provider, IssuerCredentials credentials, OrganizationDetails organizationDetails, - IssuerAttributes attributes) { - return FluxUtil.withContext(context -> updateCertificateIssuerWithResponseAsync(vaultBaseUrl, issuerName, - provider, credentials, organizationDetails, attributes, context)); - } - - /** - * Updates the specified certificate issuer. - * - * The UpdateCertificateIssuer operation performs an update on the specified certificate issuer entity. This - * operation requires the certificates/setissuers permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param issuerName The name of the issuer. - * @param provider The issuer provider. - * @param credentials The credentials to be used for the issuer. - * @param organizationDetails Details of the organization as provided to the issuer. - * @param attributes Attributes of the issuer object. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the issuer for Key Vault certificate along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> updateCertificateIssuerWithResponseAsync(String vaultBaseUrl, String issuerName, - String provider, IssuerCredentials credentials, OrganizationDetails organizationDetails, - IssuerAttributes attributes, Context context) { - final String accept = "application/json"; - CertificateIssuerUpdateParameters parameter = new CertificateIssuerUpdateParameters(); - parameter.setProvider(provider); - parameter.setCredentials(credentials); - parameter.setOrganizationDetails(organizationDetails); - parameter.setAttributes(attributes); - return service.updateCertificateIssuer(vaultBaseUrl, issuerName, this.getApiVersion(), parameter, accept, - context); - } - - /** - * Updates the specified certificate issuer. - * - * The UpdateCertificateIssuer operation performs an update on the specified certificate issuer entity. This - * operation requires the certificates/setissuers permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param issuerName The name of the issuer. - * @param provider The issuer provider. - * @param credentials The credentials to be used for the issuer. - * @param organizationDetails Details of the organization as provided to the issuer. - * @param attributes Attributes of the issuer object. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the issuer for Key Vault certificate on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono updateCertificateIssuerAsync(String vaultBaseUrl, String issuerName, String provider, - IssuerCredentials credentials, OrganizationDetails organizationDetails, IssuerAttributes attributes) { - return updateCertificateIssuerWithResponseAsync(vaultBaseUrl, issuerName, provider, credentials, - organizationDetails, attributes).flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Updates the specified certificate issuer. - * - * The UpdateCertificateIssuer operation performs an update on the specified certificate issuer entity. This - * operation requires the certificates/setissuers permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param issuerName The name of the issuer. - * @param provider The issuer provider. - * @param credentials The credentials to be used for the issuer. - * @param organizationDetails Details of the organization as provided to the issuer. - * @param attributes Attributes of the issuer object. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the issuer for Key Vault certificate on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono updateCertificateIssuerAsync(String vaultBaseUrl, String issuerName, String provider, - IssuerCredentials credentials, OrganizationDetails organizationDetails, IssuerAttributes attributes, - Context context) { - return updateCertificateIssuerWithResponseAsync(vaultBaseUrl, issuerName, provider, credentials, - organizationDetails, attributes, context).flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Updates the specified certificate issuer. - * - * The UpdateCertificateIssuer operation performs an update on the specified certificate issuer entity. This - * operation requires the certificates/setissuers permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param issuerName The name of the issuer. - * @param provider The issuer provider. - * @param credentials The credentials to be used for the issuer. - * @param organizationDetails Details of the organization as provided to the issuer. - * @param attributes Attributes of the issuer object. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the issuer for Key Vault certificate along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response updateCertificateIssuerWithResponse(String vaultBaseUrl, String issuerName, - String provider, IssuerCredentials credentials, OrganizationDetails organizationDetails, - IssuerAttributes attributes, Context context) { - final String accept = "application/json"; - CertificateIssuerUpdateParameters parameter = new CertificateIssuerUpdateParameters(); - parameter.setProvider(provider); - parameter.setCredentials(credentials); - parameter.setOrganizationDetails(organizationDetails); - parameter.setAttributes(attributes); - return service.updateCertificateIssuerSync(vaultBaseUrl, issuerName, this.getApiVersion(), parameter, accept, - context); - } - - /** - * Updates the specified certificate issuer. - * - * The UpdateCertificateIssuer operation performs an update on the specified certificate issuer entity. This - * operation requires the certificates/setissuers permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param issuerName The name of the issuer. - * @param provider The issuer provider. - * @param credentials The credentials to be used for the issuer. - * @param organizationDetails Details of the organization as provided to the issuer. - * @param attributes Attributes of the issuer object. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the issuer for Key Vault certificate. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public IssuerBundle updateCertificateIssuer(String vaultBaseUrl, String issuerName, String provider, - IssuerCredentials credentials, OrganizationDetails organizationDetails, IssuerAttributes attributes) { - return updateCertificateIssuerWithResponse(vaultBaseUrl, issuerName, provider, credentials, organizationDetails, - attributes, Context.NONE).getValue(); - } - - /** - * Lists the specified certificate issuer. - * - * The GetCertificateIssuer operation returns the specified certificate issuer resources in the specified key vault. - * This operation requires the certificates/manageissuers/getissuers permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param issuerName The name of the issuer. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the issuer for Key Vault certificate along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getCertificateIssuerWithResponseAsync(String vaultBaseUrl, String issuerName) { - return FluxUtil - .withContext(context -> getCertificateIssuerWithResponseAsync(vaultBaseUrl, issuerName, context)); - } - - /** - * Lists the specified certificate issuer. - * - * The GetCertificateIssuer operation returns the specified certificate issuer resources in the specified key vault. - * This operation requires the certificates/manageissuers/getissuers permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param issuerName The name of the issuer. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the issuer for Key Vault certificate along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getCertificateIssuerWithResponseAsync(String vaultBaseUrl, String issuerName, - Context context) { - final String accept = "application/json"; - return service.getCertificateIssuer(vaultBaseUrl, issuerName, this.getApiVersion(), accept, context); - } - - /** - * Lists the specified certificate issuer. - * - * The GetCertificateIssuer operation returns the specified certificate issuer resources in the specified key vault. - * This operation requires the certificates/manageissuers/getissuers permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param issuerName The name of the issuer. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the issuer for Key Vault certificate on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getCertificateIssuerAsync(String vaultBaseUrl, String issuerName) { - return getCertificateIssuerWithResponseAsync(vaultBaseUrl, issuerName) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Lists the specified certificate issuer. - * - * The GetCertificateIssuer operation returns the specified certificate issuer resources in the specified key vault. - * This operation requires the certificates/manageissuers/getissuers permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param issuerName The name of the issuer. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the issuer for Key Vault certificate on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getCertificateIssuerAsync(String vaultBaseUrl, String issuerName, Context context) { - return getCertificateIssuerWithResponseAsync(vaultBaseUrl, issuerName, context) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Lists the specified certificate issuer. - * - * The GetCertificateIssuer operation returns the specified certificate issuer resources in the specified key vault. - * This operation requires the certificates/manageissuers/getissuers permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param issuerName The name of the issuer. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the issuer for Key Vault certificate along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getCertificateIssuerWithResponse(String vaultBaseUrl, String issuerName, - Context context) { - final String accept = "application/json"; - return service.getCertificateIssuerSync(vaultBaseUrl, issuerName, this.getApiVersion(), accept, context); - } - - /** - * Lists the specified certificate issuer. - * - * The GetCertificateIssuer operation returns the specified certificate issuer resources in the specified key vault. - * This operation requires the certificates/manageissuers/getissuers permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param issuerName The name of the issuer. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the issuer for Key Vault certificate. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public IssuerBundle getCertificateIssuer(String vaultBaseUrl, String issuerName) { - return getCertificateIssuerWithResponse(vaultBaseUrl, issuerName, Context.NONE).getValue(); - } - - /** - * Deletes the specified certificate issuer. - * - * The DeleteCertificateIssuer operation permanently removes the specified certificate issuer from the vault. This - * operation requires the certificates/manageissuers/deleteissuers permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param issuerName The name of the issuer. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the issuer for Key Vault certificate along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> deleteCertificateIssuerWithResponseAsync(String vaultBaseUrl, - String issuerName) { - return FluxUtil - .withContext(context -> deleteCertificateIssuerWithResponseAsync(vaultBaseUrl, issuerName, context)); - } - - /** - * Deletes the specified certificate issuer. - * - * The DeleteCertificateIssuer operation permanently removes the specified certificate issuer from the vault. This - * operation requires the certificates/manageissuers/deleteissuers permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param issuerName The name of the issuer. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the issuer for Key Vault certificate along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> deleteCertificateIssuerWithResponseAsync(String vaultBaseUrl, String issuerName, - Context context) { - final String accept = "application/json"; - return service.deleteCertificateIssuer(vaultBaseUrl, issuerName, this.getApiVersion(), accept, context); - } - - /** - * Deletes the specified certificate issuer. - * - * The DeleteCertificateIssuer operation permanently removes the specified certificate issuer from the vault. This - * operation requires the certificates/manageissuers/deleteissuers permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param issuerName The name of the issuer. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the issuer for Key Vault certificate on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono deleteCertificateIssuerAsync(String vaultBaseUrl, String issuerName) { - return deleteCertificateIssuerWithResponseAsync(vaultBaseUrl, issuerName) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Deletes the specified certificate issuer. - * - * The DeleteCertificateIssuer operation permanently removes the specified certificate issuer from the vault. This - * operation requires the certificates/manageissuers/deleteissuers permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param issuerName The name of the issuer. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the issuer for Key Vault certificate on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono deleteCertificateIssuerAsync(String vaultBaseUrl, String issuerName, Context context) { - return deleteCertificateIssuerWithResponseAsync(vaultBaseUrl, issuerName, context) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Deletes the specified certificate issuer. - * - * The DeleteCertificateIssuer operation permanently removes the specified certificate issuer from the vault. This - * operation requires the certificates/manageissuers/deleteissuers permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param issuerName The name of the issuer. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the issuer for Key Vault certificate along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response deleteCertificateIssuerWithResponse(String vaultBaseUrl, String issuerName, - Context context) { - final String accept = "application/json"; - return service.deleteCertificateIssuerSync(vaultBaseUrl, issuerName, this.getApiVersion(), accept, context); - } - - /** - * Deletes the specified certificate issuer. - * - * The DeleteCertificateIssuer operation permanently removes the specified certificate issuer from the vault. This - * operation requires the certificates/manageissuers/deleteissuers permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param issuerName The name of the issuer. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the issuer for Key Vault certificate. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public IssuerBundle deleteCertificateIssuer(String vaultBaseUrl, String issuerName) { - return deleteCertificateIssuerWithResponse(vaultBaseUrl, issuerName, Context.NONE).getValue(); - } - - /** - * Creates a new certificate. - * - * If this is the first version, the certificate resource is created. This operation requires the - * certificates/create permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate. The value you provide may be copied globally for the purpose - * of running the service. The value provided should not include personally identifiable or sensitive information. - * @param certificatePolicy The management policy for the certificate. - * @param certificateAttributes The attributes of the certificate (optional). - * @param tags Application specific metadata in the form of key-value pairs. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a certificate operation is returned in case of asynchronous requests along with {@link Response} on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> createCertificateWithResponseAsync(String vaultBaseUrl, - String certificateName, CertificatePolicy certificatePolicy, CertificateAttributes certificateAttributes, - Map tags) { - return FluxUtil.withContext(context -> createCertificateWithResponseAsync(vaultBaseUrl, certificateName, - certificatePolicy, certificateAttributes, tags, context)); - } - - /** - * Creates a new certificate. - * - * If this is the first version, the certificate resource is created. This operation requires the - * certificates/create permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate. The value you provide may be copied globally for the purpose - * of running the service. The value provided should not include personally identifiable or sensitive information. - * @param certificatePolicy The management policy for the certificate. - * @param certificateAttributes The attributes of the certificate (optional). - * @param tags Application specific metadata in the form of key-value pairs. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a certificate operation is returned in case of asynchronous requests along with {@link Response} on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> createCertificateWithResponseAsync(String vaultBaseUrl, - String certificateName, CertificatePolicy certificatePolicy, CertificateAttributes certificateAttributes, - Map tags, Context context) { - final String accept = "application/json"; - CertificateCreateParameters parameters = new CertificateCreateParameters(); - parameters.setCertificatePolicy(certificatePolicy); - parameters.setCertificateAttributes(certificateAttributes); - parameters.setTags(tags); - return service.createCertificate(vaultBaseUrl, certificateName, this.getApiVersion(), parameters, accept, - context); - } - - /** - * Creates a new certificate. - * - * If this is the first version, the certificate resource is created. This operation requires the - * certificates/create permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate. The value you provide may be copied globally for the purpose - * of running the service. The value provided should not include personally identifiable or sensitive information. - * @param certificatePolicy The management policy for the certificate. - * @param certificateAttributes The attributes of the certificate (optional). - * @param tags Application specific metadata in the form of key-value pairs. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a certificate operation is returned in case of asynchronous requests on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono createCertificateAsync(String vaultBaseUrl, String certificateName, - CertificatePolicy certificatePolicy, CertificateAttributes certificateAttributes, Map tags) { - return createCertificateWithResponseAsync(vaultBaseUrl, certificateName, certificatePolicy, - certificateAttributes, tags).flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Creates a new certificate. - * - * If this is the first version, the certificate resource is created. This operation requires the - * certificates/create permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate. The value you provide may be copied globally for the purpose - * of running the service. The value provided should not include personally identifiable or sensitive information. - * @param certificatePolicy The management policy for the certificate. - * @param certificateAttributes The attributes of the certificate (optional). - * @param tags Application specific metadata in the form of key-value pairs. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a certificate operation is returned in case of asynchronous requests on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono createCertificateAsync(String vaultBaseUrl, String certificateName, - CertificatePolicy certificatePolicy, CertificateAttributes certificateAttributes, Map tags, - Context context) { - return createCertificateWithResponseAsync(vaultBaseUrl, certificateName, certificatePolicy, - certificateAttributes, tags, context).flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Creates a new certificate. - * - * If this is the first version, the certificate resource is created. This operation requires the - * certificates/create permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate. The value you provide may be copied globally for the purpose - * of running the service. The value provided should not include personally identifiable or sensitive information. - * @param certificatePolicy The management policy for the certificate. - * @param certificateAttributes The attributes of the certificate (optional). - * @param tags Application specific metadata in the form of key-value pairs. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a certificate operation is returned in case of asynchronous requests along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response createCertificateWithResponse(String vaultBaseUrl, String certificateName, - CertificatePolicy certificatePolicy, CertificateAttributes certificateAttributes, Map tags, - Context context) { - final String accept = "application/json"; - CertificateCreateParameters parameters = new CertificateCreateParameters(); - parameters.setCertificatePolicy(certificatePolicy); - parameters.setCertificateAttributes(certificateAttributes); - parameters.setTags(tags); - return service.createCertificateSync(vaultBaseUrl, certificateName, this.getApiVersion(), parameters, accept, - context); - } - - /** - * Creates a new certificate. - * - * If this is the first version, the certificate resource is created. This operation requires the - * certificates/create permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate. The value you provide may be copied globally for the purpose - * of running the service. The value provided should not include personally identifiable or sensitive information. - * @param certificatePolicy The management policy for the certificate. - * @param certificateAttributes The attributes of the certificate (optional). - * @param tags Application specific metadata in the form of key-value pairs. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a certificate operation is returned in case of asynchronous requests. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public CertificateOperation createCertificate(String vaultBaseUrl, String certificateName, - CertificatePolicy certificatePolicy, CertificateAttributes certificateAttributes, Map tags) { - return createCertificateWithResponse(vaultBaseUrl, certificateName, certificatePolicy, certificateAttributes, - tags, Context.NONE).getValue(); - } - - /** - * Imports a certificate into a specified key vault. - * - * Imports an existing valid certificate, containing a private key, into Azure Key Vault. This operation requires - * the certificates/import permission. The certificate to be imported can be in either PFX or PEM format. If the - * certificate is in PEM format the PEM file must contain the key as well as x509 certificates. Key Vault will only - * accept a key in PKCS#8 format. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate. The value you provide may be copied globally for the purpose - * of running the service. The value provided should not include personally identifiable or sensitive information. - * @param base64EncodedCertificate Base64 encoded representation of the certificate object to import. This - * certificate needs to contain the private key. - * @param password If the private key in base64EncodedCertificate is encrypted, the password used for encryption. - * @param certificatePolicy The management policy for the certificate. - * @param certificateAttributes The attributes of the certificate (optional). - * @param tags Application specific metadata in the form of key-value pairs. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a certificate bundle consists of a certificate (X509) plus its attributes along with {@link Response} on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> importCertificateWithResponseAsync(String vaultBaseUrl, - String certificateName, String base64EncodedCertificate, String password, CertificatePolicy certificatePolicy, - CertificateAttributes certificateAttributes, Map tags) { - return FluxUtil.withContext(context -> importCertificateWithResponseAsync(vaultBaseUrl, certificateName, - base64EncodedCertificate, password, certificatePolicy, certificateAttributes, tags, context)); - } - - /** - * Imports a certificate into a specified key vault. - * - * Imports an existing valid certificate, containing a private key, into Azure Key Vault. This operation requires - * the certificates/import permission. The certificate to be imported can be in either PFX or PEM format. If the - * certificate is in PEM format the PEM file must contain the key as well as x509 certificates. Key Vault will only - * accept a key in PKCS#8 format. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate. The value you provide may be copied globally for the purpose - * of running the service. The value provided should not include personally identifiable or sensitive information. - * @param base64EncodedCertificate Base64 encoded representation of the certificate object to import. This - * certificate needs to contain the private key. - * @param password If the private key in base64EncodedCertificate is encrypted, the password used for encryption. - * @param certificatePolicy The management policy for the certificate. - * @param certificateAttributes The attributes of the certificate (optional). - * @param tags Application specific metadata in the form of key-value pairs. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a certificate bundle consists of a certificate (X509) plus its attributes along with {@link Response} on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> importCertificateWithResponseAsync(String vaultBaseUrl, - String certificateName, String base64EncodedCertificate, String password, CertificatePolicy certificatePolicy, - CertificateAttributes certificateAttributes, Map tags, Context context) { - final String accept = "application/json"; - CertificateImportParameters parameters = new CertificateImportParameters(); - parameters.setBase64EncodedCertificate(base64EncodedCertificate); - parameters.setPassword(password); - parameters.setCertificatePolicy(certificatePolicy); - parameters.setCertificateAttributes(certificateAttributes); - parameters.setTags(tags); - return service.importCertificate(vaultBaseUrl, certificateName, this.getApiVersion(), parameters, accept, - context); - } - - /** - * Imports a certificate into a specified key vault. - * - * Imports an existing valid certificate, containing a private key, into Azure Key Vault. This operation requires - * the certificates/import permission. The certificate to be imported can be in either PFX or PEM format. If the - * certificate is in PEM format the PEM file must contain the key as well as x509 certificates. Key Vault will only - * accept a key in PKCS#8 format. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate. The value you provide may be copied globally for the purpose - * of running the service. The value provided should not include personally identifiable or sensitive information. - * @param base64EncodedCertificate Base64 encoded representation of the certificate object to import. This - * certificate needs to contain the private key. - * @param password If the private key in base64EncodedCertificate is encrypted, the password used for encryption. - * @param certificatePolicy The management policy for the certificate. - * @param certificateAttributes The attributes of the certificate (optional). - * @param tags Application specific metadata in the form of key-value pairs. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a certificate bundle consists of a certificate (X509) plus its attributes on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono importCertificateAsync(String vaultBaseUrl, String certificateName, - String base64EncodedCertificate, String password, CertificatePolicy certificatePolicy, - CertificateAttributes certificateAttributes, Map tags) { - return importCertificateWithResponseAsync(vaultBaseUrl, certificateName, base64EncodedCertificate, password, - certificatePolicy, certificateAttributes, tags).flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Imports a certificate into a specified key vault. - * - * Imports an existing valid certificate, containing a private key, into Azure Key Vault. This operation requires - * the certificates/import permission. The certificate to be imported can be in either PFX or PEM format. If the - * certificate is in PEM format the PEM file must contain the key as well as x509 certificates. Key Vault will only - * accept a key in PKCS#8 format. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate. The value you provide may be copied globally for the purpose - * of running the service. The value provided should not include personally identifiable or sensitive information. - * @param base64EncodedCertificate Base64 encoded representation of the certificate object to import. This - * certificate needs to contain the private key. - * @param password If the private key in base64EncodedCertificate is encrypted, the password used for encryption. - * @param certificatePolicy The management policy for the certificate. - * @param certificateAttributes The attributes of the certificate (optional). - * @param tags Application specific metadata in the form of key-value pairs. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a certificate bundle consists of a certificate (X509) plus its attributes on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono importCertificateAsync(String vaultBaseUrl, String certificateName, - String base64EncodedCertificate, String password, CertificatePolicy certificatePolicy, - CertificateAttributes certificateAttributes, Map tags, Context context) { - return importCertificateWithResponseAsync(vaultBaseUrl, certificateName, base64EncodedCertificate, password, - certificatePolicy, certificateAttributes, tags, context).flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Imports a certificate into a specified key vault. - * - * Imports an existing valid certificate, containing a private key, into Azure Key Vault. This operation requires - * the certificates/import permission. The certificate to be imported can be in either PFX or PEM format. If the - * certificate is in PEM format the PEM file must contain the key as well as x509 certificates. Key Vault will only - * accept a key in PKCS#8 format. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate. The value you provide may be copied globally for the purpose - * of running the service. The value provided should not include personally identifiable or sensitive information. - * @param base64EncodedCertificate Base64 encoded representation of the certificate object to import. This - * certificate needs to contain the private key. - * @param password If the private key in base64EncodedCertificate is encrypted, the password used for encryption. - * @param certificatePolicy The management policy for the certificate. - * @param certificateAttributes The attributes of the certificate (optional). - * @param tags Application specific metadata in the form of key-value pairs. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a certificate bundle consists of a certificate (X509) plus its attributes along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response importCertificateWithResponse(String vaultBaseUrl, String certificateName, - String base64EncodedCertificate, String password, CertificatePolicy certificatePolicy, - CertificateAttributes certificateAttributes, Map tags, Context context) { - final String accept = "application/json"; - CertificateImportParameters parameters = new CertificateImportParameters(); - parameters.setBase64EncodedCertificate(base64EncodedCertificate); - parameters.setPassword(password); - parameters.setCertificatePolicy(certificatePolicy); - parameters.setCertificateAttributes(certificateAttributes); - parameters.setTags(tags); - return service.importCertificateSync(vaultBaseUrl, certificateName, this.getApiVersion(), parameters, accept, - context); - } - - /** - * Imports a certificate into a specified key vault. - * - * Imports an existing valid certificate, containing a private key, into Azure Key Vault. This operation requires - * the certificates/import permission. The certificate to be imported can be in either PFX or PEM format. If the - * certificate is in PEM format the PEM file must contain the key as well as x509 certificates. Key Vault will only - * accept a key in PKCS#8 format. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate. The value you provide may be copied globally for the purpose - * of running the service. The value provided should not include personally identifiable or sensitive information. - * @param base64EncodedCertificate Base64 encoded representation of the certificate object to import. This - * certificate needs to contain the private key. - * @param password If the private key in base64EncodedCertificate is encrypted, the password used for encryption. - * @param certificatePolicy The management policy for the certificate. - * @param certificateAttributes The attributes of the certificate (optional). - * @param tags Application specific metadata in the form of key-value pairs. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a certificate bundle consists of a certificate (X509) plus its attributes. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public CertificateBundle importCertificate(String vaultBaseUrl, String certificateName, - String base64EncodedCertificate, String password, CertificatePolicy certificatePolicy, - CertificateAttributes certificateAttributes, Map tags) { - return importCertificateWithResponse(vaultBaseUrl, certificateName, base64EncodedCertificate, password, - certificatePolicy, certificateAttributes, tags, Context.NONE).getValue(); - } - - /** - * List the versions of a certificate. - * - * The GetCertificateVersions operation returns the versions of a certificate in the specified key vault. This - * operation requires the certificates/list permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate. - * @param maxresults Maximum number of results to return in a page. If not specified the service will return up to - * 25 results. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the certificate list result along with {@link PagedResponse} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getCertificateVersionsSinglePageAsync(String vaultBaseUrl, - String certificateName, Integer maxresults) { - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getCertificateVersions(vaultBaseUrl, certificateName, maxresults, - this.getApiVersion(), accept, context)) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().getValue(), res.getValue().getNextLink(), null)); - } - - /** - * List the versions of a certificate. - * - * The GetCertificateVersions operation returns the versions of a certificate in the specified key vault. This - * operation requires the certificates/list permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate. - * @param maxresults Maximum number of results to return in a page. If not specified the service will return up to - * 25 results. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the certificate list result along with {@link PagedResponse} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getCertificateVersionsSinglePageAsync(String vaultBaseUrl, - String certificateName, Integer maxresults, Context context) { - final String accept = "application/json"; - return service - .getCertificateVersions(vaultBaseUrl, certificateName, maxresults, this.getApiVersion(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().getValue(), res.getValue().getNextLink(), null)); - } - - /** - * List the versions of a certificate. - * - * The GetCertificateVersions operation returns the versions of a certificate in the specified key vault. This - * operation requires the certificates/list permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate. - * @param maxresults Maximum number of results to return in a page. If not specified the service will return up to - * 25 results. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the certificate list result as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux getCertificateVersionsAsync(String vaultBaseUrl, String certificateName, - Integer maxresults) { - return new PagedFlux<>(() -> getCertificateVersionsSinglePageAsync(vaultBaseUrl, certificateName, maxresults), - nextLink -> getCertificateVersionsNextSinglePageAsync(nextLink, vaultBaseUrl)); - } - - /** - * List the versions of a certificate. - * - * The GetCertificateVersions operation returns the versions of a certificate in the specified key vault. This - * operation requires the certificates/list permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate. - * @param maxresults Maximum number of results to return in a page. If not specified the service will return up to - * 25 results. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the certificate list result as paginated response with {@link PagedFlux}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux getCertificateVersionsAsync(String vaultBaseUrl, String certificateName, - Integer maxresults, Context context) { - return new PagedFlux<>( - () -> getCertificateVersionsSinglePageAsync(vaultBaseUrl, certificateName, maxresults, context), - nextLink -> getCertificateVersionsNextSinglePageAsync(nextLink, vaultBaseUrl, context)); - } - - /** - * List the versions of a certificate. - * - * The GetCertificateVersions operation returns the versions of a certificate in the specified key vault. This - * operation requires the certificates/list permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate. - * @param maxresults Maximum number of results to return in a page. If not specified the service will return up to - * 25 results. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the certificate list result along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public PagedResponse getCertificateVersionsSinglePage(String vaultBaseUrl, String certificateName, - Integer maxresults) { - final String accept = "application/json"; - Response res = service.getCertificateVersionsSync(vaultBaseUrl, certificateName, - maxresults, this.getApiVersion(), accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().getValue(), res.getValue().getNextLink(), null); - } - - /** - * List the versions of a certificate. - * - * The GetCertificateVersions operation returns the versions of a certificate in the specified key vault. This - * operation requires the certificates/list permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate. - * @param maxresults Maximum number of results to return in a page. If not specified the service will return up to - * 25 results. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the certificate list result along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public PagedResponse getCertificateVersionsSinglePage(String vaultBaseUrl, String certificateName, - Integer maxresults, Context context) { - final String accept = "application/json"; - Response res = service.getCertificateVersionsSync(vaultBaseUrl, certificateName, - maxresults, this.getApiVersion(), accept, context); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().getValue(), res.getValue().getNextLink(), null); - } - - /** - * List the versions of a certificate. - * - * The GetCertificateVersions operation returns the versions of a certificate in the specified key vault. This - * operation requires the certificates/list permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate. - * @param maxresults Maximum number of results to return in a page. If not specified the service will return up to - * 25 results. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the certificate list result as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable getCertificateVersions(String vaultBaseUrl, String certificateName, - Integer maxresults) { - return new PagedIterable<>( - () -> getCertificateVersionsSinglePage(vaultBaseUrl, certificateName, maxresults, Context.NONE), - nextLink -> getCertificateVersionsNextSinglePage(nextLink, vaultBaseUrl)); - } - - /** - * List the versions of a certificate. - * - * The GetCertificateVersions operation returns the versions of a certificate in the specified key vault. This - * operation requires the certificates/list permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate. - * @param maxresults Maximum number of results to return in a page. If not specified the service will return up to - * 25 results. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the certificate list result as paginated response with {@link PagedIterable}. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable getCertificateVersions(String vaultBaseUrl, String certificateName, - Integer maxresults, Context context) { - return new PagedIterable<>( - () -> getCertificateVersionsSinglePage(vaultBaseUrl, certificateName, maxresults, context), - nextLink -> getCertificateVersionsNextSinglePage(nextLink, vaultBaseUrl, context)); - } - - /** - * Lists the policy for a certificate. - * - * The GetCertificatePolicy operation returns the specified certificate policy resources in the specified key vault. - * This operation requires the certificates/get permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate in a given key vault. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return management policy for a certificate along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getCertificatePolicyWithResponseAsync(String vaultBaseUrl, - String certificateName) { - return FluxUtil - .withContext(context -> getCertificatePolicyWithResponseAsync(vaultBaseUrl, certificateName, context)); - } - - /** - * Lists the policy for a certificate. - * - * The GetCertificatePolicy operation returns the specified certificate policy resources in the specified key vault. - * This operation requires the certificates/get permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate in a given key vault. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return management policy for a certificate along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getCertificatePolicyWithResponseAsync(String vaultBaseUrl, - String certificateName, Context context) { - final String accept = "application/json"; - return service.getCertificatePolicy(vaultBaseUrl, certificateName, this.getApiVersion(), accept, context); - } - - /** - * Lists the policy for a certificate. - * - * The GetCertificatePolicy operation returns the specified certificate policy resources in the specified key vault. - * This operation requires the certificates/get permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate in a given key vault. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return management policy for a certificate on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getCertificatePolicyAsync(String vaultBaseUrl, String certificateName) { - return getCertificatePolicyWithResponseAsync(vaultBaseUrl, certificateName) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Lists the policy for a certificate. - * - * The GetCertificatePolicy operation returns the specified certificate policy resources in the specified key vault. - * This operation requires the certificates/get permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate in a given key vault. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return management policy for a certificate on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getCertificatePolicyAsync(String vaultBaseUrl, String certificateName, - Context context) { - return getCertificatePolicyWithResponseAsync(vaultBaseUrl, certificateName, context) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Lists the policy for a certificate. - * - * The GetCertificatePolicy operation returns the specified certificate policy resources in the specified key vault. - * This operation requires the certificates/get permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate in a given key vault. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return management policy for a certificate along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getCertificatePolicyWithResponse(String vaultBaseUrl, String certificateName, - Context context) { - final String accept = "application/json"; - return service.getCertificatePolicySync(vaultBaseUrl, certificateName, this.getApiVersion(), accept, context); - } - - /** - * Lists the policy for a certificate. - * - * The GetCertificatePolicy operation returns the specified certificate policy resources in the specified key vault. - * This operation requires the certificates/get permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate in a given key vault. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return management policy for a certificate. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public CertificatePolicy getCertificatePolicy(String vaultBaseUrl, String certificateName) { - return getCertificatePolicyWithResponse(vaultBaseUrl, certificateName, Context.NONE).getValue(); - } - - /** - * Updates the policy for a certificate. - * - * Set specified members in the certificate policy. Leave others as null. This operation requires the - * certificates/update permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate in the given vault. - * @param certificatePolicy The policy for the certificate. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return management policy for a certificate along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> updateCertificatePolicyWithResponseAsync(String vaultBaseUrl, - String certificateName, CertificatePolicy certificatePolicy) { - return FluxUtil.withContext(context -> updateCertificatePolicyWithResponseAsync(vaultBaseUrl, certificateName, - certificatePolicy, context)); - } - - /** - * Updates the policy for a certificate. - * - * Set specified members in the certificate policy. Leave others as null. This operation requires the - * certificates/update permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate in the given vault. - * @param certificatePolicy The policy for the certificate. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return management policy for a certificate along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> updateCertificatePolicyWithResponseAsync(String vaultBaseUrl, - String certificateName, CertificatePolicy certificatePolicy, Context context) { - final String accept = "application/json"; - return service.updateCertificatePolicy(vaultBaseUrl, certificateName, this.getApiVersion(), certificatePolicy, - accept, context); - } - - /** - * Updates the policy for a certificate. - * - * Set specified members in the certificate policy. Leave others as null. This operation requires the - * certificates/update permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate in the given vault. - * @param certificatePolicy The policy for the certificate. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return management policy for a certificate on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono updateCertificatePolicyAsync(String vaultBaseUrl, String certificateName, - CertificatePolicy certificatePolicy) { - return updateCertificatePolicyWithResponseAsync(vaultBaseUrl, certificateName, certificatePolicy) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Updates the policy for a certificate. - * - * Set specified members in the certificate policy. Leave others as null. This operation requires the - * certificates/update permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate in the given vault. - * @param certificatePolicy The policy for the certificate. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return management policy for a certificate on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono updateCertificatePolicyAsync(String vaultBaseUrl, String certificateName, - CertificatePolicy certificatePolicy, Context context) { - return updateCertificatePolicyWithResponseAsync(vaultBaseUrl, certificateName, certificatePolicy, context) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Updates the policy for a certificate. - * - * Set specified members in the certificate policy. Leave others as null. This operation requires the - * certificates/update permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate in the given vault. - * @param certificatePolicy The policy for the certificate. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return management policy for a certificate along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response updateCertificatePolicyWithResponse(String vaultBaseUrl, String certificateName, - CertificatePolicy certificatePolicy, Context context) { - final String accept = "application/json"; - return service.updateCertificatePolicySync(vaultBaseUrl, certificateName, this.getApiVersion(), - certificatePolicy, accept, context); - } - - /** - * Updates the policy for a certificate. - * - * Set specified members in the certificate policy. Leave others as null. This operation requires the - * certificates/update permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate in the given vault. - * @param certificatePolicy The policy for the certificate. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return management policy for a certificate. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public CertificatePolicy updateCertificatePolicy(String vaultBaseUrl, String certificateName, - CertificatePolicy certificatePolicy) { - return updateCertificatePolicyWithResponse(vaultBaseUrl, certificateName, certificatePolicy, Context.NONE) - .getValue(); - } - - /** - * Updates the specified attributes associated with the given certificate. - * - * The UpdateCertificate operation applies the specified update on the given certificate; the only elements updated - * are the certificate's attributes. This operation requires the certificates/update permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate in the given key vault. - * @param certificateVersion The version of the certificate. - * @param certificatePolicy The management policy for the certificate. - * @param certificateAttributes The attributes of the certificate (optional). - * @param tags Application specific metadata in the form of key-value pairs. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a certificate bundle consists of a certificate (X509) plus its attributes along with {@link Response} on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> updateCertificateWithResponseAsync(String vaultBaseUrl, - String certificateName, String certificateVersion, CertificatePolicy certificatePolicy, - CertificateAttributes certificateAttributes, Map tags) { - return FluxUtil.withContext(context -> updateCertificateWithResponseAsync(vaultBaseUrl, certificateName, - certificateVersion, certificatePolicy, certificateAttributes, tags, context)); - } - - /** - * Updates the specified attributes associated with the given certificate. - * - * The UpdateCertificate operation applies the specified update on the given certificate; the only elements updated - * are the certificate's attributes. This operation requires the certificates/update permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate in the given key vault. - * @param certificateVersion The version of the certificate. - * @param certificatePolicy The management policy for the certificate. - * @param certificateAttributes The attributes of the certificate (optional). - * @param tags Application specific metadata in the form of key-value pairs. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a certificate bundle consists of a certificate (X509) plus its attributes along with {@link Response} on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> updateCertificateWithResponseAsync(String vaultBaseUrl, - String certificateName, String certificateVersion, CertificatePolicy certificatePolicy, - CertificateAttributes certificateAttributes, Map tags, Context context) { - final String accept = "application/json"; - CertificateUpdateParameters parameters = new CertificateUpdateParameters(); - parameters.setCertificatePolicy(certificatePolicy); - parameters.setCertificateAttributes(certificateAttributes); - parameters.setTags(tags); - return service.updateCertificate(vaultBaseUrl, certificateName, certificateVersion, this.getApiVersion(), - parameters, accept, context); - } - - /** - * Updates the specified attributes associated with the given certificate. - * - * The UpdateCertificate operation applies the specified update on the given certificate; the only elements updated - * are the certificate's attributes. This operation requires the certificates/update permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate in the given key vault. - * @param certificateVersion The version of the certificate. - * @param certificatePolicy The management policy for the certificate. - * @param certificateAttributes The attributes of the certificate (optional). - * @param tags Application specific metadata in the form of key-value pairs. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a certificate bundle consists of a certificate (X509) plus its attributes on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono updateCertificateAsync(String vaultBaseUrl, String certificateName, - String certificateVersion, CertificatePolicy certificatePolicy, CertificateAttributes certificateAttributes, - Map tags) { - return updateCertificateWithResponseAsync(vaultBaseUrl, certificateName, certificateVersion, certificatePolicy, - certificateAttributes, tags).flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Updates the specified attributes associated with the given certificate. - * - * The UpdateCertificate operation applies the specified update on the given certificate; the only elements updated - * are the certificate's attributes. This operation requires the certificates/update permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate in the given key vault. - * @param certificateVersion The version of the certificate. - * @param certificatePolicy The management policy for the certificate. - * @param certificateAttributes The attributes of the certificate (optional). - * @param tags Application specific metadata in the form of key-value pairs. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a certificate bundle consists of a certificate (X509) plus its attributes on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono updateCertificateAsync(String vaultBaseUrl, String certificateName, - String certificateVersion, CertificatePolicy certificatePolicy, CertificateAttributes certificateAttributes, - Map tags, Context context) { - return updateCertificateWithResponseAsync(vaultBaseUrl, certificateName, certificateVersion, certificatePolicy, - certificateAttributes, tags, context).flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Updates the specified attributes associated with the given certificate. - * - * The UpdateCertificate operation applies the specified update on the given certificate; the only elements updated - * are the certificate's attributes. This operation requires the certificates/update permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate in the given key vault. - * @param certificateVersion The version of the certificate. - * @param certificatePolicy The management policy for the certificate. - * @param certificateAttributes The attributes of the certificate (optional). - * @param tags Application specific metadata in the form of key-value pairs. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a certificate bundle consists of a certificate (X509) plus its attributes along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response updateCertificateWithResponse(String vaultBaseUrl, String certificateName, - String certificateVersion, CertificatePolicy certificatePolicy, CertificateAttributes certificateAttributes, - Map tags, Context context) { - final String accept = "application/json"; - CertificateUpdateParameters parameters = new CertificateUpdateParameters(); - parameters.setCertificatePolicy(certificatePolicy); - parameters.setCertificateAttributes(certificateAttributes); - parameters.setTags(tags); - return service.updateCertificateSync(vaultBaseUrl, certificateName, certificateVersion, this.getApiVersion(), - parameters, accept, context); - } - - /** - * Updates the specified attributes associated with the given certificate. - * - * The UpdateCertificate operation applies the specified update on the given certificate; the only elements updated - * are the certificate's attributes. This operation requires the certificates/update permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate in the given key vault. - * @param certificateVersion The version of the certificate. - * @param certificatePolicy The management policy for the certificate. - * @param certificateAttributes The attributes of the certificate (optional). - * @param tags Application specific metadata in the form of key-value pairs. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a certificate bundle consists of a certificate (X509) plus its attributes. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public CertificateBundle updateCertificate(String vaultBaseUrl, String certificateName, String certificateVersion, - CertificatePolicy certificatePolicy, CertificateAttributes certificateAttributes, Map tags) { - return updateCertificateWithResponse(vaultBaseUrl, certificateName, certificateVersion, certificatePolicy, - certificateAttributes, tags, Context.NONE).getValue(); - } - - /** - * Gets information about a certificate. - * - * Gets information about a specific certificate. This operation requires the certificates/get permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate in the given vault. - * @param certificateVersion The version of the certificate. This URI fragment is optional. If not specified, the - * latest version of the certificate is returned. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return information about a specific certificate along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getCertificateWithResponseAsync(String vaultBaseUrl, - String certificateName, String certificateVersion) { - return FluxUtil.withContext( - context -> getCertificateWithResponseAsync(vaultBaseUrl, certificateName, certificateVersion, context)); - } - - /** - * Gets information about a certificate. - * - * Gets information about a specific certificate. This operation requires the certificates/get permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate in the given vault. - * @param certificateVersion The version of the certificate. This URI fragment is optional. If not specified, the - * latest version of the certificate is returned. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return information about a specific certificate along with {@link Response} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getCertificateWithResponseAsync(String vaultBaseUrl, - String certificateName, String certificateVersion, Context context) { - final String accept = "application/json"; - return service.getCertificate(vaultBaseUrl, certificateName, certificateVersion, this.getApiVersion(), accept, - context); - } - - /** - * Gets information about a certificate. - * - * Gets information about a specific certificate. This operation requires the certificates/get permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate in the given vault. - * @param certificateVersion The version of the certificate. This URI fragment is optional. If not specified, the - * latest version of the certificate is returned. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return information about a specific certificate on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getCertificateAsync(String vaultBaseUrl, String certificateName, - String certificateVersion) { - return getCertificateWithResponseAsync(vaultBaseUrl, certificateName, certificateVersion) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Gets information about a certificate. - * - * Gets information about a specific certificate. This operation requires the certificates/get permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate in the given vault. - * @param certificateVersion The version of the certificate. This URI fragment is optional. If not specified, the - * latest version of the certificate is returned. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return information about a specific certificate on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getCertificateAsync(String vaultBaseUrl, String certificateName, - String certificateVersion, Context context) { - return getCertificateWithResponseAsync(vaultBaseUrl, certificateName, certificateVersion, context) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Gets information about a certificate. - * - * Gets information about a specific certificate. This operation requires the certificates/get permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate in the given vault. - * @param certificateVersion The version of the certificate. This URI fragment is optional. If not specified, the - * latest version of the certificate is returned. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return information about a specific certificate along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getCertificateWithResponse(String vaultBaseUrl, String certificateName, - String certificateVersion, Context context) { - final String accept = "application/json"; - return service.getCertificateSync(vaultBaseUrl, certificateName, certificateVersion, this.getApiVersion(), - accept, context); - } - - /** - * Gets information about a certificate. - * - * Gets information about a specific certificate. This operation requires the certificates/get permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate in the given vault. - * @param certificateVersion The version of the certificate. This URI fragment is optional. If not specified, the - * latest version of the certificate is returned. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return information about a specific certificate. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public CertificateBundle getCertificate(String vaultBaseUrl, String certificateName, String certificateVersion) { - return getCertificateWithResponse(vaultBaseUrl, certificateName, certificateVersion, Context.NONE).getValue(); - } - - /** - * Updates a certificate operation. - * - * Updates a certificate creation operation that is already in progress. This operation requires the - * certificates/update permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate. - * @param cancellationRequested Indicates if cancellation was requested on the certificate operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a certificate operation is returned in case of asynchronous requests along with {@link Response} on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> updateCertificateOperationWithResponseAsync(String vaultBaseUrl, - String certificateName, boolean cancellationRequested) { - return FluxUtil.withContext(context -> updateCertificateOperationWithResponseAsync(vaultBaseUrl, - certificateName, cancellationRequested, context)); - } - - /** - * Updates a certificate operation. - * - * Updates a certificate creation operation that is already in progress. This operation requires the - * certificates/update permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate. - * @param cancellationRequested Indicates if cancellation was requested on the certificate operation. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a certificate operation is returned in case of asynchronous requests along with {@link Response} on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> updateCertificateOperationWithResponseAsync(String vaultBaseUrl, - String certificateName, boolean cancellationRequested, Context context) { - final String accept = "application/json"; - CertificateOperationUpdateParameter certificateOperation = new CertificateOperationUpdateParameter(); - certificateOperation.setCancellationRequested(cancellationRequested); - return service.updateCertificateOperation(vaultBaseUrl, certificateName, this.getApiVersion(), - certificateOperation, accept, context); - } - - /** - * Updates a certificate operation. - * - * Updates a certificate creation operation that is already in progress. This operation requires the - * certificates/update permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate. - * @param cancellationRequested Indicates if cancellation was requested on the certificate operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a certificate operation is returned in case of asynchronous requests on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono updateCertificateOperationAsync(String vaultBaseUrl, String certificateName, - boolean cancellationRequested) { - return updateCertificateOperationWithResponseAsync(vaultBaseUrl, certificateName, cancellationRequested) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Updates a certificate operation. - * - * Updates a certificate creation operation that is already in progress. This operation requires the - * certificates/update permission. + * The DeleteCertificateIssuer operation permanently removes the specified certificate issuer from the vault. This + * operation requires the certificates/manageissuers/deleteissuers permission. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     provider: String (Optional)
+     *     credentials (Optional): {
+     *         account_id: String (Optional)
+     *         pwd: String (Optional)
+     *     }
+     *     org_details (Optional): {
+     *         id: String (Optional)
+     *         admin_details (Optional): [
+     *              (Optional){
+     *                 first_name: String (Optional)
+     *                 last_name: String (Optional)
+     *                 email: String (Optional)
+     *                 phone: String (Optional)
+     *             }
+     *         ]
+     *     }
+     *     attributes (Optional): {
+     *         enabled: Boolean (Optional)
+     *         created: Long (Optional)
+     *         updated: Long (Optional)
+     *     }
+     * }
+     * }
+     * 
* - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate. - * @param cancellationRequested Indicates if cancellation was requested on the certificate operation. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a certificate operation is returned in case of asynchronous requests on successful completion of + * @param issuerName The name of the issuer. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the issuer for Key Vault certificate along with {@link Response} on successful completion of * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono updateCertificateOperationAsync(String vaultBaseUrl, String certificateName, - boolean cancellationRequested, Context context) { - return updateCertificateOperationWithResponseAsync(vaultBaseUrl, certificateName, cancellationRequested, - context).flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Updates a certificate operation. - * - * Updates a certificate creation operation that is already in progress. This operation requires the - * certificates/update permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate. - * @param cancellationRequested Indicates if cancellation was requested on the certificate operation. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a certificate operation is returned in case of asynchronous requests along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response updateCertificateOperationWithResponse(String vaultBaseUrl, - String certificateName, boolean cancellationRequested, Context context) { - final String accept = "application/json"; - CertificateOperationUpdateParameter certificateOperation = new CertificateOperationUpdateParameter(); - certificateOperation.setCancellationRequested(cancellationRequested); - return service.updateCertificateOperationSync(vaultBaseUrl, certificateName, this.getApiVersion(), - certificateOperation, accept, context); - } - - /** - * Updates a certificate operation. - * - * Updates a certificate creation operation that is already in progress. This operation requires the - * certificates/update permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate. - * @param cancellationRequested Indicates if cancellation was requested on the certificate operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a certificate operation is returned in case of asynchronous requests. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public CertificateOperation updateCertificateOperation(String vaultBaseUrl, String certificateName, - boolean cancellationRequested) { - return updateCertificateOperationWithResponse(vaultBaseUrl, certificateName, cancellationRequested, - Context.NONE).getValue(); - } - - /** - * Gets the creation operation of a certificate. - * - * Gets the creation operation associated with a specified certificate. This operation requires the certificates/get - * permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the creation operation associated with a specified certificate along with {@link Response} on successful - * completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getCertificateOperationWithResponseAsync(String vaultBaseUrl, - String certificateName) { - return FluxUtil - .withContext(context -> getCertificateOperationWithResponseAsync(vaultBaseUrl, certificateName, context)); - } - - /** - * Gets the creation operation of a certificate. - * - * Gets the creation operation associated with a specified certificate. This operation requires the certificates/get - * permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the creation operation associated with a specified certificate along with {@link Response} on successful - * completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getCertificateOperationWithResponseAsync(String vaultBaseUrl, - String certificateName, Context context) { + public Mono> deleteCertificateIssuerWithResponseAsync(String issuerName, + RequestOptions requestOptions) { final String accept = "application/json"; - return service.getCertificateOperation(vaultBaseUrl, certificateName, this.getApiVersion(), accept, context); - } - - /** - * Gets the creation operation of a certificate. - * - * Gets the creation operation associated with a specified certificate. This operation requires the certificates/get - * permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the creation operation associated with a specified certificate on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getCertificateOperationAsync(String vaultBaseUrl, String certificateName) { - return getCertificateOperationWithResponseAsync(vaultBaseUrl, certificateName) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Gets the creation operation of a certificate. - * - * Gets the creation operation associated with a specified certificate. This operation requires the certificates/get - * permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the creation operation associated with a specified certificate on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getCertificateOperationAsync(String vaultBaseUrl, String certificateName, - Context context) { - return getCertificateOperationWithResponseAsync(vaultBaseUrl, certificateName, context) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); + return FluxUtil.withContext(context -> service.deleteCertificateIssuer(this.getVaultBaseUrl(), + this.getServiceVersion().getVersion(), issuerName, accept, requestOptions, context)); } /** - * Gets the creation operation of a certificate. + * Deletes the specified certificate issuer. * - * Gets the creation operation associated with a specified certificate. This operation requires the certificates/get - * permission. + * The DeleteCertificateIssuer operation permanently removes the specified certificate issuer from the vault. This + * operation requires the certificates/manageissuers/deleteissuers permission. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     provider: String (Optional)
+     *     credentials (Optional): {
+     *         account_id: String (Optional)
+     *         pwd: String (Optional)
+     *     }
+     *     org_details (Optional): {
+     *         id: String (Optional)
+     *         admin_details (Optional): [
+     *              (Optional){
+     *                 first_name: String (Optional)
+     *                 last_name: String (Optional)
+     *                 email: String (Optional)
+     *                 phone: String (Optional)
+     *             }
+     *         ]
+     *     }
+     *     attributes (Optional): {
+     *         enabled: Boolean (Optional)
+     *         created: Long (Optional)
+     *         updated: Long (Optional)
+     *     }
+     * }
+     * }
+     * 
* - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the creation operation associated with a specified certificate along with {@link Response}. + * @param issuerName The name of the issuer. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the issuer for Key Vault certificate along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response getCertificateOperationWithResponse(String vaultBaseUrl, - String certificateName, Context context) { + public Response deleteCertificateIssuerWithResponse(String issuerName, RequestOptions requestOptions) { final String accept = "application/json"; - return service.getCertificateOperationSync(vaultBaseUrl, certificateName, this.getApiVersion(), accept, - context); - } - - /** - * Gets the creation operation of a certificate. - * - * Gets the creation operation associated with a specified certificate. This operation requires the certificates/get - * permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the creation operation associated with a specified certificate. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public CertificateOperation getCertificateOperation(String vaultBaseUrl, String certificateName) { - return getCertificateOperationWithResponse(vaultBaseUrl, certificateName, Context.NONE).getValue(); - } - - /** - * Deletes the creation operation for a specific certificate. - * - * Deletes the creation operation for a specified certificate that is in the process of being created. The - * certificate is no longer created. This operation requires the certificates/update permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a certificate operation is returned in case of asynchronous requests along with {@link Response} on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> deleteCertificateOperationWithResponseAsync(String vaultBaseUrl, - String certificateName) { - return FluxUtil.withContext( - context -> deleteCertificateOperationWithResponseAsync(vaultBaseUrl, certificateName, context)); + return service.deleteCertificateIssuerSync(this.getVaultBaseUrl(), this.getServiceVersion().getVersion(), + issuerName, accept, requestOptions, Context.NONE); } /** - * Deletes the creation operation for a specific certificate. + * Creates a new certificate. * - * Deletes the creation operation for a specified certificate that is in the process of being created. The - * certificate is no longer created. This operation requires the certificates/update permission. + * If this is the first version, the certificate resource is created. This operation requires the + * certificates/create permission. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     policy (Optional): {
+     *         id: String (Optional)
+     *         key_props (Optional): {
+     *             exportable: Boolean (Optional)
+     *             kty: String(EC/EC-HSM/RSA/RSA-HSM/oct/oct-HSM) (Optional)
+     *             key_size: Integer (Optional)
+     *             reuse_key: Boolean (Optional)
+     *             crv: String(P-256/P-384/P-521/P-256K) (Optional)
+     *         }
+     *         secret_props (Optional): {
+     *             contentType: String (Optional)
+     *         }
+     *         x509_props (Optional): {
+     *             subject: String (Optional)
+     *             ekus (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             sans (Optional): {
+     *                 emails (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 dns_names (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 upns (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *             }
+     *             key_usage (Optional): [
+     *                 String(digitalSignature/nonRepudiation/keyEncipherment/dataEncipherment/keyAgreement/keyCertSign/cRLSign/encipherOnly/decipherOnly) (Optional)
+     *             ]
+     *             validity_months: Integer (Optional)
+     *         }
+     *         lifetime_actions (Optional): [
+     *              (Optional){
+     *                 trigger (Optional): {
+     *                     lifetime_percentage: Integer (Optional)
+     *                     days_before_expiry: Integer (Optional)
+     *                 }
+     *                 action (Optional): {
+     *                     action_type: String(EmailContacts/AutoRenew) (Optional)
+     *                 }
+     *             }
+     *         ]
+     *         issuer (Optional): {
+     *             name: String (Optional)
+     *             cty: String (Optional)
+     *             cert_transparency: Boolean (Optional)
+     *         }
+     *         attributes (Optional): {
+     *             enabled: Boolean (Optional)
+     *             nbf: Long (Optional)
+     *             exp: Long (Optional)
+     *             created: Long (Optional)
+     *             updated: Long (Optional)
+     *             recoverableDays: Integer (Optional)
+     *             recoveryLevel: String(Purgeable/Recoverable+Purgeable/Recoverable/Recoverable+ProtectedSubscription/CustomizedRecoverable+Purgeable/CustomizedRecoverable/CustomizedRecoverable+ProtectedSubscription) (Optional)
+     *         }
+     *     }
+     *     attributes (Optional): (recursive schema, see attributes above)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     issuer (Optional): {
+     *         name: String (Optional)
+     *         cty: String (Optional)
+     *         cert_transparency: Boolean (Optional)
+     *     }
+     *     csr: byte[] (Optional)
+     *     cancellation_requested: Boolean (Optional)
+     *     status: String (Optional)
+     *     status_details: String (Optional)
+     *     error (Optional): {
+     *         code: String (Optional)
+     *         message: String (Optional)
+     *         innererror (Optional): (recursive schema, see innererror above)
+     *     }
+     *     target: String (Optional)
+     *     request_id: String (Optional)
+     * }
+     * }
+     * 
* - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @param certificateName The name of the certificate. The value you provide may be copied globally for the purpose + * of running the service. The value provided should not include personally identifiable or sensitive information. + * @param parameters The parameters to create a certificate. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. * @return a certificate operation is returned in case of asynchronous requests along with {@link Response} on * successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> deleteCertificateOperationWithResponseAsync(String vaultBaseUrl, - String certificateName, Context context) { + public Mono> createCertificateWithResponseAsync(String certificateName, BinaryData parameters, + RequestOptions requestOptions) { + final String contentType = "application/json"; final String accept = "application/json"; - return service.deleteCertificateOperation(vaultBaseUrl, certificateName, this.getApiVersion(), accept, context); - } - - /** - * Deletes the creation operation for a specific certificate. - * - * Deletes the creation operation for a specified certificate that is in the process of being created. The - * certificate is no longer created. This operation requires the certificates/update permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a certificate operation is returned in case of asynchronous requests on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono deleteCertificateOperationAsync(String vaultBaseUrl, String certificateName) { - return deleteCertificateOperationWithResponseAsync(vaultBaseUrl, certificateName) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Deletes the creation operation for a specific certificate. - * - * Deletes the creation operation for a specified certificate that is in the process of being created. The - * certificate is no longer created. This operation requires the certificates/update permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a certificate operation is returned in case of asynchronous requests on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono deleteCertificateOperationAsync(String vaultBaseUrl, String certificateName, - Context context) { - return deleteCertificateOperationWithResponseAsync(vaultBaseUrl, certificateName, context) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); + return FluxUtil.withContext( + context -> service.createCertificate(this.getVaultBaseUrl(), this.getServiceVersion().getVersion(), + certificateName, contentType, accept, parameters, requestOptions, context)); } /** - * Deletes the creation operation for a specific certificate. + * Creates a new certificate. * - * Deletes the creation operation for a specified certificate that is in the process of being created. The - * certificate is no longer created. This operation requires the certificates/update permission. + * If this is the first version, the certificate resource is created. This operation requires the + * certificates/create permission. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     policy (Optional): {
+     *         id: String (Optional)
+     *         key_props (Optional): {
+     *             exportable: Boolean (Optional)
+     *             kty: String(EC/EC-HSM/RSA/RSA-HSM/oct/oct-HSM) (Optional)
+     *             key_size: Integer (Optional)
+     *             reuse_key: Boolean (Optional)
+     *             crv: String(P-256/P-384/P-521/P-256K) (Optional)
+     *         }
+     *         secret_props (Optional): {
+     *             contentType: String (Optional)
+     *         }
+     *         x509_props (Optional): {
+     *             subject: String (Optional)
+     *             ekus (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             sans (Optional): {
+     *                 emails (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 dns_names (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 upns (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *             }
+     *             key_usage (Optional): [
+     *                 String(digitalSignature/nonRepudiation/keyEncipherment/dataEncipherment/keyAgreement/keyCertSign/cRLSign/encipherOnly/decipherOnly) (Optional)
+     *             ]
+     *             validity_months: Integer (Optional)
+     *         }
+     *         lifetime_actions (Optional): [
+     *              (Optional){
+     *                 trigger (Optional): {
+     *                     lifetime_percentage: Integer (Optional)
+     *                     days_before_expiry: Integer (Optional)
+     *                 }
+     *                 action (Optional): {
+     *                     action_type: String(EmailContacts/AutoRenew) (Optional)
+     *                 }
+     *             }
+     *         ]
+     *         issuer (Optional): {
+     *             name: String (Optional)
+     *             cty: String (Optional)
+     *             cert_transparency: Boolean (Optional)
+     *         }
+     *         attributes (Optional): {
+     *             enabled: Boolean (Optional)
+     *             nbf: Long (Optional)
+     *             exp: Long (Optional)
+     *             created: Long (Optional)
+     *             updated: Long (Optional)
+     *             recoverableDays: Integer (Optional)
+     *             recoveryLevel: String(Purgeable/Recoverable+Purgeable/Recoverable/Recoverable+ProtectedSubscription/CustomizedRecoverable+Purgeable/CustomizedRecoverable/CustomizedRecoverable+ProtectedSubscription) (Optional)
+     *         }
+     *     }
+     *     attributes (Optional): (recursive schema, see attributes above)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     issuer (Optional): {
+     *         name: String (Optional)
+     *         cty: String (Optional)
+     *         cert_transparency: Boolean (Optional)
+     *     }
+     *     csr: byte[] (Optional)
+     *     cancellation_requested: Boolean (Optional)
+     *     status: String (Optional)
+     *     status_details: String (Optional)
+     *     error (Optional): {
+     *         code: String (Optional)
+     *         message: String (Optional)
+     *         innererror (Optional): (recursive schema, see innererror above)
+     *     }
+     *     target: String (Optional)
+     *     request_id: String (Optional)
+     * }
+     * }
+     * 
* - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @param certificateName The name of the certificate. The value you provide may be copied globally for the purpose + * of running the service. The value provided should not include personally identifiable or sensitive information. + * @param parameters The parameters to create a certificate. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. * @return a certificate operation is returned in case of asynchronous requests along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response deleteCertificateOperationWithResponse(String vaultBaseUrl, - String certificateName, Context context) { + public Response createCertificateWithResponse(String certificateName, BinaryData parameters, + RequestOptions requestOptions) { + final String contentType = "application/json"; final String accept = "application/json"; - return service.deleteCertificateOperationSync(vaultBaseUrl, certificateName, this.getApiVersion(), accept, - context); + return service.createCertificateSync(this.getVaultBaseUrl(), this.getServiceVersion().getVersion(), + certificateName, contentType, accept, parameters, requestOptions, Context.NONE); } /** - * Deletes the creation operation for a specific certificate. - * - * Deletes the creation operation for a specified certificate that is in the process of being created. The - * certificate is no longer created. This operation requires the certificates/update permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a certificate operation is returned in case of asynchronous requests. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public CertificateOperation deleteCertificateOperation(String vaultBaseUrl, String certificateName) { - return deleteCertificateOperationWithResponse(vaultBaseUrl, certificateName, Context.NONE).getValue(); - } - - /** - * Merges a certificate or a certificate chain with a key pair existing on the server. - * - * The MergeCertificate operation performs the merging of a certificate or certificate chain with a key pair - * currently available in the service. This operation requires the certificates/create permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate. - * @param x509Certificates The certificate or the certificate chain to merge. - * @param certificateAttributes The attributes of the certificate (optional). - * @param tags Application specific metadata in the form of key-value pairs. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a certificate bundle consists of a certificate (X509) plus its attributes along with {@link Response} on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> mergeCertificateWithResponseAsync(String vaultBaseUrl, - String certificateName, List x509Certificates, CertificateAttributes certificateAttributes, - Map tags) { - return FluxUtil.withContext(context -> mergeCertificateWithResponseAsync(vaultBaseUrl, certificateName, - x509Certificates, certificateAttributes, tags, context)); - } - - /** - * Merges a certificate or a certificate chain with a key pair existing on the server. + * Imports a certificate into a specified key vault. * - * The MergeCertificate operation performs the merging of a certificate or certificate chain with a key pair - * currently available in the service. This operation requires the certificates/create permission. + * Imports an existing valid certificate, containing a private key, into Azure Key Vault. This operation requires + * the certificates/import permission. The certificate to be imported can be in either PFX or PEM format. If the + * certificate is in PEM format the PEM file must contain the key as well as x509 certificates. Key Vault will only + * accept a key in PKCS#8 format. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: String (Required)
+     *     pwd: String (Optional)
+     *     policy (Optional): {
+     *         id: String (Optional)
+     *         key_props (Optional): {
+     *             exportable: Boolean (Optional)
+     *             kty: String(EC/EC-HSM/RSA/RSA-HSM/oct/oct-HSM) (Optional)
+     *             key_size: Integer (Optional)
+     *             reuse_key: Boolean (Optional)
+     *             crv: String(P-256/P-384/P-521/P-256K) (Optional)
+     *         }
+     *         secret_props (Optional): {
+     *             contentType: String (Optional)
+     *         }
+     *         x509_props (Optional): {
+     *             subject: String (Optional)
+     *             ekus (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             sans (Optional): {
+     *                 emails (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 dns_names (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 upns (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *             }
+     *             key_usage (Optional): [
+     *                 String(digitalSignature/nonRepudiation/keyEncipherment/dataEncipherment/keyAgreement/keyCertSign/cRLSign/encipherOnly/decipherOnly) (Optional)
+     *             ]
+     *             validity_months: Integer (Optional)
+     *         }
+     *         lifetime_actions (Optional): [
+     *              (Optional){
+     *                 trigger (Optional): {
+     *                     lifetime_percentage: Integer (Optional)
+     *                     days_before_expiry: Integer (Optional)
+     *                 }
+     *                 action (Optional): {
+     *                     action_type: String(EmailContacts/AutoRenew) (Optional)
+     *                 }
+     *             }
+     *         ]
+     *         issuer (Optional): {
+     *             name: String (Optional)
+     *             cty: String (Optional)
+     *             cert_transparency: Boolean (Optional)
+     *         }
+     *         attributes (Optional): {
+     *             enabled: Boolean (Optional)
+     *             nbf: Long (Optional)
+     *             exp: Long (Optional)
+     *             created: Long (Optional)
+     *             updated: Long (Optional)
+     *             recoverableDays: Integer (Optional)
+     *             recoveryLevel: String(Purgeable/Recoverable+Purgeable/Recoverable/Recoverable+ProtectedSubscription/CustomizedRecoverable+Purgeable/CustomizedRecoverable/CustomizedRecoverable+ProtectedSubscription) (Optional)
+     *         }
+     *     }
+     *     attributes (Optional): (recursive schema, see attributes above)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     kid: String (Optional)
+     *     sid: String (Optional)
+     *     x5t: Base64Url (Optional)
+     *     policy (Optional): {
+     *         id: String (Optional)
+     *         key_props (Optional): {
+     *             exportable: Boolean (Optional)
+     *             kty: String(EC/EC-HSM/RSA/RSA-HSM/oct/oct-HSM) (Optional)
+     *             key_size: Integer (Optional)
+     *             reuse_key: Boolean (Optional)
+     *             crv: String(P-256/P-384/P-521/P-256K) (Optional)
+     *         }
+     *         secret_props (Optional): {
+     *             contentType: String (Optional)
+     *         }
+     *         x509_props (Optional): {
+     *             subject: String (Optional)
+     *             ekus (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             sans (Optional): {
+     *                 emails (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 dns_names (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 upns (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *             }
+     *             key_usage (Optional): [
+     *                 String(digitalSignature/nonRepudiation/keyEncipherment/dataEncipherment/keyAgreement/keyCertSign/cRLSign/encipherOnly/decipherOnly) (Optional)
+     *             ]
+     *             validity_months: Integer (Optional)
+     *         }
+     *         lifetime_actions (Optional): [
+     *              (Optional){
+     *                 trigger (Optional): {
+     *                     lifetime_percentage: Integer (Optional)
+     *                     days_before_expiry: Integer (Optional)
+     *                 }
+     *                 action (Optional): {
+     *                     action_type: String(EmailContacts/AutoRenew) (Optional)
+     *                 }
+     *             }
+     *         ]
+     *         issuer (Optional): {
+     *             name: String (Optional)
+     *             cty: String (Optional)
+     *             cert_transparency: Boolean (Optional)
+     *         }
+     *         attributes (Optional): {
+     *             enabled: Boolean (Optional)
+     *             nbf: Long (Optional)
+     *             exp: Long (Optional)
+     *             created: Long (Optional)
+     *             updated: Long (Optional)
+     *             recoverableDays: Integer (Optional)
+     *             recoveryLevel: String(Purgeable/Recoverable+Purgeable/Recoverable/Recoverable+ProtectedSubscription/CustomizedRecoverable+Purgeable/CustomizedRecoverable/CustomizedRecoverable+ProtectedSubscription) (Optional)
+     *         }
+     *     }
+     *     cer: byte[] (Optional)
+     *     contentType: String (Optional)
+     *     attributes (Optional): (recursive schema, see attributes above)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
* - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate. - * @param x509Certificates The certificate or the certificate chain to merge. - * @param certificateAttributes The attributes of the certificate (optional). - * @param tags Application specific metadata in the form of key-value pairs. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @param certificateName The name of the certificate. The value you provide may be copied globally for the purpose + * of running the service. The value provided should not include personally identifiable or sensitive information. + * @param parameters The parameters to import the certificate. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. * @return a certificate bundle consists of a certificate (X509) plus its attributes along with {@link Response} on * successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> mergeCertificateWithResponseAsync(String vaultBaseUrl, - String certificateName, List x509Certificates, CertificateAttributes certificateAttributes, - Map tags, Context context) { + public Mono> importCertificateWithResponseAsync(String certificateName, BinaryData parameters, + RequestOptions requestOptions) { + final String contentType = "application/json"; final String accept = "application/json"; - CertificateMergeParameters parameters = new CertificateMergeParameters(); - parameters.setX509Certificates(x509Certificates); - parameters.setCertificateAttributes(certificateAttributes); - parameters.setTags(tags); - return service.mergeCertificate(vaultBaseUrl, certificateName, this.getApiVersion(), parameters, accept, - context); - } - - /** - * Merges a certificate or a certificate chain with a key pair existing on the server. - * - * The MergeCertificate operation performs the merging of a certificate or certificate chain with a key pair - * currently available in the service. This operation requires the certificates/create permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate. - * @param x509Certificates The certificate or the certificate chain to merge. - * @param certificateAttributes The attributes of the certificate (optional). - * @param tags Application specific metadata in the form of key-value pairs. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a certificate bundle consists of a certificate (X509) plus its attributes on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono mergeCertificateAsync(String vaultBaseUrl, String certificateName, - List x509Certificates, CertificateAttributes certificateAttributes, Map tags) { - return mergeCertificateWithResponseAsync(vaultBaseUrl, certificateName, x509Certificates, certificateAttributes, - tags).flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Merges a certificate or a certificate chain with a key pair existing on the server. - * - * The MergeCertificate operation performs the merging of a certificate or certificate chain with a key pair - * currently available in the service. This operation requires the certificates/create permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate. - * @param x509Certificates The certificate or the certificate chain to merge. - * @param certificateAttributes The attributes of the certificate (optional). - * @param tags Application specific metadata in the form of key-value pairs. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a certificate bundle consists of a certificate (X509) plus its attributes on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono mergeCertificateAsync(String vaultBaseUrl, String certificateName, - List x509Certificates, CertificateAttributes certificateAttributes, Map tags, - Context context) { - return mergeCertificateWithResponseAsync(vaultBaseUrl, certificateName, x509Certificates, certificateAttributes, - tags, context).flatMap(res -> Mono.justOrEmpty(res.getValue())); + return FluxUtil.withContext( + context -> service.importCertificate(this.getVaultBaseUrl(), this.getServiceVersion().getVersion(), + certificateName, contentType, accept, parameters, requestOptions, context)); } /** - * Merges a certificate or a certificate chain with a key pair existing on the server. + * Imports a certificate into a specified key vault. * - * The MergeCertificate operation performs the merging of a certificate or certificate chain with a key pair - * currently available in the service. This operation requires the certificates/create permission. + * Imports an existing valid certificate, containing a private key, into Azure Key Vault. This operation requires + * the certificates/import permission. The certificate to be imported can be in either PFX or PEM format. If the + * certificate is in PEM format the PEM file must contain the key as well as x509 certificates. Key Vault will only + * accept a key in PKCS#8 format. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: String (Required)
+     *     pwd: String (Optional)
+     *     policy (Optional): {
+     *         id: String (Optional)
+     *         key_props (Optional): {
+     *             exportable: Boolean (Optional)
+     *             kty: String(EC/EC-HSM/RSA/RSA-HSM/oct/oct-HSM) (Optional)
+     *             key_size: Integer (Optional)
+     *             reuse_key: Boolean (Optional)
+     *             crv: String(P-256/P-384/P-521/P-256K) (Optional)
+     *         }
+     *         secret_props (Optional): {
+     *             contentType: String (Optional)
+     *         }
+     *         x509_props (Optional): {
+     *             subject: String (Optional)
+     *             ekus (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             sans (Optional): {
+     *                 emails (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 dns_names (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 upns (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *             }
+     *             key_usage (Optional): [
+     *                 String(digitalSignature/nonRepudiation/keyEncipherment/dataEncipherment/keyAgreement/keyCertSign/cRLSign/encipherOnly/decipherOnly) (Optional)
+     *             ]
+     *             validity_months: Integer (Optional)
+     *         }
+     *         lifetime_actions (Optional): [
+     *              (Optional){
+     *                 trigger (Optional): {
+     *                     lifetime_percentage: Integer (Optional)
+     *                     days_before_expiry: Integer (Optional)
+     *                 }
+     *                 action (Optional): {
+     *                     action_type: String(EmailContacts/AutoRenew) (Optional)
+     *                 }
+     *             }
+     *         ]
+     *         issuer (Optional): {
+     *             name: String (Optional)
+     *             cty: String (Optional)
+     *             cert_transparency: Boolean (Optional)
+     *         }
+     *         attributes (Optional): {
+     *             enabled: Boolean (Optional)
+     *             nbf: Long (Optional)
+     *             exp: Long (Optional)
+     *             created: Long (Optional)
+     *             updated: Long (Optional)
+     *             recoverableDays: Integer (Optional)
+     *             recoveryLevel: String(Purgeable/Recoverable+Purgeable/Recoverable/Recoverable+ProtectedSubscription/CustomizedRecoverable+Purgeable/CustomizedRecoverable/CustomizedRecoverable+ProtectedSubscription) (Optional)
+     *         }
+     *     }
+     *     attributes (Optional): (recursive schema, see attributes above)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     kid: String (Optional)
+     *     sid: String (Optional)
+     *     x5t: Base64Url (Optional)
+     *     policy (Optional): {
+     *         id: String (Optional)
+     *         key_props (Optional): {
+     *             exportable: Boolean (Optional)
+     *             kty: String(EC/EC-HSM/RSA/RSA-HSM/oct/oct-HSM) (Optional)
+     *             key_size: Integer (Optional)
+     *             reuse_key: Boolean (Optional)
+     *             crv: String(P-256/P-384/P-521/P-256K) (Optional)
+     *         }
+     *         secret_props (Optional): {
+     *             contentType: String (Optional)
+     *         }
+     *         x509_props (Optional): {
+     *             subject: String (Optional)
+     *             ekus (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             sans (Optional): {
+     *                 emails (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 dns_names (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 upns (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *             }
+     *             key_usage (Optional): [
+     *                 String(digitalSignature/nonRepudiation/keyEncipherment/dataEncipherment/keyAgreement/keyCertSign/cRLSign/encipherOnly/decipherOnly) (Optional)
+     *             ]
+     *             validity_months: Integer (Optional)
+     *         }
+     *         lifetime_actions (Optional): [
+     *              (Optional){
+     *                 trigger (Optional): {
+     *                     lifetime_percentage: Integer (Optional)
+     *                     days_before_expiry: Integer (Optional)
+     *                 }
+     *                 action (Optional): {
+     *                     action_type: String(EmailContacts/AutoRenew) (Optional)
+     *                 }
+     *             }
+     *         ]
+     *         issuer (Optional): {
+     *             name: String (Optional)
+     *             cty: String (Optional)
+     *             cert_transparency: Boolean (Optional)
+     *         }
+     *         attributes (Optional): {
+     *             enabled: Boolean (Optional)
+     *             nbf: Long (Optional)
+     *             exp: Long (Optional)
+     *             created: Long (Optional)
+     *             updated: Long (Optional)
+     *             recoverableDays: Integer (Optional)
+     *             recoveryLevel: String(Purgeable/Recoverable+Purgeable/Recoverable/Recoverable+ProtectedSubscription/CustomizedRecoverable+Purgeable/CustomizedRecoverable/CustomizedRecoverable+ProtectedSubscription) (Optional)
+     *         }
+     *     }
+     *     cer: byte[] (Optional)
+     *     contentType: String (Optional)
+     *     attributes (Optional): (recursive schema, see attributes above)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
* - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate. - * @param x509Certificates The certificate or the certificate chain to merge. - * @param certificateAttributes The attributes of the certificate (optional). - * @param tags Application specific metadata in the form of key-value pairs. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @param certificateName The name of the certificate. The value you provide may be copied globally for the purpose + * of running the service. The value provided should not include personally identifiable or sensitive information. + * @param parameters The parameters to import the certificate. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. * @return a certificate bundle consists of a certificate (X509) plus its attributes along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response mergeCertificateWithResponse(String vaultBaseUrl, String certificateName, - List x509Certificates, CertificateAttributes certificateAttributes, Map tags, - Context context) { - final String accept = "application/json"; - CertificateMergeParameters parameters = new CertificateMergeParameters(); - parameters.setX509Certificates(x509Certificates); - parameters.setCertificateAttributes(certificateAttributes); - parameters.setTags(tags); - return service.mergeCertificateSync(vaultBaseUrl, certificateName, this.getApiVersion(), parameters, accept, - context); - } - - /** - * Merges a certificate or a certificate chain with a key pair existing on the server. - * - * The MergeCertificate operation performs the merging of a certificate or certificate chain with a key pair - * currently available in the service. This operation requires the certificates/create permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate. - * @param x509Certificates The certificate or the certificate chain to merge. - * @param certificateAttributes The attributes of the certificate (optional). - * @param tags Application specific metadata in the form of key-value pairs. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a certificate bundle consists of a certificate (X509) plus its attributes. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public CertificateBundle mergeCertificate(String vaultBaseUrl, String certificateName, - List x509Certificates, CertificateAttributes certificateAttributes, Map tags) { - return mergeCertificateWithResponse(vaultBaseUrl, certificateName, x509Certificates, certificateAttributes, - tags, Context.NONE).getValue(); - } - - /** - * Backs up the specified certificate. - * - * Requests that a backup of the specified certificate be downloaded to the client. All versions of the certificate - * will be downloaded. This operation requires the certificates/backup permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the backup certificate result, containing the backup blob along with {@link Response} on successful - * completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> backupCertificateWithResponseAsync(String vaultBaseUrl, - String certificateName) { - return FluxUtil - .withContext(context -> backupCertificateWithResponseAsync(vaultBaseUrl, certificateName, context)); + public Response importCertificateWithResponse(String certificateName, BinaryData parameters, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.importCertificateSync(this.getVaultBaseUrl(), this.getServiceVersion().getVersion(), + certificateName, contentType, accept, parameters, requestOptions, Context.NONE); } /** - * Backs up the specified certificate. + * List the versions of a certificate. * - * Requests that a backup of the specified certificate be downloaded to the client. All versions of the certificate - * will be downloaded. This operation requires the certificates/backup permission. + * The GetCertificateVersions operation returns the versions of a certificate in the specified key vault. This + * operation requires the certificates/list permission. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
maxresultsIntegerNoMaximum number of results to return in a page. If not + * specified the service will return up to 25 results.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     attributes (Optional): {
+     *         enabled: Boolean (Optional)
+     *         nbf: Long (Optional)
+     *         exp: Long (Optional)
+     *         created: Long (Optional)
+     *         updated: Long (Optional)
+     *         recoverableDays: Integer (Optional)
+     *         recoveryLevel: String(Purgeable/Recoverable+Purgeable/Recoverable/Recoverable+ProtectedSubscription/CustomizedRecoverable+Purgeable/CustomizedRecoverable/CustomizedRecoverable+ProtectedSubscription) (Optional)
+     *     }
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     x5t: Base64Url (Optional)
+     * }
+     * }
+     * 
* - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. * @param certificateName The name of the certificate. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the backup certificate result, containing the backup blob along with {@link Response} on successful - * completion of {@link Mono}. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the certificate list result along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> backupCertificateWithResponseAsync(String vaultBaseUrl, - String certificateName, Context context) { + private Mono> getCertificateVersionsSinglePageAsync(String certificateName, + RequestOptions requestOptions) { final String accept = "application/json"; - return service.backupCertificate(vaultBaseUrl, certificateName, this.getApiVersion(), accept, context); + return FluxUtil + .withContext(context -> service.getCertificateVersions(this.getVaultBaseUrl(), + this.getServiceVersion().getVersion(), certificateName, accept, requestOptions, context)) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); } /** - * Backs up the specified certificate. + * List the versions of a certificate. * - * Requests that a backup of the specified certificate be downloaded to the client. All versions of the certificate - * will be downloaded. This operation requires the certificates/backup permission. + * The GetCertificateVersions operation returns the versions of a certificate in the specified key vault. This + * operation requires the certificates/list permission. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
maxresultsIntegerNoMaximum number of results to return in a page. If not + * specified the service will return up to 25 results.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     attributes (Optional): {
+     *         enabled: Boolean (Optional)
+     *         nbf: Long (Optional)
+     *         exp: Long (Optional)
+     *         created: Long (Optional)
+     *         updated: Long (Optional)
+     *         recoverableDays: Integer (Optional)
+     *         recoveryLevel: String(Purgeable/Recoverable+Purgeable/Recoverable/Recoverable+ProtectedSubscription/CustomizedRecoverable+Purgeable/CustomizedRecoverable/CustomizedRecoverable+ProtectedSubscription) (Optional)
+     *     }
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     x5t: Base64Url (Optional)
+     * }
+     * }
+     * 
* - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. * @param certificateName The name of the certificate. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the backup certificate result, containing the backup blob on successful completion of {@link Mono}. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the certificate list result as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono backupCertificateAsync(String vaultBaseUrl, String certificateName) { - return backupCertificateWithResponseAsync(vaultBaseUrl, certificateName) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux getCertificateVersionsAsync(String certificateName, RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedFlux<>(() -> getCertificateVersionsSinglePageAsync(certificateName, requestOptions), + nextLink -> getCertificateVersionsNextSinglePageAsync(nextLink, requestOptionsForNextPage)); } /** - * Backs up the specified certificate. + * List the versions of a certificate. * - * Requests that a backup of the specified certificate be downloaded to the client. All versions of the certificate - * will be downloaded. This operation requires the certificates/backup permission. + * The GetCertificateVersions operation returns the versions of a certificate in the specified key vault. This + * operation requires the certificates/list permission. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
maxresultsIntegerNoMaximum number of results to return in a page. If not + * specified the service will return up to 25 results.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     attributes (Optional): {
+     *         enabled: Boolean (Optional)
+     *         nbf: Long (Optional)
+     *         exp: Long (Optional)
+     *         created: Long (Optional)
+     *         updated: Long (Optional)
+     *         recoverableDays: Integer (Optional)
+     *         recoveryLevel: String(Purgeable/Recoverable+Purgeable/Recoverable/Recoverable+ProtectedSubscription/CustomizedRecoverable+Purgeable/CustomizedRecoverable/CustomizedRecoverable+ProtectedSubscription) (Optional)
+     *     }
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     x5t: Base64Url (Optional)
+     * }
+     * }
+     * 
* - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. * @param certificateName The name of the certificate. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the backup certificate result, containing the backup blob on successful completion of {@link Mono}. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the certificate list result along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono backupCertificateAsync(String vaultBaseUrl, String certificateName, - Context context) { - return backupCertificateWithResponseAsync(vaultBaseUrl, certificateName, context) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); + private PagedResponse getCertificateVersionsSinglePage(String certificateName, + RequestOptions requestOptions) { + final String accept = "application/json"; + Response res = service.getCertificateVersionsSync(this.getVaultBaseUrl(), + this.getServiceVersion().getVersion(), certificateName, accept, requestOptions, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); } /** - * Backs up the specified certificate. + * List the versions of a certificate. * - * Requests that a backup of the specified certificate be downloaded to the client. All versions of the certificate - * will be downloaded. This operation requires the certificates/backup permission. + * The GetCertificateVersions operation returns the versions of a certificate in the specified key vault. This + * operation requires the certificates/list permission. + *

Query Parameters

+ * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
maxresultsIntegerNoMaximum number of results to return in a page. If not + * specified the service will return up to 25 results.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     attributes (Optional): {
+     *         enabled: Boolean (Optional)
+     *         nbf: Long (Optional)
+     *         exp: Long (Optional)
+     *         created: Long (Optional)
+     *         updated: Long (Optional)
+     *         recoverableDays: Integer (Optional)
+     *         recoveryLevel: String(Purgeable/Recoverable+Purgeable/Recoverable/Recoverable+ProtectedSubscription/CustomizedRecoverable+Purgeable/CustomizedRecoverable/CustomizedRecoverable+ProtectedSubscription) (Optional)
+     *     }
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     x5t: Base64Url (Optional)
+     * }
+     * }
+     * 
* - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. * @param certificateName The name of the certificate. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the backup certificate result, containing the backup blob along with {@link Response}. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the certificate list result as paginated response with {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response backupCertificateWithResponse(String vaultBaseUrl, String certificateName, - Context context) { - final String accept = "application/json"; - return service.backupCertificateSync(vaultBaseUrl, certificateName, this.getApiVersion(), accept, context); + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getCertificateVersions(String certificateName, RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedIterable<>(() -> getCertificateVersionsSinglePage(certificateName, requestOptions), + nextLink -> getCertificateVersionsNextSinglePage(nextLink, requestOptionsForNextPage)); } /** - * Backs up the specified certificate. + * Lists the policy for a certificate. * - * Requests that a backup of the specified certificate be downloaded to the client. All versions of the certificate - * will be downloaded. This operation requires the certificates/backup permission. + * The GetCertificatePolicy operation returns the specified certificate policy resources in the specified key vault. + * This operation requires the certificates/get permission. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     key_props (Optional): {
+     *         exportable: Boolean (Optional)
+     *         kty: String(EC/EC-HSM/RSA/RSA-HSM/oct/oct-HSM) (Optional)
+     *         key_size: Integer (Optional)
+     *         reuse_key: Boolean (Optional)
+     *         crv: String(P-256/P-384/P-521/P-256K) (Optional)
+     *     }
+     *     secret_props (Optional): {
+     *         contentType: String (Optional)
+     *     }
+     *     x509_props (Optional): {
+     *         subject: String (Optional)
+     *         ekus (Optional): [
+     *             String (Optional)
+     *         ]
+     *         sans (Optional): {
+     *             emails (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             dns_names (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             upns (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *         key_usage (Optional): [
+     *             String(digitalSignature/nonRepudiation/keyEncipherment/dataEncipherment/keyAgreement/keyCertSign/cRLSign/encipherOnly/decipherOnly) (Optional)
+     *         ]
+     *         validity_months: Integer (Optional)
+     *     }
+     *     lifetime_actions (Optional): [
+     *          (Optional){
+     *             trigger (Optional): {
+     *                 lifetime_percentage: Integer (Optional)
+     *                 days_before_expiry: Integer (Optional)
+     *             }
+     *             action (Optional): {
+     *                 action_type: String(EmailContacts/AutoRenew) (Optional)
+     *             }
+     *         }
+     *     ]
+     *     issuer (Optional): {
+     *         name: String (Optional)
+     *         cty: String (Optional)
+     *         cert_transparency: Boolean (Optional)
+     *     }
+     *     attributes (Optional): {
+     *         enabled: Boolean (Optional)
+     *         nbf: Long (Optional)
+     *         exp: Long (Optional)
+     *         created: Long (Optional)
+     *         updated: Long (Optional)
+     *         recoverableDays: Integer (Optional)
+     *         recoveryLevel: String(Purgeable/Recoverable+Purgeable/Recoverable/Recoverable+ProtectedSubscription/CustomizedRecoverable+Purgeable/CustomizedRecoverable/CustomizedRecoverable+ProtectedSubscription) (Optional)
+     *     }
+     * }
+     * }
+     * 
* - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the backup certificate result, containing the backup blob. + * @param certificateName The name of the certificate in a given key vault. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return management policy for a certificate along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public BackupCertificateResult backupCertificate(String vaultBaseUrl, String certificateName) { - return backupCertificateWithResponse(vaultBaseUrl, certificateName, Context.NONE).getValue(); + public Mono> getCertificatePolicyWithResponseAsync(String certificateName, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.getCertificatePolicy(this.getVaultBaseUrl(), + this.getServiceVersion().getVersion(), certificateName, accept, requestOptions, context)); } /** - * Restores a backed up certificate to a vault. + * Lists the policy for a certificate. * - * Restores a backed up certificate, and all its versions, to a vault. This operation requires the - * certificates/restore permission. + * The GetCertificatePolicy operation returns the specified certificate policy resources in the specified key vault. + * This operation requires the certificates/get permission. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     key_props (Optional): {
+     *         exportable: Boolean (Optional)
+     *         kty: String(EC/EC-HSM/RSA/RSA-HSM/oct/oct-HSM) (Optional)
+     *         key_size: Integer (Optional)
+     *         reuse_key: Boolean (Optional)
+     *         crv: String(P-256/P-384/P-521/P-256K) (Optional)
+     *     }
+     *     secret_props (Optional): {
+     *         contentType: String (Optional)
+     *     }
+     *     x509_props (Optional): {
+     *         subject: String (Optional)
+     *         ekus (Optional): [
+     *             String (Optional)
+     *         ]
+     *         sans (Optional): {
+     *             emails (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             dns_names (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             upns (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *         key_usage (Optional): [
+     *             String(digitalSignature/nonRepudiation/keyEncipherment/dataEncipherment/keyAgreement/keyCertSign/cRLSign/encipherOnly/decipherOnly) (Optional)
+     *         ]
+     *         validity_months: Integer (Optional)
+     *     }
+     *     lifetime_actions (Optional): [
+     *          (Optional){
+     *             trigger (Optional): {
+     *                 lifetime_percentage: Integer (Optional)
+     *                 days_before_expiry: Integer (Optional)
+     *             }
+     *             action (Optional): {
+     *                 action_type: String(EmailContacts/AutoRenew) (Optional)
+     *             }
+     *         }
+     *     ]
+     *     issuer (Optional): {
+     *         name: String (Optional)
+     *         cty: String (Optional)
+     *         cert_transparency: Boolean (Optional)
+     *     }
+     *     attributes (Optional): {
+     *         enabled: Boolean (Optional)
+     *         nbf: Long (Optional)
+     *         exp: Long (Optional)
+     *         created: Long (Optional)
+     *         updated: Long (Optional)
+     *         recoverableDays: Integer (Optional)
+     *         recoveryLevel: String(Purgeable/Recoverable+Purgeable/Recoverable/Recoverable+ProtectedSubscription/CustomizedRecoverable+Purgeable/CustomizedRecoverable/CustomizedRecoverable+ProtectedSubscription) (Optional)
+     *     }
+     * }
+     * }
+     * 
* - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateBundleBackup The backup blob associated with a certificate bundle. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a certificate bundle consists of a certificate (X509) plus its attributes along with {@link Response} on - * successful completion of {@link Mono}. + * @param certificateName The name of the certificate in a given key vault. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return management policy for a certificate along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> restoreCertificateWithResponseAsync(String vaultBaseUrl, - byte[] certificateBundleBackup) { - return FluxUtil.withContext( - context -> restoreCertificateWithResponseAsync(vaultBaseUrl, certificateBundleBackup, context)); + public Response getCertificatePolicyWithResponse(String certificateName, + RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getCertificatePolicySync(this.getVaultBaseUrl(), this.getServiceVersion().getVersion(), + certificateName, accept, requestOptions, Context.NONE); } /** - * Restores a backed up certificate to a vault. + * Updates the policy for a certificate. * - * Restores a backed up certificate, and all its versions, to a vault. This operation requires the - * certificates/restore permission. + * Set specified members in the certificate policy. Leave others as null. This operation requires the + * certificates/update permission. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     key_props (Optional): {
+     *         exportable: Boolean (Optional)
+     *         kty: String(EC/EC-HSM/RSA/RSA-HSM/oct/oct-HSM) (Optional)
+     *         key_size: Integer (Optional)
+     *         reuse_key: Boolean (Optional)
+     *         crv: String(P-256/P-384/P-521/P-256K) (Optional)
+     *     }
+     *     secret_props (Optional): {
+     *         contentType: String (Optional)
+     *     }
+     *     x509_props (Optional): {
+     *         subject: String (Optional)
+     *         ekus (Optional): [
+     *             String (Optional)
+     *         ]
+     *         sans (Optional): {
+     *             emails (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             dns_names (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             upns (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *         key_usage (Optional): [
+     *             String(digitalSignature/nonRepudiation/keyEncipherment/dataEncipherment/keyAgreement/keyCertSign/cRLSign/encipherOnly/decipherOnly) (Optional)
+     *         ]
+     *         validity_months: Integer (Optional)
+     *     }
+     *     lifetime_actions (Optional): [
+     *          (Optional){
+     *             trigger (Optional): {
+     *                 lifetime_percentage: Integer (Optional)
+     *                 days_before_expiry: Integer (Optional)
+     *             }
+     *             action (Optional): {
+     *                 action_type: String(EmailContacts/AutoRenew) (Optional)
+     *             }
+     *         }
+     *     ]
+     *     issuer (Optional): {
+     *         name: String (Optional)
+     *         cty: String (Optional)
+     *         cert_transparency: Boolean (Optional)
+     *     }
+     *     attributes (Optional): {
+     *         enabled: Boolean (Optional)
+     *         nbf: Long (Optional)
+     *         exp: Long (Optional)
+     *         created: Long (Optional)
+     *         updated: Long (Optional)
+     *         recoverableDays: Integer (Optional)
+     *         recoveryLevel: String(Purgeable/Recoverable+Purgeable/Recoverable/Recoverable+ProtectedSubscription/CustomizedRecoverable+Purgeable/CustomizedRecoverable/CustomizedRecoverable+ProtectedSubscription) (Optional)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     key_props (Optional): {
+     *         exportable: Boolean (Optional)
+     *         kty: String(EC/EC-HSM/RSA/RSA-HSM/oct/oct-HSM) (Optional)
+     *         key_size: Integer (Optional)
+     *         reuse_key: Boolean (Optional)
+     *         crv: String(P-256/P-384/P-521/P-256K) (Optional)
+     *     }
+     *     secret_props (Optional): {
+     *         contentType: String (Optional)
+     *     }
+     *     x509_props (Optional): {
+     *         subject: String (Optional)
+     *         ekus (Optional): [
+     *             String (Optional)
+     *         ]
+     *         sans (Optional): {
+     *             emails (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             dns_names (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             upns (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *         key_usage (Optional): [
+     *             String(digitalSignature/nonRepudiation/keyEncipherment/dataEncipherment/keyAgreement/keyCertSign/cRLSign/encipherOnly/decipherOnly) (Optional)
+     *         ]
+     *         validity_months: Integer (Optional)
+     *     }
+     *     lifetime_actions (Optional): [
+     *          (Optional){
+     *             trigger (Optional): {
+     *                 lifetime_percentage: Integer (Optional)
+     *                 days_before_expiry: Integer (Optional)
+     *             }
+     *             action (Optional): {
+     *                 action_type: String(EmailContacts/AutoRenew) (Optional)
+     *             }
+     *         }
+     *     ]
+     *     issuer (Optional): {
+     *         name: String (Optional)
+     *         cty: String (Optional)
+     *         cert_transparency: Boolean (Optional)
+     *     }
+     *     attributes (Optional): {
+     *         enabled: Boolean (Optional)
+     *         nbf: Long (Optional)
+     *         exp: Long (Optional)
+     *         created: Long (Optional)
+     *         updated: Long (Optional)
+     *         recoverableDays: Integer (Optional)
+     *         recoveryLevel: String(Purgeable/Recoverable+Purgeable/Recoverable/Recoverable+ProtectedSubscription/CustomizedRecoverable+Purgeable/CustomizedRecoverable/CustomizedRecoverable+ProtectedSubscription) (Optional)
+     *     }
+     * }
+     * }
+     * 
* - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateBundleBackup The backup blob associated with a certificate bundle. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a certificate bundle consists of a certificate (X509) plus its attributes along with {@link Response} on - * successful completion of {@link Mono}. + * @param certificateName The name of the certificate in the given vault. + * @param certificatePolicy The policy for the certificate. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return management policy for a certificate along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> restoreCertificateWithResponseAsync(String vaultBaseUrl, - byte[] certificateBundleBackup, Context context) { + public Mono> updateCertificatePolicyWithResponseAsync(String certificateName, + BinaryData certificatePolicy, RequestOptions requestOptions) { + final String contentType = "application/json"; final String accept = "application/json"; - CertificateRestoreParameters parameters = new CertificateRestoreParameters(); - parameters.setCertificateBundleBackup(certificateBundleBackup); - return service.restoreCertificate(vaultBaseUrl, this.getApiVersion(), parameters, accept, context); + return FluxUtil.withContext( + context -> service.updateCertificatePolicy(this.getVaultBaseUrl(), this.getServiceVersion().getVersion(), + certificateName, contentType, accept, certificatePolicy, requestOptions, context)); } /** - * Restores a backed up certificate to a vault. + * Updates the policy for a certificate. * - * Restores a backed up certificate, and all its versions, to a vault. This operation requires the - * certificates/restore permission. + * Set specified members in the certificate policy. Leave others as null. This operation requires the + * certificates/update permission. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     key_props (Optional): {
+     *         exportable: Boolean (Optional)
+     *         kty: String(EC/EC-HSM/RSA/RSA-HSM/oct/oct-HSM) (Optional)
+     *         key_size: Integer (Optional)
+     *         reuse_key: Boolean (Optional)
+     *         crv: String(P-256/P-384/P-521/P-256K) (Optional)
+     *     }
+     *     secret_props (Optional): {
+     *         contentType: String (Optional)
+     *     }
+     *     x509_props (Optional): {
+     *         subject: String (Optional)
+     *         ekus (Optional): [
+     *             String (Optional)
+     *         ]
+     *         sans (Optional): {
+     *             emails (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             dns_names (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             upns (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *         key_usage (Optional): [
+     *             String(digitalSignature/nonRepudiation/keyEncipherment/dataEncipherment/keyAgreement/keyCertSign/cRLSign/encipherOnly/decipherOnly) (Optional)
+     *         ]
+     *         validity_months: Integer (Optional)
+     *     }
+     *     lifetime_actions (Optional): [
+     *          (Optional){
+     *             trigger (Optional): {
+     *                 lifetime_percentage: Integer (Optional)
+     *                 days_before_expiry: Integer (Optional)
+     *             }
+     *             action (Optional): {
+     *                 action_type: String(EmailContacts/AutoRenew) (Optional)
+     *             }
+     *         }
+     *     ]
+     *     issuer (Optional): {
+     *         name: String (Optional)
+     *         cty: String (Optional)
+     *         cert_transparency: Boolean (Optional)
+     *     }
+     *     attributes (Optional): {
+     *         enabled: Boolean (Optional)
+     *         nbf: Long (Optional)
+     *         exp: Long (Optional)
+     *         created: Long (Optional)
+     *         updated: Long (Optional)
+     *         recoverableDays: Integer (Optional)
+     *         recoveryLevel: String(Purgeable/Recoverable+Purgeable/Recoverable/Recoverable+ProtectedSubscription/CustomizedRecoverable+Purgeable/CustomizedRecoverable/CustomizedRecoverable+ProtectedSubscription) (Optional)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     key_props (Optional): {
+     *         exportable: Boolean (Optional)
+     *         kty: String(EC/EC-HSM/RSA/RSA-HSM/oct/oct-HSM) (Optional)
+     *         key_size: Integer (Optional)
+     *         reuse_key: Boolean (Optional)
+     *         crv: String(P-256/P-384/P-521/P-256K) (Optional)
+     *     }
+     *     secret_props (Optional): {
+     *         contentType: String (Optional)
+     *     }
+     *     x509_props (Optional): {
+     *         subject: String (Optional)
+     *         ekus (Optional): [
+     *             String (Optional)
+     *         ]
+     *         sans (Optional): {
+     *             emails (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             dns_names (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             upns (Optional): [
+     *                 String (Optional)
+     *             ]
+     *         }
+     *         key_usage (Optional): [
+     *             String(digitalSignature/nonRepudiation/keyEncipherment/dataEncipherment/keyAgreement/keyCertSign/cRLSign/encipherOnly/decipherOnly) (Optional)
+     *         ]
+     *         validity_months: Integer (Optional)
+     *     }
+     *     lifetime_actions (Optional): [
+     *          (Optional){
+     *             trigger (Optional): {
+     *                 lifetime_percentage: Integer (Optional)
+     *                 days_before_expiry: Integer (Optional)
+     *             }
+     *             action (Optional): {
+     *                 action_type: String(EmailContacts/AutoRenew) (Optional)
+     *             }
+     *         }
+     *     ]
+     *     issuer (Optional): {
+     *         name: String (Optional)
+     *         cty: String (Optional)
+     *         cert_transparency: Boolean (Optional)
+     *     }
+     *     attributes (Optional): {
+     *         enabled: Boolean (Optional)
+     *         nbf: Long (Optional)
+     *         exp: Long (Optional)
+     *         created: Long (Optional)
+     *         updated: Long (Optional)
+     *         recoverableDays: Integer (Optional)
+     *         recoveryLevel: String(Purgeable/Recoverable+Purgeable/Recoverable/Recoverable+ProtectedSubscription/CustomizedRecoverable+Purgeable/CustomizedRecoverable/CustomizedRecoverable+ProtectedSubscription) (Optional)
+     *     }
+     * }
+     * }
+     * 
* - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateBundleBackup The backup blob associated with a certificate bundle. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a certificate bundle consists of a certificate (X509) plus its attributes on successful completion of - * {@link Mono}. + * @param certificateName The name of the certificate in the given vault. + * @param certificatePolicy The policy for the certificate. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return management policy for a certificate along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono restoreCertificateAsync(String vaultBaseUrl, byte[] certificateBundleBackup) { - return restoreCertificateWithResponseAsync(vaultBaseUrl, certificateBundleBackup) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); + public Response updateCertificatePolicyWithResponse(String certificateName, + BinaryData certificatePolicy, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateCertificatePolicySync(this.getVaultBaseUrl(), this.getServiceVersion().getVersion(), + certificateName, contentType, accept, certificatePolicy, requestOptions, Context.NONE); } /** - * Restores a backed up certificate to a vault. + * Updates the specified attributes associated with the given certificate. * - * Restores a backed up certificate, and all its versions, to a vault. This operation requires the - * certificates/restore permission. + * The UpdateCertificate operation applies the specified update on the given certificate; the only elements updated + * are the certificate's attributes. This operation requires the certificates/update permission. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     policy (Optional): {
+     *         id: String (Optional)
+     *         key_props (Optional): {
+     *             exportable: Boolean (Optional)
+     *             kty: String(EC/EC-HSM/RSA/RSA-HSM/oct/oct-HSM) (Optional)
+     *             key_size: Integer (Optional)
+     *             reuse_key: Boolean (Optional)
+     *             crv: String(P-256/P-384/P-521/P-256K) (Optional)
+     *         }
+     *         secret_props (Optional): {
+     *             contentType: String (Optional)
+     *         }
+     *         x509_props (Optional): {
+     *             subject: String (Optional)
+     *             ekus (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             sans (Optional): {
+     *                 emails (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 dns_names (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 upns (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *             }
+     *             key_usage (Optional): [
+     *                 String(digitalSignature/nonRepudiation/keyEncipherment/dataEncipherment/keyAgreement/keyCertSign/cRLSign/encipherOnly/decipherOnly) (Optional)
+     *             ]
+     *             validity_months: Integer (Optional)
+     *         }
+     *         lifetime_actions (Optional): [
+     *              (Optional){
+     *                 trigger (Optional): {
+     *                     lifetime_percentage: Integer (Optional)
+     *                     days_before_expiry: Integer (Optional)
+     *                 }
+     *                 action (Optional): {
+     *                     action_type: String(EmailContacts/AutoRenew) (Optional)
+     *                 }
+     *             }
+     *         ]
+     *         issuer (Optional): {
+     *             name: String (Optional)
+     *             cty: String (Optional)
+     *             cert_transparency: Boolean (Optional)
+     *         }
+     *         attributes (Optional): {
+     *             enabled: Boolean (Optional)
+     *             nbf: Long (Optional)
+     *             exp: Long (Optional)
+     *             created: Long (Optional)
+     *             updated: Long (Optional)
+     *             recoverableDays: Integer (Optional)
+     *             recoveryLevel: String(Purgeable/Recoverable+Purgeable/Recoverable/Recoverable+ProtectedSubscription/CustomizedRecoverable+Purgeable/CustomizedRecoverable/CustomizedRecoverable+ProtectedSubscription) (Optional)
+     *         }
+     *     }
+     *     attributes (Optional): (recursive schema, see attributes above)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     kid: String (Optional)
+     *     sid: String (Optional)
+     *     x5t: Base64Url (Optional)
+     *     policy (Optional): {
+     *         id: String (Optional)
+     *         key_props (Optional): {
+     *             exportable: Boolean (Optional)
+     *             kty: String(EC/EC-HSM/RSA/RSA-HSM/oct/oct-HSM) (Optional)
+     *             key_size: Integer (Optional)
+     *             reuse_key: Boolean (Optional)
+     *             crv: String(P-256/P-384/P-521/P-256K) (Optional)
+     *         }
+     *         secret_props (Optional): {
+     *             contentType: String (Optional)
+     *         }
+     *         x509_props (Optional): {
+     *             subject: String (Optional)
+     *             ekus (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             sans (Optional): {
+     *                 emails (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 dns_names (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 upns (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *             }
+     *             key_usage (Optional): [
+     *                 String(digitalSignature/nonRepudiation/keyEncipherment/dataEncipherment/keyAgreement/keyCertSign/cRLSign/encipherOnly/decipherOnly) (Optional)
+     *             ]
+     *             validity_months: Integer (Optional)
+     *         }
+     *         lifetime_actions (Optional): [
+     *              (Optional){
+     *                 trigger (Optional): {
+     *                     lifetime_percentage: Integer (Optional)
+     *                     days_before_expiry: Integer (Optional)
+     *                 }
+     *                 action (Optional): {
+     *                     action_type: String(EmailContacts/AutoRenew) (Optional)
+     *                 }
+     *             }
+     *         ]
+     *         issuer (Optional): {
+     *             name: String (Optional)
+     *             cty: String (Optional)
+     *             cert_transparency: Boolean (Optional)
+     *         }
+     *         attributes (Optional): {
+     *             enabled: Boolean (Optional)
+     *             nbf: Long (Optional)
+     *             exp: Long (Optional)
+     *             created: Long (Optional)
+     *             updated: Long (Optional)
+     *             recoverableDays: Integer (Optional)
+     *             recoveryLevel: String(Purgeable/Recoverable+Purgeable/Recoverable/Recoverable+ProtectedSubscription/CustomizedRecoverable+Purgeable/CustomizedRecoverable/CustomizedRecoverable+ProtectedSubscription) (Optional)
+     *         }
+     *     }
+     *     cer: byte[] (Optional)
+     *     contentType: String (Optional)
+     *     attributes (Optional): (recursive schema, see attributes above)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
* - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateBundleBackup The backup blob associated with a certificate bundle. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a certificate bundle consists of a certificate (X509) plus its attributes on successful completion of - * {@link Mono}. + * @param certificateName The name of the certificate in the given key vault. + * @param certificateVersion The version of the certificate. + * @param parameters The parameters for certificate update. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a certificate bundle consists of a certificate (X509) plus its attributes along with {@link Response} on + * successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono restoreCertificateAsync(String vaultBaseUrl, byte[] certificateBundleBackup, - Context context) { - return restoreCertificateWithResponseAsync(vaultBaseUrl, certificateBundleBackup, context) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); + public Mono> updateCertificateWithResponseAsync(String certificateName, + String certificateVersion, BinaryData parameters, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.updateCertificate(this.getVaultBaseUrl(), this.getServiceVersion().getVersion(), + certificateName, certificateVersion, contentType, accept, parameters, requestOptions, context)); } /** - * Restores a backed up certificate to a vault. + * Updates the specified attributes associated with the given certificate. * - * Restores a backed up certificate, and all its versions, to a vault. This operation requires the - * certificates/restore permission. + * The UpdateCertificate operation applies the specified update on the given certificate; the only elements updated + * are the certificate's attributes. This operation requires the certificates/update permission. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     policy (Optional): {
+     *         id: String (Optional)
+     *         key_props (Optional): {
+     *             exportable: Boolean (Optional)
+     *             kty: String(EC/EC-HSM/RSA/RSA-HSM/oct/oct-HSM) (Optional)
+     *             key_size: Integer (Optional)
+     *             reuse_key: Boolean (Optional)
+     *             crv: String(P-256/P-384/P-521/P-256K) (Optional)
+     *         }
+     *         secret_props (Optional): {
+     *             contentType: String (Optional)
+     *         }
+     *         x509_props (Optional): {
+     *             subject: String (Optional)
+     *             ekus (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             sans (Optional): {
+     *                 emails (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 dns_names (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 upns (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *             }
+     *             key_usage (Optional): [
+     *                 String(digitalSignature/nonRepudiation/keyEncipherment/dataEncipherment/keyAgreement/keyCertSign/cRLSign/encipherOnly/decipherOnly) (Optional)
+     *             ]
+     *             validity_months: Integer (Optional)
+     *         }
+     *         lifetime_actions (Optional): [
+     *              (Optional){
+     *                 trigger (Optional): {
+     *                     lifetime_percentage: Integer (Optional)
+     *                     days_before_expiry: Integer (Optional)
+     *                 }
+     *                 action (Optional): {
+     *                     action_type: String(EmailContacts/AutoRenew) (Optional)
+     *                 }
+     *             }
+     *         ]
+     *         issuer (Optional): {
+     *             name: String (Optional)
+     *             cty: String (Optional)
+     *             cert_transparency: Boolean (Optional)
+     *         }
+     *         attributes (Optional): {
+     *             enabled: Boolean (Optional)
+     *             nbf: Long (Optional)
+     *             exp: Long (Optional)
+     *             created: Long (Optional)
+     *             updated: Long (Optional)
+     *             recoverableDays: Integer (Optional)
+     *             recoveryLevel: String(Purgeable/Recoverable+Purgeable/Recoverable/Recoverable+ProtectedSubscription/CustomizedRecoverable+Purgeable/CustomizedRecoverable/CustomizedRecoverable+ProtectedSubscription) (Optional)
+     *         }
+     *     }
+     *     attributes (Optional): (recursive schema, see attributes above)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     kid: String (Optional)
+     *     sid: String (Optional)
+     *     x5t: Base64Url (Optional)
+     *     policy (Optional): {
+     *         id: String (Optional)
+     *         key_props (Optional): {
+     *             exportable: Boolean (Optional)
+     *             kty: String(EC/EC-HSM/RSA/RSA-HSM/oct/oct-HSM) (Optional)
+     *             key_size: Integer (Optional)
+     *             reuse_key: Boolean (Optional)
+     *             crv: String(P-256/P-384/P-521/P-256K) (Optional)
+     *         }
+     *         secret_props (Optional): {
+     *             contentType: String (Optional)
+     *         }
+     *         x509_props (Optional): {
+     *             subject: String (Optional)
+     *             ekus (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             sans (Optional): {
+     *                 emails (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 dns_names (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 upns (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *             }
+     *             key_usage (Optional): [
+     *                 String(digitalSignature/nonRepudiation/keyEncipherment/dataEncipherment/keyAgreement/keyCertSign/cRLSign/encipherOnly/decipherOnly) (Optional)
+     *             ]
+     *             validity_months: Integer (Optional)
+     *         }
+     *         lifetime_actions (Optional): [
+     *              (Optional){
+     *                 trigger (Optional): {
+     *                     lifetime_percentage: Integer (Optional)
+     *                     days_before_expiry: Integer (Optional)
+     *                 }
+     *                 action (Optional): {
+     *                     action_type: String(EmailContacts/AutoRenew) (Optional)
+     *                 }
+     *             }
+     *         ]
+     *         issuer (Optional): {
+     *             name: String (Optional)
+     *             cty: String (Optional)
+     *             cert_transparency: Boolean (Optional)
+     *         }
+     *         attributes (Optional): {
+     *             enabled: Boolean (Optional)
+     *             nbf: Long (Optional)
+     *             exp: Long (Optional)
+     *             created: Long (Optional)
+     *             updated: Long (Optional)
+     *             recoverableDays: Integer (Optional)
+     *             recoveryLevel: String(Purgeable/Recoverable+Purgeable/Recoverable/Recoverable+ProtectedSubscription/CustomizedRecoverable+Purgeable/CustomizedRecoverable/CustomizedRecoverable+ProtectedSubscription) (Optional)
+     *         }
+     *     }
+     *     cer: byte[] (Optional)
+     *     contentType: String (Optional)
+     *     attributes (Optional): (recursive schema, see attributes above)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
* - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateBundleBackup The backup blob associated with a certificate bundle. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @param certificateName The name of the certificate in the given key vault. + * @param certificateVersion The version of the certificate. + * @param parameters The parameters for certificate update. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. * @return a certificate bundle consists of a certificate (X509) plus its attributes along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response restoreCertificateWithResponse(String vaultBaseUrl, - byte[] certificateBundleBackup, Context context) { + public Response updateCertificateWithResponse(String certificateName, String certificateVersion, + BinaryData parameters, RequestOptions requestOptions) { + final String contentType = "application/json"; final String accept = "application/json"; - CertificateRestoreParameters parameters = new CertificateRestoreParameters(); - parameters.setCertificateBundleBackup(certificateBundleBackup); - return service.restoreCertificateSync(vaultBaseUrl, this.getApiVersion(), parameters, accept, context); + return service.updateCertificateSync(this.getVaultBaseUrl(), this.getServiceVersion().getVersion(), + certificateName, certificateVersion, contentType, accept, parameters, requestOptions, Context.NONE); } /** - * Restores a backed up certificate to a vault. + * Gets information about a certificate. * - * Restores a backed up certificate, and all its versions, to a vault. This operation requires the - * certificates/restore permission. + * Gets information about a specific certificate. This operation requires the certificates/get permission. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     kid: String (Optional)
+     *     sid: String (Optional)
+     *     x5t: Base64Url (Optional)
+     *     policy (Optional): {
+     *         id: String (Optional)
+     *         key_props (Optional): {
+     *             exportable: Boolean (Optional)
+     *             kty: String(EC/EC-HSM/RSA/RSA-HSM/oct/oct-HSM) (Optional)
+     *             key_size: Integer (Optional)
+     *             reuse_key: Boolean (Optional)
+     *             crv: String(P-256/P-384/P-521/P-256K) (Optional)
+     *         }
+     *         secret_props (Optional): {
+     *             contentType: String (Optional)
+     *         }
+     *         x509_props (Optional): {
+     *             subject: String (Optional)
+     *             ekus (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             sans (Optional): {
+     *                 emails (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 dns_names (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 upns (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *             }
+     *             key_usage (Optional): [
+     *                 String(digitalSignature/nonRepudiation/keyEncipherment/dataEncipherment/keyAgreement/keyCertSign/cRLSign/encipherOnly/decipherOnly) (Optional)
+     *             ]
+     *             validity_months: Integer (Optional)
+     *         }
+     *         lifetime_actions (Optional): [
+     *              (Optional){
+     *                 trigger (Optional): {
+     *                     lifetime_percentage: Integer (Optional)
+     *                     days_before_expiry: Integer (Optional)
+     *                 }
+     *                 action (Optional): {
+     *                     action_type: String(EmailContacts/AutoRenew) (Optional)
+     *                 }
+     *             }
+     *         ]
+     *         issuer (Optional): {
+     *             name: String (Optional)
+     *             cty: String (Optional)
+     *             cert_transparency: Boolean (Optional)
+     *         }
+     *         attributes (Optional): {
+     *             enabled: Boolean (Optional)
+     *             nbf: Long (Optional)
+     *             exp: Long (Optional)
+     *             created: Long (Optional)
+     *             updated: Long (Optional)
+     *             recoverableDays: Integer (Optional)
+     *             recoveryLevel: String(Purgeable/Recoverable+Purgeable/Recoverable/Recoverable+ProtectedSubscription/CustomizedRecoverable+Purgeable/CustomizedRecoverable/CustomizedRecoverable+ProtectedSubscription) (Optional)
+     *         }
+     *     }
+     *     cer: byte[] (Optional)
+     *     contentType: String (Optional)
+     *     attributes (Optional): (recursive schema, see attributes above)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
* - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateBundleBackup The backup blob associated with a certificate bundle. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a certificate bundle consists of a certificate (X509) plus its attributes. + * @param certificateName The name of the certificate in the given vault. + * @param certificateVersion The version of the certificate. This URI fragment is optional. If not specified, the + * latest version of the certificate is returned. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return information about a certificate. + * + * Gets information about a specific certificate along with {@link Response} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public CertificateBundle restoreCertificate(String vaultBaseUrl, byte[] certificateBundleBackup) { - return restoreCertificateWithResponse(vaultBaseUrl, certificateBundleBackup, Context.NONE).getValue(); + public Mono> getCertificateWithResponseAsync(String certificateName, String certificateVersion, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.getCertificate(this.getVaultBaseUrl(), this.getServiceVersion().getVersion(), + certificateName, certificateVersion, accept, requestOptions, context)); } /** - * Lists the deleted certificates in the specified vault currently available for recovery. + * Gets information about a certificate. * - * The GetDeletedCertificates operation retrieves the certificates in the current vault which are in a deleted state - * and ready for recovery or purging. This operation includes deletion-specific information. This operation requires - * the certificates/get/list permission. This operation can only be enabled on soft-delete enabled vaults. + * Gets information about a specific certificate. This operation requires the certificates/get permission. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     kid: String (Optional)
+     *     sid: String (Optional)
+     *     x5t: Base64Url (Optional)
+     *     policy (Optional): {
+     *         id: String (Optional)
+     *         key_props (Optional): {
+     *             exportable: Boolean (Optional)
+     *             kty: String(EC/EC-HSM/RSA/RSA-HSM/oct/oct-HSM) (Optional)
+     *             key_size: Integer (Optional)
+     *             reuse_key: Boolean (Optional)
+     *             crv: String(P-256/P-384/P-521/P-256K) (Optional)
+     *         }
+     *         secret_props (Optional): {
+     *             contentType: String (Optional)
+     *         }
+     *         x509_props (Optional): {
+     *             subject: String (Optional)
+     *             ekus (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             sans (Optional): {
+     *                 emails (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 dns_names (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 upns (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *             }
+     *             key_usage (Optional): [
+     *                 String(digitalSignature/nonRepudiation/keyEncipherment/dataEncipherment/keyAgreement/keyCertSign/cRLSign/encipherOnly/decipherOnly) (Optional)
+     *             ]
+     *             validity_months: Integer (Optional)
+     *         }
+     *         lifetime_actions (Optional): [
+     *              (Optional){
+     *                 trigger (Optional): {
+     *                     lifetime_percentage: Integer (Optional)
+     *                     days_before_expiry: Integer (Optional)
+     *                 }
+     *                 action (Optional): {
+     *                     action_type: String(EmailContacts/AutoRenew) (Optional)
+     *                 }
+     *             }
+     *         ]
+     *         issuer (Optional): {
+     *             name: String (Optional)
+     *             cty: String (Optional)
+     *             cert_transparency: Boolean (Optional)
+     *         }
+     *         attributes (Optional): {
+     *             enabled: Boolean (Optional)
+     *             nbf: Long (Optional)
+     *             exp: Long (Optional)
+     *             created: Long (Optional)
+     *             updated: Long (Optional)
+     *             recoverableDays: Integer (Optional)
+     *             recoveryLevel: String(Purgeable/Recoverable+Purgeable/Recoverable/Recoverable+ProtectedSubscription/CustomizedRecoverable+Purgeable/CustomizedRecoverable/CustomizedRecoverable+ProtectedSubscription) (Optional)
+     *         }
+     *     }
+     *     cer: byte[] (Optional)
+     *     contentType: String (Optional)
+     *     attributes (Optional): (recursive schema, see attributes above)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
* - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param maxresults Maximum number of results to return in a page. If not specified the service will return up to - * 25 results. - * @param includePending Specifies whether to include certificates which are not completely provisioned. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of certificates that have been deleted in this vault along with {@link PagedResponse} on - * successful completion of {@link Mono}. + * @param certificateName The name of the certificate in the given vault. + * @param certificateVersion The version of the certificate. This URI fragment is optional. If not specified, the + * latest version of the certificate is returned. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return information about a certificate. + * + * Gets information about a specific certificate along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getDeletedCertificatesSinglePageAsync(String vaultBaseUrl, - Integer maxresults, Boolean includePending) { + public Response getCertificateWithResponse(String certificateName, String certificateVersion, + RequestOptions requestOptions) { final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.getDeletedCertificates(vaultBaseUrl, maxresults, includePending, - this.getApiVersion(), accept, context)) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().getValue(), res.getValue().getNextLink(), null)); + return service.getCertificateSync(this.getVaultBaseUrl(), this.getServiceVersion().getVersion(), + certificateName, certificateVersion, accept, requestOptions, Context.NONE); } /** - * Lists the deleted certificates in the specified vault currently available for recovery. + * Updates a certificate operation. * - * The GetDeletedCertificates operation retrieves the certificates in the current vault which are in a deleted state - * and ready for recovery or purging. This operation includes deletion-specific information. This operation requires - * the certificates/get/list permission. This operation can only be enabled on soft-delete enabled vaults. + * Updates a certificate creation operation that is already in progress. This operation requires the + * certificates/update permission. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     cancellation_requested: boolean (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     issuer (Optional): {
+     *         name: String (Optional)
+     *         cty: String (Optional)
+     *         cert_transparency: Boolean (Optional)
+     *     }
+     *     csr: byte[] (Optional)
+     *     cancellation_requested: Boolean (Optional)
+     *     status: String (Optional)
+     *     status_details: String (Optional)
+     *     error (Optional): {
+     *         code: String (Optional)
+     *         message: String (Optional)
+     *         innererror (Optional): (recursive schema, see innererror above)
+     *     }
+     *     target: String (Optional)
+     *     request_id: String (Optional)
+     * }
+     * }
+     * 
* - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param maxresults Maximum number of results to return in a page. If not specified the service will return up to - * 25 results. - * @param includePending Specifies whether to include certificates which are not completely provisioned. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of certificates that have been deleted in this vault along with {@link PagedResponse} on + * @param certificateName The name of the certificate. + * @param certificateOperation The certificate operation response. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a certificate operation is returned in case of asynchronous requests along with {@link Response} on * successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getDeletedCertificatesSinglePageAsync(String vaultBaseUrl, - Integer maxresults, Boolean includePending, Context context) { + public Mono> updateCertificateOperationWithResponseAsync(String certificateName, + BinaryData certificateOperation, RequestOptions requestOptions) { + final String contentType = "application/json"; final String accept = "application/json"; - return service - .getDeletedCertificates(vaultBaseUrl, maxresults, includePending, this.getApiVersion(), accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().getValue(), res.getValue().getNextLink(), null)); + return FluxUtil.withContext( + context -> service.updateCertificateOperation(this.getVaultBaseUrl(), this.getServiceVersion().getVersion(), + certificateName, contentType, accept, certificateOperation, requestOptions, context)); } /** - * Lists the deleted certificates in the specified vault currently available for recovery. + * Updates a certificate operation. * - * The GetDeletedCertificates operation retrieves the certificates in the current vault which are in a deleted state - * and ready for recovery or purging. This operation includes deletion-specific information. This operation requires - * the certificates/get/list permission. This operation can only be enabled on soft-delete enabled vaults. + * Updates a certificate creation operation that is already in progress. This operation requires the + * certificates/update permission. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     cancellation_requested: boolean (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     issuer (Optional): {
+     *         name: String (Optional)
+     *         cty: String (Optional)
+     *         cert_transparency: Boolean (Optional)
+     *     }
+     *     csr: byte[] (Optional)
+     *     cancellation_requested: Boolean (Optional)
+     *     status: String (Optional)
+     *     status_details: String (Optional)
+     *     error (Optional): {
+     *         code: String (Optional)
+     *         message: String (Optional)
+     *         innererror (Optional): (recursive schema, see innererror above)
+     *     }
+     *     target: String (Optional)
+     *     request_id: String (Optional)
+     * }
+     * }
+     * 
* - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param maxresults Maximum number of results to return in a page. If not specified the service will return up to - * 25 results. - * @param includePending Specifies whether to include certificates which are not completely provisioned. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of certificates that have been deleted in this vault as paginated response with {@link PagedFlux}. + * @param certificateName The name of the certificate. + * @param certificateOperation The certificate operation response. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a certificate operation is returned in case of asynchronous requests along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux getDeletedCertificatesAsync(String vaultBaseUrl, Integer maxresults, - Boolean includePending) { - return new PagedFlux<>(() -> getDeletedCertificatesSinglePageAsync(vaultBaseUrl, maxresults, includePending), - nextLink -> getDeletedCertificatesNextSinglePageAsync(nextLink, vaultBaseUrl)); + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateCertificateOperationWithResponse(String certificateName, + BinaryData certificateOperation, RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateCertificateOperationSync(this.getVaultBaseUrl(), this.getServiceVersion().getVersion(), + certificateName, contentType, accept, certificateOperation, requestOptions, Context.NONE); } /** - * Lists the deleted certificates in the specified vault currently available for recovery. + * Gets the creation operation of a certificate. * - * The GetDeletedCertificates operation retrieves the certificates in the current vault which are in a deleted state - * and ready for recovery or purging. This operation includes deletion-specific information. This operation requires - * the certificates/get/list permission. This operation can only be enabled on soft-delete enabled vaults. + * Gets the creation operation associated with a specified certificate. This operation requires the certificates/get + * permission. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     issuer (Optional): {
+     *         name: String (Optional)
+     *         cty: String (Optional)
+     *         cert_transparency: Boolean (Optional)
+     *     }
+     *     csr: byte[] (Optional)
+     *     cancellation_requested: Boolean (Optional)
+     *     status: String (Optional)
+     *     status_details: String (Optional)
+     *     error (Optional): {
+     *         code: String (Optional)
+     *         message: String (Optional)
+     *         innererror (Optional): (recursive schema, see innererror above)
+     *     }
+     *     target: String (Optional)
+     *     request_id: String (Optional)
+     * }
+     * }
+     * 
* - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param maxresults Maximum number of results to return in a page. If not specified the service will return up to - * 25 results. - * @param includePending Specifies whether to include certificates which are not completely provisioned. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of certificates that have been deleted in this vault as paginated response with {@link PagedFlux}. + * @param certificateName The name of the certificate. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the creation operation of a certificate. + * + * Gets the creation operation associated with a specified certificate along with {@link Response} on successful + * completion of {@link Mono}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedFlux getDeletedCertificatesAsync(String vaultBaseUrl, Integer maxresults, - Boolean includePending, Context context) { - return new PagedFlux<>( - () -> getDeletedCertificatesSinglePageAsync(vaultBaseUrl, maxresults, includePending, context), - nextLink -> getDeletedCertificatesNextSinglePageAsync(nextLink, vaultBaseUrl, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getCertificateOperationWithResponseAsync(String certificateName, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.getCertificateOperation(this.getVaultBaseUrl(), + this.getServiceVersion().getVersion(), certificateName, accept, requestOptions, context)); } /** - * Lists the deleted certificates in the specified vault currently available for recovery. + * Gets the creation operation of a certificate. * - * The GetDeletedCertificates operation retrieves the certificates in the current vault which are in a deleted state - * and ready for recovery or purging. This operation includes deletion-specific information. This operation requires - * the certificates/get/list permission. This operation can only be enabled on soft-delete enabled vaults. + * Gets the creation operation associated with a specified certificate. This operation requires the certificates/get + * permission. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     issuer (Optional): {
+     *         name: String (Optional)
+     *         cty: String (Optional)
+     *         cert_transparency: Boolean (Optional)
+     *     }
+     *     csr: byte[] (Optional)
+     *     cancellation_requested: Boolean (Optional)
+     *     status: String (Optional)
+     *     status_details: String (Optional)
+     *     error (Optional): {
+     *         code: String (Optional)
+     *         message: String (Optional)
+     *         innererror (Optional): (recursive schema, see innererror above)
+     *     }
+     *     target: String (Optional)
+     *     request_id: String (Optional)
+     * }
+     * }
+     * 
* - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param maxresults Maximum number of results to return in a page. If not specified the service will return up to - * 25 results. - * @param includePending Specifies whether to include certificates which are not completely provisioned. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of certificates that have been deleted in this vault along with {@link PagedResponse}. + * @param certificateName The name of the certificate. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the creation operation of a certificate. + * + * Gets the creation operation associated with a specified certificate along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public PagedResponse getDeletedCertificatesSinglePage(String vaultBaseUrl, - Integer maxresults, Boolean includePending) { + public Response getCertificateOperationWithResponse(String certificateName, + RequestOptions requestOptions) { final String accept = "application/json"; - Response res = service.getDeletedCertificatesSync(vaultBaseUrl, maxresults, - includePending, this.getApiVersion(), accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().getValue(), res.getValue().getNextLink(), null); + return service.getCertificateOperationSync(this.getVaultBaseUrl(), this.getServiceVersion().getVersion(), + certificateName, accept, requestOptions, Context.NONE); } /** - * Lists the deleted certificates in the specified vault currently available for recovery. + * Deletes the creation operation for a specific certificate. * - * The GetDeletedCertificates operation retrieves the certificates in the current vault which are in a deleted state - * and ready for recovery or purging. This operation includes deletion-specific information. This operation requires - * the certificates/get/list permission. This operation can only be enabled on soft-delete enabled vaults. + * Deletes the creation operation for a specified certificate that is in the process of being created. The + * certificate is no longer created. This operation requires the certificates/update permission. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     issuer (Optional): {
+     *         name: String (Optional)
+     *         cty: String (Optional)
+     *         cert_transparency: Boolean (Optional)
+     *     }
+     *     csr: byte[] (Optional)
+     *     cancellation_requested: Boolean (Optional)
+     *     status: String (Optional)
+     *     status_details: String (Optional)
+     *     error (Optional): {
+     *         code: String (Optional)
+     *         message: String (Optional)
+     *         innererror (Optional): (recursive schema, see innererror above)
+     *     }
+     *     target: String (Optional)
+     *     request_id: String (Optional)
+     * }
+     * }
+     * 
* - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param maxresults Maximum number of results to return in a page. If not specified the service will return up to - * 25 results. - * @param includePending Specifies whether to include certificates which are not completely provisioned. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of certificates that have been deleted in this vault along with {@link PagedResponse}. + * @param certificateName The name of the certificate. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a certificate operation is returned in case of asynchronous requests along with {@link Response} on + * successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public PagedResponse getDeletedCertificatesSinglePage(String vaultBaseUrl, - Integer maxresults, Boolean includePending, Context context) { + public Mono> deleteCertificateOperationWithResponseAsync(String certificateName, + RequestOptions requestOptions) { final String accept = "application/json"; - Response res = service.getDeletedCertificatesSync(vaultBaseUrl, maxresults, - includePending, this.getApiVersion(), accept, context); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().getValue(), res.getValue().getNextLink(), null); + return FluxUtil.withContext(context -> service.deleteCertificateOperation(this.getVaultBaseUrl(), + this.getServiceVersion().getVersion(), certificateName, accept, requestOptions, context)); } /** - * Lists the deleted certificates in the specified vault currently available for recovery. + * Deletes the creation operation for a specific certificate. * - * The GetDeletedCertificates operation retrieves the certificates in the current vault which are in a deleted state - * and ready for recovery or purging. This operation includes deletion-specific information. This operation requires - * the certificates/get/list permission. This operation can only be enabled on soft-delete enabled vaults. + * Deletes the creation operation for a specified certificate that is in the process of being created. The + * certificate is no longer created. This operation requires the certificates/update permission. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     issuer (Optional): {
+     *         name: String (Optional)
+     *         cty: String (Optional)
+     *         cert_transparency: Boolean (Optional)
+     *     }
+     *     csr: byte[] (Optional)
+     *     cancellation_requested: Boolean (Optional)
+     *     status: String (Optional)
+     *     status_details: String (Optional)
+     *     error (Optional): {
+     *         code: String (Optional)
+     *         message: String (Optional)
+     *         innererror (Optional): (recursive schema, see innererror above)
+     *     }
+     *     target: String (Optional)
+     *     request_id: String (Optional)
+     * }
+     * }
+     * 
* - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param maxresults Maximum number of results to return in a page. If not specified the service will return up to - * 25 results. - * @param includePending Specifies whether to include certificates which are not completely provisioned. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of certificates that have been deleted in this vault as paginated response with - * {@link PagedIterable}. + * @param certificateName The name of the certificate. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a certificate operation is returned in case of asynchronous requests along with {@link Response}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable getDeletedCertificates(String vaultBaseUrl, Integer maxresults, - Boolean includePending) { - return new PagedIterable<>( - () -> getDeletedCertificatesSinglePage(vaultBaseUrl, maxresults, includePending, Context.NONE), - nextLink -> getDeletedCertificatesNextSinglePage(nextLink, vaultBaseUrl)); + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteCertificateOperationWithResponse(String certificateName, + RequestOptions requestOptions) { + final String accept = "application/json"; + return service.deleteCertificateOperationSync(this.getVaultBaseUrl(), this.getServiceVersion().getVersion(), + certificateName, accept, requestOptions, Context.NONE); } /** - * Lists the deleted certificates in the specified vault currently available for recovery. + * Merges a certificate or a certificate chain with a key pair existing on the server. * - * The GetDeletedCertificates operation retrieves the certificates in the current vault which are in a deleted state - * and ready for recovery or purging. This operation includes deletion-specific information. This operation requires - * the certificates/get/list permission. This operation can only be enabled on soft-delete enabled vaults. + * The MergeCertificate operation performs the merging of a certificate or certificate chain with a key pair + * currently available in the service. This operation requires the certificates/create permission. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     x5c (Required): [
+     *         byte[] (Required)
+     *     ]
+     *     attributes (Optional): {
+     *         enabled: Boolean (Optional)
+     *         nbf: Long (Optional)
+     *         exp: Long (Optional)
+     *         created: Long (Optional)
+     *         updated: Long (Optional)
+     *         recoverableDays: Integer (Optional)
+     *         recoveryLevel: String(Purgeable/Recoverable+Purgeable/Recoverable/Recoverable+ProtectedSubscription/CustomizedRecoverable+Purgeable/CustomizedRecoverable/CustomizedRecoverable+ProtectedSubscription) (Optional)
+     *     }
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     kid: String (Optional)
+     *     sid: String (Optional)
+     *     x5t: Base64Url (Optional)
+     *     policy (Optional): {
+     *         id: String (Optional)
+     *         key_props (Optional): {
+     *             exportable: Boolean (Optional)
+     *             kty: String(EC/EC-HSM/RSA/RSA-HSM/oct/oct-HSM) (Optional)
+     *             key_size: Integer (Optional)
+     *             reuse_key: Boolean (Optional)
+     *             crv: String(P-256/P-384/P-521/P-256K) (Optional)
+     *         }
+     *         secret_props (Optional): {
+     *             contentType: String (Optional)
+     *         }
+     *         x509_props (Optional): {
+     *             subject: String (Optional)
+     *             ekus (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             sans (Optional): {
+     *                 emails (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 dns_names (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 upns (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *             }
+     *             key_usage (Optional): [
+     *                 String(digitalSignature/nonRepudiation/keyEncipherment/dataEncipherment/keyAgreement/keyCertSign/cRLSign/encipherOnly/decipherOnly) (Optional)
+     *             ]
+     *             validity_months: Integer (Optional)
+     *         }
+     *         lifetime_actions (Optional): [
+     *              (Optional){
+     *                 trigger (Optional): {
+     *                     lifetime_percentage: Integer (Optional)
+     *                     days_before_expiry: Integer (Optional)
+     *                 }
+     *                 action (Optional): {
+     *                     action_type: String(EmailContacts/AutoRenew) (Optional)
+     *                 }
+     *             }
+     *         ]
+     *         issuer (Optional): {
+     *             name: String (Optional)
+     *             cty: String (Optional)
+     *             cert_transparency: Boolean (Optional)
+     *         }
+     *         attributes (Optional): {
+     *             enabled: Boolean (Optional)
+     *             nbf: Long (Optional)
+     *             exp: Long (Optional)
+     *             created: Long (Optional)
+     *             updated: Long (Optional)
+     *             recoverableDays: Integer (Optional)
+     *             recoveryLevel: String(Purgeable/Recoverable+Purgeable/Recoverable/Recoverable+ProtectedSubscription/CustomizedRecoverable+Purgeable/CustomizedRecoverable/CustomizedRecoverable+ProtectedSubscription) (Optional)
+     *         }
+     *     }
+     *     cer: byte[] (Optional)
+     *     contentType: String (Optional)
+     *     attributes (Optional): (recursive schema, see attributes above)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
* - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param maxresults Maximum number of results to return in a page. If not specified the service will return up to - * 25 results. - * @param includePending Specifies whether to include certificates which are not completely provisioned. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of certificates that have been deleted in this vault as paginated response with - * {@link PagedIterable}. + * @param certificateName The name of the certificate. + * @param parameters The parameters to merge certificate. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a certificate bundle consists of a certificate (X509) plus its attributes along with {@link Response} on + * successful completion of {@link Mono}. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable getDeletedCertificates(String vaultBaseUrl, Integer maxresults, - Boolean includePending, Context context) { - return new PagedIterable<>( - () -> getDeletedCertificatesSinglePage(vaultBaseUrl, maxresults, includePending, context), - nextLink -> getDeletedCertificatesNextSinglePage(nextLink, vaultBaseUrl, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> mergeCertificateWithResponseAsync(String certificateName, BinaryData parameters, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.mergeCertificate(this.getVaultBaseUrl(), this.getServiceVersion().getVersion(), + certificateName, contentType, accept, parameters, requestOptions, context)); } /** - * Retrieves information about the specified deleted certificate. + * Merges a certificate or a certificate chain with a key pair existing on the server. * - * The GetDeletedCertificate operation retrieves the deleted certificate information plus its attributes, such as - * retention interval, scheduled permanent deletion and the current deletion recovery level. This operation requires - * the certificates/get permission. + * The MergeCertificate operation performs the merging of a certificate or certificate chain with a key pair + * currently available in the service. This operation requires the certificates/create permission. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     x5c (Required): [
+     *         byte[] (Required)
+     *     ]
+     *     attributes (Optional): {
+     *         enabled: Boolean (Optional)
+     *         nbf: Long (Optional)
+     *         exp: Long (Optional)
+     *         created: Long (Optional)
+     *         updated: Long (Optional)
+     *         recoverableDays: Integer (Optional)
+     *         recoveryLevel: String(Purgeable/Recoverable+Purgeable/Recoverable/Recoverable+ProtectedSubscription/CustomizedRecoverable+Purgeable/CustomizedRecoverable/CustomizedRecoverable+ProtectedSubscription) (Optional)
+     *     }
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     kid: String (Optional)
+     *     sid: String (Optional)
+     *     x5t: Base64Url (Optional)
+     *     policy (Optional): {
+     *         id: String (Optional)
+     *         key_props (Optional): {
+     *             exportable: Boolean (Optional)
+     *             kty: String(EC/EC-HSM/RSA/RSA-HSM/oct/oct-HSM) (Optional)
+     *             key_size: Integer (Optional)
+     *             reuse_key: Boolean (Optional)
+     *             crv: String(P-256/P-384/P-521/P-256K) (Optional)
+     *         }
+     *         secret_props (Optional): {
+     *             contentType: String (Optional)
+     *         }
+     *         x509_props (Optional): {
+     *             subject: String (Optional)
+     *             ekus (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             sans (Optional): {
+     *                 emails (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 dns_names (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 upns (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *             }
+     *             key_usage (Optional): [
+     *                 String(digitalSignature/nonRepudiation/keyEncipherment/dataEncipherment/keyAgreement/keyCertSign/cRLSign/encipherOnly/decipherOnly) (Optional)
+     *             ]
+     *             validity_months: Integer (Optional)
+     *         }
+     *         lifetime_actions (Optional): [
+     *              (Optional){
+     *                 trigger (Optional): {
+     *                     lifetime_percentage: Integer (Optional)
+     *                     days_before_expiry: Integer (Optional)
+     *                 }
+     *                 action (Optional): {
+     *                     action_type: String(EmailContacts/AutoRenew) (Optional)
+     *                 }
+     *             }
+     *         ]
+     *         issuer (Optional): {
+     *             name: String (Optional)
+     *             cty: String (Optional)
+     *             cert_transparency: Boolean (Optional)
+     *         }
+     *         attributes (Optional): {
+     *             enabled: Boolean (Optional)
+     *             nbf: Long (Optional)
+     *             exp: Long (Optional)
+     *             created: Long (Optional)
+     *             updated: Long (Optional)
+     *             recoverableDays: Integer (Optional)
+     *             recoveryLevel: String(Purgeable/Recoverable+Purgeable/Recoverable/Recoverable+ProtectedSubscription/CustomizedRecoverable+Purgeable/CustomizedRecoverable/CustomizedRecoverable+ProtectedSubscription) (Optional)
+     *         }
+     *     }
+     *     cer: byte[] (Optional)
+     *     contentType: String (Optional)
+     *     attributes (Optional): (recursive schema, see attributes above)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
* - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. * @param certificateName The name of the certificate. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a Deleted Certificate consisting of its previous id, attributes and its tags, as well as information on - * when it will be purged along with {@link Response} on successful completion of {@link Mono}. + * @param parameters The parameters to merge certificate. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a certificate bundle consists of a certificate (X509) plus its attributes along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getDeletedCertificateWithResponseAsync(String vaultBaseUrl, - String certificateName) { - return FluxUtil - .withContext(context -> getDeletedCertificateWithResponseAsync(vaultBaseUrl, certificateName, context)); + public Response mergeCertificateWithResponse(String certificateName, BinaryData parameters, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.mergeCertificateSync(this.getVaultBaseUrl(), this.getServiceVersion().getVersion(), + certificateName, contentType, accept, parameters, requestOptions, Context.NONE); } /** - * Retrieves information about the specified deleted certificate. + * Backs up the specified certificate. * - * The GetDeletedCertificate operation retrieves the deleted certificate information plus its attributes, such as - * retention interval, scheduled permanent deletion and the current deletion recovery level. This operation requires - * the certificates/get permission. + * Requests that a backup of the specified certificate be downloaded to the client. All versions of the certificate + * will be downloaded. This operation requires the certificates/backup permission. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: Base64Url (Optional)
+     * }
+     * }
+     * 
* - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. * @param certificateName The name of the certificate. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a Deleted Certificate consisting of its previous id, attributes and its tags, as well as information on - * when it will be purged along with {@link Response} on successful completion of {@link Mono}. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the backup certificate result, containing the backup blob along with {@link Response} on successful + * completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getDeletedCertificateWithResponseAsync(String vaultBaseUrl, - String certificateName, Context context) { + public Mono> backupCertificateWithResponseAsync(String certificateName, + RequestOptions requestOptions) { final String accept = "application/json"; - return service.getDeletedCertificate(vaultBaseUrl, certificateName, this.getApiVersion(), accept, context); + return FluxUtil.withContext(context -> service.backupCertificate(this.getVaultBaseUrl(), + this.getServiceVersion().getVersion(), certificateName, accept, requestOptions, context)); } /** - * Retrieves information about the specified deleted certificate. + * Backs up the specified certificate. * - * The GetDeletedCertificate operation retrieves the deleted certificate information plus its attributes, such as - * retention interval, scheduled permanent deletion and the current deletion recovery level. This operation requires - * the certificates/get permission. + * Requests that a backup of the specified certificate be downloaded to the client. All versions of the certificate + * will be downloaded. This operation requires the certificates/backup permission. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: Base64Url (Optional)
+     * }
+     * }
+     * 
* - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. * @param certificateName The name of the certificate. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a Deleted Certificate consisting of its previous id, attributes and its tags, as well as information on - * when it will be purged on successful completion of {@link Mono}. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the backup certificate result, containing the backup blob along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getDeletedCertificateAsync(String vaultBaseUrl, String certificateName) { - return getDeletedCertificateWithResponseAsync(vaultBaseUrl, certificateName) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); + public Response backupCertificateWithResponse(String certificateName, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.backupCertificateSync(this.getVaultBaseUrl(), this.getServiceVersion().getVersion(), + certificateName, accept, requestOptions, Context.NONE); } /** - * Retrieves information about the specified deleted certificate. - * - * The GetDeletedCertificate operation retrieves the deleted certificate information plus its attributes, such as - * retention interval, scheduled permanent deletion and the current deletion recovery level. This operation requires - * the certificates/get permission. + * Restores a backed up certificate to a vault. * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a Deleted Certificate consisting of its previous id, attributes and its tags, as well as information on - * when it will be purged on successful completion of {@link Mono}. + * Restores a backed up certificate, and all its versions, to a vault. This operation requires the + * certificates/restore permission. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: Base64Url (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     kid: String (Optional)
+     *     sid: String (Optional)
+     *     x5t: Base64Url (Optional)
+     *     policy (Optional): {
+     *         id: String (Optional)
+     *         key_props (Optional): {
+     *             exportable: Boolean (Optional)
+     *             kty: String(EC/EC-HSM/RSA/RSA-HSM/oct/oct-HSM) (Optional)
+     *             key_size: Integer (Optional)
+     *             reuse_key: Boolean (Optional)
+     *             crv: String(P-256/P-384/P-521/P-256K) (Optional)
+     *         }
+     *         secret_props (Optional): {
+     *             contentType: String (Optional)
+     *         }
+     *         x509_props (Optional): {
+     *             subject: String (Optional)
+     *             ekus (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             sans (Optional): {
+     *                 emails (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 dns_names (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 upns (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *             }
+     *             key_usage (Optional): [
+     *                 String(digitalSignature/nonRepudiation/keyEncipherment/dataEncipherment/keyAgreement/keyCertSign/cRLSign/encipherOnly/decipherOnly) (Optional)
+     *             ]
+     *             validity_months: Integer (Optional)
+     *         }
+     *         lifetime_actions (Optional): [
+     *              (Optional){
+     *                 trigger (Optional): {
+     *                     lifetime_percentage: Integer (Optional)
+     *                     days_before_expiry: Integer (Optional)
+     *                 }
+     *                 action (Optional): {
+     *                     action_type: String(EmailContacts/AutoRenew) (Optional)
+     *                 }
+     *             }
+     *         ]
+     *         issuer (Optional): {
+     *             name: String (Optional)
+     *             cty: String (Optional)
+     *             cert_transparency: Boolean (Optional)
+     *         }
+     *         attributes (Optional): {
+     *             enabled: Boolean (Optional)
+     *             nbf: Long (Optional)
+     *             exp: Long (Optional)
+     *             created: Long (Optional)
+     *             updated: Long (Optional)
+     *             recoverableDays: Integer (Optional)
+     *             recoveryLevel: String(Purgeable/Recoverable+Purgeable/Recoverable/Recoverable+ProtectedSubscription/CustomizedRecoverable+Purgeable/CustomizedRecoverable/CustomizedRecoverable+ProtectedSubscription) (Optional)
+     *         }
+     *     }
+     *     cer: byte[] (Optional)
+     *     contentType: String (Optional)
+     *     attributes (Optional): (recursive schema, see attributes above)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param parameters The parameters to restore the certificate. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a certificate bundle consists of a certificate (X509) plus its attributes along with {@link Response} on + * successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getDeletedCertificateAsync(String vaultBaseUrl, String certificateName, - Context context) { - return getDeletedCertificateWithResponseAsync(vaultBaseUrl, certificateName, context) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); + public Mono> restoreCertificateWithResponseAsync(BinaryData parameters, + RequestOptions requestOptions) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.restoreCertificate(this.getVaultBaseUrl(), + this.getServiceVersion().getVersion(), contentType, accept, parameters, requestOptions, context)); } /** - * Retrieves information about the specified deleted certificate. - * - * The GetDeletedCertificate operation retrieves the deleted certificate information plus its attributes, such as - * retention interval, scheduled permanent deletion and the current deletion recovery level. This operation requires - * the certificates/get permission. + * Restores a backed up certificate to a vault. * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a Deleted Certificate consisting of its previous id, attributes and its tags, as well as information on - * when it will be purged along with {@link Response}. + * Restores a backed up certificate, and all its versions, to a vault. This operation requires the + * certificates/restore permission. + *

Request Body Schema

+ * + *
+     * {@code
+     * {
+     *     value: Base64Url (Required)
+     * }
+     * }
+     * 
+ * + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     kid: String (Optional)
+     *     sid: String (Optional)
+     *     x5t: Base64Url (Optional)
+     *     policy (Optional): {
+     *         id: String (Optional)
+     *         key_props (Optional): {
+     *             exportable: Boolean (Optional)
+     *             kty: String(EC/EC-HSM/RSA/RSA-HSM/oct/oct-HSM) (Optional)
+     *             key_size: Integer (Optional)
+     *             reuse_key: Boolean (Optional)
+     *             crv: String(P-256/P-384/P-521/P-256K) (Optional)
+     *         }
+     *         secret_props (Optional): {
+     *             contentType: String (Optional)
+     *         }
+     *         x509_props (Optional): {
+     *             subject: String (Optional)
+     *             ekus (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             sans (Optional): {
+     *                 emails (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 dns_names (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 upns (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *             }
+     *             key_usage (Optional): [
+     *                 String(digitalSignature/nonRepudiation/keyEncipherment/dataEncipherment/keyAgreement/keyCertSign/cRLSign/encipherOnly/decipherOnly) (Optional)
+     *             ]
+     *             validity_months: Integer (Optional)
+     *         }
+     *         lifetime_actions (Optional): [
+     *              (Optional){
+     *                 trigger (Optional): {
+     *                     lifetime_percentage: Integer (Optional)
+     *                     days_before_expiry: Integer (Optional)
+     *                 }
+     *                 action (Optional): {
+     *                     action_type: String(EmailContacts/AutoRenew) (Optional)
+     *                 }
+     *             }
+     *         ]
+     *         issuer (Optional): {
+     *             name: String (Optional)
+     *             cty: String (Optional)
+     *             cert_transparency: Boolean (Optional)
+     *         }
+     *         attributes (Optional): {
+     *             enabled: Boolean (Optional)
+     *             nbf: Long (Optional)
+     *             exp: Long (Optional)
+     *             created: Long (Optional)
+     *             updated: Long (Optional)
+     *             recoverableDays: Integer (Optional)
+     *             recoveryLevel: String(Purgeable/Recoverable+Purgeable/Recoverable/Recoverable+ProtectedSubscription/CustomizedRecoverable+Purgeable/CustomizedRecoverable/CustomizedRecoverable+ProtectedSubscription) (Optional)
+     *         }
+     *     }
+     *     cer: byte[] (Optional)
+     *     contentType: String (Optional)
+     *     attributes (Optional): (recursive schema, see attributes above)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
+ * + * @param parameters The parameters to restore the certificate. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a certificate bundle consists of a certificate (X509) plus its attributes along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response getDeletedCertificateWithResponse(String vaultBaseUrl, - String certificateName, Context context) { + public Response restoreCertificateWithResponse(BinaryData parameters, RequestOptions requestOptions) { + final String contentType = "application/json"; final String accept = "application/json"; - return service.getDeletedCertificateSync(vaultBaseUrl, certificateName, this.getApiVersion(), accept, context); + return service.restoreCertificateSync(this.getVaultBaseUrl(), this.getServiceVersion().getVersion(), + contentType, accept, parameters, requestOptions, Context.NONE); } /** - * Retrieves information about the specified deleted certificate. - * - * The GetDeletedCertificate operation retrieves the deleted certificate information plus its attributes, such as - * retention interval, scheduled permanent deletion and the current deletion recovery level. This operation requires - * the certificates/get permission. + * Lists the deleted certificates in the specified vault currently available for recovery. * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a Deleted Certificate consisting of its previous id, attributes and its tags, as well as information on - * when it will be purged. + * The GetDeletedCertificates operation retrieves the certificates in the current vault which are in a deleted state + * and ready for recovery or purging. This operation includes deletion-specific information. This operation requires + * the certificates/get/list permission. This operation can only be enabled on soft-delete enabled vaults. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
maxresultsIntegerNoMaximum number of results to return in a page. If not + * specified the service will return up to 25 results.
includePendingBooleanNoSpecifies whether to include certificates which are not + * completely provisioned.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     attributes (Optional): {
+     *         enabled: Boolean (Optional)
+     *         nbf: Long (Optional)
+     *         exp: Long (Optional)
+     *         created: Long (Optional)
+     *         updated: Long (Optional)
+     *         recoverableDays: Integer (Optional)
+     *         recoveryLevel: String(Purgeable/Recoverable+Purgeable/Recoverable/Recoverable+ProtectedSubscription/CustomizedRecoverable+Purgeable/CustomizedRecoverable/CustomizedRecoverable+ProtectedSubscription) (Optional)
+     *     }
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     x5t: Base64Url (Optional)
+     *     recoveryId: String (Optional)
+     *     scheduledPurgeDate: Long (Optional)
+     *     deletedDate: Long (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a list of certificates that have been deleted in this vault along with {@link PagedResponse} on + * successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public DeletedCertificateBundle getDeletedCertificate(String vaultBaseUrl, String certificateName) { - return getDeletedCertificateWithResponse(vaultBaseUrl, certificateName, Context.NONE).getValue(); + private Mono> getDeletedCertificatesSinglePageAsync(RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getDeletedCertificates(this.getVaultBaseUrl(), + this.getServiceVersion().getVersion(), accept, requestOptions, context)) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); } /** - * Permanently deletes the specified deleted certificate. - * - * The PurgeDeletedCertificate operation performs an irreversible deletion of the specified certificate, without - * possibility for recovery. The operation is not available if the recovery level does not specify 'Purgeable'. This - * operation requires the certificate/purge permission. + * Lists the deleted certificates in the specified vault currently available for recovery. * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. + * The GetDeletedCertificates operation retrieves the certificates in the current vault which are in a deleted state + * and ready for recovery or purging. This operation includes deletion-specific information. This operation requires + * the certificates/get/list permission. This operation can only be enabled on soft-delete enabled vaults. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
maxresultsIntegerNoMaximum number of results to return in a page. If not + * specified the service will return up to 25 results.
includePendingBooleanNoSpecifies whether to include certificates which are not + * completely provisioned.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     attributes (Optional): {
+     *         enabled: Boolean (Optional)
+     *         nbf: Long (Optional)
+     *         exp: Long (Optional)
+     *         created: Long (Optional)
+     *         updated: Long (Optional)
+     *         recoverableDays: Integer (Optional)
+     *         recoveryLevel: String(Purgeable/Recoverable+Purgeable/Recoverable/Recoverable+ProtectedSubscription/CustomizedRecoverable+Purgeable/CustomizedRecoverable/CustomizedRecoverable+ProtectedSubscription) (Optional)
+     *     }
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     x5t: Base64Url (Optional)
+     *     recoveryId: String (Optional)
+     *     scheduledPurgeDate: Long (Optional)
+     *     deletedDate: Long (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a list of certificates that have been deleted in this vault as paginated response with {@link PagedFlux}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> purgeDeletedCertificateWithResponseAsync(String vaultBaseUrl, String certificateName) { - return FluxUtil - .withContext(context -> purgeDeletedCertificateWithResponseAsync(vaultBaseUrl, certificateName, context)); + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux getDeletedCertificatesAsync(RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedFlux<>(() -> getDeletedCertificatesSinglePageAsync(requestOptions), + nextLink -> getDeletedCertificatesNextSinglePageAsync(nextLink, requestOptionsForNextPage)); } /** - * Permanently deletes the specified deleted certificate. - * - * The PurgeDeletedCertificate operation performs an irreversible deletion of the specified certificate, without - * possibility for recovery. The operation is not available if the recovery level does not specify 'Purgeable'. This - * operation requires the certificate/purge permission. + * Lists the deleted certificates in the specified vault currently available for recovery. * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. + * The GetDeletedCertificates operation retrieves the certificates in the current vault which are in a deleted state + * and ready for recovery or purging. This operation includes deletion-specific information. This operation requires + * the certificates/get/list permission. This operation can only be enabled on soft-delete enabled vaults. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
maxresultsIntegerNoMaximum number of results to return in a page. If not + * specified the service will return up to 25 results.
includePendingBooleanNoSpecifies whether to include certificates which are not + * completely provisioned.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     attributes (Optional): {
+     *         enabled: Boolean (Optional)
+     *         nbf: Long (Optional)
+     *         exp: Long (Optional)
+     *         created: Long (Optional)
+     *         updated: Long (Optional)
+     *         recoverableDays: Integer (Optional)
+     *         recoveryLevel: String(Purgeable/Recoverable+Purgeable/Recoverable/Recoverable+ProtectedSubscription/CustomizedRecoverable+Purgeable/CustomizedRecoverable/CustomizedRecoverable+ProtectedSubscription) (Optional)
+     *     }
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     x5t: Base64Url (Optional)
+     *     recoveryId: String (Optional)
+     *     scheduledPurgeDate: Long (Optional)
+     *     deletedDate: Long (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a list of certificates that have been deleted in this vault along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> purgeDeletedCertificateWithResponseAsync(String vaultBaseUrl, String certificateName, - Context context) { + private PagedResponse getDeletedCertificatesSinglePage(RequestOptions requestOptions) { final String accept = "application/json"; - return service.purgeDeletedCertificate(vaultBaseUrl, certificateName, this.getApiVersion(), accept, context); + Response res = service.getDeletedCertificatesSync(this.getVaultBaseUrl(), + this.getServiceVersion().getVersion(), accept, requestOptions, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); } /** - * Permanently deletes the specified deleted certificate. - * - * The PurgeDeletedCertificate operation performs an irreversible deletion of the specified certificate, without - * possibility for recovery. The operation is not available if the recovery level does not specify 'Purgeable'. This - * operation requires the certificate/purge permission. + * Lists the deleted certificates in the specified vault currently available for recovery. * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the certificate. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. + * The GetDeletedCertificates operation retrieves the certificates in the current vault which are in a deleted state + * and ready for recovery or purging. This operation includes deletion-specific information. This operation requires + * the certificates/get/list permission. This operation can only be enabled on soft-delete enabled vaults. + *

Query Parameters

+ * + * + * + * + * + *
Query Parameters
NameTypeRequiredDescription
maxresultsIntegerNoMaximum number of results to return in a page. If not + * specified the service will return up to 25 results.
includePendingBooleanNoSpecifies whether to include certificates which are not + * completely provisioned.
+ * You can add these to a request with {@link RequestOptions#addQueryParam} + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     attributes (Optional): {
+     *         enabled: Boolean (Optional)
+     *         nbf: Long (Optional)
+     *         exp: Long (Optional)
+     *         created: Long (Optional)
+     *         updated: Long (Optional)
+     *         recoverableDays: Integer (Optional)
+     *         recoveryLevel: String(Purgeable/Recoverable+Purgeable/Recoverable/Recoverable+ProtectedSubscription/CustomizedRecoverable+Purgeable/CustomizedRecoverable/CustomizedRecoverable+ProtectedSubscription) (Optional)
+     *     }
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     x5t: Base64Url (Optional)
+     *     recoveryId: String (Optional)
+     *     scheduledPurgeDate: Long (Optional)
+     *     deletedDate: Long (Optional)
+     * }
+     * }
+     * 
+ * + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a list of certificates that have been deleted in this vault as paginated response with + * {@link PagedIterable}. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono purgeDeletedCertificateAsync(String vaultBaseUrl, String certificateName) { - return purgeDeletedCertificateWithResponseAsync(vaultBaseUrl, certificateName).flatMap(ignored -> Mono.empty()); + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getDeletedCertificates(RequestOptions requestOptions) { + RequestOptions requestOptionsForNextPage = new RequestOptions(); + requestOptionsForNextPage.setContext( + requestOptions != null && requestOptions.getContext() != null ? requestOptions.getContext() : Context.NONE); + return new PagedIterable<>(() -> getDeletedCertificatesSinglePage(requestOptions), + nextLink -> getDeletedCertificatesNextSinglePage(nextLink, requestOptionsForNextPage)); } /** - * Permanently deletes the specified deleted certificate. + * Retrieves information about the specified deleted certificate. * - * The PurgeDeletedCertificate operation performs an irreversible deletion of the specified certificate, without - * possibility for recovery. The operation is not available if the recovery level does not specify 'Purgeable'. This - * operation requires the certificate/purge permission. + * The GetDeletedCertificate operation retrieves the deleted certificate information plus its attributes, such as + * retention interval, scheduled permanent deletion and the current deletion recovery level. This operation requires + * the certificates/get permission. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     kid: String (Optional)
+     *     sid: String (Optional)
+     *     x5t: Base64Url (Optional)
+     *     policy (Optional): {
+     *         id: String (Optional)
+     *         key_props (Optional): {
+     *             exportable: Boolean (Optional)
+     *             kty: String(EC/EC-HSM/RSA/RSA-HSM/oct/oct-HSM) (Optional)
+     *             key_size: Integer (Optional)
+     *             reuse_key: Boolean (Optional)
+     *             crv: String(P-256/P-384/P-521/P-256K) (Optional)
+     *         }
+     *         secret_props (Optional): {
+     *             contentType: String (Optional)
+     *         }
+     *         x509_props (Optional): {
+     *             subject: String (Optional)
+     *             ekus (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             sans (Optional): {
+     *                 emails (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 dns_names (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 upns (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *             }
+     *             key_usage (Optional): [
+     *                 String(digitalSignature/nonRepudiation/keyEncipherment/dataEncipherment/keyAgreement/keyCertSign/cRLSign/encipherOnly/decipherOnly) (Optional)
+     *             ]
+     *             validity_months: Integer (Optional)
+     *         }
+     *         lifetime_actions (Optional): [
+     *              (Optional){
+     *                 trigger (Optional): {
+     *                     lifetime_percentage: Integer (Optional)
+     *                     days_before_expiry: Integer (Optional)
+     *                 }
+     *                 action (Optional): {
+     *                     action_type: String(EmailContacts/AutoRenew) (Optional)
+     *                 }
+     *             }
+     *         ]
+     *         issuer (Optional): {
+     *             name: String (Optional)
+     *             cty: String (Optional)
+     *             cert_transparency: Boolean (Optional)
+     *         }
+     *         attributes (Optional): {
+     *             enabled: Boolean (Optional)
+     *             nbf: Long (Optional)
+     *             exp: Long (Optional)
+     *             created: Long (Optional)
+     *             updated: Long (Optional)
+     *             recoverableDays: Integer (Optional)
+     *             recoveryLevel: String(Purgeable/Recoverable+Purgeable/Recoverable/Recoverable+ProtectedSubscription/CustomizedRecoverable+Purgeable/CustomizedRecoverable/CustomizedRecoverable+ProtectedSubscription) (Optional)
+     *         }
+     *     }
+     *     cer: byte[] (Optional)
+     *     contentType: String (Optional)
+     *     attributes (Optional): (recursive schema, see attributes above)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     recoveryId: String (Optional)
+     *     scheduledPurgeDate: Long (Optional)
+     *     deletedDate: Long (Optional)
+     * }
+     * }
+     * 
* - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. * @param certificateName The name of the certificate. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a Deleted Certificate consisting of its previous id, attributes and its tags, as well as information on + * when it will be purged along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono purgeDeletedCertificateAsync(String vaultBaseUrl, String certificateName, Context context) { - return purgeDeletedCertificateWithResponseAsync(vaultBaseUrl, certificateName, context) - .flatMap(ignored -> Mono.empty()); + public Mono> getDeletedCertificateWithResponseAsync(String certificateName, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.getDeletedCertificate(this.getVaultBaseUrl(), + this.getServiceVersion().getVersion(), certificateName, accept, requestOptions, context)); } /** - * Permanently deletes the specified deleted certificate. + * Retrieves information about the specified deleted certificate. * - * The PurgeDeletedCertificate operation performs an irreversible deletion of the specified certificate, without - * possibility for recovery. The operation is not available if the recovery level does not specify 'Purgeable'. This - * operation requires the certificate/purge permission. + * The GetDeletedCertificate operation retrieves the deleted certificate information plus its attributes, such as + * retention interval, scheduled permanent deletion and the current deletion recovery level. This operation requires + * the certificates/get permission. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     kid: String (Optional)
+     *     sid: String (Optional)
+     *     x5t: Base64Url (Optional)
+     *     policy (Optional): {
+     *         id: String (Optional)
+     *         key_props (Optional): {
+     *             exportable: Boolean (Optional)
+     *             kty: String(EC/EC-HSM/RSA/RSA-HSM/oct/oct-HSM) (Optional)
+     *             key_size: Integer (Optional)
+     *             reuse_key: Boolean (Optional)
+     *             crv: String(P-256/P-384/P-521/P-256K) (Optional)
+     *         }
+     *         secret_props (Optional): {
+     *             contentType: String (Optional)
+     *         }
+     *         x509_props (Optional): {
+     *             subject: String (Optional)
+     *             ekus (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             sans (Optional): {
+     *                 emails (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 dns_names (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 upns (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *             }
+     *             key_usage (Optional): [
+     *                 String(digitalSignature/nonRepudiation/keyEncipherment/dataEncipherment/keyAgreement/keyCertSign/cRLSign/encipherOnly/decipherOnly) (Optional)
+     *             ]
+     *             validity_months: Integer (Optional)
+     *         }
+     *         lifetime_actions (Optional): [
+     *              (Optional){
+     *                 trigger (Optional): {
+     *                     lifetime_percentage: Integer (Optional)
+     *                     days_before_expiry: Integer (Optional)
+     *                 }
+     *                 action (Optional): {
+     *                     action_type: String(EmailContacts/AutoRenew) (Optional)
+     *                 }
+     *             }
+     *         ]
+     *         issuer (Optional): {
+     *             name: String (Optional)
+     *             cty: String (Optional)
+     *             cert_transparency: Boolean (Optional)
+     *         }
+     *         attributes (Optional): {
+     *             enabled: Boolean (Optional)
+     *             nbf: Long (Optional)
+     *             exp: Long (Optional)
+     *             created: Long (Optional)
+     *             updated: Long (Optional)
+     *             recoverableDays: Integer (Optional)
+     *             recoveryLevel: String(Purgeable/Recoverable+Purgeable/Recoverable/Recoverable+ProtectedSubscription/CustomizedRecoverable+Purgeable/CustomizedRecoverable/CustomizedRecoverable+ProtectedSubscription) (Optional)
+     *         }
+     *     }
+     *     cer: byte[] (Optional)
+     *     contentType: String (Optional)
+     *     attributes (Optional): (recursive schema, see attributes above)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     recoveryId: String (Optional)
+     *     scheduledPurgeDate: Long (Optional)
+     *     deletedDate: Long (Optional)
+     * }
+     * }
+     * 
* - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. * @param certificateName The name of the certificate. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return a Deleted Certificate consisting of its previous id, attributes and its tags, as well as information on + * when it will be purged along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response purgeDeletedCertificateWithResponse(String vaultBaseUrl, String certificateName, - Context context) { + public Response getDeletedCertificateWithResponse(String certificateName, + RequestOptions requestOptions) { final String accept = "application/json"; - return service.purgeDeletedCertificateSync(vaultBaseUrl, certificateName, this.getApiVersion(), accept, - context); + return service.getDeletedCertificateSync(this.getVaultBaseUrl(), this.getServiceVersion().getVersion(), + certificateName, accept, requestOptions, Context.NONE); } /** @@ -4394,37 +5364,42 @@ public Response purgeDeletedCertificateWithResponse(String vaultBaseUrl, S * possibility for recovery. The operation is not available if the recovery level does not specify 'Purgeable'. This * operation requires the certificate/purge permission. * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. * @param certificateName The name of the certificate. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public void purgeDeletedCertificate(String vaultBaseUrl, String certificateName) { - purgeDeletedCertificateWithResponse(vaultBaseUrl, certificateName, Context.NONE); + public Mono> purgeDeletedCertificateWithResponseAsync(String certificateName, + RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.purgeDeletedCertificate(this.getVaultBaseUrl(), + this.getServiceVersion().getVersion(), certificateName, accept, requestOptions, context)); } /** - * Recovers the deleted certificate back to its current version under /certificates. + * Permanently deletes the specified deleted certificate. * - * The RecoverDeletedCertificate operation performs the reversal of the Delete operation. The operation is - * applicable in vaults enabled for soft-delete, and must be issued during the retention interval (available in the - * deleted certificate's attributes). This operation requires the certificates/recover permission. + * The PurgeDeletedCertificate operation performs an irreversible deletion of the specified certificate, without + * possibility for recovery. The operation is not available if the recovery level does not specify 'Purgeable'. This + * operation requires the certificate/purge permission. * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the deleted certificate. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a certificate bundle consists of a certificate (X509) plus its attributes along with {@link Response} on - * successful completion of {@link Mono}. + * @param certificateName The name of the certificate. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. + * @return the {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> recoverDeletedCertificateWithResponseAsync(String vaultBaseUrl, - String certificateName) { - return FluxUtil - .withContext(context -> recoverDeletedCertificateWithResponseAsync(vaultBaseUrl, certificateName, context)); + public Response purgeDeletedCertificateWithResponse(String certificateName, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.purgeDeletedCertificateSync(this.getVaultBaseUrl(), this.getServiceVersion().getVersion(), + certificateName, accept, requestOptions, Context.NONE); } /** @@ -4433,65 +5408,99 @@ public Mono> recoverDeletedCertificateWithResponseAs * The RecoverDeletedCertificate operation performs the reversal of the Delete operation. The operation is * applicable in vaults enabled for soft-delete, and must be issued during the retention interval (available in the * deleted certificate's attributes). This operation requires the certificates/recover permission. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     kid: String (Optional)
+     *     sid: String (Optional)
+     *     x5t: Base64Url (Optional)
+     *     policy (Optional): {
+     *         id: String (Optional)
+     *         key_props (Optional): {
+     *             exportable: Boolean (Optional)
+     *             kty: String(EC/EC-HSM/RSA/RSA-HSM/oct/oct-HSM) (Optional)
+     *             key_size: Integer (Optional)
+     *             reuse_key: Boolean (Optional)
+     *             crv: String(P-256/P-384/P-521/P-256K) (Optional)
+     *         }
+     *         secret_props (Optional): {
+     *             contentType: String (Optional)
+     *         }
+     *         x509_props (Optional): {
+     *             subject: String (Optional)
+     *             ekus (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             sans (Optional): {
+     *                 emails (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 dns_names (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 upns (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *             }
+     *             key_usage (Optional): [
+     *                 String(digitalSignature/nonRepudiation/keyEncipherment/dataEncipherment/keyAgreement/keyCertSign/cRLSign/encipherOnly/decipherOnly) (Optional)
+     *             ]
+     *             validity_months: Integer (Optional)
+     *         }
+     *         lifetime_actions (Optional): [
+     *              (Optional){
+     *                 trigger (Optional): {
+     *                     lifetime_percentage: Integer (Optional)
+     *                     days_before_expiry: Integer (Optional)
+     *                 }
+     *                 action (Optional): {
+     *                     action_type: String(EmailContacts/AutoRenew) (Optional)
+     *                 }
+     *             }
+     *         ]
+     *         issuer (Optional): {
+     *             name: String (Optional)
+     *             cty: String (Optional)
+     *             cert_transparency: Boolean (Optional)
+     *         }
+     *         attributes (Optional): {
+     *             enabled: Boolean (Optional)
+     *             nbf: Long (Optional)
+     *             exp: Long (Optional)
+     *             created: Long (Optional)
+     *             updated: Long (Optional)
+     *             recoverableDays: Integer (Optional)
+     *             recoveryLevel: String(Purgeable/Recoverable+Purgeable/Recoverable/Recoverable+ProtectedSubscription/CustomizedRecoverable+Purgeable/CustomizedRecoverable/CustomizedRecoverable+ProtectedSubscription) (Optional)
+     *         }
+     *     }
+     *     cer: byte[] (Optional)
+     *     contentType: String (Optional)
+     *     attributes (Optional): (recursive schema, see attributes above)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
* - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. * @param certificateName The name of the deleted certificate. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. * @return a certificate bundle consists of a certificate (X509) plus its attributes along with {@link Response} on * successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> recoverDeletedCertificateWithResponseAsync(String vaultBaseUrl, - String certificateName, Context context) { + public Mono> recoverDeletedCertificateWithResponseAsync(String certificateName, + RequestOptions requestOptions) { final String accept = "application/json"; - return service.recoverDeletedCertificate(vaultBaseUrl, certificateName, this.getApiVersion(), accept, context); - } - - /** - * Recovers the deleted certificate back to its current version under /certificates. - * - * The RecoverDeletedCertificate operation performs the reversal of the Delete operation. The operation is - * applicable in vaults enabled for soft-delete, and must be issued during the retention interval (available in the - * deleted certificate's attributes). This operation requires the certificates/recover permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the deleted certificate. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a certificate bundle consists of a certificate (X509) plus its attributes on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono recoverDeletedCertificateAsync(String vaultBaseUrl, String certificateName) { - return recoverDeletedCertificateWithResponseAsync(vaultBaseUrl, certificateName) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Recovers the deleted certificate back to its current version under /certificates. - * - * The RecoverDeletedCertificate operation performs the reversal of the Delete operation. The operation is - * applicable in vaults enabled for soft-delete, and must be issued during the retention interval (available in the - * deleted certificate's attributes). This operation requires the certificates/recover permission. - * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the deleted certificate. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a certificate bundle consists of a certificate (X509) plus its attributes on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono recoverDeletedCertificateAsync(String vaultBaseUrl, String certificateName, - Context context) { - return recoverDeletedCertificateWithResponseAsync(vaultBaseUrl, certificateName, context) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); + return FluxUtil.withContext(context -> service.recoverDeletedCertificate(this.getVaultBaseUrl(), + this.getServiceVersion().getVersion(), certificateName, accept, requestOptions, context)); } /** @@ -4500,363 +5509,462 @@ public Mono recoverDeletedCertificateAsync(String vaultBaseUr * The RecoverDeletedCertificate operation performs the reversal of the Delete operation. The operation is * applicable in vaults enabled for soft-delete, and must be issued during the retention interval (available in the * deleted certificate's attributes). This operation requires the certificates/recover permission. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     kid: String (Optional)
+     *     sid: String (Optional)
+     *     x5t: Base64Url (Optional)
+     *     policy (Optional): {
+     *         id: String (Optional)
+     *         key_props (Optional): {
+     *             exportable: Boolean (Optional)
+     *             kty: String(EC/EC-HSM/RSA/RSA-HSM/oct/oct-HSM) (Optional)
+     *             key_size: Integer (Optional)
+     *             reuse_key: Boolean (Optional)
+     *             crv: String(P-256/P-384/P-521/P-256K) (Optional)
+     *         }
+     *         secret_props (Optional): {
+     *             contentType: String (Optional)
+     *         }
+     *         x509_props (Optional): {
+     *             subject: String (Optional)
+     *             ekus (Optional): [
+     *                 String (Optional)
+     *             ]
+     *             sans (Optional): {
+     *                 emails (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 dns_names (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *                 upns (Optional): [
+     *                     String (Optional)
+     *                 ]
+     *             }
+     *             key_usage (Optional): [
+     *                 String(digitalSignature/nonRepudiation/keyEncipherment/dataEncipherment/keyAgreement/keyCertSign/cRLSign/encipherOnly/decipherOnly) (Optional)
+     *             ]
+     *             validity_months: Integer (Optional)
+     *         }
+     *         lifetime_actions (Optional): [
+     *              (Optional){
+     *                 trigger (Optional): {
+     *                     lifetime_percentage: Integer (Optional)
+     *                     days_before_expiry: Integer (Optional)
+     *                 }
+     *                 action (Optional): {
+     *                     action_type: String(EmailContacts/AutoRenew) (Optional)
+     *                 }
+     *             }
+     *         ]
+     *         issuer (Optional): {
+     *             name: String (Optional)
+     *             cty: String (Optional)
+     *             cert_transparency: Boolean (Optional)
+     *         }
+     *         attributes (Optional): {
+     *             enabled: Boolean (Optional)
+     *             nbf: Long (Optional)
+     *             exp: Long (Optional)
+     *             created: Long (Optional)
+     *             updated: Long (Optional)
+     *             recoverableDays: Integer (Optional)
+     *             recoveryLevel: String(Purgeable/Recoverable+Purgeable/Recoverable/Recoverable+ProtectedSubscription/CustomizedRecoverable+Purgeable/CustomizedRecoverable/CustomizedRecoverable+ProtectedSubscription) (Optional)
+     *         }
+     *     }
+     *     cer: byte[] (Optional)
+     *     contentType: String (Optional)
+     *     attributes (Optional): (recursive schema, see attributes above)
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     * }
+     * }
+     * 
* - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. * @param certificateName The name of the deleted certificate. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. * @return a certificate bundle consists of a certificate (X509) plus its attributes along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response recoverDeletedCertificateWithResponse(String vaultBaseUrl, - String certificateName, Context context) { + public Response recoverDeletedCertificateWithResponse(String certificateName, + RequestOptions requestOptions) { final String accept = "application/json"; - return service.recoverDeletedCertificateSync(vaultBaseUrl, certificateName, this.getApiVersion(), accept, - context); + return service.recoverDeletedCertificateSync(this.getVaultBaseUrl(), this.getServiceVersion().getVersion(), + certificateName, accept, requestOptions, Context.NONE); } /** - * Recovers the deleted certificate back to its current version under /certificates. - * - * The RecoverDeletedCertificate operation performs the reversal of the Delete operation. The operation is - * applicable in vaults enabled for soft-delete, and must be issued during the retention interval (available in the - * deleted certificate's attributes). This operation requires the certificates/recover permission. + * List certificates in a specified key vault * - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param certificateName The name of the deleted certificate. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a certificate bundle consists of a certificate (X509) plus its attributes. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public CertificateBundle recoverDeletedCertificate(String vaultBaseUrl, String certificateName) { - return recoverDeletedCertificateWithResponse(vaultBaseUrl, certificateName, Context.NONE).getValue(); - } - - /** * Get the next page of items. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     attributes (Optional): {
+     *         enabled: Boolean (Optional)
+     *         nbf: Long (Optional)
+     *         exp: Long (Optional)
+     *         created: Long (Optional)
+     *         updated: Long (Optional)
+     *         recoverableDays: Integer (Optional)
+     *         recoveryLevel: String(Purgeable/Recoverable+Purgeable/Recoverable/Recoverable+ProtectedSubscription/CustomizedRecoverable+Purgeable/CustomizedRecoverable/CustomizedRecoverable+ProtectedSubscription) (Optional)
+     *     }
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     x5t: Base64Url (Optional)
+     * }
+     * }
+     * 
* * @param nextLink The URL to get the next list of items. - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. * @return the certificate list result along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getCertificatesNextSinglePageAsync(String nextLink, - String vaultBaseUrl) { + private Mono> getCertificatesNextSinglePageAsync(String nextLink, + RequestOptions requestOptions) { final String accept = "application/json"; - return FluxUtil.withContext(context -> service.getCertificatesNext(nextLink, vaultBaseUrl, accept, context)) + return FluxUtil.withContext( + context -> service.getCertificatesNext(nextLink, this.getVaultBaseUrl(), accept, requestOptions, context)) .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().getValue(), res.getValue().getNextLink(), null)); + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); } /** - * Get the next page of items. + * List certificates in a specified key vault * - * @param nextLink The URL to get the next list of items. - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the certificate list result along with {@link PagedResponse} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getCertificatesNextSinglePageAsync(String nextLink, String vaultBaseUrl, - Context context) { - final String accept = "application/json"; - return service.getCertificatesNext(nextLink, vaultBaseUrl, accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().getValue(), res.getValue().getNextLink(), null)); - } - - /** * Get the next page of items. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     attributes (Optional): {
+     *         enabled: Boolean (Optional)
+     *         nbf: Long (Optional)
+     *         exp: Long (Optional)
+     *         created: Long (Optional)
+     *         updated: Long (Optional)
+     *         recoverableDays: Integer (Optional)
+     *         recoveryLevel: String(Purgeable/Recoverable+Purgeable/Recoverable/Recoverable+ProtectedSubscription/CustomizedRecoverable+Purgeable/CustomizedRecoverable/CustomizedRecoverable+ProtectedSubscription) (Optional)
+     *     }
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     x5t: Base64Url (Optional)
+     * }
+     * }
+     * 
* * @param nextLink The URL to get the next list of items. - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. * @return the certificate list result along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public PagedResponse getCertificatesNextSinglePage(String nextLink, String vaultBaseUrl) { + private PagedResponse getCertificatesNextSinglePage(String nextLink, RequestOptions requestOptions) { final String accept = "application/json"; - Response res - = service.getCertificatesNextSync(nextLink, vaultBaseUrl, accept, Context.NONE); + Response res + = service.getCertificatesNextSync(nextLink, this.getVaultBaseUrl(), accept, requestOptions, Context.NONE); return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().getValue(), res.getValue().getNextLink(), null); + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); } /** - * Get the next page of items. + * List certificate issuers for a specified key vault. * - * @param nextLink The URL to get the next list of items. - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the certificate list result along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public PagedResponse getCertificatesNextSinglePage(String nextLink, String vaultBaseUrl, - Context context) { - final String accept = "application/json"; - Response res = service.getCertificatesNextSync(nextLink, vaultBaseUrl, accept, context); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().getValue(), res.getValue().getNextLink(), null); - } - - /** * Get the next page of items. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     provider: String (Optional)
+     * }
+     * }
+     * 
* * @param nextLink The URL to get the next list of items. - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. * @return the certificate issuer list result along with {@link PagedResponse} on successful completion of * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getCertificateIssuersNextSinglePageAsync(String nextLink, - String vaultBaseUrl) { + private Mono> getCertificateIssuersNextSinglePageAsync(String nextLink, + RequestOptions requestOptions) { final String accept = "application/json"; return FluxUtil - .withContext(context -> service.getCertificateIssuersNext(nextLink, vaultBaseUrl, accept, context)) + .withContext(context -> service.getCertificateIssuersNext(nextLink, this.getVaultBaseUrl(), accept, + requestOptions, context)) .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().getValue(), res.getValue().getNextLink(), null)); + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); } /** - * Get the next page of items. + * List certificate issuers for a specified key vault. * - * @param nextLink The URL to get the next list of items. - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the certificate issuer list result along with {@link PagedResponse} on successful completion of - * {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getCertificateIssuersNextSinglePageAsync(String nextLink, - String vaultBaseUrl, Context context) { - final String accept = "application/json"; - return service.getCertificateIssuersNext(nextLink, vaultBaseUrl, accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().getValue(), res.getValue().getNextLink(), null)); - } - - /** * Get the next page of items. + *

Response Body Schema

* - * @param nextLink The URL to get the next list of items. - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the certificate issuer list result along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public PagedResponse getCertificateIssuersNextSinglePage(String nextLink, - String vaultBaseUrl) { - final String accept = "application/json"; - Response res - = service.getCertificateIssuersNextSync(nextLink, vaultBaseUrl, accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().getValue(), res.getValue().getNextLink(), null); - } - - /** - * Get the next page of items. + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     provider: String (Optional)
+     * }
+     * }
+     * 
* * @param nextLink The URL to get the next list of items. - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. * @return the certificate issuer list result along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public PagedResponse getCertificateIssuersNextSinglePage(String nextLink, - String vaultBaseUrl, Context context) { + private PagedResponse getCertificateIssuersNextSinglePage(String nextLink, + RequestOptions requestOptions) { final String accept = "application/json"; - Response res - = service.getCertificateIssuersNextSync(nextLink, vaultBaseUrl, accept, context); + Response res = service.getCertificateIssuersNextSync(nextLink, this.getVaultBaseUrl(), accept, + requestOptions, Context.NONE); return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().getValue(), res.getValue().getNextLink(), null); + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); } /** + * List the versions of a certificate. + * * Get the next page of items. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     attributes (Optional): {
+     *         enabled: Boolean (Optional)
+     *         nbf: Long (Optional)
+     *         exp: Long (Optional)
+     *         created: Long (Optional)
+     *         updated: Long (Optional)
+     *         recoverableDays: Integer (Optional)
+     *         recoveryLevel: String(Purgeable/Recoverable+Purgeable/Recoverable/Recoverable+ProtectedSubscription/CustomizedRecoverable+Purgeable/CustomizedRecoverable/CustomizedRecoverable+ProtectedSubscription) (Optional)
+     *     }
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     x5t: Base64Url (Optional)
+     * }
+     * }
+     * 
* * @param nextLink The URL to get the next list of items. - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. * @return the certificate list result along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getCertificateVersionsNextSinglePageAsync(String nextLink, - String vaultBaseUrl) { + private Mono> getCertificateVersionsNextSinglePageAsync(String nextLink, + RequestOptions requestOptions) { final String accept = "application/json"; return FluxUtil - .withContext(context -> service.getCertificateVersionsNext(nextLink, vaultBaseUrl, accept, context)) + .withContext(context -> service.getCertificateVersionsNext(nextLink, this.getVaultBaseUrl(), accept, + requestOptions, context)) .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().getValue(), res.getValue().getNextLink(), null)); + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); } /** - * Get the next page of items. + * List the versions of a certificate. * - * @param nextLink The URL to get the next list of items. - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the certificate list result along with {@link PagedResponse} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getCertificateVersionsNextSinglePageAsync(String nextLink, - String vaultBaseUrl, Context context) { - final String accept = "application/json"; - return service.getCertificateVersionsNext(nextLink, vaultBaseUrl, accept, context) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().getValue(), res.getValue().getNextLink(), null)); - } - - /** * Get the next page of items. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     attributes (Optional): {
+     *         enabled: Boolean (Optional)
+     *         nbf: Long (Optional)
+     *         exp: Long (Optional)
+     *         created: Long (Optional)
+     *         updated: Long (Optional)
+     *         recoverableDays: Integer (Optional)
+     *         recoveryLevel: String(Purgeable/Recoverable+Purgeable/Recoverable/Recoverable+ProtectedSubscription/CustomizedRecoverable+Purgeable/CustomizedRecoverable/CustomizedRecoverable+ProtectedSubscription) (Optional)
+     *     }
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     x5t: Base64Url (Optional)
+     * }
+     * }
+     * 
* * @param nextLink The URL to get the next list of items. - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. * @return the certificate list result along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public PagedResponse getCertificateVersionsNextSinglePage(String nextLink, String vaultBaseUrl) { + private PagedResponse getCertificateVersionsNextSinglePage(String nextLink, + RequestOptions requestOptions) { final String accept = "application/json"; - Response res - = service.getCertificateVersionsNextSync(nextLink, vaultBaseUrl, accept, Context.NONE); + Response res = service.getCertificateVersionsNextSync(nextLink, this.getVaultBaseUrl(), accept, + requestOptions, Context.NONE); return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().getValue(), res.getValue().getNextLink(), null); + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); } /** - * Get the next page of items. + * Lists the deleted certificates in the specified vault currently available for recovery. * - * @param nextLink The URL to get the next list of items. - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the certificate list result along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public PagedResponse getCertificateVersionsNextSinglePage(String nextLink, String vaultBaseUrl, - Context context) { - final String accept = "application/json"; - Response res - = service.getCertificateVersionsNextSync(nextLink, vaultBaseUrl, accept, context); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().getValue(), res.getValue().getNextLink(), null); - } - - /** * Get the next page of items. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     attributes (Optional): {
+     *         enabled: Boolean (Optional)
+     *         nbf: Long (Optional)
+     *         exp: Long (Optional)
+     *         created: Long (Optional)
+     *         updated: Long (Optional)
+     *         recoverableDays: Integer (Optional)
+     *         recoveryLevel: String(Purgeable/Recoverable+Purgeable/Recoverable/Recoverable+ProtectedSubscription/CustomizedRecoverable+Purgeable/CustomizedRecoverable/CustomizedRecoverable+ProtectedSubscription) (Optional)
+     *     }
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     x5t: Base64Url (Optional)
+     *     recoveryId: String (Optional)
+     *     scheduledPurgeDate: Long (Optional)
+     *     deletedDate: Long (Optional)
+     * }
+     * }
+     * 
* * @param nextLink The URL to get the next list of items. - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. * @return a list of certificates that have been deleted in this vault along with {@link PagedResponse} on * successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getDeletedCertificatesNextSinglePageAsync(String nextLink, - String vaultBaseUrl) { + private Mono> getDeletedCertificatesNextSinglePageAsync(String nextLink, + RequestOptions requestOptions) { final String accept = "application/json"; return FluxUtil - .withContext(context -> service.getDeletedCertificatesNext(nextLink, vaultBaseUrl, accept, context)) - .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().getValue(), res.getValue().getNextLink(), null)); - } - - /** - * Get the next page of items. - * - * @param nextLink The URL to get the next list of items. - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of certificates that have been deleted in this vault along with {@link PagedResponse} on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getDeletedCertificatesNextSinglePageAsync(String nextLink, - String vaultBaseUrl, Context context) { - final String accept = "application/json"; - return service.getDeletedCertificatesNext(nextLink, vaultBaseUrl, accept, context) + .withContext(context -> service.getDeletedCertificatesNext(nextLink, this.getVaultBaseUrl(), accept, + requestOptions, context)) .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().getValue(), res.getValue().getNextLink(), null)); + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null)); } /** - * Get the next page of items. + * Lists the deleted certificates in the specified vault currently available for recovery. * - * @param nextLink The URL to get the next list of items. - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of certificates that have been deleted in this vault along with {@link PagedResponse}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public PagedResponse getDeletedCertificatesNextSinglePage(String nextLink, - String vaultBaseUrl) { - final String accept = "application/json"; - Response res - = service.getDeletedCertificatesNextSync(nextLink, vaultBaseUrl, accept, Context.NONE); - return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().getValue(), res.getValue().getNextLink(), null); - } - - /** * Get the next page of items. + *

Response Body Schema

+ * + *
+     * {@code
+     * {
+     *     id: String (Optional)
+     *     attributes (Optional): {
+     *         enabled: Boolean (Optional)
+     *         nbf: Long (Optional)
+     *         exp: Long (Optional)
+     *         created: Long (Optional)
+     *         updated: Long (Optional)
+     *         recoverableDays: Integer (Optional)
+     *         recoveryLevel: String(Purgeable/Recoverable+Purgeable/Recoverable/Recoverable+ProtectedSubscription/CustomizedRecoverable+Purgeable/CustomizedRecoverable/CustomizedRecoverable+ProtectedSubscription) (Optional)
+     *     }
+     *     tags (Optional): {
+     *         String: String (Required)
+     *     }
+     *     x5t: Base64Url (Optional)
+     *     recoveryId: String (Optional)
+     *     scheduledPurgeDate: Long (Optional)
+     *     deletedDate: Long (Optional)
+     * }
+     * }
+     * 
* * @param nextLink The URL to get the next list of items. - * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws KeyVaultErrorException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. + * @throws HttpResponseException thrown if the request is rejected by server. + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. * @return a list of certificates that have been deleted in this vault along with {@link PagedResponse}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public PagedResponse getDeletedCertificatesNextSinglePage(String nextLink, - String vaultBaseUrl, Context context) { + private PagedResponse getDeletedCertificatesNextSinglePage(String nextLink, + RequestOptions requestOptions) { final String accept = "application/json"; - Response res - = service.getDeletedCertificatesNextSync(nextLink, vaultBaseUrl, accept, context); + Response res = service.getDeletedCertificatesNextSync(nextLink, this.getVaultBaseUrl(), accept, + requestOptions, Context.NONE); return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), - res.getValue().getValue(), res.getValue().getNextLink(), null); + getValues(res.getValue(), "value"), getNextLink(res.getValue(), "nextLink"), null); + } + + private List getValues(BinaryData binaryData, String path) { + try { + Map obj = binaryData.toObject(Map.class); + List values = (List) obj.get(path); + return values.stream().map(BinaryData::fromObject).collect(Collectors.toList()); + } catch (RuntimeException e) { + return null; + } + } + + private String getNextLink(BinaryData binaryData, String path) { + try { + Map obj = binaryData.toObject(Map.class); + return (String) obj.get(path); + } catch (RuntimeException e) { + return null; + } } } diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/CertificateIssuerHelper.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/CertificateIssuerHelper.java index 9bd27f53f5962..2435dbbfeda10 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/CertificateIssuerHelper.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/CertificateIssuerHelper.java @@ -9,18 +9,18 @@ public final class CertificateIssuerHelper { private static CertificateIssuerAccessor accessor; public interface CertificateIssuerAccessor { - CertificateIssuer createCertificateIssuer(IssuerBundle impl); + CertificateIssuer createCertificateIssuer(IssuerBundle issuerBundle); - IssuerBundle getImpl(CertificateIssuer certificateIssuer); + IssuerBundle getIssuerBundle(CertificateIssuer certificateIssuer); } - public static CertificateIssuer createCertificateIssuer(IssuerBundle impl) { + public static CertificateIssuer createCertificateIssuer(IssuerBundle issuerBundle) { if (accessor == null) { new CertificateIssuer(""); } assert accessor != null; - return accessor.createCertificateIssuer(impl); + return accessor.createCertificateIssuer(issuerBundle); } public static IssuerBundle getIssuerBundle(CertificateIssuer certificateIssuer) { @@ -29,7 +29,7 @@ public static IssuerBundle getIssuerBundle(CertificateIssuer certificateIssuer) } assert accessor != null; - return accessor.getImpl(certificateIssuer); + return accessor.getIssuerBundle(certificateIssuer); } public static void setAccessor(CertificateIssuerAccessor accessor) { diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/CertificatePropertiesHelper.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/CertificatePropertiesHelper.java index 690dd442f3125..6d4842dbfa833 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/CertificatePropertiesHelper.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/CertificatePropertiesHelper.java @@ -3,6 +3,7 @@ package com.azure.security.keyvault.certificates.implementation; import com.azure.security.keyvault.certificates.implementation.models.CertificateItem; +import com.azure.security.keyvault.certificates.implementation.models.DeletedCertificateItem; import com.azure.security.keyvault.certificates.models.CertificateProperties; import com.azure.security.keyvault.certificates.models.DeletedCertificate; @@ -11,6 +12,8 @@ public final class CertificatePropertiesHelper { public interface CertificatePropertiesAccessor { CertificateProperties createCertificateProperties(CertificateItem item); + + CertificateProperties createCertificateProperties(DeletedCertificateItem item); } public static CertificateProperties createCertificateProperties(CertificateItem item) { @@ -25,6 +28,18 @@ public static CertificateProperties createCertificateProperties(CertificateItem return accessor.createCertificateProperties(item); } + public static CertificateProperties createCertificateProperties(DeletedCertificateItem item) { + if (accessor == null) { + // CertificateProperties doesn't have a public constructor but DeletedCertificate does and creates an + // instance of CertificateProperties. This will result in CertificateProperties being loaded by the class + // loader. + new DeletedCertificate(); + } + + assert accessor != null; + return accessor.createCertificateProperties(item); + } + public static void setAccessor(CertificatePropertiesAccessor accessor) { CertificatePropertiesHelper.accessor = accessor; } diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/Action.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/Action.java index 1d2be598f24a2..9ca627df60d5f 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/Action.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/Action.java @@ -1,15 +1,14 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.security.keyvault.certificates.implementation.models; import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; -import com.azure.security.keyvault.certificates.models.CertificatePolicyAction; import java.io.IOException; /** @@ -17,32 +16,37 @@ */ @Fluent public final class Action implements JsonSerializable { + /* * The type of the action. */ + @Generated private CertificatePolicyAction actionType; /** * Creates an instance of Action class. */ + @Generated public Action() { } /** * Get the actionType property: The type of the action. - * + * * @return the actionType value. */ + @Generated public CertificatePolicyAction getActionType() { return this.actionType; } /** * Set the actionType property: The type of the action. - * + * * @param actionType the actionType value to set. * @return the Action object itself. */ + @Generated public Action setActionType(CertificatePolicyAction actionType) { this.actionType = actionType; return this; @@ -51,6 +55,7 @@ public Action setActionType(CertificatePolicyAction actionType) { /** * {@inheritDoc} */ + @Generated @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); @@ -60,26 +65,25 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { /** * Reads an instance of Action from the JsonReader. - * + * * @param jsonReader The JsonReader being read. * @return An instance of Action if the JsonReader was pointing to an instance of it, or null if it was pointing to * JSON null. * @throws IOException If an error occurs while reading the Action. */ + @Generated public static Action fromJson(JsonReader jsonReader) throws IOException { return jsonReader.readObject(reader -> { Action deserializedAction = new Action(); while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("action_type".equals(fieldName)) { deserializedAction.actionType = CertificatePolicyAction.fromString(reader.getString()); } else { reader.skipChildren(); } } - return deserializedAction; }); } diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/Attributes.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/Attributes.java deleted file mode 100644 index 28ec25a8a0c14..0000000000000 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/Attributes.java +++ /dev/null @@ -1,226 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.security.keyvault.certificates.implementation.models; - -import com.azure.core.annotation.Fluent; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.time.Instant; -import java.time.OffsetDateTime; -import java.time.ZoneOffset; - -/** - * The object attributes managed by the KeyVault service. - */ -@Fluent -public class Attributes implements JsonSerializable { - /* - * Determines whether the object is enabled. - */ - private Boolean enabled; - - /* - * Not before date in UTC. - */ - private Long notBefore; - - /* - * Expiry date in UTC. - */ - private Long expires; - - /* - * Creation time in UTC. - */ - private Long created; - - /* - * Last updated time in UTC. - */ - private Long updated; - - /** - * Creates an instance of Attributes class. - */ - public Attributes() { - } - - /** - * Get the enabled property: Determines whether the object is enabled. - * - * @return the enabled value. - */ - public Boolean isEnabled() { - return this.enabled; - } - - /** - * Set the enabled property: Determines whether the object is enabled. - * - * @param enabled the enabled value to set. - * @return the Attributes object itself. - */ - public Attributes setEnabled(Boolean enabled) { - this.enabled = enabled; - return this; - } - - /** - * Get the notBefore property: Not before date in UTC. - * - * @return the notBefore value. - */ - public OffsetDateTime getNotBefore() { - if (this.notBefore == null) { - return null; - } - return OffsetDateTime.ofInstant(Instant.ofEpochSecond(this.notBefore), ZoneOffset.UTC); - } - - /** - * Set the notBefore property: Not before date in UTC. - * - * @param notBefore the notBefore value to set. - * @return the Attributes object itself. - */ - public Attributes setNotBefore(OffsetDateTime notBefore) { - if (notBefore == null) { - this.notBefore = null; - } else { - this.notBefore = notBefore.toEpochSecond(); - } - return this; - } - - /** - * Get the expires property: Expiry date in UTC. - * - * @return the expires value. - */ - public OffsetDateTime getExpires() { - if (this.expires == null) { - return null; - } - return OffsetDateTime.ofInstant(Instant.ofEpochSecond(this.expires), ZoneOffset.UTC); - } - - /** - * Set the expires property: Expiry date in UTC. - * - * @param expires the expires value to set. - * @return the Attributes object itself. - */ - public Attributes setExpires(OffsetDateTime expires) { - if (expires == null) { - this.expires = null; - } else { - this.expires = expires.toEpochSecond(); - } - return this; - } - - /** - * Get the created property: Creation time in UTC. - * - * @return the created value. - */ - public OffsetDateTime getCreated() { - if (this.created == null) { - return null; - } - return OffsetDateTime.ofInstant(Instant.ofEpochSecond(this.created), ZoneOffset.UTC); - } - - /** - * Set the created property: Creation time in UTC. - * - * @param created the created value to set. - * @return the Attributes object itself. - */ - Attributes setCreated(OffsetDateTime created) { - if (created == null) { - this.created = null; - } else { - this.created = created.toEpochSecond(); - } - return this; - } - - /** - * Get the updated property: Last updated time in UTC. - * - * @return the updated value. - */ - public OffsetDateTime getUpdated() { - if (this.updated == null) { - return null; - } - return OffsetDateTime.ofInstant(Instant.ofEpochSecond(this.updated), ZoneOffset.UTC); - } - - /** - * Set the updated property: Last updated time in UTC. - * - * @param updated the updated value to set. - * @return the Attributes object itself. - */ - Attributes setUpdated(OffsetDateTime updated) { - if (updated == null) { - this.updated = null; - } else { - this.updated = updated.toEpochSecond(); - } - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - jsonWriter.writeBooleanField("enabled", this.enabled); - jsonWriter.writeNumberField("nbf", this.notBefore); - jsonWriter.writeNumberField("exp", this.expires); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of Attributes from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of Attributes if the JsonReader was pointing to an instance of it, or null if it was pointing - * to JSON null. - * @throws IOException If an error occurs while reading the Attributes. - */ - public static Attributes fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - Attributes deserializedAttributes = new Attributes(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("enabled".equals(fieldName)) { - deserializedAttributes.enabled = reader.getNullable(JsonReader::getBoolean); - } else if ("nbf".equals(fieldName)) { - deserializedAttributes.notBefore = reader.getNullable(JsonReader::getLong); - } else if ("exp".equals(fieldName)) { - deserializedAttributes.expires = reader.getNullable(JsonReader::getLong); - } else if ("created".equals(fieldName)) { - deserializedAttributes.created = reader.getNullable(JsonReader::getLong); - } else if ("updated".equals(fieldName)) { - deserializedAttributes.updated = reader.getNullable(JsonReader::getLong); - } else { - reader.skipChildren(); - } - } - - return deserializedAttributes; - }); - } -} diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/BackupCertificateResult.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/BackupCertificateResult.java index 3031631df13a6..9386e8909136a 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/BackupCertificateResult.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/BackupCertificateResult.java @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.security.keyvault.certificates.implementation.models; +import com.azure.core.annotation.Generated; import com.azure.core.annotation.Immutable; import com.azure.core.util.Base64Url; import com.azure.json.JsonReader; @@ -17,22 +17,26 @@ */ @Immutable public final class BackupCertificateResult implements JsonSerializable { + /* * The backup blob containing the backed up certificate. */ + @Generated private Base64Url value; /** * Creates an instance of BackupCertificateResult class. */ - public BackupCertificateResult() { + @Generated + private BackupCertificateResult() { } /** * Get the value property: The backup blob containing the backed up certificate. - * + * * @return the value value. */ + @Generated public byte[] getValue() { if (this.value == null) { return null; @@ -43,6 +47,7 @@ public byte[] getValue() { /** * {@inheritDoc} */ + @Generated @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); @@ -51,19 +56,19 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { /** * Reads an instance of BackupCertificateResult from the JsonReader. - * + * * @param jsonReader The JsonReader being read. * @return An instance of BackupCertificateResult if the JsonReader was pointing to an instance of it, or null if it * was pointing to JSON null. * @throws IOException If an error occurs while reading the BackupCertificateResult. */ + @Generated public static BackupCertificateResult fromJson(JsonReader jsonReader) throws IOException { return jsonReader.readObject(reader -> { BackupCertificateResult deserializedBackupCertificateResult = new BackupCertificateResult(); while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("value".equals(fieldName)) { deserializedBackupCertificateResult.value = reader.getNullable(nonNullReader -> new Base64Url(nonNullReader.getString())); @@ -71,7 +76,6 @@ public static BackupCertificateResult fromJson(JsonReader jsonReader) throws IOE reader.skipChildren(); } } - return deserializedBackupCertificateResult; }); } diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificateAttributes.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificateAttributes.java index d7e7a407d66c2..0b5533a95c3b9 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificateAttributes.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificateAttributes.java @@ -1,11 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.security.keyvault.certificates.implementation.models; import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; import java.io.IOException; @@ -17,75 +18,145 @@ * The certificate management attributes. */ @Fluent -public final class CertificateAttributes extends Attributes { +public final class CertificateAttributes implements JsonSerializable { + /* - * softDelete data retention days. Value should be >=7 and <=90 when softDelete enabled, otherwise 0. + * Determines whether the object is enabled. */ - private Integer recoverableDays; + @Generated + private Boolean enabled; /* - * Reflects the deletion recovery level currently in effect for certificates in the current vault. If it contains - * 'Purgeable', the certificate can be permanently deleted by a privileged user; otherwise, only the system can - * purge the certificate, at the end of the retention interval. + * Not before date in UTC. */ - private DeletionRecoveryLevel recoveryLevel; + @Generated + private Long notBefore; /* - * Last updated time in UTC. + * Expiry date in UTC. */ - private Long updated; + @Generated + private Long expires; /* * Creation time in UTC. */ + @Generated private Long created; + /* + * Last updated time in UTC. + */ + @Generated + private Long updated; + + /* + * softDelete data retention days. Value should be >=7 and <=90 when softDelete enabled, otherwise 0. + */ + @Generated + private Integer recoverableDays; + + /* + * Reflects the deletion recovery level currently in effect for certificates in the current vault. If it contains + * 'Purgeable', the certificate can be permanently deleted by a privileged user; otherwise, only the system can + * purge the certificate, at the end of the retention interval. + */ + @Generated + private DeletionRecoveryLevel adminContacts; + /** * Creates an instance of CertificateAttributes class. */ + @Generated public CertificateAttributes() { } /** - * Get the recoverableDays property: softDelete data retention days. Value should be >=7 and <=90 when - * softDelete enabled, otherwise 0. - * - * @return the recoverableDays value. + * Get the enabled property: Determines whether the object is enabled. + * + * @return the enabled value. */ - public Integer getRecoverableDays() { - return this.recoverableDays; + @Generated + public Boolean isEnabled() { + return this.enabled; } /** - * Get the recoveryLevel property: Reflects the deletion recovery level currently in effect for certificates in the - * current vault. If it contains 'Purgeable', the certificate can be permanently deleted by a privileged user; - * otherwise, only the system can purge the certificate, at the end of the retention interval. - * - * @return the recoveryLevel value. + * Set the enabled property: Determines whether the object is enabled. + * + * @param enabled the enabled value to set. + * @return the CertificateAttributes object itself. */ - public DeletionRecoveryLevel getRecoveryLevel() { - return this.recoveryLevel; + @Generated + public CertificateAttributes setEnabled(Boolean enabled) { + this.enabled = enabled; + return this; } /** - * Get the updated property: Last updated time in UTC. - * - * @return the updated value. + * Get the notBefore property: Not before date in UTC. + * + * @return the notBefore value. */ - @Override - public OffsetDateTime getUpdated() { - if (this.updated == null) { + @Generated + public OffsetDateTime getNotBefore() { + if (this.notBefore == null) { return null; } - return OffsetDateTime.ofInstant(Instant.ofEpochSecond(this.updated), ZoneOffset.UTC); + return OffsetDateTime.ofInstant(Instant.ofEpochSecond(this.notBefore), ZoneOffset.UTC); + } + + /** + * Set the notBefore property: Not before date in UTC. + * + * @param notBefore the notBefore value to set. + * @return the CertificateAttributes object itself. + */ + @Generated + public CertificateAttributes setNotBefore(OffsetDateTime notBefore) { + if (notBefore == null) { + this.notBefore = null; + } else { + this.notBefore = notBefore.toEpochSecond(); + } + return this; + } + + /** + * Get the expires property: Expiry date in UTC. + * + * @return the expires value. + */ + @Generated + public OffsetDateTime getExpires() { + if (this.expires == null) { + return null; + } + return OffsetDateTime.ofInstant(Instant.ofEpochSecond(this.expires), ZoneOffset.UTC); + } + + /** + * Set the expires property: Expiry date in UTC. + * + * @param expires the expires value to set. + * @return the CertificateAttributes object itself. + */ + @Generated + public CertificateAttributes setExpires(OffsetDateTime expires) { + if (expires == null) { + this.expires = null; + } else { + this.expires = expires.toEpochSecond(); + } + return this; } /** * Get the created property: Creation time in UTC. - * + * * @return the created value. */ - @Override + @Generated public OffsetDateTime getCreated() { if (this.created == null) { return null; @@ -94,77 +165,75 @@ public OffsetDateTime getCreated() { } /** - * {@inheritDoc} + * Get the updated property: Last updated time in UTC. + * + * @return the updated value. */ - @Override - public CertificateAttributes setEnabled(Boolean enabled) { - super.setEnabled(enabled); - return this; + @Generated + public OffsetDateTime getUpdated() { + if (this.updated == null) { + return null; + } + return OffsetDateTime.ofInstant(Instant.ofEpochSecond(this.updated), ZoneOffset.UTC); } /** - * {@inheritDoc} + * Get the recoverableDays property: softDelete data retention days. Value should be >=7 and <=90 when + * softDelete enabled, otherwise 0. + * + * @return the recoverableDays value. */ - @Override - public CertificateAttributes setNotBefore(OffsetDateTime notBefore) { - super.setNotBefore(notBefore); - return this; + @Generated + public Integer getRecoverableDays() { + return this.recoverableDays; } /** - * {@inheritDoc} + * Get the adminContacts property: Reflects the deletion recovery level currently in effect for certificates in the + * current vault. If it contains 'Purgeable', the certificate can be permanently deleted by a privileged user; + * otherwise, only the system can purge the certificate, at the end of the retention interval. + * + * @return the adminContacts value. */ - @Override - public CertificateAttributes setExpires(OffsetDateTime expires) { - super.setExpires(expires); - return this; + @Generated + public DeletionRecoveryLevel getAdminContacts() { + return this.adminContacts; } /** * {@inheritDoc} */ + @Generated @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); - jsonWriter.writeBooleanField("enabled", isEnabled()); - if (getNotBefore() != null) { - jsonWriter.writeNumberField("nbf", getNotBefore().toEpochSecond()); - } - if (getExpires() != null) { - jsonWriter.writeNumberField("exp", getExpires().toEpochSecond()); - } + jsonWriter.writeBooleanField("enabled", this.enabled); + jsonWriter.writeNumberField("nbf", this.notBefore); + jsonWriter.writeNumberField("exp", this.expires); return jsonWriter.writeEndObject(); } /** * Reads an instance of CertificateAttributes from the JsonReader. - * + * * @param jsonReader The JsonReader being read. * @return An instance of CertificateAttributes if the JsonReader was pointing to an instance of it, or null if it * was pointing to JSON null. * @throws IOException If an error occurs while reading the CertificateAttributes. */ + @Generated public static CertificateAttributes fromJson(JsonReader jsonReader) throws IOException { return jsonReader.readObject(reader -> { CertificateAttributes deserializedCertificateAttributes = new CertificateAttributes(); while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("enabled".equals(fieldName)) { - deserializedCertificateAttributes.setEnabled(reader.getNullable(JsonReader::getBoolean)); + deserializedCertificateAttributes.enabled = reader.getNullable(JsonReader::getBoolean); } else if ("nbf".equals(fieldName)) { - Long notBeforeHolder = reader.getNullable(JsonReader::getLong); - if (notBeforeHolder != null) { - deserializedCertificateAttributes.setNotBefore( - OffsetDateTime.ofInstant(Instant.ofEpochSecond(notBeforeHolder), ZoneOffset.UTC)); - } + deserializedCertificateAttributes.notBefore = reader.getNullable(JsonReader::getLong); } else if ("exp".equals(fieldName)) { - Long expiresHolder = reader.getNullable(JsonReader::getLong); - if (expiresHolder != null) { - deserializedCertificateAttributes - .setExpires(OffsetDateTime.ofInstant(Instant.ofEpochSecond(expiresHolder), ZoneOffset.UTC)); - } + deserializedCertificateAttributes.expires = reader.getNullable(JsonReader::getLong); } else if ("created".equals(fieldName)) { deserializedCertificateAttributes.created = reader.getNullable(JsonReader::getLong); } else if ("updated".equals(fieldName)) { @@ -172,13 +241,12 @@ public static CertificateAttributes fromJson(JsonReader jsonReader) throws IOExc } else if ("recoverableDays".equals(fieldName)) { deserializedCertificateAttributes.recoverableDays = reader.getNullable(JsonReader::getInt); } else if ("recoveryLevel".equals(fieldName)) { - deserializedCertificateAttributes.recoveryLevel + deserializedCertificateAttributes.adminContacts = DeletionRecoveryLevel.fromString(reader.getString()); } else { reader.skipChildren(); } } - return deserializedCertificateAttributes; }); } diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificateBundle.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificateBundle.java index 06c7d41010386..e2d13f30bc257 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificateBundle.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificateBundle.java @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.security.keyvault.certificates.implementation.models; -import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; import com.azure.core.util.Base64Url; import com.azure.core.util.CoreUtils; import com.azure.json.JsonReader; @@ -17,124 +17,106 @@ /** * A certificate bundle consists of a certificate (X509) plus its attributes. */ -@Fluent -public class CertificateBundle implements JsonSerializable { +@Immutable +public final class CertificateBundle implements JsonSerializable { + /* * The certificate id. */ + @Generated private String id; /* * The key id. */ + @Generated private String kid; /* * The secret id. */ + @Generated private String sid; /* * Thumbprint of the certificate. */ + @Generated private Base64Url x509Thumbprint; /* * The management policy. */ + @Generated private CertificatePolicy policy; /* * CER contents of x509 certificate. */ + @Generated private byte[] cer; /* * The content type of the secret. eg. 'application/x-pem-file' or 'application/x-pkcs12', */ + @Generated private String contentType; /* * The certificate attributes. */ + @Generated private CertificateAttributes attributes; /* * Application specific metadata in the form of key-value pairs */ + @Generated private Map tags; /** * Creates an instance of CertificateBundle class. */ - public CertificateBundle() { + @Generated + private CertificateBundle() { } /** * Get the id property: The certificate id. - * + * * @return the id value. */ + @Generated public String getId() { return this.id; } - /** - * Set the id property: The certificate id. - * - * @param id the id value to set. - * @return the CertificateBundle object itself. - */ - CertificateBundle setId(String id) { - this.id = id; - return this; - } - /** * Get the kid property: The key id. - * + * * @return the kid value. */ + @Generated public String getKid() { return this.kid; } - /** - * Set the kid property: The key id. - * - * @param kid the kid value to set. - * @return the CertificateBundle object itself. - */ - CertificateBundle setKid(String kid) { - this.kid = kid; - return this; - } - /** * Get the sid property: The secret id. - * + * * @return the sid value. */ + @Generated public String getSid() { return this.sid; } - /** - * Set the sid property: The secret id. - * - * @param sid the sid value to set. - * @return the CertificateBundle object itself. - */ - CertificateBundle setSid(String sid) { - this.sid = sid; - return this; - } - /** * Get the x509Thumbprint property: Thumbprint of the certificate. - * + * * @return the x509Thumbprint value. */ + @Generated public byte[] getX509Thumbprint() { if (this.x509Thumbprint == null) { return null; @@ -142,126 +124,61 @@ public byte[] getX509Thumbprint() { return this.x509Thumbprint.decodedBytes(); } - /** - * Set the x509Thumbprint property: Thumbprint of the certificate. - * - * @param x509Thumbprint the x509Thumbprint value to set. - * @return the CertificateBundle object itself. - */ - CertificateBundle setX509Thumbprint(byte[] x509Thumbprint) { - if (x509Thumbprint == null) { - this.x509Thumbprint = null; - } else { - this.x509Thumbprint = Base64Url.encode(CoreUtils.clone(x509Thumbprint)); - } - return this; - } - /** * Get the policy property: The management policy. - * + * * @return the policy value. */ + @Generated public CertificatePolicy getPolicy() { return this.policy; } - /** - * Set the policy property: The management policy. - * - * @param policy the policy value to set. - * @return the CertificateBundle object itself. - */ - CertificateBundle setPolicy(CertificatePolicy policy) { - this.policy = policy; - return this; - } - /** * Get the cer property: CER contents of x509 certificate. - * + * * @return the cer value. */ + @Generated public byte[] getCer() { return CoreUtils.clone(this.cer); } - /** - * Set the cer property: CER contents of x509 certificate. - * - * @param cer the cer value to set. - * @return the CertificateBundle object itself. - */ - public CertificateBundle setCer(byte[] cer) { - this.cer = CoreUtils.clone(cer); - return this; - } - /** * Get the contentType property: The content type of the secret. eg. 'application/x-pem-file' or * 'application/x-pkcs12',. - * + * * @return the contentType value. */ + @Generated public String getContentType() { return this.contentType; } - /** - * Set the contentType property: The content type of the secret. eg. 'application/x-pem-file' or - * 'application/x-pkcs12',. - * - * @param contentType the contentType value to set. - * @return the CertificateBundle object itself. - */ - public CertificateBundle setContentType(String contentType) { - this.contentType = contentType; - return this; - } - /** * Get the attributes property: The certificate attributes. - * + * * @return the attributes value. */ + @Generated public CertificateAttributes getAttributes() { return this.attributes; } - /** - * Set the attributes property: The certificate attributes. - * - * @param attributes the attributes value to set. - * @return the CertificateBundle object itself. - */ - public CertificateBundle setAttributes(CertificateAttributes attributes) { - this.attributes = attributes; - return this; - } - /** * Get the tags property: Application specific metadata in the form of key-value pairs. - * + * * @return the tags value. */ + @Generated public Map getTags() { return this.tags; } - /** - * Set the tags property: Application specific metadata in the form of key-value pairs. - * - * @param tags the tags value to set. - * @return the CertificateBundle object itself. - */ - public CertificateBundle setTags(Map tags) { - this.tags = tags; - return this; - } - /** * {@inheritDoc} */ + @Generated @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); @@ -274,19 +191,19 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { /** * Reads an instance of CertificateBundle from the JsonReader. - * + * * @param jsonReader The JsonReader being read. * @return An instance of CertificateBundle if the JsonReader was pointing to an instance of it, or null if it was * pointing to JSON null. * @throws IOException If an error occurs while reading the CertificateBundle. */ + @Generated public static CertificateBundle fromJson(JsonReader jsonReader) throws IOException { return jsonReader.readObject(reader -> { CertificateBundle deserializedCertificateBundle = new CertificateBundle(); while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("id".equals(fieldName)) { deserializedCertificateBundle.id = reader.getString(); } else if ("kid".equals(fieldName)) { @@ -311,7 +228,6 @@ public static CertificateBundle fromJson(JsonReader jsonReader) throws IOExcepti reader.skipChildren(); } } - return deserializedCertificateBundle; }); } diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificateCreateParameters.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificateCreateParameters.java index b2f4d960f564f..7909480e5959f 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificateCreateParameters.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificateCreateParameters.java @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.security.keyvault.certificates.implementation.models; import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -17,42 +17,49 @@ */ @Fluent public final class CertificateCreateParameters implements JsonSerializable { + /* * The management policy for the certificate. */ + @Generated private CertificatePolicy certificatePolicy; /* * The attributes of the certificate (optional). */ + @Generated private CertificateAttributes certificateAttributes; /* * Application specific metadata in the form of key-value pairs. */ + @Generated private Map tags; /** * Creates an instance of CertificateCreateParameters class. */ + @Generated public CertificateCreateParameters() { } /** * Get the certificatePolicy property: The management policy for the certificate. - * + * * @return the certificatePolicy value. */ + @Generated public CertificatePolicy getCertificatePolicy() { return this.certificatePolicy; } /** * Set the certificatePolicy property: The management policy for the certificate. - * + * * @param certificatePolicy the certificatePolicy value to set. * @return the CertificateCreateParameters object itself. */ + @Generated public CertificateCreateParameters setCertificatePolicy(CertificatePolicy certificatePolicy) { this.certificatePolicy = certificatePolicy; return this; @@ -60,19 +67,21 @@ public CertificateCreateParameters setCertificatePolicy(CertificatePolicy certif /** * Get the certificateAttributes property: The attributes of the certificate (optional). - * + * * @return the certificateAttributes value. */ + @Generated public CertificateAttributes getCertificateAttributes() { return this.certificateAttributes; } /** * Set the certificateAttributes property: The attributes of the certificate (optional). - * + * * @param certificateAttributes the certificateAttributes value to set. * @return the CertificateCreateParameters object itself. */ + @Generated public CertificateCreateParameters setCertificateAttributes(CertificateAttributes certificateAttributes) { this.certificateAttributes = certificateAttributes; return this; @@ -80,19 +89,21 @@ public CertificateCreateParameters setCertificateAttributes(CertificateAttribute /** * Get the tags property: Application specific metadata in the form of key-value pairs. - * + * * @return the tags value. */ + @Generated public Map getTags() { return this.tags; } /** * Set the tags property: Application specific metadata in the form of key-value pairs. - * + * * @param tags the tags value to set. * @return the CertificateCreateParameters object itself. */ + @Generated public CertificateCreateParameters setTags(Map tags) { this.tags = tags; return this; @@ -101,6 +112,7 @@ public CertificateCreateParameters setTags(Map tags) { /** * {@inheritDoc} */ + @Generated @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); @@ -112,19 +124,19 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { /** * Reads an instance of CertificateCreateParameters from the JsonReader. - * + * * @param jsonReader The JsonReader being read. * @return An instance of CertificateCreateParameters if the JsonReader was pointing to an instance of it, or null * if it was pointing to JSON null. * @throws IOException If an error occurs while reading the CertificateCreateParameters. */ + @Generated public static CertificateCreateParameters fromJson(JsonReader jsonReader) throws IOException { return jsonReader.readObject(reader -> { CertificateCreateParameters deserializedCertificateCreateParameters = new CertificateCreateParameters(); while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("policy".equals(fieldName)) { deserializedCertificateCreateParameters.certificatePolicy = CertificatePolicy.fromJson(reader); } else if ("attributes".equals(fieldName)) { @@ -137,7 +149,6 @@ public static CertificateCreateParameters fromJson(JsonReader jsonReader) throws reader.skipChildren(); } } - return deserializedCertificateCreateParameters; }); } diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificateImportParameters.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificateImportParameters.java index 63c062bced7a5..41f6b8cb13f65 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificateImportParameters.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificateImportParameters.java @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.security.keyvault.certificates.implementation.models; import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -17,66 +17,66 @@ */ @Fluent public final class CertificateImportParameters implements JsonSerializable { + /* * Base64 encoded representation of the certificate object to import. This certificate needs to contain the private * key. */ - private String base64EncodedCertificate; + @Generated + private final String base64EncodedCertificate; /* * If the private key in base64EncodedCertificate is encrypted, the password used for encryption. */ + @Generated private String password; /* * The management policy for the certificate. */ + @Generated private CertificatePolicy certificatePolicy; /* * The attributes of the certificate (optional). */ + @Generated private CertificateAttributes certificateAttributes; /* * Application specific metadata in the form of key-value pairs. */ + @Generated private Map tags; /** * Creates an instance of CertificateImportParameters class. + * + * @param base64EncodedCertificate the base64EncodedCertificate value to set. */ - public CertificateImportParameters() { + @Generated + public CertificateImportParameters(String base64EncodedCertificate) { + this.base64EncodedCertificate = base64EncodedCertificate; } /** * Get the base64EncodedCertificate property: Base64 encoded representation of the certificate object to import. * This certificate needs to contain the private key. - * + * * @return the base64EncodedCertificate value. */ + @Generated public String getBase64EncodedCertificate() { return this.base64EncodedCertificate; } - /** - * Set the base64EncodedCertificate property: Base64 encoded representation of the certificate object to import. - * This certificate needs to contain the private key. - * - * @param base64EncodedCertificate the base64EncodedCertificate value to set. - * @return the CertificateImportParameters object itself. - */ - public CertificateImportParameters setBase64EncodedCertificate(String base64EncodedCertificate) { - this.base64EncodedCertificate = base64EncodedCertificate; - return this; - } - /** * Get the password property: If the private key in base64EncodedCertificate is encrypted, the password used for * encryption. - * + * * @return the password value. */ + @Generated public String getPassword() { return this.password; } @@ -84,10 +84,11 @@ public String getPassword() { /** * Set the password property: If the private key in base64EncodedCertificate is encrypted, the password used for * encryption. - * + * * @param password the password value to set. * @return the CertificateImportParameters object itself. */ + @Generated public CertificateImportParameters setPassword(String password) { this.password = password; return this; @@ -95,19 +96,21 @@ public CertificateImportParameters setPassword(String password) { /** * Get the certificatePolicy property: The management policy for the certificate. - * + * * @return the certificatePolicy value. */ + @Generated public CertificatePolicy getCertificatePolicy() { return this.certificatePolicy; } /** * Set the certificatePolicy property: The management policy for the certificate. - * + * * @param certificatePolicy the certificatePolicy value to set. * @return the CertificateImportParameters object itself. */ + @Generated public CertificateImportParameters setCertificatePolicy(CertificatePolicy certificatePolicy) { this.certificatePolicy = certificatePolicy; return this; @@ -115,19 +118,21 @@ public CertificateImportParameters setCertificatePolicy(CertificatePolicy certif /** * Get the certificateAttributes property: The attributes of the certificate (optional). - * + * * @return the certificateAttributes value. */ + @Generated public CertificateAttributes getCertificateAttributes() { return this.certificateAttributes; } /** * Set the certificateAttributes property: The attributes of the certificate (optional). - * + * * @param certificateAttributes the certificateAttributes value to set. * @return the CertificateImportParameters object itself. */ + @Generated public CertificateImportParameters setCertificateAttributes(CertificateAttributes certificateAttributes) { this.certificateAttributes = certificateAttributes; return this; @@ -135,19 +140,21 @@ public CertificateImportParameters setCertificateAttributes(CertificateAttribute /** * Get the tags property: Application specific metadata in the form of key-value pairs. - * + * * @return the tags value. */ + @Generated public Map getTags() { return this.tags; } /** * Set the tags property: Application specific metadata in the form of key-value pairs. - * + * * @param tags the tags value to set. * @return the CertificateImportParameters object itself. */ + @Generated public CertificateImportParameters setTags(Map tags) { this.tags = tags; return this; @@ -156,6 +163,7 @@ public CertificateImportParameters setTags(Map tags) { /** * {@inheritDoc} */ + @Generated @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); @@ -169,37 +177,44 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { /** * Reads an instance of CertificateImportParameters from the JsonReader. - * + * * @param jsonReader The JsonReader being read. * @return An instance of CertificateImportParameters if the JsonReader was pointing to an instance of it, or null * if it was pointing to JSON null. * @throws IllegalStateException If the deserialized JSON object was missing any required properties. * @throws IOException If an error occurs while reading the CertificateImportParameters. */ + @Generated public static CertificateImportParameters fromJson(JsonReader jsonReader) throws IOException { return jsonReader.readObject(reader -> { - CertificateImportParameters deserializedCertificateImportParameters = new CertificateImportParameters(); + String base64EncodedCertificate = null; + String password = null; + CertificatePolicy certificatePolicy = null; + CertificateAttributes certificateAttributes = null; + Map tags = null; while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("value".equals(fieldName)) { - deserializedCertificateImportParameters.base64EncodedCertificate = reader.getString(); + base64EncodedCertificate = reader.getString(); } else if ("pwd".equals(fieldName)) { - deserializedCertificateImportParameters.password = reader.getString(); + password = reader.getString(); } else if ("policy".equals(fieldName)) { - deserializedCertificateImportParameters.certificatePolicy = CertificatePolicy.fromJson(reader); + certificatePolicy = CertificatePolicy.fromJson(reader); } else if ("attributes".equals(fieldName)) { - deserializedCertificateImportParameters.certificateAttributes - = CertificateAttributes.fromJson(reader); + certificateAttributes = CertificateAttributes.fromJson(reader); } else if ("tags".equals(fieldName)) { - Map tags = reader.readMap(reader1 -> reader1.getString()); - deserializedCertificateImportParameters.tags = tags; + tags = reader.readMap(reader1 -> reader1.getString()); } else { reader.skipChildren(); } } - + CertificateImportParameters deserializedCertificateImportParameters + = new CertificateImportParameters(base64EncodedCertificate); + deserializedCertificateImportParameters.password = password; + deserializedCertificateImportParameters.certificatePolicy = certificatePolicy; + deserializedCertificateImportParameters.certificateAttributes = certificateAttributes; + deserializedCertificateImportParameters.tags = tags; return deserializedCertificateImportParameters; }); } diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificateIssuerItem.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificateIssuerItem.java index b3a82fd210d39..edd21217bfeb6 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificateIssuerItem.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificateIssuerItem.java @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.security.keyvault.certificates.implementation.models; import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -16,65 +16,50 @@ */ @Fluent public final class CertificateIssuerItem implements JsonSerializable { + /* * Certificate Identifier. */ + @Generated private String id; /* * The issuer provider. */ + @Generated private String provider; /** * Creates an instance of CertificateIssuerItem class. */ + @Generated public CertificateIssuerItem() { } /** * Get the id property: Certificate Identifier. - * + * * @return the id value. */ + @Generated public String getId() { return this.id; } - /** - * Set the id property: Certificate Identifier. - * - * @param id the id value to set. - * @return the CertificateIssuerItem object itself. - */ - public CertificateIssuerItem setId(String id) { - this.id = id; - return this; - } - /** * Get the provider property: The issuer provider. - * + * * @return the provider value. */ + @Generated public String getProvider() { return this.provider; } - /** - * Set the provider property: The issuer provider. - * - * @param provider the provider value to set. - * @return the CertificateIssuerItem object itself. - */ - public CertificateIssuerItem setProvider(String provider) { - this.provider = provider; - return this; - } - /** * {@inheritDoc} */ + @Generated @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); @@ -85,19 +70,19 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { /** * Reads an instance of CertificateIssuerItem from the JsonReader. - * + * * @param jsonReader The JsonReader being read. * @return An instance of CertificateIssuerItem if the JsonReader was pointing to an instance of it, or null if it * was pointing to JSON null. * @throws IOException If an error occurs while reading the CertificateIssuerItem. */ + @Generated public static CertificateIssuerItem fromJson(JsonReader jsonReader) throws IOException { return jsonReader.readObject(reader -> { CertificateIssuerItem deserializedCertificateIssuerItem = new CertificateIssuerItem(); while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("id".equals(fieldName)) { deserializedCertificateIssuerItem.id = reader.getString(); } else if ("provider".equals(fieldName)) { @@ -106,8 +91,31 @@ public static CertificateIssuerItem fromJson(JsonReader jsonReader) throws IOExc reader.skipChildren(); } } - return deserializedCertificateIssuerItem; }); } + + /** + * Set the id property: Certificate Identifier. + * + * @param id the id value to set. + * @return the CertificateIssuerItem object itself. + */ + @Generated + public CertificateIssuerItem setId(String id) { + this.id = id; + return this; + } + + /** + * Set the provider property: The issuer provider. + * + * @param provider the provider value to set. + * @return the CertificateIssuerItem object itself. + */ + @Generated + public CertificateIssuerItem setProvider(String provider) { + this.provider = provider; + return this; + } } diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificateIssuerListResult.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificateIssuerListResult.java deleted file mode 100644 index 73495be17c0a2..0000000000000 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificateIssuerListResult.java +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.security.keyvault.certificates.implementation.models; - -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.List; - -/** - * The certificate issuer list result. - */ -@Immutable -public final class CertificateIssuerListResult implements JsonSerializable { - /* - * A response message containing a list of certificate issuers in the key vault along with a link to the next page - * of certificate issuers. - */ - private List value; - - /* - * The URL to get the next set of certificate issuers. - */ - private String nextLink; - - /** - * Creates an instance of CertificateIssuerListResult class. - */ - public CertificateIssuerListResult() { - } - - /** - * Get the value property: A response message containing a list of certificate issuers in the key vault along with a - * link to the next page of certificate issuers. - * - * @return the value value. - */ - public List getValue() { - return this.value; - } - - /** - * Get the nextLink property: The URL to get the next set of certificate issuers. - * - * @return the nextLink value. - */ - public String getNextLink() { - return this.nextLink; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of CertificateIssuerListResult from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of CertificateIssuerListResult if the JsonReader was pointing to an instance of it, or null - * if it was pointing to JSON null. - * @throws IOException If an error occurs while reading the CertificateIssuerListResult. - */ - public static CertificateIssuerListResult fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - CertificateIssuerListResult deserializedCertificateIssuerListResult = new CertificateIssuerListResult(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("value".equals(fieldName)) { - List value - = reader.readArray(reader1 -> CertificateIssuerItem.fromJson(reader1)); - deserializedCertificateIssuerListResult.value = value; - } else if ("nextLink".equals(fieldName)) { - deserializedCertificateIssuerListResult.nextLink = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedCertificateIssuerListResult; - }); - } -} diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificateIssuerSetParameters.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificateIssuerSetParameters.java index ce6e00c1243e5..5b7507879b37e 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificateIssuerSetParameters.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificateIssuerSetParameters.java @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.security.keyvault.certificates.implementation.models; import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -16,67 +16,68 @@ */ @Fluent public final class CertificateIssuerSetParameters implements JsonSerializable { + /* * The issuer provider. */ - private String provider; + @Generated + private final String provider; /* * The credentials to be used for the issuer. */ + @Generated private IssuerCredentials credentials; /* * Details of the organization as provided to the issuer. */ + @Generated private OrganizationDetails organizationDetails; /* * Attributes of the issuer object. */ + @Generated private IssuerAttributes attributes; /** * Creates an instance of CertificateIssuerSetParameters class. + * + * @param provider the provider value to set. */ - public CertificateIssuerSetParameters() { + @Generated + public CertificateIssuerSetParameters(String provider) { + this.provider = provider; } /** * Get the provider property: The issuer provider. - * + * * @return the provider value. */ + @Generated public String getProvider() { return this.provider; } - /** - * Set the provider property: The issuer provider. - * - * @param provider the provider value to set. - * @return the CertificateIssuerSetParameters object itself. - */ - public CertificateIssuerSetParameters setProvider(String provider) { - this.provider = provider; - return this; - } - /** * Get the credentials property: The credentials to be used for the issuer. - * + * * @return the credentials value. */ + @Generated public IssuerCredentials getCredentials() { return this.credentials; } /** * Set the credentials property: The credentials to be used for the issuer. - * + * * @param credentials the credentials value to set. * @return the CertificateIssuerSetParameters object itself. */ + @Generated public CertificateIssuerSetParameters setCredentials(IssuerCredentials credentials) { this.credentials = credentials; return this; @@ -84,19 +85,21 @@ public CertificateIssuerSetParameters setCredentials(IssuerCredentials credentia /** * Get the organizationDetails property: Details of the organization as provided to the issuer. - * + * * @return the organizationDetails value. */ + @Generated public OrganizationDetails getOrganizationDetails() { return this.organizationDetails; } /** * Set the organizationDetails property: Details of the organization as provided to the issuer. - * + * * @param organizationDetails the organizationDetails value to set. * @return the CertificateIssuerSetParameters object itself. */ + @Generated public CertificateIssuerSetParameters setOrganizationDetails(OrganizationDetails organizationDetails) { this.organizationDetails = organizationDetails; return this; @@ -104,19 +107,21 @@ public CertificateIssuerSetParameters setOrganizationDetails(OrganizationDetails /** * Get the attributes property: Attributes of the issuer object. - * + * * @return the attributes value. */ + @Generated public IssuerAttributes getAttributes() { return this.attributes; } /** * Set the attributes property: Attributes of the issuer object. - * + * * @param attributes the attributes value to set. * @return the CertificateIssuerSetParameters object itself. */ + @Generated public CertificateIssuerSetParameters setAttributes(IssuerAttributes attributes) { this.attributes = attributes; return this; @@ -125,6 +130,7 @@ public CertificateIssuerSetParameters setAttributes(IssuerAttributes attributes) /** * {@inheritDoc} */ + @Generated @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); @@ -137,35 +143,40 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { /** * Reads an instance of CertificateIssuerSetParameters from the JsonReader. - * + * * @param jsonReader The JsonReader being read. * @return An instance of CertificateIssuerSetParameters if the JsonReader was pointing to an instance of it, or * null if it was pointing to JSON null. * @throws IllegalStateException If the deserialized JSON object was missing any required properties. * @throws IOException If an error occurs while reading the CertificateIssuerSetParameters. */ + @Generated public static CertificateIssuerSetParameters fromJson(JsonReader jsonReader) throws IOException { return jsonReader.readObject(reader -> { - CertificateIssuerSetParameters deserializedCertificateIssuerSetParameters - = new CertificateIssuerSetParameters(); + String provider = null; + IssuerCredentials credentials = null; + OrganizationDetails organizationDetails = null; + IssuerAttributes attributes = null; while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("provider".equals(fieldName)) { - deserializedCertificateIssuerSetParameters.provider = reader.getString(); + provider = reader.getString(); } else if ("credentials".equals(fieldName)) { - deserializedCertificateIssuerSetParameters.credentials = IssuerCredentials.fromJson(reader); + credentials = IssuerCredentials.fromJson(reader); } else if ("org_details".equals(fieldName)) { - deserializedCertificateIssuerSetParameters.organizationDetails - = OrganizationDetails.fromJson(reader); + organizationDetails = OrganizationDetails.fromJson(reader); } else if ("attributes".equals(fieldName)) { - deserializedCertificateIssuerSetParameters.attributes = IssuerAttributes.fromJson(reader); + attributes = IssuerAttributes.fromJson(reader); } else { reader.skipChildren(); } } - + CertificateIssuerSetParameters deserializedCertificateIssuerSetParameters + = new CertificateIssuerSetParameters(provider); + deserializedCertificateIssuerSetParameters.credentials = credentials; + deserializedCertificateIssuerSetParameters.organizationDetails = organizationDetails; + deserializedCertificateIssuerSetParameters.attributes = attributes; return deserializedCertificateIssuerSetParameters; }); } diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificateIssuerUpdateParameters.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificateIssuerUpdateParameters.java index 4109a4a35ce1f..413e8bce850a3 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificateIssuerUpdateParameters.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificateIssuerUpdateParameters.java @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.security.keyvault.certificates.implementation.models; import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -16,47 +16,55 @@ */ @Fluent public final class CertificateIssuerUpdateParameters implements JsonSerializable { + /* * The issuer provider. */ + @Generated private String provider; /* * The credentials to be used for the issuer. */ + @Generated private IssuerCredentials credentials; /* * Details of the organization as provided to the issuer. */ + @Generated private OrganizationDetails organizationDetails; /* * Attributes of the issuer object. */ + @Generated private IssuerAttributes attributes; /** * Creates an instance of CertificateIssuerUpdateParameters class. */ + @Generated public CertificateIssuerUpdateParameters() { } /** * Get the provider property: The issuer provider. - * + * * @return the provider value. */ + @Generated public String getProvider() { return this.provider; } /** * Set the provider property: The issuer provider. - * + * * @param provider the provider value to set. * @return the CertificateIssuerUpdateParameters object itself. */ + @Generated public CertificateIssuerUpdateParameters setProvider(String provider) { this.provider = provider; return this; @@ -64,19 +72,21 @@ public CertificateIssuerUpdateParameters setProvider(String provider) { /** * Get the credentials property: The credentials to be used for the issuer. - * + * * @return the credentials value. */ + @Generated public IssuerCredentials getCredentials() { return this.credentials; } /** * Set the credentials property: The credentials to be used for the issuer. - * + * * @param credentials the credentials value to set. * @return the CertificateIssuerUpdateParameters object itself. */ + @Generated public CertificateIssuerUpdateParameters setCredentials(IssuerCredentials credentials) { this.credentials = credentials; return this; @@ -84,19 +94,21 @@ public CertificateIssuerUpdateParameters setCredentials(IssuerCredentials creden /** * Get the organizationDetails property: Details of the organization as provided to the issuer. - * + * * @return the organizationDetails value. */ + @Generated public OrganizationDetails getOrganizationDetails() { return this.organizationDetails; } /** * Set the organizationDetails property: Details of the organization as provided to the issuer. - * + * * @param organizationDetails the organizationDetails value to set. * @return the CertificateIssuerUpdateParameters object itself. */ + @Generated public CertificateIssuerUpdateParameters setOrganizationDetails(OrganizationDetails organizationDetails) { this.organizationDetails = organizationDetails; return this; @@ -104,19 +116,21 @@ public CertificateIssuerUpdateParameters setOrganizationDetails(OrganizationDeta /** * Get the attributes property: Attributes of the issuer object. - * + * * @return the attributes value. */ + @Generated public IssuerAttributes getAttributes() { return this.attributes; } /** * Set the attributes property: Attributes of the issuer object. - * + * * @param attributes the attributes value to set. * @return the CertificateIssuerUpdateParameters object itself. */ + @Generated public CertificateIssuerUpdateParameters setAttributes(IssuerAttributes attributes) { this.attributes = attributes; return this; @@ -125,6 +139,7 @@ public CertificateIssuerUpdateParameters setAttributes(IssuerAttributes attribut /** * {@inheritDoc} */ + @Generated @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); @@ -137,12 +152,13 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { /** * Reads an instance of CertificateIssuerUpdateParameters from the JsonReader. - * + * * @param jsonReader The JsonReader being read. * @return An instance of CertificateIssuerUpdateParameters if the JsonReader was pointing to an instance of it, or * null if it was pointing to JSON null. * @throws IOException If an error occurs while reading the CertificateIssuerUpdateParameters. */ + @Generated public static CertificateIssuerUpdateParameters fromJson(JsonReader jsonReader) throws IOException { return jsonReader.readObject(reader -> { CertificateIssuerUpdateParameters deserializedCertificateIssuerUpdateParameters @@ -150,7 +166,6 @@ public static CertificateIssuerUpdateParameters fromJson(JsonReader jsonReader) while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("provider".equals(fieldName)) { deserializedCertificateIssuerUpdateParameters.provider = reader.getString(); } else if ("credentials".equals(fieldName)) { @@ -164,7 +179,6 @@ public static CertificateIssuerUpdateParameters fromJson(JsonReader jsonReader) reader.skipChildren(); } } - return deserializedCertificateIssuerUpdateParameters; }); } diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificateItem.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificateItem.java index 20682166ad748..53c7a9ca81fd9 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificateItem.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificateItem.java @@ -1,12 +1,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.security.keyvault.certificates.implementation.models; -import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; import com.azure.core.util.Base64Url; -import com.azure.core.util.CoreUtils; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -18,99 +17,76 @@ /** * The certificate item containing certificate metadata. */ -@Fluent -public class CertificateItem implements JsonSerializable { +@Immutable +public final class CertificateItem implements JsonSerializable { + /* * Certificate identifier. */ + @Generated private String id; /* * The certificate management attributes. */ + @Generated private CertificateAttributes attributes; /* * Application specific metadata in the form of key-value pairs. */ + @Generated private Map tags; /* * Thumbprint of the certificate. */ + @Generated private Base64Url x509Thumbprint; /** * Creates an instance of CertificateItem class. */ - public CertificateItem() { + @Generated + private CertificateItem() { } /** * Get the id property: Certificate identifier. - * + * * @return the id value. */ + @Generated public String getId() { return this.id; } - /** - * Set the id property: Certificate identifier. - * - * @param id the id value to set. - * @return the CertificateItem object itself. - */ - public CertificateItem setId(String id) { - this.id = id; - return this; - } - /** * Get the attributes property: The certificate management attributes. - * + * * @return the attributes value. */ + @Generated public CertificateAttributes getAttributes() { return this.attributes; } - /** - * Set the attributes property: The certificate management attributes. - * - * @param attributes the attributes value to set. - * @return the CertificateItem object itself. - */ - public CertificateItem setAttributes(CertificateAttributes attributes) { - this.attributes = attributes; - return this; - } - /** * Get the tags property: Application specific metadata in the form of key-value pairs. - * + * * @return the tags value. */ + @Generated public Map getTags() { return this.tags; } - /** - * Set the tags property: Application specific metadata in the form of key-value pairs. - * - * @param tags the tags value to set. - * @return the CertificateItem object itself. - */ - public CertificateItem setTags(Map tags) { - this.tags = tags; - return this; - } - /** * Get the x509Thumbprint property: Thumbprint of the certificate. - * + * * @return the x509Thumbprint value. */ + @Generated public byte[] getX509Thumbprint() { if (this.x509Thumbprint == null) { return null; @@ -118,24 +94,10 @@ public byte[] getX509Thumbprint() { return this.x509Thumbprint.decodedBytes(); } - /** - * Set the x509Thumbprint property: Thumbprint of the certificate. - * - * @param x509Thumbprint the x509Thumbprint value to set. - * @return the CertificateItem object itself. - */ - public CertificateItem setX509Thumbprint(byte[] x509Thumbprint) { - if (x509Thumbprint == null) { - this.x509Thumbprint = null; - } else { - this.x509Thumbprint = Base64Url.encode(CoreUtils.clone(x509Thumbprint)); - } - return this; - } - /** * {@inheritDoc} */ + @Generated @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); @@ -148,19 +110,19 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { /** * Reads an instance of CertificateItem from the JsonReader. - * + * * @param jsonReader The JsonReader being read. * @return An instance of CertificateItem if the JsonReader was pointing to an instance of it, or null if it was * pointing to JSON null. * @throws IOException If an error occurs while reading the CertificateItem. */ + @Generated public static CertificateItem fromJson(JsonReader jsonReader) throws IOException { return jsonReader.readObject(reader -> { CertificateItem deserializedCertificateItem = new CertificateItem(); while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("id".equals(fieldName)) { deserializedCertificateItem.id = reader.getString(); } else if ("attributes".equals(fieldName)) { @@ -175,7 +137,6 @@ public static CertificateItem fromJson(JsonReader jsonReader) throws IOException reader.skipChildren(); } } - return deserializedCertificateItem; }); } diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificateListResult.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificateListResult.java deleted file mode 100644 index f5ac96a82b6bd..0000000000000 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificateListResult.java +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.security.keyvault.certificates.implementation.models; - -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; -import java.util.List; - -/** - * The certificate list result. - */ -@Immutable -public final class CertificateListResult implements JsonSerializable { - /* - * A response message containing a list of certificates in the key vault along with a link to the next page of - * certificates. - */ - private List value; - - /* - * The URL to get the next set of certificates. - */ - private String nextLink; - - /** - * Creates an instance of CertificateListResult class. - */ - public CertificateListResult() { - } - - /** - * Get the value property: A response message containing a list of certificates in the key vault along with a link - * to the next page of certificates. - * - * @return the value value. - */ - public List getValue() { - return this.value; - } - - /** - * Get the nextLink property: The URL to get the next set of certificates. - * - * @return the nextLink value. - */ - public String getNextLink() { - return this.nextLink; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of CertificateListResult from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of CertificateListResult if the JsonReader was pointing to an instance of it, or null if it - * was pointing to JSON null. - * @throws IOException If an error occurs while reading the CertificateListResult. - */ - public static CertificateListResult fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - CertificateListResult deserializedCertificateListResult = new CertificateListResult(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("value".equals(fieldName)) { - List value = reader.readArray(reader1 -> CertificateItem.fromJson(reader1)); - deserializedCertificateListResult.value = value; - } else if ("nextLink".equals(fieldName)) { - deserializedCertificateListResult.nextLink = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedCertificateListResult; - }); - } -} diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificateMergeParameters.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificateMergeParameters.java index c5aa619ba09a5..33de6ce0378d9 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificateMergeParameters.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificateMergeParameters.java @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.security.keyvault.certificates.implementation.models; import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -18,62 +18,62 @@ */ @Fluent public final class CertificateMergeParameters implements JsonSerializable { + /* * The certificate or the certificate chain to merge. */ - private List x509Certificates; + @Generated + private final List x509Certificates; /* * The attributes of the certificate (optional). */ + @Generated private CertificateAttributes certificateAttributes; /* * Application specific metadata in the form of key-value pairs. */ + @Generated private Map tags; /** * Creates an instance of CertificateMergeParameters class. + * + * @param x509Certificates the x509Certificates value to set. */ - public CertificateMergeParameters() { + @Generated + public CertificateMergeParameters(List x509Certificates) { + this.x509Certificates = x509Certificates; } /** * Get the x509Certificates property: The certificate or the certificate chain to merge. - * + * * @return the x509Certificates value. */ + @Generated public List getX509Certificates() { return this.x509Certificates; } - /** - * Set the x509Certificates property: The certificate or the certificate chain to merge. - * - * @param x509Certificates the x509Certificates value to set. - * @return the CertificateMergeParameters object itself. - */ - public CertificateMergeParameters setX509Certificates(List x509Certificates) { - this.x509Certificates = x509Certificates; - return this; - } - /** * Get the certificateAttributes property: The attributes of the certificate (optional). - * + * * @return the certificateAttributes value. */ + @Generated public CertificateAttributes getCertificateAttributes() { return this.certificateAttributes; } /** * Set the certificateAttributes property: The attributes of the certificate (optional). - * + * * @param certificateAttributes the certificateAttributes value to set. * @return the CertificateMergeParameters object itself. */ + @Generated public CertificateMergeParameters setCertificateAttributes(CertificateAttributes certificateAttributes) { this.certificateAttributes = certificateAttributes; return this; @@ -81,19 +81,21 @@ public CertificateMergeParameters setCertificateAttributes(CertificateAttributes /** * Get the tags property: Application specific metadata in the form of key-value pairs. - * + * * @return the tags value. */ + @Generated public Map getTags() { return this.tags; } /** * Set the tags property: Application specific metadata in the form of key-value pairs. - * + * * @param tags the tags value to set. * @return the CertificateMergeParameters object itself. */ + @Generated public CertificateMergeParameters setTags(Map tags) { this.tags = tags; return this; @@ -102,6 +104,7 @@ public CertificateMergeParameters setTags(Map tags) { /** * {@inheritDoc} */ + @Generated @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); @@ -113,34 +116,36 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { /** * Reads an instance of CertificateMergeParameters from the JsonReader. - * + * * @param jsonReader The JsonReader being read. * @return An instance of CertificateMergeParameters if the JsonReader was pointing to an instance of it, or null if * it was pointing to JSON null. * @throws IllegalStateException If the deserialized JSON object was missing any required properties. * @throws IOException If an error occurs while reading the CertificateMergeParameters. */ + @Generated public static CertificateMergeParameters fromJson(JsonReader jsonReader) throws IOException { return jsonReader.readObject(reader -> { - CertificateMergeParameters deserializedCertificateMergeParameters = new CertificateMergeParameters(); + List x509Certificates = null; + CertificateAttributes certificateAttributes = null; + Map tags = null; while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("x5c".equals(fieldName)) { - List x509Certificates = reader.readArray(reader1 -> reader1.getBinary()); - deserializedCertificateMergeParameters.x509Certificates = x509Certificates; + x509Certificates = reader.readArray(reader1 -> reader1.getBinary()); } else if ("attributes".equals(fieldName)) { - deserializedCertificateMergeParameters.certificateAttributes - = CertificateAttributes.fromJson(reader); + certificateAttributes = CertificateAttributes.fromJson(reader); } else if ("tags".equals(fieldName)) { - Map tags = reader.readMap(reader1 -> reader1.getString()); - deserializedCertificateMergeParameters.tags = tags; + tags = reader.readMap(reader1 -> reader1.getString()); } else { reader.skipChildren(); } } - + CertificateMergeParameters deserializedCertificateMergeParameters + = new CertificateMergeParameters(x509Certificates); + deserializedCertificateMergeParameters.certificateAttributes = certificateAttributes; + deserializedCertificateMergeParameters.tags = tags; return deserializedCertificateMergeParameters; }); } diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificateOperation.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificateOperation.java index eb1a7d147d5a9..fef1aae848320 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificateOperation.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificateOperation.java @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.security.keyvault.certificates.implementation.models; import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; import com.azure.core.util.CoreUtils; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; @@ -18,229 +18,162 @@ */ @Fluent public final class CertificateOperation implements JsonSerializable { + /* * The certificate id. */ + @Generated private String id; /* * Parameters for the issuer of the X509 component of a certificate. */ + @Generated private IssuerParameters issuerParameters; /* * The certificate signing request (CSR) that is being used in the certificate operation. */ + @Generated private byte[] csr; /* * Indicates if cancellation was requested on the certificate operation. */ + @Generated private Boolean cancellationRequested; /* * Status of the certificate operation. */ + @Generated private String status; /* * The status details of the certificate operation. */ + @Generated private String statusDetails; /* * Error encountered, if any, during the certificate operation. */ + @Generated private CertificateOperationError error; /* * Location which contains the result of the certificate operation. */ + @Generated private String target; /* * Identifier for the certificate operation. */ + @Generated private String requestId; /** * Creates an instance of CertificateOperation class. */ + @Generated public CertificateOperation() { } /** * Get the id property: The certificate id. - * + * * @return the id value. */ + @Generated public String getId() { return this.id; } /** * Get the issuerParameters property: Parameters for the issuer of the X509 component of a certificate. - * + * * @return the issuerParameters value. */ + @Generated public IssuerParameters getIssuerParameters() { return this.issuerParameters; } - /** - * Set the issuerParameters property: Parameters for the issuer of the X509 component of a certificate. - * - * @param issuerParameters the issuerParameters value to set. - * @return the CertificateOperation object itself. - */ - public CertificateOperation setIssuerParameters(IssuerParameters issuerParameters) { - this.issuerParameters = issuerParameters; - return this; - } - /** * Get the csr property: The certificate signing request (CSR) that is being used in the certificate operation. - * + * * @return the csr value. */ + @Generated public byte[] getCsr() { return CoreUtils.clone(this.csr); } - /** - * Set the csr property: The certificate signing request (CSR) that is being used in the certificate operation. - * - * @param csr the csr value to set. - * @return the CertificateOperation object itself. - */ - public CertificateOperation setCsr(byte[] csr) { - this.csr = CoreUtils.clone(csr); - return this; - } - /** * Get the cancellationRequested property: Indicates if cancellation was requested on the certificate operation. - * + * * @return the cancellationRequested value. */ + @Generated public Boolean isCancellationRequested() { return this.cancellationRequested; } - /** - * Set the cancellationRequested property: Indicates if cancellation was requested on the certificate operation. - * - * @param cancellationRequested the cancellationRequested value to set. - * @return the CertificateOperation object itself. - */ - public CertificateOperation setCancellationRequested(Boolean cancellationRequested) { - this.cancellationRequested = cancellationRequested; - return this; - } - /** * Get the status property: Status of the certificate operation. - * + * * @return the status value. */ + @Generated public String getStatus() { return this.status; } - /** - * Set the status property: Status of the certificate operation. - * - * @param status the status value to set. - * @return the CertificateOperation object itself. - */ - public CertificateOperation setStatus(String status) { - this.status = status; - return this; - } - /** * Get the statusDetails property: The status details of the certificate operation. - * + * * @return the statusDetails value. */ + @Generated public String getStatusDetails() { return this.statusDetails; } - /** - * Set the statusDetails property: The status details of the certificate operation. - * - * @param statusDetails the statusDetails value to set. - * @return the CertificateOperation object itself. - */ - public CertificateOperation setStatusDetails(String statusDetails) { - this.statusDetails = statusDetails; - return this; - } - /** * Get the error property: Error encountered, if any, during the certificate operation. - * + * * @return the error value. */ + @Generated public CertificateOperationError getError() { return this.error; } - /** - * Set the error property: Error encountered, if any, during the certificate operation. - * - * @param error the error value to set. - * @return the CertificateOperation object itself. - */ - public CertificateOperation setError(CertificateOperationError error) { - this.error = error; - return this; - } - /** * Get the target property: Location which contains the result of the certificate operation. - * + * * @return the target value. */ + @Generated public String getTarget() { return this.target; } - /** - * Set the target property: Location which contains the result of the certificate operation. - * - * @param target the target value to set. - * @return the CertificateOperation object itself. - */ - public CertificateOperation setTarget(String target) { - this.target = target; - return this; - } - /** * Get the requestId property: Identifier for the certificate operation. - * + * * @return the requestId value. */ + @Generated public String getRequestId() { return this.requestId; } - /** - * Set the requestId property: Identifier for the certificate operation. - * - * @param requestId the requestId value to set. - * @return the CertificateOperation object itself. - */ - public CertificateOperation setRequestId(String requestId) { - this.requestId = requestId; - return this; - } - /** * {@inheritDoc} */ + @Generated @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); @@ -257,19 +190,19 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { /** * Reads an instance of CertificateOperation from the JsonReader. - * + * * @param jsonReader The JsonReader being read. * @return An instance of CertificateOperation if the JsonReader was pointing to an instance of it, or null if it * was pointing to JSON null. * @throws IOException If an error occurs while reading the CertificateOperation. */ + @Generated public static CertificateOperation fromJson(JsonReader jsonReader) throws IOException { return jsonReader.readObject(reader -> { CertificateOperation deserializedCertificateOperation = new CertificateOperation(); while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("id".equals(fieldName)) { deserializedCertificateOperation.id = reader.getString(); } else if ("issuer".equals(fieldName)) { @@ -292,8 +225,103 @@ public static CertificateOperation fromJson(JsonReader jsonReader) throws IOExce reader.skipChildren(); } } - return deserializedCertificateOperation; }); } + + /** + * Set the issuerParameters property: Parameters for the issuer of the X509 component of a certificate. + * + * @param issuerParameters the issuerParameters value to set. + * @return the CertificateOperation object itself. + */ + @Generated + public CertificateOperation setIssuerParameters(IssuerParameters issuerParameters) { + this.issuerParameters = issuerParameters; + return this; + } + + /** + * Set the csr property: The certificate signing request (CSR) that is being used in the certificate operation. + * + * @param csr the csr value to set. + * @return the CertificateOperation object itself. + */ + @Generated + public CertificateOperation setCsr(byte[] csr) { + this.csr = CoreUtils.clone(csr); + return this; + } + + /** + * Set the cancellationRequested property: Indicates if cancellation was requested on the certificate operation. + * + * @param cancellationRequested the cancellationRequested value to set. + * @return the CertificateOperation object itself. + */ + @Generated + public CertificateOperation setCancellationRequested(Boolean cancellationRequested) { + this.cancellationRequested = cancellationRequested; + return this; + } + + /** + * Set the status property: Status of the certificate operation. + * + * @param status the status value to set. + * @return the CertificateOperation object itself. + */ + @Generated + public CertificateOperation setStatus(String status) { + this.status = status; + return this; + } + + /** + * Set the statusDetails property: The status details of the certificate operation. + * + * @param statusDetails the statusDetails value to set. + * @return the CertificateOperation object itself. + */ + @Generated + public CertificateOperation setStatusDetails(String statusDetails) { + this.statusDetails = statusDetails; + return this; + } + + /** + * Set the error property: Error encountered, if any, during the certificate operation. + * + * @param error the error value to set. + * @return the CertificateOperation object itself. + */ + @Generated + public CertificateOperation setError(CertificateOperationError error) { + this.error = error; + return this; + } + + /** + * Set the target property: Location which contains the result of the certificate operation. + * + * @param target the target value to set. + * @return the CertificateOperation object itself. + */ + @Generated + public CertificateOperation setTarget(String target) { + this.target = target; + return this; + } + + /** + * Set the requestId property: Identifier for the certificate operation. + * + * @param requestId the requestId value to set. + * @return the CertificateOperation object itself. + */ + @Generated + public CertificateOperation setRequestId(String requestId) { + this.requestId = requestId; + return this; + } } diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificateOperationUpdateParameter.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificateOperationUpdateParameter.java index c2aeea4bb2a61..d659e5c01a99e 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificateOperationUpdateParameter.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificateOperationUpdateParameter.java @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.security.keyvault.certificates.implementation.models; -import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -14,43 +14,40 @@ /** * The certificate operation update parameters. */ -@Fluent +@Immutable public final class CertificateOperationUpdateParameter implements JsonSerializable { + /* * Indicates if cancellation was requested on the certificate operation. */ - private boolean cancellationRequested; + @Generated + private final boolean cancellationRequested; /** * Creates an instance of CertificateOperationUpdateParameter class. + * + * @param cancellationRequested the cancellationRequested value to set. */ - public CertificateOperationUpdateParameter() { + @Generated + public CertificateOperationUpdateParameter(boolean cancellationRequested) { + this.cancellationRequested = cancellationRequested; } /** * Get the cancellationRequested property: Indicates if cancellation was requested on the certificate operation. - * + * * @return the cancellationRequested value. */ + @Generated public boolean isCancellationRequested() { return this.cancellationRequested; } - /** - * Set the cancellationRequested property: Indicates if cancellation was requested on the certificate operation. - * - * @param cancellationRequested the cancellationRequested value to set. - * @return the CertificateOperationUpdateParameter object itself. - */ - public CertificateOperationUpdateParameter setCancellationRequested(boolean cancellationRequested) { - this.cancellationRequested = cancellationRequested; - return this; - } - /** * {@inheritDoc} */ + @Generated @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); @@ -60,29 +57,27 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { /** * Reads an instance of CertificateOperationUpdateParameter from the JsonReader. - * + * * @param jsonReader The JsonReader being read. * @return An instance of CertificateOperationUpdateParameter if the JsonReader was pointing to an instance of it, * or null if it was pointing to JSON null. * @throws IllegalStateException If the deserialized JSON object was missing any required properties. * @throws IOException If an error occurs while reading the CertificateOperationUpdateParameter. */ + @Generated public static CertificateOperationUpdateParameter fromJson(JsonReader jsonReader) throws IOException { return jsonReader.readObject(reader -> { - CertificateOperationUpdateParameter deserializedCertificateOperationUpdateParameter - = new CertificateOperationUpdateParameter(); + boolean cancellationRequested = false; while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("cancellation_requested".equals(fieldName)) { - deserializedCertificateOperationUpdateParameter.cancellationRequested = reader.getBoolean(); + cancellationRequested = reader.getBoolean(); } else { reader.skipChildren(); } } - - return deserializedCertificateOperationUpdateParameter; + return new CertificateOperationUpdateParameter(cancellationRequested); }); } } diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificatePolicy.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificatePolicy.java index 3e6670a1fee30..e16ea8f5900b3 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificatePolicy.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificatePolicy.java @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.security.keyvault.certificates.implementation.models; import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -17,71 +17,83 @@ */ @Fluent public final class CertificatePolicy implements JsonSerializable { + /* * The certificate id. */ + @Generated private String id; /* * Properties of the key backing a certificate. */ + @Generated private KeyProperties keyProperties; /* * Properties of the secret backing a certificate. */ + @Generated private SecretProperties secretProperties; /* * Properties of the X509 component of a certificate. */ + @Generated private X509CertificateProperties x509CertificateProperties; /* * Actions that will be performed by Key Vault over the lifetime of a certificate. */ + @Generated private List lifetimeActions; /* * Parameters for the issuer of the X509 component of a certificate. */ + @Generated private IssuerParameters issuerParameters; /* * The certificate attributes. */ + @Generated private CertificateAttributes attributes; /** * Creates an instance of CertificatePolicy class. */ + @Generated public CertificatePolicy() { } /** * Get the id property: The certificate id. - * + * * @return the id value. */ + @Generated public String getId() { return this.id; } /** * Get the keyProperties property: Properties of the key backing a certificate. - * + * * @return the keyProperties value. */ + @Generated public KeyProperties getKeyProperties() { return this.keyProperties; } /** * Set the keyProperties property: Properties of the key backing a certificate. - * + * * @param keyProperties the keyProperties value to set. * @return the CertificatePolicy object itself. */ + @Generated public CertificatePolicy setKeyProperties(KeyProperties keyProperties) { this.keyProperties = keyProperties; return this; @@ -89,19 +101,21 @@ public CertificatePolicy setKeyProperties(KeyProperties keyProperties) { /** * Get the secretProperties property: Properties of the secret backing a certificate. - * + * * @return the secretProperties value. */ + @Generated public SecretProperties getSecretProperties() { return this.secretProperties; } /** * Set the secretProperties property: Properties of the secret backing a certificate. - * + * * @param secretProperties the secretProperties value to set. * @return the CertificatePolicy object itself. */ + @Generated public CertificatePolicy setSecretProperties(SecretProperties secretProperties) { this.secretProperties = secretProperties; return this; @@ -109,19 +123,21 @@ public CertificatePolicy setSecretProperties(SecretProperties secretProperties) /** * Get the x509CertificateProperties property: Properties of the X509 component of a certificate. - * + * * @return the x509CertificateProperties value. */ + @Generated public X509CertificateProperties getX509CertificateProperties() { return this.x509CertificateProperties; } /** * Set the x509CertificateProperties property: Properties of the X509 component of a certificate. - * + * * @param x509CertificateProperties the x509CertificateProperties value to set. * @return the CertificatePolicy object itself. */ + @Generated public CertificatePolicy setX509CertificateProperties(X509CertificateProperties x509CertificateProperties) { this.x509CertificateProperties = x509CertificateProperties; return this; @@ -129,19 +145,21 @@ public CertificatePolicy setX509CertificateProperties(X509CertificateProperties /** * Get the lifetimeActions property: Actions that will be performed by Key Vault over the lifetime of a certificate. - * + * * @return the lifetimeActions value. */ + @Generated public List getLifetimeActions() { return this.lifetimeActions; } /** * Set the lifetimeActions property: Actions that will be performed by Key Vault over the lifetime of a certificate. - * + * * @param lifetimeActions the lifetimeActions value to set. * @return the CertificatePolicy object itself. */ + @Generated public CertificatePolicy setLifetimeActions(List lifetimeActions) { this.lifetimeActions = lifetimeActions; return this; @@ -149,19 +167,21 @@ public CertificatePolicy setLifetimeActions(List lifetimeActions /** * Get the issuerParameters property: Parameters for the issuer of the X509 component of a certificate. - * + * * @return the issuerParameters value. */ + @Generated public IssuerParameters getIssuerParameters() { return this.issuerParameters; } /** * Set the issuerParameters property: Parameters for the issuer of the X509 component of a certificate. - * + * * @param issuerParameters the issuerParameters value to set. * @return the CertificatePolicy object itself. */ + @Generated public CertificatePolicy setIssuerParameters(IssuerParameters issuerParameters) { this.issuerParameters = issuerParameters; return this; @@ -169,19 +189,21 @@ public CertificatePolicy setIssuerParameters(IssuerParameters issuerParameters) /** * Get the attributes property: The certificate attributes. - * + * * @return the attributes value. */ + @Generated public CertificateAttributes getAttributes() { return this.attributes; } /** * Set the attributes property: The certificate attributes. - * + * * @param attributes the attributes value to set. * @return the CertificatePolicy object itself. */ + @Generated public CertificatePolicy setAttributes(CertificateAttributes attributes) { this.attributes = attributes; return this; @@ -190,6 +212,7 @@ public CertificatePolicy setAttributes(CertificateAttributes attributes) { /** * {@inheritDoc} */ + @Generated @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); @@ -205,19 +228,19 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { /** * Reads an instance of CertificatePolicy from the JsonReader. - * + * * @param jsonReader The JsonReader being read. * @return An instance of CertificatePolicy if the JsonReader was pointing to an instance of it, or null if it was * pointing to JSON null. * @throws IOException If an error occurs while reading the CertificatePolicy. */ + @Generated public static CertificatePolicy fromJson(JsonReader jsonReader) throws IOException { return jsonReader.readObject(reader -> { CertificatePolicy deserializedCertificatePolicy = new CertificatePolicy(); while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("id".equals(fieldName)) { deserializedCertificatePolicy.id = reader.getString(); } else if ("key_props".equals(fieldName)) { @@ -239,7 +262,6 @@ public static CertificatePolicy fromJson(JsonReader jsonReader) throws IOExcepti reader.skipChildren(); } } - return deserializedCertificatePolicy; }); } diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificatePolicyAction.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificatePolicyAction.java index 3a66756b5c947..f53c55b9feecf 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificatePolicyAction.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificatePolicyAction.java @@ -1,18 +1,26 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.security.keyvault.certificates.implementation.models; -/** The type of the action. */ +/** + * The type of the action. + */ public enum CertificatePolicyAction { - /** Enum value EmailContacts. */ + /** + * A certificate policy that will email certificate contacts. + */ EMAIL_CONTACTS("EmailContacts"), - /** Enum value AutoRenew. */ + /** + * A certificate policy that will auto-renew a certificate. + */ AUTO_RENEW("AutoRenew"); - /** The actual serialized value for a CertificatePolicyAction instance. */ + /** + * The actual serialized value for a CertificatePolicyAction instance. + */ private final String value; CertificatePolicyAction(String value) { @@ -21,7 +29,7 @@ public enum CertificatePolicyAction { /** * Parses a serialized value to a CertificatePolicyAction instance. - * + * * @param value the serialized value to parse. * @return the parsed CertificatePolicyAction object, or null if unable to parse. */ @@ -38,7 +46,9 @@ public static CertificatePolicyAction fromString(String value) { return null; } - /** {@inheritDoc} */ + /** + * {@inheritDoc} + */ @Override public String toString() { return this.value; diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificateRestoreParameters.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificateRestoreParameters.java index 9f85f49d7f06f..343aab993eaaa 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificateRestoreParameters.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificateRestoreParameters.java @@ -1,12 +1,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.security.keyvault.certificates.implementation.models; -import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; import com.azure.core.util.Base64Url; -import com.azure.core.util.CoreUtils; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -17,24 +16,35 @@ /** * The certificate restore parameters. */ -@Fluent +@Immutable public final class CertificateRestoreParameters implements JsonSerializable { + /* * The backup blob associated with a certificate bundle. */ - private Base64Url certificateBundleBackup; + @Generated + private final Base64Url certificateBundleBackup; /** * Creates an instance of CertificateRestoreParameters class. + * + * @param certificateBundleBackup the certificateBundleBackup value to set. */ - public CertificateRestoreParameters() { + @Generated + public CertificateRestoreParameters(byte[] certificateBundleBackup) { + if (certificateBundleBackup == null) { + this.certificateBundleBackup = null; + } else { + this.certificateBundleBackup = Base64Url.encode(certificateBundleBackup); + } } /** * Get the certificateBundleBackup property: The backup blob associated with a certificate bundle. - * + * * @return the certificateBundleBackup value. */ + @Generated public byte[] getCertificateBundleBackup() { if (this.certificateBundleBackup == null) { return null; @@ -42,24 +52,10 @@ public byte[] getCertificateBundleBackup() { return this.certificateBundleBackup.decodedBytes(); } - /** - * Set the certificateBundleBackup property: The backup blob associated with a certificate bundle. - * - * @param certificateBundleBackup the certificateBundleBackup value to set. - * @return the CertificateRestoreParameters object itself. - */ - public CertificateRestoreParameters setCertificateBundleBackup(byte[] certificateBundleBackup) { - if (certificateBundleBackup == null) { - this.certificateBundleBackup = null; - } else { - this.certificateBundleBackup = Base64Url.encode(CoreUtils.clone(certificateBundleBackup)); - } - return this; - } - /** * {@inheritDoc} */ + @Generated @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); @@ -69,29 +65,31 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { /** * Reads an instance of CertificateRestoreParameters from the JsonReader. - * + * * @param jsonReader The JsonReader being read. * @return An instance of CertificateRestoreParameters if the JsonReader was pointing to an instance of it, or null * if it was pointing to JSON null. * @throws IllegalStateException If the deserialized JSON object was missing any required properties. * @throws IOException If an error occurs while reading the CertificateRestoreParameters. */ + @Generated public static CertificateRestoreParameters fromJson(JsonReader jsonReader) throws IOException { return jsonReader.readObject(reader -> { - CertificateRestoreParameters deserializedCertificateRestoreParameters = new CertificateRestoreParameters(); + byte[] certificateBundleBackup = null; while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("value".equals(fieldName)) { - deserializedCertificateRestoreParameters.certificateBundleBackup + Base64Url certificateBundleBackupHolder = reader.getNullable(nonNullReader -> new Base64Url(nonNullReader.getString())); + if (certificateBundleBackupHolder != null) { + certificateBundleBackup = certificateBundleBackupHolder.decodedBytes(); + } } else { reader.skipChildren(); } } - - return deserializedCertificateRestoreParameters; + return new CertificateRestoreParameters(certificateBundleBackup); }); } } diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificateUpdateParameters.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificateUpdateParameters.java index c461ed0511237..be8cdb0395be7 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificateUpdateParameters.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/CertificateUpdateParameters.java @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.security.keyvault.certificates.implementation.models; import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -17,42 +17,49 @@ */ @Fluent public final class CertificateUpdateParameters implements JsonSerializable { + /* * The management policy for the certificate. */ + @Generated private CertificatePolicy certificatePolicy; /* * The attributes of the certificate (optional). */ + @Generated private CertificateAttributes certificateAttributes; /* * Application specific metadata in the form of key-value pairs. */ + @Generated private Map tags; /** * Creates an instance of CertificateUpdateParameters class. */ + @Generated public CertificateUpdateParameters() { } /** * Get the certificatePolicy property: The management policy for the certificate. - * + * * @return the certificatePolicy value. */ + @Generated public CertificatePolicy getCertificatePolicy() { return this.certificatePolicy; } /** * Set the certificatePolicy property: The management policy for the certificate. - * + * * @param certificatePolicy the certificatePolicy value to set. * @return the CertificateUpdateParameters object itself. */ + @Generated public CertificateUpdateParameters setCertificatePolicy(CertificatePolicy certificatePolicy) { this.certificatePolicy = certificatePolicy; return this; @@ -60,19 +67,21 @@ public CertificateUpdateParameters setCertificatePolicy(CertificatePolicy certif /** * Get the certificateAttributes property: The attributes of the certificate (optional). - * + * * @return the certificateAttributes value. */ + @Generated public CertificateAttributes getCertificateAttributes() { return this.certificateAttributes; } /** * Set the certificateAttributes property: The attributes of the certificate (optional). - * + * * @param certificateAttributes the certificateAttributes value to set. * @return the CertificateUpdateParameters object itself. */ + @Generated public CertificateUpdateParameters setCertificateAttributes(CertificateAttributes certificateAttributes) { this.certificateAttributes = certificateAttributes; return this; @@ -80,19 +89,21 @@ public CertificateUpdateParameters setCertificateAttributes(CertificateAttribute /** * Get the tags property: Application specific metadata in the form of key-value pairs. - * + * * @return the tags value. */ + @Generated public Map getTags() { return this.tags; } /** * Set the tags property: Application specific metadata in the form of key-value pairs. - * + * * @param tags the tags value to set. * @return the CertificateUpdateParameters object itself. */ + @Generated public CertificateUpdateParameters setTags(Map tags) { this.tags = tags; return this; @@ -101,6 +112,7 @@ public CertificateUpdateParameters setTags(Map tags) { /** * {@inheritDoc} */ + @Generated @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); @@ -112,19 +124,19 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { /** * Reads an instance of CertificateUpdateParameters from the JsonReader. - * + * * @param jsonReader The JsonReader being read. * @return An instance of CertificateUpdateParameters if the JsonReader was pointing to an instance of it, or null * if it was pointing to JSON null. * @throws IOException If an error occurs while reading the CertificateUpdateParameters. */ + @Generated public static CertificateUpdateParameters fromJson(JsonReader jsonReader) throws IOException { return jsonReader.readObject(reader -> { CertificateUpdateParameters deserializedCertificateUpdateParameters = new CertificateUpdateParameters(); while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("policy".equals(fieldName)) { deserializedCertificateUpdateParameters.certificatePolicy = CertificatePolicy.fromJson(reader); } else if ("attributes".equals(fieldName)) { @@ -137,7 +149,6 @@ public static CertificateUpdateParameters fromJson(JsonReader jsonReader) throws reader.skipChildren(); } } - return deserializedCertificateUpdateParameters; }); } diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/Contacts.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/Contacts.java index b8140faf45202..3a24fbf7bd78f 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/Contacts.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/Contacts.java @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.security.keyvault.certificates.implementation.models; import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -18,46 +18,53 @@ */ @Fluent public final class Contacts implements JsonSerializable { + /* * Identifier for the contacts collection. */ + @Generated private String id; /* * The contact list for the vault certificates. */ + @Generated private List contactList; /** * Creates an instance of Contacts class. */ + @Generated public Contacts() { } /** * Get the id property: Identifier for the contacts collection. - * + * * @return the id value. */ + @Generated public String getId() { return this.id; } /** * Get the contactList property: The contact list for the vault certificates. - * + * * @return the contactList value. */ + @Generated public List getContactList() { return this.contactList; } /** * Set the contactList property: The contact list for the vault certificates. - * + * * @param contactList the contactList value to set. * @return the Contacts object itself. */ + @Generated public Contacts setContactList(List contactList) { this.contactList = contactList; return this; @@ -66,6 +73,7 @@ public Contacts setContactList(List contactList) { /** * {@inheritDoc} */ + @Generated @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); @@ -75,19 +83,19 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { /** * Reads an instance of Contacts from the JsonReader. - * + * * @param jsonReader The JsonReader being read. * @return An instance of Contacts if the JsonReader was pointing to an instance of it, or null if it was pointing * to JSON null. * @throws IOException If an error occurs while reading the Contacts. */ + @Generated public static Contacts fromJson(JsonReader jsonReader) throws IOException { return jsonReader.readObject(reader -> { Contacts deserializedContacts = new Contacts(); while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("id".equals(fieldName)) { deserializedContacts.id = reader.getString(); } else if ("contacts".equals(fieldName)) { @@ -98,7 +106,6 @@ public static Contacts fromJson(JsonReader jsonReader) throws IOException { reader.skipChildren(); } } - return deserializedContacts; }); } diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/DeletedCertificateBundle.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/DeletedCertificateBundle.java index a03211e2d06d5..36fb5b044f984 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/DeletedCertificateBundle.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/DeletedCertificateBundle.java @@ -1,12 +1,14 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.security.keyvault.certificates.implementation.models; -import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; import com.azure.core.util.Base64Url; +import com.azure.core.util.CoreUtils; import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; import java.io.IOException; @@ -19,116 +21,124 @@ * A Deleted Certificate consisting of its previous id, attributes and its tags, as well as information on when it will * be purged. */ -@Fluent -public final class DeletedCertificateBundle extends CertificateBundle { +@Immutable +public final class DeletedCertificateBundle implements JsonSerializable { + /* - * The url of the recovery object, used to identify and recover the deleted certificate. + * The certificate id. */ - private String recoveryId; + @Generated + private String id; /* - * The time when the certificate is scheduled to be purged, in UTC + * The key id. */ - private Long scheduledPurgeDate; + @Generated + private String kid; /* - * The time when the certificate was deleted, in UTC + * The secret id. */ - private Long deletedDate; + @Generated + private String sid; + + /* + * Thumbprint of the certificate. + */ + @Generated + private Base64Url x509Thumbprint; /* * The management policy. */ + @Generated private CertificatePolicy policy; /* - * Thumbprint of the certificate. + * CER contents of x509 certificate. */ - private Base64Url x509Thumbprint; + @Generated + private byte[] cer; /* - * The secret id. + * The content type of the secret. eg. 'application/x-pem-file' or 'application/x-pkcs12', */ - private String sid; + @Generated + private String contentType; /* - * The key id. + * The certificate attributes. */ - private String kid; + @Generated + private CertificateAttributes attributes; /* - * The certificate id. + * Application specific metadata in the form of key-value pairs */ - private String id; + @Generated + private Map tags; - /** - * Creates an instance of DeletedCertificateBundle class. + /* + * The url of the recovery object, used to identify and recover the deleted certificate. */ - public DeletedCertificateBundle() { - } + @Generated + private String recoveryId; - /** - * Get the recoveryId property: The url of the recovery object, used to identify and recover the deleted - * certificate. - * - * @return the recoveryId value. + /* + * The time when the certificate is scheduled to be purged, in UTC */ - public String getRecoveryId() { - return this.recoveryId; - } + @Generated + private Long scheduledPurgeDate; + + /* + * The time when the certificate was deleted, in UTC + */ + @Generated + private Long deletedDate; /** - * Set the recoveryId property: The url of the recovery object, used to identify and recover the deleted - * certificate. - * - * @param recoveryId the recoveryId value to set. - * @return the DeletedCertificateBundle object itself. + * Creates an instance of DeletedCertificateBundle class. */ - public DeletedCertificateBundle setRecoveryId(String recoveryId) { - this.recoveryId = recoveryId; - return this; + @Generated + private DeletedCertificateBundle() { } /** - * Get the scheduledPurgeDate property: The time when the certificate is scheduled to be purged, in UTC. - * - * @return the scheduledPurgeDate value. + * Get the id property: The certificate id. + * + * @return the id value. */ - public OffsetDateTime getScheduledPurgeDate() { - if (this.scheduledPurgeDate == null) { - return null; - } - return OffsetDateTime.ofInstant(Instant.ofEpochSecond(this.scheduledPurgeDate), ZoneOffset.UTC); + @Generated + public String getId() { + return this.id; } /** - * Get the deletedDate property: The time when the certificate was deleted, in UTC. - * - * @return the deletedDate value. + * Get the kid property: The key id. + * + * @return the kid value. */ - public OffsetDateTime getDeletedDate() { - if (this.deletedDate == null) { - return null; - } - return OffsetDateTime.ofInstant(Instant.ofEpochSecond(this.deletedDate), ZoneOffset.UTC); + @Generated + public String getKid() { + return this.kid; } /** - * Get the policy property: The management policy. - * - * @return the policy value. + * Get the sid property: The secret id. + * + * @return the sid value. */ - @Override - public CertificatePolicy getPolicy() { - return this.policy; + @Generated + public String getSid() { + return this.sid; } /** * Get the x509Thumbprint property: Thumbprint of the certificate. - * + * * @return the x509Thumbprint value. */ - @Override + @Generated public byte[] getX509Thumbprint() { if (this.x509Thumbprint == null) { return null; @@ -137,100 +147,123 @@ public byte[] getX509Thumbprint() { } /** - * Get the sid property: The secret id. - * - * @return the sid value. + * Get the policy property: The management policy. + * + * @return the policy value. */ - @Override - public String getSid() { - return this.sid; + @Generated + public CertificatePolicy getPolicy() { + return this.policy; } /** - * Get the kid property: The key id. - * - * @return the kid value. + * Get the cer property: CER contents of x509 certificate. + * + * @return the cer value. */ - @Override - public String getKid() { - return this.kid; + @Generated + public byte[] getCer() { + return CoreUtils.clone(this.cer); } /** - * Get the id property: The certificate id. - * - * @return the id value. + * Get the contentType property: The content type of the secret. eg. 'application/x-pem-file' or + * 'application/x-pkcs12',. + * + * @return the contentType value. */ - @Override - public String getId() { - return this.id; + @Generated + public String getContentType() { + return this.contentType; } /** - * {@inheritDoc} + * Get the attributes property: The certificate attributes. + * + * @return the attributes value. */ - @Override - public DeletedCertificateBundle setCer(byte[] cer) { - super.setCer(cer); - return this; + @Generated + public CertificateAttributes getAttributes() { + return this.attributes; } /** - * {@inheritDoc} + * Get the tags property: Application specific metadata in the form of key-value pairs. + * + * @return the tags value. */ - @Override - public DeletedCertificateBundle setContentType(String contentType) { - super.setContentType(contentType); - return this; + @Generated + public Map getTags() { + return this.tags; } /** - * {@inheritDoc} + * Get the recoveryId property: The url of the recovery object, used to identify and recover the deleted + * certificate. + * + * @return the recoveryId value. */ - @Override - public DeletedCertificateBundle setAttributes(CertificateAttributes attributes) { - super.setAttributes(attributes); - return this; + @Generated + public String getRecoveryId() { + return this.recoveryId; } /** - * {@inheritDoc} + * Get the scheduledPurgeDate property: The time when the certificate is scheduled to be purged, in UTC. + * + * @return the scheduledPurgeDate value. */ - @Override - public DeletedCertificateBundle setTags(Map tags) { - super.setTags(tags); - return this; + @Generated + public OffsetDateTime getScheduledPurgeDate() { + if (this.scheduledPurgeDate == null) { + return null; + } + return OffsetDateTime.ofInstant(Instant.ofEpochSecond(this.scheduledPurgeDate), ZoneOffset.UTC); + } + + /** + * Get the deletedDate property: The time when the certificate was deleted, in UTC. + * + * @return the deletedDate value. + */ + @Generated + public OffsetDateTime getDeletedDate() { + if (this.deletedDate == null) { + return null; + } + return OffsetDateTime.ofInstant(Instant.ofEpochSecond(this.deletedDate), ZoneOffset.UTC); } /** * {@inheritDoc} */ + @Generated @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); - jsonWriter.writeBinaryField("cer", getCer()); - jsonWriter.writeStringField("contentType", getContentType()); - jsonWriter.writeJsonField("attributes", getAttributes()); - jsonWriter.writeMapField("tags", getTags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeBinaryField("cer", this.cer); + jsonWriter.writeStringField("contentType", this.contentType); + jsonWriter.writeJsonField("attributes", this.attributes); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); jsonWriter.writeStringField("recoveryId", this.recoveryId); return jsonWriter.writeEndObject(); } /** * Reads an instance of DeletedCertificateBundle from the JsonReader. - * + * * @param jsonReader The JsonReader being read. * @return An instance of DeletedCertificateBundle if the JsonReader was pointing to an instance of it, or null if * it was pointing to JSON null. * @throws IOException If an error occurs while reading the DeletedCertificateBundle. */ + @Generated public static DeletedCertificateBundle fromJson(JsonReader jsonReader) throws IOException { return jsonReader.readObject(reader -> { DeletedCertificateBundle deserializedDeletedCertificateBundle = new DeletedCertificateBundle(); while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("id".equals(fieldName)) { deserializedDeletedCertificateBundle.id = reader.getString(); } else if ("kid".equals(fieldName)) { @@ -243,14 +276,14 @@ public static DeletedCertificateBundle fromJson(JsonReader jsonReader) throws IO } else if ("policy".equals(fieldName)) { deserializedDeletedCertificateBundle.policy = CertificatePolicy.fromJson(reader); } else if ("cer".equals(fieldName)) { - deserializedDeletedCertificateBundle.setCer(reader.getBinary()); + deserializedDeletedCertificateBundle.cer = reader.getBinary(); } else if ("contentType".equals(fieldName)) { - deserializedDeletedCertificateBundle.setContentType(reader.getString()); + deserializedDeletedCertificateBundle.contentType = reader.getString(); } else if ("attributes".equals(fieldName)) { - deserializedDeletedCertificateBundle.setAttributes(CertificateAttributes.fromJson(reader)); + deserializedDeletedCertificateBundle.attributes = CertificateAttributes.fromJson(reader); } else if ("tags".equals(fieldName)) { Map tags = reader.readMap(reader1 -> reader1.getString()); - deserializedDeletedCertificateBundle.setTags(tags); + deserializedDeletedCertificateBundle.tags = tags; } else if ("recoveryId".equals(fieldName)) { deserializedDeletedCertificateBundle.recoveryId = reader.getString(); } else if ("scheduledPurgeDate".equals(fieldName)) { @@ -261,7 +294,6 @@ public static DeletedCertificateBundle fromJson(JsonReader jsonReader) throws IO reader.skipChildren(); } } - return deserializedDeletedCertificateBundle; }); } diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/DeletedCertificateItem.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/DeletedCertificateItem.java index e6621b5821d8e..7d8e57a38048e 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/DeletedCertificateItem.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/DeletedCertificateItem.java @@ -1,12 +1,13 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.security.keyvault.certificates.implementation.models; -import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; import com.azure.core.util.Base64Url; import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; import com.azure.json.JsonWriter; import java.io.IOException; @@ -19,56 +20,118 @@ /** * The deleted certificate item containing metadata about the deleted certificate. */ -@Fluent -public final class DeletedCertificateItem extends CertificateItem { +@Immutable +public final class DeletedCertificateItem implements JsonSerializable { + + /* + * Certificate identifier. + */ + @Generated + private String id; + + /* + * The certificate management attributes. + */ + @Generated + private CertificateAttributes attributes; + + /* + * Application specific metadata in the form of key-value pairs. + */ + @Generated + private Map tags; + + /* + * Thumbprint of the certificate. + */ + @Generated + private Base64Url x509Thumbprint; + /* * The url of the recovery object, used to identify and recover the deleted certificate. */ + @Generated private String recoveryId; /* * The time when the certificate is scheduled to be purged, in UTC */ + @Generated private Long scheduledPurgeDate; /* * The time when the certificate was deleted, in UTC */ + @Generated private Long deletedDate; /** * Creates an instance of DeletedCertificateItem class. */ - public DeletedCertificateItem() { + @Generated + private DeletedCertificateItem() { } /** - * Get the recoveryId property: The url of the recovery object, used to identify and recover the deleted - * certificate. - * - * @return the recoveryId value. + * Get the id property: Certificate identifier. + * + * @return the id value. */ - public String getRecoveryId() { - return this.recoveryId; + @Generated + public String getId() { + return this.id; + } + + /** + * Get the attributes property: The certificate management attributes. + * + * @return the attributes value. + */ + @Generated + public CertificateAttributes getAttributes() { + return this.attributes; + } + + /** + * Get the tags property: Application specific metadata in the form of key-value pairs. + * + * @return the tags value. + */ + @Generated + public Map getTags() { + return this.tags; + } + + /** + * Get the x509Thumbprint property: Thumbprint of the certificate. + * + * @return the x509Thumbprint value. + */ + @Generated + public byte[] getX509Thumbprint() { + if (this.x509Thumbprint == null) { + return null; + } + return this.x509Thumbprint.decodedBytes(); } /** - * Set the recoveryId property: The url of the recovery object, used to identify and recover the deleted + * Get the recoveryId property: The url of the recovery object, used to identify and recover the deleted * certificate. - * - * @param recoveryId the recoveryId value to set. - * @return the DeletedCertificateItem object itself. + * + * @return the recoveryId value. */ - public DeletedCertificateItem setRecoveryId(String recoveryId) { - this.recoveryId = recoveryId; - return this; + @Generated + public String getRecoveryId() { + return this.recoveryId; } /** * Get the scheduledPurgeDate property: The time when the certificate is scheduled to be purged, in UTC. - * + * * @return the scheduledPurgeDate value. */ + @Generated public OffsetDateTime getScheduledPurgeDate() { if (this.scheduledPurgeDate == null) { return null; @@ -78,9 +141,10 @@ public OffsetDateTime getScheduledPurgeDate() { /** * Get the deletedDate property: The time when the certificate was deleted, in UTC. - * + * * @return the deletedDate value. */ + @Generated public OffsetDateTime getDeletedDate() { if (this.deletedDate == null) { return null; @@ -91,83 +155,43 @@ public OffsetDateTime getDeletedDate() { /** * {@inheritDoc} */ - @Override - public DeletedCertificateItem setId(String id) { - super.setId(id); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public DeletedCertificateItem setAttributes(CertificateAttributes attributes) { - super.setAttributes(attributes); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public DeletedCertificateItem setTags(Map tags) { - super.setTags(tags); - return this; - } - - /** - * {@inheritDoc} - */ - @Override - public DeletedCertificateItem setX509Thumbprint(byte[] x509Thumbprint) { - super.setX509Thumbprint(x509Thumbprint); - return this; - } - - /** - * {@inheritDoc} - */ + @Generated @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); - jsonWriter.writeStringField("id", getId()); - jsonWriter.writeJsonField("attributes", getAttributes()); - jsonWriter.writeMapField("tags", getTags(), (writer, element) -> writer.writeString(element)); - if (getX509Thumbprint() != null) { - jsonWriter.writeStringField("x5t", Objects.toString(Base64Url.encode(getX509Thumbprint()), null)); - } + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeJsonField("attributes", this.attributes); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("x5t", Objects.toString(this.x509Thumbprint, null)); jsonWriter.writeStringField("recoveryId", this.recoveryId); return jsonWriter.writeEndObject(); } /** * Reads an instance of DeletedCertificateItem from the JsonReader. - * + * * @param jsonReader The JsonReader being read. * @return An instance of DeletedCertificateItem if the JsonReader was pointing to an instance of it, or null if it * was pointing to JSON null. * @throws IOException If an error occurs while reading the DeletedCertificateItem. */ + @Generated public static DeletedCertificateItem fromJson(JsonReader jsonReader) throws IOException { return jsonReader.readObject(reader -> { DeletedCertificateItem deserializedDeletedCertificateItem = new DeletedCertificateItem(); while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("id".equals(fieldName)) { - deserializedDeletedCertificateItem.setId(reader.getString()); + deserializedDeletedCertificateItem.id = reader.getString(); } else if ("attributes".equals(fieldName)) { - deserializedDeletedCertificateItem.setAttributes(CertificateAttributes.fromJson(reader)); + deserializedDeletedCertificateItem.attributes = CertificateAttributes.fromJson(reader); } else if ("tags".equals(fieldName)) { Map tags = reader.readMap(reader1 -> reader1.getString()); - deserializedDeletedCertificateItem.setTags(tags); + deserializedDeletedCertificateItem.tags = tags; } else if ("x5t".equals(fieldName)) { - Base64Url x509ThumbprintHolder + deserializedDeletedCertificateItem.x509Thumbprint = reader.getNullable(nonNullReader -> new Base64Url(nonNullReader.getString())); - if (x509ThumbprintHolder != null) { - deserializedDeletedCertificateItem.setX509Thumbprint(x509ThumbprintHolder.decodedBytes()); - } } else if ("recoveryId".equals(fieldName)) { deserializedDeletedCertificateItem.recoveryId = reader.getString(); } else if ("scheduledPurgeDate".equals(fieldName)) { @@ -178,7 +202,6 @@ public static DeletedCertificateItem fromJson(JsonReader jsonReader) throws IOEx reader.skipChildren(); } } - return deserializedDeletedCertificateItem; }); } diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/DeletedCertificateListResult.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/DeletedCertificateListResult.java index f3ba01e6a7993..b9502d0eef15a 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/DeletedCertificateListResult.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/DeletedCertificateListResult.java @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.security.keyvault.certificates.implementation.models; +import com.azure.core.annotation.Generated; import com.azure.core.annotation.Immutable; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; @@ -17,38 +17,45 @@ */ @Immutable public final class DeletedCertificateListResult implements JsonSerializable { + /* * A response message containing a list of deleted certificates in the vault along with a link to the next page of - * deleted certificates + * deleted certificates. */ + @Generated private List value; /* * The URL to get the next set of deleted certificates. */ + @Generated private String nextLink; /** * Creates an instance of DeletedCertificateListResult class. */ - public DeletedCertificateListResult() { + @Generated + private DeletedCertificateListResult() { } /** * Get the value property: A response message containing a list of deleted certificates in the vault along with a - * link to the next page of deleted certificates. - * + * link to the next page of + * deleted certificates. + * * @return the value value. */ + @Generated public List getValue() { return this.value; } /** * Get the nextLink property: The URL to get the next set of deleted certificates. - * + * * @return the nextLink value. */ + @Generated public String getNextLink() { return this.nextLink; } @@ -56,6 +63,7 @@ public String getNextLink() { /** * {@inheritDoc} */ + @Generated @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); @@ -64,19 +72,19 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { /** * Reads an instance of DeletedCertificateListResult from the JsonReader. - * + * * @param jsonReader The JsonReader being read. * @return An instance of DeletedCertificateListResult if the JsonReader was pointing to an instance of it, or null * if it was pointing to JSON null. * @throws IOException If an error occurs while reading the DeletedCertificateListResult. */ + @Generated public static DeletedCertificateListResult fromJson(JsonReader jsonReader) throws IOException { return jsonReader.readObject(reader -> { DeletedCertificateListResult deserializedDeletedCertificateListResult = new DeletedCertificateListResult(); while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("value".equals(fieldName)) { List value = reader.readArray(reader1 -> DeletedCertificateItem.fromJson(reader1)); @@ -87,7 +95,6 @@ public static DeletedCertificateListResult fromJson(JsonReader jsonReader) throw reader.skipChildren(); } } - return deserializedDeletedCertificateListResult; }); } diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/DeletionRecoveryLevel.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/DeletionRecoveryLevel.java index 788f8a757837d..1b3e0afb7cd68 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/DeletionRecoveryLevel.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/DeletionRecoveryLevel.java @@ -1,18 +1,18 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.security.keyvault.certificates.implementation.models; import com.azure.core.util.ExpandableStringEnum; import java.util.Collection; /** - * Reflects the deletion recovery level currently in effect for certificates in the current vault. If it contains - * 'Purgeable', the certificate can be permanently deleted by a privileged user; otherwise, only the system can purge - * the certificate, at the end of the retention interval. + * Reflects the deletion recovery level currently in effect for secrets in the current vault. If it contains + * 'Purgeable', the secret can be permanently deleted by a privileged user; otherwise, only the system can purge the + * secret, at the end of the retention interval. */ public final class DeletionRecoveryLevel extends ExpandableStringEnum { + /** * Denotes a vault state in which deletion is an irreversible operation, without the possibility for recovery. This * level corresponds to no protection being available against a Delete operation; the data is irretrievably lost @@ -71,7 +71,7 @@ public final class DeletionRecoveryLevel extends ExpandableStringEnum values() { diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/IssuerAttributes.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/IssuerAttributes.java index baeff12b4efcb..aacbd1f15ee5d 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/IssuerAttributes.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/IssuerAttributes.java @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.security.keyvault.certificates.implementation.models; import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -19,42 +19,49 @@ */ @Fluent public final class IssuerAttributes implements JsonSerializable { + /* * Determines whether the issuer is enabled. */ + @Generated private Boolean enabled; /* * Creation time in UTC. */ + @Generated private Long created; /* * Last updated time in UTC. */ + @Generated private Long updated; /** * Creates an instance of IssuerAttributes class. */ + @Generated public IssuerAttributes() { } /** * Get the enabled property: Determines whether the issuer is enabled. - * + * * @return the enabled value. */ + @Generated public Boolean isEnabled() { return this.enabled; } /** * Set the enabled property: Determines whether the issuer is enabled. - * + * * @param enabled the enabled value to set. * @return the IssuerAttributes object itself. */ + @Generated public IssuerAttributes setEnabled(Boolean enabled) { this.enabled = enabled; return this; @@ -62,9 +69,10 @@ public IssuerAttributes setEnabled(Boolean enabled) { /** * Get the created property: Creation time in UTC. - * + * * @return the created value. */ + @Generated public OffsetDateTime getCreated() { if (this.created == null) { return null; @@ -74,9 +82,10 @@ public OffsetDateTime getCreated() { /** * Get the updated property: Last updated time in UTC. - * + * * @return the updated value. */ + @Generated public OffsetDateTime getUpdated() { if (this.updated == null) { return null; @@ -87,6 +96,7 @@ public OffsetDateTime getUpdated() { /** * {@inheritDoc} */ + @Generated @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); @@ -96,19 +106,19 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { /** * Reads an instance of IssuerAttributes from the JsonReader. - * + * * @param jsonReader The JsonReader being read. * @return An instance of IssuerAttributes if the JsonReader was pointing to an instance of it, or null if it was * pointing to JSON null. * @throws IOException If an error occurs while reading the IssuerAttributes. */ + @Generated public static IssuerAttributes fromJson(JsonReader jsonReader) throws IOException { return jsonReader.readObject(reader -> { IssuerAttributes deserializedIssuerAttributes = new IssuerAttributes(); while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("enabled".equals(fieldName)) { deserializedIssuerAttributes.enabled = reader.getNullable(JsonReader::getBoolean); } else if ("created".equals(fieldName)) { @@ -119,7 +129,6 @@ public static IssuerAttributes fromJson(JsonReader jsonReader) throws IOExceptio reader.skipChildren(); } } - return deserializedIssuerAttributes; }); } diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/IssuerBundle.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/IssuerBundle.java index 395bbce737d3f..c490541f439b6 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/IssuerBundle.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/IssuerBundle.java @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.security.keyvault.certificates.implementation.models; import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -16,129 +16,98 @@ */ @Fluent public final class IssuerBundle implements JsonSerializable { + /* * Identifier for the issuer object. */ + @Generated private String id; /* * The issuer provider. */ + @Generated private String provider; /* * The credentials to be used for the issuer. */ + @Generated private IssuerCredentials credentials; /* * Details of the organization as provided to the issuer. */ + @Generated private OrganizationDetails organizationDetails; /* * Attributes of the issuer object. */ + @Generated private IssuerAttributes attributes; /** * Creates an instance of IssuerBundle class. */ + @Generated public IssuerBundle() { } /** * Get the id property: Identifier for the issuer object. - * + * * @return the id value. */ + @Generated public String getId() { return this.id; } /** * Get the provider property: The issuer provider. - * + * * @return the provider value. */ + @Generated public String getProvider() { return this.provider; } - /** - * Set the provider property: The issuer provider. - * - * @param provider the provider value to set. - * @return the IssuerBundle object itself. - */ - public IssuerBundle setProvider(String provider) { - this.provider = provider; - return this; - } - /** * Get the credentials property: The credentials to be used for the issuer. - * + * * @return the credentials value. */ + @Generated public IssuerCredentials getCredentials() { return this.credentials; } - /** - * Set the credentials property: The credentials to be used for the issuer. - * - * @param credentials the credentials value to set. - * @return the IssuerBundle object itself. - */ - public IssuerBundle setCredentials(IssuerCredentials credentials) { - this.credentials = credentials; - return this; - } - /** * Get the organizationDetails property: Details of the organization as provided to the issuer. - * + * * @return the organizationDetails value. */ + @Generated public OrganizationDetails getOrganizationDetails() { return this.organizationDetails; } - /** - * Set the organizationDetails property: Details of the organization as provided to the issuer. - * - * @param organizationDetails the organizationDetails value to set. - * @return the IssuerBundle object itself. - */ - public IssuerBundle setOrganizationDetails(OrganizationDetails organizationDetails) { - this.organizationDetails = organizationDetails; - return this; - } - /** * Get the attributes property: Attributes of the issuer object. - * + * * @return the attributes value. */ + @Generated public IssuerAttributes getAttributes() { return this.attributes; } - /** - * Set the attributes property: Attributes of the issuer object. - * - * @param attributes the attributes value to set. - * @return the IssuerBundle object itself. - */ - public IssuerBundle setAttributes(IssuerAttributes attributes) { - this.attributes = attributes; - return this; - } - /** * {@inheritDoc} */ + @Generated @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); @@ -151,19 +120,19 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { /** * Reads an instance of IssuerBundle from the JsonReader. - * + * * @param jsonReader The JsonReader being read. * @return An instance of IssuerBundle if the JsonReader was pointing to an instance of it, or null if it was * pointing to JSON null. * @throws IOException If an error occurs while reading the IssuerBundle. */ + @Generated public static IssuerBundle fromJson(JsonReader jsonReader) throws IOException { return jsonReader.readObject(reader -> { IssuerBundle deserializedIssuerBundle = new IssuerBundle(); while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("id".equals(fieldName)) { deserializedIssuerBundle.id = reader.getString(); } else if ("provider".equals(fieldName)) { @@ -178,8 +147,55 @@ public static IssuerBundle fromJson(JsonReader jsonReader) throws IOException { reader.skipChildren(); } } - return deserializedIssuerBundle; }); } + + /** + * Set the provider property: The issuer provider. + * + * @param provider the provider value to set. + * @return the IssuerBundle object itself. + */ + @Generated + public IssuerBundle setProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Set the credentials property: The credentials to be used for the issuer. + * + * @param credentials the credentials value to set. + * @return the IssuerBundle object itself. + */ + @Generated + public IssuerBundle setCredentials(IssuerCredentials credentials) { + this.credentials = credentials; + return this; + } + + /** + * Set the organizationDetails property: Details of the organization as provided to the issuer. + * + * @param organizationDetails the organizationDetails value to set. + * @return the IssuerBundle object itself. + */ + @Generated + public IssuerBundle setOrganizationDetails(OrganizationDetails organizationDetails) { + this.organizationDetails = organizationDetails; + return this; + } + + /** + * Set the attributes property: Attributes of the issuer object. + * + * @param attributes the attributes value to set. + * @return the IssuerBundle object itself. + */ + @Generated + public IssuerBundle setAttributes(IssuerAttributes attributes) { + this.attributes = attributes; + return this; + } } diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/IssuerCredentials.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/IssuerCredentials.java index f6904d67e66b5..f765b5cf2829a 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/IssuerCredentials.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/IssuerCredentials.java @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.security.keyvault.certificates.implementation.models; import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -16,37 +16,43 @@ */ @Fluent public final class IssuerCredentials implements JsonSerializable { + /* * The user name/account name/account id. */ + @Generated private String accountId; /* * The password/secret/account key. */ + @Generated private String password; /** * Creates an instance of IssuerCredentials class. */ + @Generated public IssuerCredentials() { } /** * Get the accountId property: The user name/account name/account id. - * + * * @return the accountId value. */ + @Generated public String getAccountId() { return this.accountId; } /** * Set the accountId property: The user name/account name/account id. - * + * * @param accountId the accountId value to set. * @return the IssuerCredentials object itself. */ + @Generated public IssuerCredentials setAccountId(String accountId) { this.accountId = accountId; return this; @@ -54,19 +60,21 @@ public IssuerCredentials setAccountId(String accountId) { /** * Get the password property: The password/secret/account key. - * + * * @return the password value. */ + @Generated public String getPassword() { return this.password; } /** * Set the password property: The password/secret/account key. - * + * * @param password the password value to set. * @return the IssuerCredentials object itself. */ + @Generated public IssuerCredentials setPassword(String password) { this.password = password; return this; @@ -75,6 +83,7 @@ public IssuerCredentials setPassword(String password) { /** * {@inheritDoc} */ + @Generated @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); @@ -85,19 +94,19 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { /** * Reads an instance of IssuerCredentials from the JsonReader. - * + * * @param jsonReader The JsonReader being read. * @return An instance of IssuerCredentials if the JsonReader was pointing to an instance of it, or null if it was * pointing to JSON null. * @throws IOException If an error occurs while reading the IssuerCredentials. */ + @Generated public static IssuerCredentials fromJson(JsonReader jsonReader) throws IOException { return jsonReader.readObject(reader -> { IssuerCredentials deserializedIssuerCredentials = new IssuerCredentials(); while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("account_id".equals(fieldName)) { deserializedIssuerCredentials.accountId = reader.getString(); } else if ("pwd".equals(fieldName)) { @@ -106,7 +115,6 @@ public static IssuerCredentials fromJson(JsonReader jsonReader) throws IOExcepti reader.skipChildren(); } } - return deserializedIssuerCredentials; }); } diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/IssuerParameters.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/IssuerParameters.java index 18d3de76f283b..79b5bf2711c2f 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/IssuerParameters.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/IssuerParameters.java @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.security.keyvault.certificates.implementation.models; import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -16,42 +16,49 @@ */ @Fluent public final class IssuerParameters implements JsonSerializable { + /* * Name of the referenced issuer object or reserved names; for example, 'Self' or 'Unknown'. */ + @Generated private String name; /* * Certificate type as supported by the provider (optional); for example 'OV-SSL', 'EV-SSL' */ + @Generated private String certificateType; /* * Indicates if the certificates generated under this policy should be published to certificate transparency logs. */ + @Generated private Boolean certificateTransparency; /** * Creates an instance of IssuerParameters class. */ + @Generated public IssuerParameters() { } /** * Get the name property: Name of the referenced issuer object or reserved names; for example, 'Self' or 'Unknown'. - * + * * @return the name value. */ + @Generated public String getName() { return this.name; } /** * Set the name property: Name of the referenced issuer object or reserved names; for example, 'Self' or 'Unknown'. - * + * * @param name the name value to set. * @return the IssuerParameters object itself. */ + @Generated public IssuerParameters setName(String name) { this.name = name; return this; @@ -60,9 +67,10 @@ public IssuerParameters setName(String name) { /** * Get the certificateType property: Certificate type as supported by the provider (optional); for example 'OV-SSL', * 'EV-SSL'. - * + * * @return the certificateType value. */ + @Generated public String getCertificateType() { return this.certificateType; } @@ -70,10 +78,11 @@ public String getCertificateType() { /** * Set the certificateType property: Certificate type as supported by the provider (optional); for example 'OV-SSL', * 'EV-SSL'. - * + * * @param certificateType the certificateType value to set. * @return the IssuerParameters object itself. */ + @Generated public IssuerParameters setCertificateType(String certificateType) { this.certificateType = certificateType; return this; @@ -82,9 +91,10 @@ public IssuerParameters setCertificateType(String certificateType) { /** * Get the certificateTransparency property: Indicates if the certificates generated under this policy should be * published to certificate transparency logs. - * + * * @return the certificateTransparency value. */ + @Generated public Boolean isCertificateTransparency() { return this.certificateTransparency; } @@ -92,10 +102,11 @@ public Boolean isCertificateTransparency() { /** * Set the certificateTransparency property: Indicates if the certificates generated under this policy should be * published to certificate transparency logs. - * + * * @param certificateTransparency the certificateTransparency value to set. * @return the IssuerParameters object itself. */ + @Generated public IssuerParameters setCertificateTransparency(Boolean certificateTransparency) { this.certificateTransparency = certificateTransparency; return this; @@ -104,6 +115,7 @@ public IssuerParameters setCertificateTransparency(Boolean certificateTransparen /** * {@inheritDoc} */ + @Generated @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); @@ -115,19 +127,19 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { /** * Reads an instance of IssuerParameters from the JsonReader. - * + * * @param jsonReader The JsonReader being read. * @return An instance of IssuerParameters if the JsonReader was pointing to an instance of it, or null if it was * pointing to JSON null. * @throws IOException If an error occurs while reading the IssuerParameters. */ + @Generated public static IssuerParameters fromJson(JsonReader jsonReader) throws IOException { return jsonReader.readObject(reader -> { IssuerParameters deserializedIssuerParameters = new IssuerParameters(); while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("name".equals(fieldName)) { deserializedIssuerParameters.name = reader.getString(); } else if ("cty".equals(fieldName)) { @@ -138,7 +150,6 @@ public static IssuerParameters fromJson(JsonReader jsonReader) throws IOExceptio reader.skipChildren(); } } - return deserializedIssuerParameters; }); } diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/KeyProperties.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/KeyProperties.java index 2c49b2a5d6af1..587cc6f800394 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/KeyProperties.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/KeyProperties.java @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.security.keyvault.certificates.implementation.models; import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -18,44 +18,52 @@ */ @Fluent public final class KeyProperties implements JsonSerializable { + /* * Indicates if the private key can be exported. Release policy must be provided when creating the first version of * an exportable key. */ + @Generated private Boolean exportable; + /* + * The type of key pair to be used for the certificate. + */ + @Generated + private CertificateKeyType keyType; + /* * The key size in bits. For example: 2048, 3072, or 4096 for RSA. */ + @Generated private Integer keySize; /* * Indicates if the same key pair will be used on certificate renewal. */ + @Generated private Boolean reuseKey; - /* - * JsonWebKey Key Type (kty), as defined in https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40. - */ - private CertificateKeyType kty; - /* * Elliptic curve name. For valid values, see JsonWebKeyCurveName. */ - private CertificateKeyCurveName crv; + @Generated + private CertificateKeyCurveName curve; /** * Creates an instance of KeyProperties class. */ + @Generated public KeyProperties() { } /** * Get the exportable property: Indicates if the private key can be exported. Release policy must be provided when * creating the first version of an exportable key. - * + * * @return the exportable value. */ + @Generated public Boolean isExportable() { return this.exportable; } @@ -63,30 +71,55 @@ public Boolean isExportable() { /** * Set the exportable property: Indicates if the private key can be exported. Release policy must be provided when * creating the first version of an exportable key. - * + * * @param exportable the exportable value to set. * @return the KeyProperties object itself. */ + @Generated public KeyProperties setExportable(Boolean exportable) { this.exportable = exportable; return this; } + /** + * Get the keyType property: The type of key pair to be used for the certificate. + * + * @return the keyType value. + */ + @Generated + public CertificateKeyType getKeyType() { + return this.keyType; + } + + /** + * Set the keyType property: The type of key pair to be used for the certificate. + * + * @param keyType the keyType value to set. + * @return the KeyProperties object itself. + */ + @Generated + public KeyProperties setKeyType(CertificateKeyType keyType) { + this.keyType = keyType; + return this; + } + /** * Get the keySize property: The key size in bits. For example: 2048, 3072, or 4096 for RSA. - * + * * @return the keySize value. */ + @Generated public Integer getKeySize() { return this.keySize; } /** * Set the keySize property: The key size in bits. For example: 2048, 3072, or 4096 for RSA. - * + * * @param keySize the keySize value to set. * @return the KeyProperties object itself. */ + @Generated public KeyProperties setKeySize(Integer keySize) { this.keySize = keySize; return this; @@ -94,110 +127,92 @@ public KeyProperties setKeySize(Integer keySize) { /** * Get the reuseKey property: Indicates if the same key pair will be used on certificate renewal. - * + * * @return the reuseKey value. */ + @Generated public Boolean isReuseKey() { return this.reuseKey; } /** * Set the reuseKey property: Indicates if the same key pair will be used on certificate renewal. - * + * * @param reuseKey the reuseKey value to set. * @return the KeyProperties object itself. */ + @Generated public KeyProperties setReuseKey(Boolean reuseKey) { this.reuseKey = reuseKey; return this; } /** - * Get the kty property: JsonWebKey Key Type (kty), as defined in - * https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40. - * - * @return the kty value. - */ - public CertificateKeyType getKty() { - return this.kty; - } - - /** - * Set the kty property: JsonWebKey Key Type (kty), as defined in - * https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40. - * - * @param kty the kty value to set. - * @return the KeyProperties object itself. - */ - public KeyProperties setKty(CertificateKeyType kty) { - this.kty = kty; - return this; - } - - /** - * Get the crv property: Elliptic curve name. For valid values, see JsonWebKeyCurveName. - * - * @return the crv value. + * Get the curve property: Elliptic curve name. For valid values, see JsonWebKeyCurveName. + * + * @return the curve value. */ - public CertificateKeyCurveName getCrv() { - return this.crv; + @Generated + public CertificateKeyCurveName getCurve() { + return this.curve; } /** - * Set the crv property: Elliptic curve name. For valid values, see JsonWebKeyCurveName. - * - * @param crv the crv value to set. + * Set the curve property: Elliptic curve name. For valid values, see JsonWebKeyCurveName. + * + * @param curve the curve value to set. * @return the KeyProperties object itself. */ - public KeyProperties setCrv(CertificateKeyCurveName crv) { - this.crv = crv; + @Generated + public KeyProperties setCurve(CertificateKeyCurveName curve) { + this.curve = curve; return this; } /** * {@inheritDoc} */ + @Generated @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); jsonWriter.writeBooleanField("exportable", this.exportable); + jsonWriter.writeStringField("kty", this.keyType == null ? null : this.keyType.toString()); jsonWriter.writeNumberField("key_size", this.keySize); jsonWriter.writeBooleanField("reuse_key", this.reuseKey); - jsonWriter.writeStringField("kty", this.kty == null ? null : this.kty.toString()); - jsonWriter.writeStringField("crv", this.crv == null ? null : this.crv.toString()); + jsonWriter.writeStringField("crv", this.curve == null ? null : this.curve.toString()); return jsonWriter.writeEndObject(); } /** * Reads an instance of KeyProperties from the JsonReader. - * + * * @param jsonReader The JsonReader being read. * @return An instance of KeyProperties if the JsonReader was pointing to an instance of it, or null if it was * pointing to JSON null. * @throws IOException If an error occurs while reading the KeyProperties. */ + @Generated public static KeyProperties fromJson(JsonReader jsonReader) throws IOException { return jsonReader.readObject(reader -> { KeyProperties deserializedKeyProperties = new KeyProperties(); while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("exportable".equals(fieldName)) { deserializedKeyProperties.exportable = reader.getNullable(JsonReader::getBoolean); + } else if ("kty".equals(fieldName)) { + deserializedKeyProperties.keyType = CertificateKeyType.fromString(reader.getString()); } else if ("key_size".equals(fieldName)) { deserializedKeyProperties.keySize = reader.getNullable(JsonReader::getInt); } else if ("reuse_key".equals(fieldName)) { deserializedKeyProperties.reuseKey = reader.getNullable(JsonReader::getBoolean); - } else if ("kty".equals(fieldName)) { - deserializedKeyProperties.kty = CertificateKeyType.fromString(reader.getString()); } else if ("crv".equals(fieldName)) { - deserializedKeyProperties.crv = CertificateKeyCurveName.fromString(reader.getString()); + deserializedKeyProperties.curve = CertificateKeyCurveName.fromString(reader.getString()); } else { reader.skipChildren(); } } - return deserializedKeyProperties; }); } diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/KeyVaultError.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/KeyVaultError.java deleted file mode 100644 index cf3c57b0108bd..0000000000000 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/KeyVaultError.java +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.security.keyvault.certificates.implementation.models; - -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import com.azure.security.keyvault.certificates.models.CertificateOperationError; -import java.io.IOException; - -/** - * The key vault error exception. - */ -@Immutable -public final class KeyVaultError implements JsonSerializable { - /* - * The key vault server error. - */ - private CertificateOperationError error; - - /** - * Creates an instance of KeyVaultError class. - */ - public KeyVaultError() { - } - - /** - * Get the error property: The key vault server error. - * - * @return the error value. - */ - public CertificateOperationError getError() { - return this.error; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of KeyVaultError from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of KeyVaultError if the JsonReader was pointing to an instance of it, or null if it was - * pointing to JSON null. - * @throws IOException If an error occurs while reading the KeyVaultError. - */ - public static KeyVaultError fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - KeyVaultError deserializedKeyVaultError = new KeyVaultError(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("error".equals(fieldName)) { - deserializedKeyVaultError.error = CertificateOperationError.fromJson(reader); - } else { - reader.skipChildren(); - } - } - - return deserializedKeyVaultError; - }); - } -} diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/KeyVaultErrorException.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/KeyVaultErrorException.java deleted file mode 100644 index 56278adcfef1b..0000000000000 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/KeyVaultErrorException.java +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.security.keyvault.certificates.implementation.models; - -import com.azure.core.exception.HttpResponseException; -import com.azure.core.http.HttpResponse; - -/** - * Exception thrown for an invalid response with KeyVaultError information. - */ -public final class KeyVaultErrorException extends HttpResponseException { - /** - * Initializes a new instance of the KeyVaultErrorException class. - * - * @param message the exception message or the response content if a message is not available. - * @param response the HTTP response. - */ - public KeyVaultErrorException(String message, HttpResponse response) { - super(message, response); - } - - /** - * Initializes a new instance of the KeyVaultErrorException class. - * - * @param message the exception message or the response content if a message is not available. - * @param response the HTTP response. - * @param value the deserialized response value. - */ - public KeyVaultErrorException(String message, HttpResponse response, KeyVaultError value) { - super(message, response, value); - } - - /** - * {@inheritDoc} - */ - @Override - public KeyVaultError getValue() { - return (KeyVaultError) super.getValue(); - } -} diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/LifetimeAction.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/LifetimeAction.java index e4b934b07da21..ba5effd80e858 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/LifetimeAction.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/LifetimeAction.java @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.security.keyvault.certificates.implementation.models; import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -16,37 +16,43 @@ */ @Fluent public final class LifetimeAction implements JsonSerializable { + /* * The condition that will execute the action. */ + @Generated private Trigger trigger; /* * The action that will be executed. */ + @Generated private Action action; /** * Creates an instance of LifetimeAction class. */ + @Generated public LifetimeAction() { } /** * Get the trigger property: The condition that will execute the action. - * + * * @return the trigger value. */ + @Generated public Trigger getTrigger() { return this.trigger; } /** * Set the trigger property: The condition that will execute the action. - * + * * @param trigger the trigger value to set. * @return the LifetimeAction object itself. */ + @Generated public LifetimeAction setTrigger(Trigger trigger) { this.trigger = trigger; return this; @@ -54,19 +60,21 @@ public LifetimeAction setTrigger(Trigger trigger) { /** * Get the action property: The action that will be executed. - * + * * @return the action value. */ + @Generated public Action getAction() { return this.action; } /** * Set the action property: The action that will be executed. - * + * * @param action the action value to set. * @return the LifetimeAction object itself. */ + @Generated public LifetimeAction setAction(Action action) { this.action = action; return this; @@ -75,6 +83,7 @@ public LifetimeAction setAction(Action action) { /** * {@inheritDoc} */ + @Generated @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); @@ -85,19 +94,19 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { /** * Reads an instance of LifetimeAction from the JsonReader. - * + * * @param jsonReader The JsonReader being read. * @return An instance of LifetimeAction if the JsonReader was pointing to an instance of it, or null if it was * pointing to JSON null. * @throws IOException If an error occurs while reading the LifetimeAction. */ + @Generated public static LifetimeAction fromJson(JsonReader jsonReader) throws IOException { return jsonReader.readObject(reader -> { LifetimeAction deserializedLifetimeAction = new LifetimeAction(); while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("trigger".equals(fieldName)) { deserializedLifetimeAction.trigger = Trigger.fromJson(reader); } else if ("action".equals(fieldName)) { @@ -106,7 +115,6 @@ public static LifetimeAction fromJson(JsonReader jsonReader) throws IOException reader.skipChildren(); } } - return deserializedLifetimeAction; }); } diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/OrganizationDetails.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/OrganizationDetails.java index 013853e98f604..9524511e8383f 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/OrganizationDetails.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/OrganizationDetails.java @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.security.keyvault.certificates.implementation.models; import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -18,37 +18,43 @@ */ @Fluent public final class OrganizationDetails implements JsonSerializable { + /* * Id of the organization. */ + @Generated private String id; /* * Details of the organization administrator. */ + @Generated private List adminDetails; /** * Creates an instance of OrganizationDetails class. */ + @Generated public OrganizationDetails() { } /** * Get the id property: Id of the organization. - * + * * @return the id value. */ + @Generated public String getId() { return this.id; } /** * Set the id property: Id of the organization. - * + * * @param id the id value to set. * @return the OrganizationDetails object itself. */ + @Generated public OrganizationDetails setId(String id) { this.id = id; return this; @@ -56,19 +62,21 @@ public OrganizationDetails setId(String id) { /** * Get the adminDetails property: Details of the organization administrator. - * + * * @return the adminDetails value. */ + @Generated public List getAdminDetails() { return this.adminDetails; } /** * Set the adminDetails property: Details of the organization administrator. - * + * * @param adminDetails the adminDetails value to set. * @return the OrganizationDetails object itself. */ + @Generated public OrganizationDetails setAdminDetails(List adminDetails) { this.adminDetails = adminDetails; return this; @@ -77,6 +85,7 @@ public OrganizationDetails setAdminDetails(List adminDetai /** * {@inheritDoc} */ + @Generated @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); @@ -87,19 +96,19 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { /** * Reads an instance of OrganizationDetails from the JsonReader. - * + * * @param jsonReader The JsonReader being read. * @return An instance of OrganizationDetails if the JsonReader was pointing to an instance of it, or null if it was * pointing to JSON null. * @throws IOException If an error occurs while reading the OrganizationDetails. */ + @Generated public static OrganizationDetails fromJson(JsonReader jsonReader) throws IOException { return jsonReader.readObject(reader -> { OrganizationDetails deserializedOrganizationDetails = new OrganizationDetails(); while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("id".equals(fieldName)) { deserializedOrganizationDetails.id = reader.getString(); } else if ("admin_details".equals(fieldName)) { @@ -110,7 +119,6 @@ public static OrganizationDetails fromJson(JsonReader jsonReader) throws IOExcep reader.skipChildren(); } } - return deserializedOrganizationDetails; }); } diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/PendingCertificateSigningRequestResult.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/PendingCertificateSigningRequestResult.java deleted file mode 100644 index 043e9a17e5ee1..0000000000000 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/PendingCertificateSigningRequestResult.java +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.security.keyvault.certificates.implementation.models; - -import com.azure.core.annotation.Immutable; -import com.azure.json.JsonReader; -import com.azure.json.JsonSerializable; -import com.azure.json.JsonToken; -import com.azure.json.JsonWriter; -import java.io.IOException; - -/** - * The pending certificate signing request result. - */ -@Immutable -public final class PendingCertificateSigningRequestResult - implements JsonSerializable { - /* - * The pending certificate signing request as Base64 encoded string. - */ - private String value; - - /** - * Creates an instance of PendingCertificateSigningRequestResult class. - */ - public PendingCertificateSigningRequestResult() { - } - - /** - * Get the value property: The pending certificate signing request as Base64 encoded string. - * - * @return the value value. - */ - public String getValue() { - return this.value; - } - - /** - * {@inheritDoc} - */ - @Override - public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - jsonWriter.writeStartObject(); - return jsonWriter.writeEndObject(); - } - - /** - * Reads an instance of PendingCertificateSigningRequestResult from the JsonReader. - * - * @param jsonReader The JsonReader being read. - * @return An instance of PendingCertificateSigningRequestResult if the JsonReader was pointing to an instance of - * it, or null if it was pointing to JSON null. - * @throws IOException If an error occurs while reading the PendingCertificateSigningRequestResult. - */ - public static PendingCertificateSigningRequestResult fromJson(JsonReader jsonReader) throws IOException { - return jsonReader.readObject(reader -> { - PendingCertificateSigningRequestResult deserializedPendingCertificateSigningRequestResult - = new PendingCertificateSigningRequestResult(); - while (reader.nextToken() != JsonToken.END_OBJECT) { - String fieldName = reader.getFieldName(); - reader.nextToken(); - - if ("value".equals(fieldName)) { - deserializedPendingCertificateSigningRequestResult.value = reader.getString(); - } else { - reader.skipChildren(); - } - } - - return deserializedPendingCertificateSigningRequestResult; - }); - } -} diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/SecretProperties.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/SecretProperties.java index 018493f104b77..dbf80de20b108 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/SecretProperties.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/SecretProperties.java @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.security.keyvault.certificates.implementation.models; import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -16,32 +16,37 @@ */ @Fluent public final class SecretProperties implements JsonSerializable { + /* * The media type (MIME type). */ + @Generated private String contentType; /** * Creates an instance of SecretProperties class. */ + @Generated public SecretProperties() { } /** * Get the contentType property: The media type (MIME type). - * + * * @return the contentType value. */ + @Generated public String getContentType() { return this.contentType; } /** * Set the contentType property: The media type (MIME type). - * + * * @param contentType the contentType value to set. * @return the SecretProperties object itself. */ + @Generated public SecretProperties setContentType(String contentType) { this.contentType = contentType; return this; @@ -50,6 +55,7 @@ public SecretProperties setContentType(String contentType) { /** * {@inheritDoc} */ + @Generated @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); @@ -59,26 +65,25 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { /** * Reads an instance of SecretProperties from the JsonReader. - * + * * @param jsonReader The JsonReader being read. * @return An instance of SecretProperties if the JsonReader was pointing to an instance of it, or null if it was * pointing to JSON null. * @throws IOException If an error occurs while reading the SecretProperties. */ + @Generated public static SecretProperties fromJson(JsonReader jsonReader) throws IOException { return jsonReader.readObject(reader -> { SecretProperties deserializedSecretProperties = new SecretProperties(); while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("contentType".equals(fieldName)) { deserializedSecretProperties.contentType = reader.getString(); } else { reader.skipChildren(); } } - return deserializedSecretProperties; }); } diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/Trigger.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/Trigger.java index 5db6c3e060df6..7e1a5c6b91329 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/Trigger.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/Trigger.java @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.security.keyvault.certificates.implementation.models; import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -16,29 +16,34 @@ */ @Fluent public final class Trigger implements JsonSerializable { + /* * Percentage of lifetime at which to trigger. Value should be between 1 and 99. */ + @Generated private Integer lifetimePercentage; /* * Days before expiry to attempt renewal. Value should be between 1 and validity_in_months multiplied by 27. If * validity_in_months is 36, then value should be between 1 and 972 (36 * 27). */ + @Generated private Integer daysBeforeExpiry; /** * Creates an instance of Trigger class. */ + @Generated public Trigger() { } /** * Get the lifetimePercentage property: Percentage of lifetime at which to trigger. Value should be between 1 and * 99. - * + * * @return the lifetimePercentage value. */ + @Generated public Integer getLifetimePercentage() { return this.lifetimePercentage; } @@ -46,10 +51,11 @@ public Integer getLifetimePercentage() { /** * Set the lifetimePercentage property: Percentage of lifetime at which to trigger. Value should be between 1 and * 99. - * + * * @param lifetimePercentage the lifetimePercentage value to set. * @return the Trigger object itself. */ + @Generated public Trigger setLifetimePercentage(Integer lifetimePercentage) { this.lifetimePercentage = lifetimePercentage; return this; @@ -59,9 +65,10 @@ public Trigger setLifetimePercentage(Integer lifetimePercentage) { * Get the daysBeforeExpiry property: Days before expiry to attempt renewal. Value should be between 1 and * validity_in_months multiplied by 27. If validity_in_months is 36, then value should be between 1 and 972 (36 * * 27). - * + * * @return the daysBeforeExpiry value. */ + @Generated public Integer getDaysBeforeExpiry() { return this.daysBeforeExpiry; } @@ -70,10 +77,11 @@ public Integer getDaysBeforeExpiry() { * Set the daysBeforeExpiry property: Days before expiry to attempt renewal. Value should be between 1 and * validity_in_months multiplied by 27. If validity_in_months is 36, then value should be between 1 and 972 (36 * * 27). - * + * * @param daysBeforeExpiry the daysBeforeExpiry value to set. * @return the Trigger object itself. */ + @Generated public Trigger setDaysBeforeExpiry(Integer daysBeforeExpiry) { this.daysBeforeExpiry = daysBeforeExpiry; return this; @@ -82,6 +90,7 @@ public Trigger setDaysBeforeExpiry(Integer daysBeforeExpiry) { /** * {@inheritDoc} */ + @Generated @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); @@ -92,19 +101,19 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { /** * Reads an instance of Trigger from the JsonReader. - * + * * @param jsonReader The JsonReader being read. * @return An instance of Trigger if the JsonReader was pointing to an instance of it, or null if it was pointing to * JSON null. * @throws IOException If an error occurs while reading the Trigger. */ + @Generated public static Trigger fromJson(JsonReader jsonReader) throws IOException { return jsonReader.readObject(reader -> { Trigger deserializedTrigger = new Trigger(); while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("lifetime_percentage".equals(fieldName)) { deserializedTrigger.lifetimePercentage = reader.getNullable(JsonReader::getInt); } else if ("days_before_expiry".equals(fieldName)) { @@ -113,7 +122,6 @@ public static Trigger fromJson(JsonReader jsonReader) throws IOException { reader.skipChildren(); } } - return deserializedTrigger; }); } diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/X509CertificateProperties.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/X509CertificateProperties.java index 3ffccc1c717ab..e8393bc1d7f55 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/X509CertificateProperties.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/X509CertificateProperties.java @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.security.keyvault.certificates.implementation.models; import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; import com.azure.json.JsonReader; import com.azure.json.JsonSerializable; import com.azure.json.JsonToken; @@ -19,52 +19,61 @@ */ @Fluent public final class X509CertificateProperties implements JsonSerializable { + /* * The subject name. Should be a valid X509 distinguished Name. */ + @Generated private String subject; /* * The enhanced key usage. */ + @Generated private List ekus; /* * The subject alternative names. */ + @Generated private SubjectAlternativeNames subjectAlternativeNames; /* * Defines how the certificate's key may be used. */ + @Generated private List keyUsage; /* * The duration that the certificate is valid in months. */ + @Generated private Integer validityInMonths; /** * Creates an instance of X509CertificateProperties class. */ + @Generated public X509CertificateProperties() { } /** * Get the subject property: The subject name. Should be a valid X509 distinguished Name. - * + * * @return the subject value. */ + @Generated public String getSubject() { return this.subject; } /** * Set the subject property: The subject name. Should be a valid X509 distinguished Name. - * + * * @param subject the subject value to set. * @return the X509CertificateProperties object itself. */ + @Generated public X509CertificateProperties setSubject(String subject) { this.subject = subject; return this; @@ -72,19 +81,21 @@ public X509CertificateProperties setSubject(String subject) { /** * Get the ekus property: The enhanced key usage. - * + * * @return the ekus value. */ + @Generated public List getEkus() { return this.ekus; } /** * Set the ekus property: The enhanced key usage. - * + * * @param ekus the ekus value to set. * @return the X509CertificateProperties object itself. */ + @Generated public X509CertificateProperties setEkus(List ekus) { this.ekus = ekus; return this; @@ -92,19 +103,21 @@ public X509CertificateProperties setEkus(List ekus) { /** * Get the subjectAlternativeNames property: The subject alternative names. - * + * * @return the subjectAlternativeNames value. */ + @Generated public SubjectAlternativeNames getSubjectAlternativeNames() { return this.subjectAlternativeNames; } /** * Set the subjectAlternativeNames property: The subject alternative names. - * + * * @param subjectAlternativeNames the subjectAlternativeNames value to set. * @return the X509CertificateProperties object itself. */ + @Generated public X509CertificateProperties setSubjectAlternativeNames(SubjectAlternativeNames subjectAlternativeNames) { this.subjectAlternativeNames = subjectAlternativeNames; return this; @@ -112,19 +125,21 @@ public X509CertificateProperties setSubjectAlternativeNames(SubjectAlternativeNa /** * Get the keyUsage property: Defines how the certificate's key may be used. - * + * * @return the keyUsage value. */ + @Generated public List getKeyUsage() { return this.keyUsage; } /** * Set the keyUsage property: Defines how the certificate's key may be used. - * + * * @param keyUsage the keyUsage value to set. * @return the X509CertificateProperties object itself. */ + @Generated public X509CertificateProperties setKeyUsage(List keyUsage) { this.keyUsage = keyUsage; return this; @@ -132,19 +147,21 @@ public X509CertificateProperties setKeyUsage(List keyUsage) /** * Get the validityInMonths property: The duration that the certificate is valid in months. - * + * * @return the validityInMonths value. */ + @Generated public Integer getValidityInMonths() { return this.validityInMonths; } /** * Set the validityInMonths property: The duration that the certificate is valid in months. - * + * * @param validityInMonths the validityInMonths value to set. * @return the X509CertificateProperties object itself. */ + @Generated public X509CertificateProperties setValidityInMonths(Integer validityInMonths) { this.validityInMonths = validityInMonths; return this; @@ -153,6 +170,7 @@ public X509CertificateProperties setValidityInMonths(Integer validityInMonths) { /** * {@inheritDoc} */ + @Generated @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); @@ -167,19 +185,19 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { /** * Reads an instance of X509CertificateProperties from the JsonReader. - * + * * @param jsonReader The JsonReader being read. * @return An instance of X509CertificateProperties if the JsonReader was pointing to an instance of it, or null if * it was pointing to JSON null. * @throws IOException If an error occurs while reading the X509CertificateProperties. */ + @Generated public static X509CertificateProperties fromJson(JsonReader jsonReader) throws IOException { return jsonReader.readObject(reader -> { X509CertificateProperties deserializedX509CertificateProperties = new X509CertificateProperties(); while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("subject".equals(fieldName)) { deserializedX509CertificateProperties.subject = reader.getString(); } else if ("ekus".equals(fieldName)) { @@ -198,7 +216,6 @@ public static X509CertificateProperties fromJson(JsonReader jsonReader) throws I reader.skipChildren(); } } - return deserializedX509CertificateProperties; }); } diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/package-info.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/package-info.java index c26554b225b6f..c69ed5d6b381d 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/package-info.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/models/package-info.java @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - +// Code generated by Microsoft (R) TypeSpec Code Generator. /** - * Package containing the data models for CertificateClient. - * The key vault client performs cryptographic key operations and vault operations against the Key Vault service. + * + * Package containing the data models for CertificateClient. The key vault client performs cryptographic key operations + * and vault operations against the Key Vault service. */ package com.azure.security.keyvault.certificates.implementation.models; diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/package-info.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/package-info.java index 843b387e49adb..bb5cc1df52e6c 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/package-info.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/implementation/package-info.java @@ -1,9 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - +// Code generated by Microsoft (R) TypeSpec Code Generator. /** - * Package containing the implementations for CertificateClient. - * The key vault client performs cryptographic key operations and vault operations against the Key Vault service. + * + * Package containing the implementations for CertificateClient. The key vault client performs cryptographic key + * operations and vault operations against the Key Vault service. */ package com.azure.security.keyvault.certificates.implementation; diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/AdministratorContact.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/AdministratorContact.java index acdbf81bbe923..4144a7a0eb2a7 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/AdministratorContact.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/AdministratorContact.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.security.keyvault.certificates.models; import com.azure.core.annotation.Fluent; @@ -16,6 +15,7 @@ */ @Fluent public final class AdministratorContact implements JsonSerializable { + /* * First name. */ @@ -44,7 +44,7 @@ public AdministratorContact() { /** * Get the firstName property: First name. - * + * * @return the firstName value. */ public String getFirstName() { @@ -53,7 +53,7 @@ public String getFirstName() { /** * Set the firstName property: First name. - * + * * @param firstName the firstName value to set. * @return the AdministratorContact object itself. */ @@ -64,7 +64,7 @@ public AdministratorContact setFirstName(String firstName) { /** * Get the lastName property: Last name. - * + * * @return the lastName value. */ public String getLastName() { @@ -73,7 +73,7 @@ public String getLastName() { /** * Set the lastName property: Last name. - * + * * @param lastName the lastName value to set. * @return the AdministratorContact object itself. */ @@ -84,7 +84,7 @@ public AdministratorContact setLastName(String lastName) { /** * Get the email property: Email address. - * + * * @return the email value. */ public String getEmail() { @@ -93,7 +93,7 @@ public String getEmail() { /** * Set the email property: Email address. - * + * * @param email the email value to set. * @return the AdministratorContact object itself. */ @@ -104,7 +104,7 @@ public AdministratorContact setEmail(String email) { /** * Get the phone property: Phone number. - * + * * @return the phone value. */ public String getPhone() { @@ -113,7 +113,7 @@ public String getPhone() { /** * Set the phone property: Phone number. - * + * * @param phone the phone value to set. * @return the AdministratorContact object itself. */ @@ -137,7 +137,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { /** * Reads an instance of AdministratorContact from the JsonReader. - * + * * @param jsonReader The JsonReader being read. * @return An instance of AdministratorContact if the JsonReader was pointing to an instance of it, or null if it * was pointing to JSON null. @@ -149,7 +149,6 @@ public static AdministratorContact fromJson(JsonReader jsonReader) throws IOExce while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("first_name".equals(fieldName)) { deserializedAdministratorContact.firstName = reader.getString(); } else if ("last_name".equals(fieldName)) { @@ -162,7 +161,6 @@ public static AdministratorContact fromJson(JsonReader jsonReader) throws IOExce reader.skipChildren(); } } - return deserializedAdministratorContact; }); } diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/CertificateContact.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/CertificateContact.java index a256a84dd06aa..1a389c0db4949 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/CertificateContact.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/CertificateContact.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.security.keyvault.certificates.models; import com.azure.core.annotation.Fluent; @@ -16,6 +15,7 @@ */ @Fluent public final class CertificateContact implements JsonSerializable { + /* * Email address. */ @@ -39,7 +39,7 @@ public CertificateContact() { /** * Get the email property: Email address. - * + * * @return the email value. */ public String getEmail() { @@ -48,7 +48,7 @@ public String getEmail() { /** * Set the email property: Email address. - * + * * @param email the email value to set. * @return the CertificateContact object itself. */ @@ -59,7 +59,7 @@ public CertificateContact setEmail(String email) { /** * Get the name property: Name. - * + * * @return the name value. */ public String getName() { @@ -68,7 +68,7 @@ public String getName() { /** * Set the name property: Name. - * + * * @param name the name value to set. * @return the CertificateContact object itself. */ @@ -79,7 +79,7 @@ public CertificateContact setName(String name) { /** * Get the phone property: Phone number. - * + * * @return the phone value. */ public String getPhone() { @@ -88,7 +88,7 @@ public String getPhone() { /** * Set the phone property: Phone number. - * + * * @param phone the phone value to set. * @return the CertificateContact object itself. */ @@ -111,7 +111,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { /** * Reads an instance of CertificateContact from the JsonReader. - * + * * @param jsonReader The JsonReader being read. * @return An instance of CertificateContact if the JsonReader was pointing to an instance of it, or null if it was * pointing to JSON null. @@ -123,7 +123,6 @@ public static CertificateContact fromJson(JsonReader jsonReader) throws IOExcept while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("email".equals(fieldName)) { deserializedCertificateContact.email = reader.getString(); } else if ("name".equals(fieldName)) { @@ -134,7 +133,6 @@ public static CertificateContact fromJson(JsonReader jsonReader) throws IOExcept reader.skipChildren(); } } - return deserializedCertificateContact; }); } diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/CertificateIssuer.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/CertificateIssuer.java index fccf699a22133..33eb0c40fb938 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/CertificateIssuer.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/CertificateIssuer.java @@ -28,18 +28,18 @@ public final class CertificateIssuer implements JsonSerializable getAdministratorContacts() { - return impl.getOrganizationDetails() == null ? null : impl.getOrganizationDetails().getAdminDetails(); + return issuerBundle.getOrganizationDetails() == null + ? null + : issuerBundle.getOrganizationDetails().getAdminDetails(); } /** @@ -176,11 +178,11 @@ public List getAdministratorContacts() { * @return the Issuer object itself. */ public CertificateIssuer setAdministratorContacts(List administratorContacts) { - if (impl.getOrganizationDetails() == null) { - impl.setOrganizationDetails(new OrganizationDetails()); + if (issuerBundle.getOrganizationDetails() == null) { + issuerBundle.setOrganizationDetails(new OrganizationDetails()); } - impl.getOrganizationDetails().setAdminDetails(administratorContacts); + issuerBundle.getOrganizationDetails().setAdminDetails(administratorContacts); return this; } @@ -189,7 +191,7 @@ public CertificateIssuer setAdministratorContacts(List adm * @return the enabled status */ public Boolean isEnabled() { - return impl.getAttributes() == null ? null : impl.getAttributes().isEnabled(); + return issuerBundle.getAttributes() == null ? null : issuerBundle.getAttributes().isEnabled(); } /** @@ -198,11 +200,11 @@ public Boolean isEnabled() { * @return the Issuer object itself. */ public CertificateIssuer setEnabled(Boolean enabled) { - if (impl.getAttributes() == null) { - impl.setAttributes(new IssuerAttributes()); + if (issuerBundle.getAttributes() == null) { + issuerBundle.setAttributes(new IssuerAttributes()); } - impl.getAttributes().setEnabled(enabled); + issuerBundle.getAttributes().setEnabled(enabled); return this; } @@ -211,7 +213,7 @@ public CertificateIssuer setEnabled(Boolean enabled) { * @return the created UTC time. */ public OffsetDateTime getCreatedOn() { - return impl.getAttributes() == null ? null : impl.getAttributes().getCreated(); + return issuerBundle.getAttributes() == null ? null : issuerBundle.getAttributes().getCreated(); } /** @@ -219,12 +221,12 @@ public OffsetDateTime getCreatedOn() { * @return the updated UTC time. */ public OffsetDateTime getUpdatedOn() { - return impl.getAttributes() == null ? null : impl.getAttributes().getUpdated(); + return issuerBundle.getAttributes() == null ? null : issuerBundle.getAttributes().getUpdated(); } @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { - return impl.toJson(jsonWriter); + return issuerBundle.toJson(jsonWriter); } /** diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/CertificateKeyCurveName.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/CertificateKeyCurveName.java index 023bcbb7845bf..86edfd9cab099 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/CertificateKeyCurveName.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/CertificateKeyCurveName.java @@ -1,6 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.security.keyvault.certificates.models; import com.azure.core.util.ExpandableStringEnum; diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/CertificateKeyType.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/CertificateKeyType.java index 82019be3f0d1c..713760059ba00 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/CertificateKeyType.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/CertificateKeyType.java @@ -1,16 +1,16 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.security.keyvault.certificates.models; import com.azure.core.util.ExpandableStringEnum; import java.util.Collection; /** - * JsonWebKey Key Type (kty), as defined in https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40. + * The type of key pair to be used for the certificate. */ public final class CertificateKeyType extends ExpandableStringEnum { + /** * Elliptic Curve. */ @@ -33,7 +33,7 @@ public final class CertificateKeyType extends ExpandableStringEnum values() { return values(CertificateKeyType.class); } + + /** + * Octet sequence (used to represent symmetric keys). + */ + static final CertificateKeyType OCT = fromString("oct"); + + /** + * Octet sequence with a private key which is not exportable from the HSM. + */ + static final CertificateKeyType OCT_HSM = fromString("oct-HSM"); } diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/CertificateKeyUsage.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/CertificateKeyUsage.java index 150976d3ad2d0..009fb299b13c2 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/CertificateKeyUsage.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/CertificateKeyUsage.java @@ -1,16 +1,16 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.security.keyvault.certificates.models; import com.azure.core.util.ExpandableStringEnum; import java.util.Collection; /** - * Defines values for CertificateKeyUsage. + * Supported usages of a certificate key. */ public final class CertificateKeyUsage extends ExpandableStringEnum { + /** * Static value digitalSignature for CertificateKeyUsage. */ @@ -58,7 +58,7 @@ public final class CertificateKeyUsage extends ExpandableStringEnum values() { return values(CertificateKeyUsage.class); } + + /** + * Indicates that the certificate key can be used to sign a certificate revocation list. + */ + static final CertificateKeyUsage C_RLSIGN = fromString("cRLSign"); } diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/CertificateOperationError.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/CertificateOperationError.java index 46421d7470913..82fa118b9df93 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/CertificateOperationError.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/CertificateOperationError.java @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - +// Code generated by Microsoft (R) TypeSpec Code Generator. package com.azure.security.keyvault.certificates.models; import com.azure.core.annotation.Immutable; @@ -16,6 +15,7 @@ */ @Immutable public final class CertificateOperationError implements JsonSerializable { + /* * The error code. */ @@ -39,7 +39,7 @@ public CertificateOperationError() { /** * Get the code property: The error code. - * + * * @return the code value. */ public String getCode() { @@ -48,7 +48,7 @@ public String getCode() { /** * Get the message property: The error message. - * + * * @return the message value. */ public String getMessage() { @@ -57,7 +57,7 @@ public String getMessage() { /** * Get the innerError property: The key vault server error. - * + * * @return the innerError value. */ public CertificateOperationError getInnerError() { @@ -75,7 +75,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { /** * Reads an instance of CertificateOperationError from the JsonReader. - * + * * @param jsonReader The JsonReader being read. * @return An instance of CertificateOperationError if the JsonReader was pointing to an instance of it, or null if * it was pointing to JSON null. @@ -87,7 +87,6 @@ public static CertificateOperationError fromJson(JsonReader jsonReader) throws I while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("code".equals(fieldName)) { deserializedCertificateOperationError.code = reader.getString(); } else if ("message".equals(fieldName)) { @@ -98,7 +97,6 @@ public static CertificateOperationError fromJson(JsonReader jsonReader) throws I reader.skipChildren(); } } - return deserializedCertificateOperationError; }); } diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/CertificatePolicy.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/CertificatePolicy.java index c4021d98f41e1..09f1abc13dde0 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/CertificatePolicy.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/CertificatePolicy.java @@ -160,7 +160,7 @@ public CertificatePolicy setExportable(Boolean exportable) { * @return the key type value */ public CertificateKeyType getKeyType() { - return impl.getKeyProperties() == null ? null : impl.getKeyProperties().getKty(); + return impl.getKeyProperties() == null ? null : impl.getKeyProperties().getKeyType(); } /** @@ -174,7 +174,7 @@ public CertificatePolicy setKeyType(CertificateKeyType keyType) { impl.setKeyProperties(new KeyProperties()); } - impl.getKeyProperties().setKty(keyType); + impl.getKeyProperties().setKeyType(keyType); return this; } @@ -217,7 +217,7 @@ public CertificatePolicy setKeyReusable(Boolean keyReusable) { * @return the curve value */ public CertificateKeyCurveName getKeyCurveName() { - return impl.getKeyProperties() == null ? null : impl.getKeyProperties().getCrv(); + return impl.getKeyProperties() == null ? null : impl.getKeyProperties().getCurve(); } /** @@ -355,7 +355,7 @@ public CertificatePolicy setKeyCurveName(CertificateKeyCurveName keyCurveName) { impl.setKeyProperties(new KeyProperties()); } - impl.getKeyProperties().setCrv(keyCurveName); + impl.getKeyProperties().setCurve(keyCurveName); return this; } diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/CertificatePolicyAction.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/CertificatePolicyAction.java index 6b78b9423b5ee..f73b8cff78655 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/CertificatePolicyAction.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/CertificatePolicyAction.java @@ -5,6 +5,7 @@ package com.azure.security.keyvault.certificates.models; import com.azure.core.util.ExpandableStringEnum; + import java.util.Collection; /** @@ -23,7 +24,7 @@ public final class CertificatePolicyAction extends ExpandableStringEnum values() { diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/CertificateProperties.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/CertificateProperties.java index 1e18bc5266682..96e1d36d54bec 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/CertificateProperties.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/CertificateProperties.java @@ -14,6 +14,8 @@ import com.azure.security.keyvault.certificates.implementation.models.CertificateAttributes; import com.azure.security.keyvault.certificates.implementation.models.CertificateBundle; import com.azure.security.keyvault.certificates.implementation.models.CertificateItem; +import com.azure.security.keyvault.certificates.implementation.models.DeletedCertificateBundle; +import com.azure.security.keyvault.certificates.implementation.models.DeletedCertificateItem; import java.io.IOException; import java.time.OffsetDateTime; @@ -30,7 +32,17 @@ public class CertificateProperties implements JsonSerializable tags, byte[] wireThumbprint, Integer recoverableDays) { + IdMetadata idMetadata = getIdMetadata(id, 1, 2, 3, LOGGER); this.id = idMetadata.getId(); this.vaultUrl = idMetadata.getVaultUrl(); @@ -129,7 +152,7 @@ public class CertificateProperties implements JsonSerializable { + /* * Email addresses. */ @@ -40,7 +40,7 @@ public SubjectAlternativeNames() { /** * Get the emails property: Email addresses. - * + * * @return the emails value. */ public List getEmails() { @@ -49,7 +49,7 @@ public List getEmails() { /** * Set the emails property: Email addresses. - * + * * @param emails the emails value to set. * @return the SubjectAlternativeNames object itself. */ @@ -60,7 +60,7 @@ public SubjectAlternativeNames setEmails(List emails) { /** * Get the dnsNames property: Domain names. - * + * * @return the dnsNames value. */ public List getDnsNames() { @@ -69,7 +69,7 @@ public List getDnsNames() { /** * Set the dnsNames property: Domain names. - * + * * @param dnsNames the dnsNames value to set. * @return the SubjectAlternativeNames object itself. */ @@ -80,7 +80,7 @@ public SubjectAlternativeNames setDnsNames(List dnsNames) { /** * Get the userPrincipalNames property: User principal names. - * + * * @return the userPrincipalNames value. */ public List getUserPrincipalNames() { @@ -89,7 +89,7 @@ public List getUserPrincipalNames() { /** * Set the userPrincipalNames property: User principal names. - * + * * @param userPrincipalNames the userPrincipalNames value to set. * @return the SubjectAlternativeNames object itself. */ @@ -112,7 +112,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { /** * Reads an instance of SubjectAlternativeNames from the JsonReader. - * + * * @param jsonReader The JsonReader being read. * @return An instance of SubjectAlternativeNames if the JsonReader was pointing to an instance of it, or null if it * was pointing to JSON null. @@ -124,7 +124,6 @@ public static SubjectAlternativeNames fromJson(JsonReader jsonReader) throws IOE while (reader.nextToken() != JsonToken.END_OBJECT) { String fieldName = reader.getFieldName(); reader.nextToken(); - if ("emails".equals(fieldName)) { List emails = reader.readArray(reader1 -> reader1.getString()); deserializedSubjectAlternativeNames.emails = emails; @@ -138,7 +137,6 @@ public static SubjectAlternativeNames fromJson(JsonReader jsonReader) throws IOE reader.skipChildren(); } } - return deserializedSubjectAlternativeNames; }); } diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/package-info.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/package-info.java index a863a78a1c37f..bff5a479a45b1 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/package-info.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/models/package-info.java @@ -1,9 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - /** - * Package containing the data models for CertificateClient. - * The key vault client performs cryptographic key operations and vault operations against the Key Vault service. + * + * Package containing the data models for CertificateClient. The key vault client performs cryptographic key operations + * and vault operations against the Key Vault service. */ package com.azure.security.keyvault.certificates.models; diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/package-info.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/package-info.java index c562087d17d8e..f281f1001d17d 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/package-info.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/com/azure/security/keyvault/certificates/package-info.java @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. - /** + * *

Azure Key Vault is a cloud-based service * provided by Microsoft Azure that allows users to securely store and manage cryptographic certificates used for encrypting * and decrypting data. It is a part of Azure Key Vault, which is a cloud-based service for managing cryptographic certificates, diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/module-info.java b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/module-info.java index edacc9974f284..04d4b5167bb64 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/module-info.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/main/java/module-info.java @@ -1,5 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. module com.azure.security.keyvault.certificates { requires transitive com.azure.core; @@ -8,8 +9,8 @@ exports com.azure.security.keyvault.certificates; exports com.azure.security.keyvault.certificates.models; - opens com.azure.security.keyvault.certificates to com.azure.core; - opens com.azure.security.keyvault.certificates.implementation to com.azure.core; opens com.azure.security.keyvault.certificates.implementation.models to com.azure.core; opens com.azure.security.keyvault.certificates.models to com.azure.core; + opens com.azure.security.keyvault.certificates to com.azure.core; + opens com.azure.security.keyvault.certificates.implementation to com.azure.core; } diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/main/resources/azure-key-vault-certificates.properties b/sdk/keyvault/azure-security-keyvault-certificates/src/main/resources/azure-security-keyvault-certificates.properties similarity index 100% rename from sdk/keyvault/azure-security-keyvault-certificates/src/main/resources/azure-key-vault-certificates.properties rename to sdk/keyvault/azure-security-keyvault-certificates/src/main/resources/azure-security-keyvault-certificates.properties diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/test/java/com/azure/security/keyvault/certificates/CertificateAsyncClientTest.java b/sdk/keyvault/azure-security-keyvault-certificates/src/test/java/com/azure/security/keyvault/certificates/CertificateAsyncClientTest.java index 73c3073c89607..914cb606829b5 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/test/java/com/azure/security/keyvault/certificates/CertificateAsyncClientTest.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/test/java/com/azure/security/keyvault/certificates/CertificateAsyncClientTest.java @@ -3,16 +3,17 @@ package com.azure.security.keyvault.certificates; +import com.azure.core.exception.HttpResponseException; import com.azure.core.exception.ResourceModifiedException; import com.azure.core.exception.ResourceNotFoundException; import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedFlux; import com.azure.core.test.http.AssertingHttpClientBuilder; import com.azure.core.util.CoreUtils; import com.azure.core.util.polling.AsyncPollResponse; import com.azure.core.util.polling.LongRunningOperationStatus; import com.azure.core.util.polling.PollerFlux; import com.azure.security.keyvault.certificates.implementation.KeyVaultCredentialPolicy; -import com.azure.security.keyvault.certificates.implementation.models.KeyVaultErrorException; import com.azure.security.keyvault.certificates.models.CertificateContact; import com.azure.security.keyvault.certificates.models.CertificateContentType; import com.azure.security.keyvault.certificates.models.CertificateIssuer; @@ -147,7 +148,7 @@ public void createCertificateEmptyName(HttpClient httpClient, CertificateService StepVerifier.create(certificateAsyncClient.beginCreateCertificate("", CertificatePolicy.getDefault())) .verifyErrorSatisfies( - e -> assertResponseException(e, KeyVaultErrorException.class, HttpURLConnection.HTTP_BAD_METHOD)); + e -> assertResponseException(e, HttpResponseException.class, HttpURLConnection.HTTP_BAD_METHOD)); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @@ -647,7 +648,7 @@ public void createIssuerEmptyName(HttpClient httpClient, CertificateServiceVersi StepVerifier.create(certificateAsyncClient.createIssuer(new CertificateIssuer("", ""))) .verifyErrorSatisfies( - e -> assertResponseException(e, KeyVaultErrorException.class, HttpURLConnection.HTTP_BAD_METHOD)); + e -> assertResponseException(e, HttpResponseException.class, HttpURLConnection.HTTP_BAD_METHOD)); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @@ -657,7 +658,7 @@ public void createIssuerNullProvider(HttpClient httpClient, CertificateServiceVe StepVerifier.create(certificateAsyncClient.createIssuer(new CertificateIssuer("", null))) .verifyErrorSatisfies( - e -> assertResponseException(e, KeyVaultErrorException.class, HttpURLConnection.HTTP_BAD_METHOD)); + e -> assertResponseException(e, HttpResponseException.class, HttpURLConnection.HTTP_BAD_METHOD)); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @@ -882,9 +883,14 @@ public void listDeletedCertificates(HttpClient httpClient, CertificateServiceVer sleepIfRunningAgainstService(30000); - StepVerifier.create(certificateAsyncClient.listDeletedCertificates() - .doOnNext(deletedCertificate -> certificatesToDelete.remove(deletedCertificate.getName())) - .last()).assertNext(ignored -> assertEquals(0, certificatesToDelete.size())).verifyComplete(); + PagedFlux pagedFlux = certificateAsyncClient.listDeletedCertificates(); + + StepVerifier + .create( + pagedFlux.doOnNext(deletedCertificate -> certificatesToDelete.remove(deletedCertificate.getName())) + .last()) + .assertNext(ignored -> assertEquals(0, certificatesToDelete.size())) + .verifyComplete(); }); } @@ -985,7 +991,7 @@ public void mergeCertificateNotFound(HttpClient httpClient, CertificateServiceVe .create(certificateAsyncClient.mergeCertificate(new MergeCertificateOptions( testResourceNamer.randomName("testCert", 20), Collections.singletonList("test".getBytes())))) .verifyErrorSatisfies( - e -> assertResponseException(e, KeyVaultErrorException.class, HttpURLConnection.HTTP_NOT_FOUND)); + e -> assertResponseException(e, ResourceNotFoundException.class, HttpURLConnection.HTTP_NOT_FOUND)); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) diff --git a/sdk/keyvault/azure-security-keyvault-certificates/src/test/java/com/azure/security/keyvault/certificates/CertificateClientTest.java b/sdk/keyvault/azure-security-keyvault-certificates/src/test/java/com/azure/security/keyvault/certificates/CertificateClientTest.java index 0e5e361955fb7..72179c678ca47 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/src/test/java/com/azure/security/keyvault/certificates/CertificateClientTest.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/src/test/java/com/azure/security/keyvault/certificates/CertificateClientTest.java @@ -3,6 +3,7 @@ package com.azure.security.keyvault.certificates; +import com.azure.core.exception.HttpResponseException; import com.azure.core.exception.ResourceModifiedException; import com.azure.core.exception.ResourceNotFoundException; import com.azure.core.http.HttpClient; @@ -15,7 +16,6 @@ import com.azure.core.util.polling.PollResponse; import com.azure.core.util.polling.SyncPoller; import com.azure.security.keyvault.certificates.implementation.KeyVaultCredentialPolicy; -import com.azure.security.keyvault.certificates.implementation.models.KeyVaultErrorException; import com.azure.security.keyvault.certificates.models.CertificateContact; import com.azure.security.keyvault.certificates.models.CertificateContentType; import com.azure.security.keyvault.certificates.models.CertificateIssuer; @@ -169,7 +169,7 @@ public void createCertificateEmptyName(HttpClient httpClient, CertificateService createCertificateClient(httpClient, serviceVersion); assertResponseException(() -> certificateClient.beginCreateCertificate("", CertificatePolicy.getDefault()), - KeyVaultErrorException.class, HttpURLConnection.HTTP_BAD_METHOD); + HttpResponseException.class, HttpURLConnection.HTTP_BAD_METHOD); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @@ -651,7 +651,7 @@ public void createIssuerEmptyName(HttpClient httpClient, CertificateServiceVersi createCertificateClient(httpClient, serviceVersion); assertResponseException(() -> certificateClient.createIssuer(new CertificateIssuer("", "")), - KeyVaultErrorException.class, HttpURLConnection.HTTP_BAD_METHOD); + HttpResponseException.class, HttpURLConnection.HTTP_BAD_METHOD); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @@ -660,7 +660,7 @@ public void createIssuerNullProvider(HttpClient httpClient, CertificateServiceVe createCertificateClient(httpClient, serviceVersion); assertResponseException(() -> certificateClient.createIssuer(new CertificateIssuer("", null)), - KeyVaultErrorException.class, HttpURLConnection.HTTP_BAD_METHOD); + HttpResponseException.class, HttpURLConnection.HTTP_BAD_METHOD); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @@ -964,7 +964,7 @@ public void mergeCertificateNotFound(HttpClient httpClient, CertificateServiceVe assertResponseException( () -> certificateClient.mergeCertificate(new MergeCertificateOptions( testResourceNamer.randomName("testCert", 20), Collections.singletonList("test".getBytes()))), - KeyVaultErrorException.class, HttpURLConnection.HTTP_NOT_FOUND); + ResourceNotFoundException.class, HttpURLConnection.HTTP_NOT_FOUND); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) diff --git a/sdk/keyvault/azure-security-keyvault-certificates/swagger/src/main/java/CertificatesCustomizations.java b/sdk/keyvault/azure-security-keyvault-certificates/swagger/src/main/java/CertificatesCustomizations.java index 1a5799d6be19d..16d77401698c8 100644 --- a/sdk/keyvault/azure-security-keyvault-certificates/swagger/src/main/java/CertificatesCustomizations.java +++ b/sdk/keyvault/azure-security-keyvault-certificates/swagger/src/main/java/CertificatesCustomizations.java @@ -1,20 +1,78 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +import com.azure.autorest.customization.ClassCustomization; import com.azure.autorest.customization.Customization; +import com.azure.autorest.customization.Editor; import com.azure.autorest.customization.LibraryCustomization; +import com.azure.autorest.customization.PackageCustomization; +import com.github.javaparser.ast.CompilationUnit; +import com.github.javaparser.ast.ImportDeclaration; +import com.github.javaparser.ast.NodeList; import org.slf4j.Logger; +/** + * Contains customizations for Azure KeyVault's Certificates swagger code generation. + */ public class CertificatesCustomizations extends Customization { @Override public void customize(LibraryCustomization libraryCustomization, Logger logger) { - libraryCustomization.getPackage("com.azure.security.keyvault.certificates.models") - .getClass("CertificateKeyCurveName") - .customizeAst(ast -> ast.getClassByName("CertificateKeyCurveName").ifPresent(clazz -> { - clazz.getFieldByName("P256K").ifPresent(field -> field.getVariable(0).setName("P_256K")); - clazz.getFieldByName("P256").ifPresent(field -> field.getVariable(0).setName("P_256")); - clazz.getFieldByName("P384").ifPresent(field -> field.getVariable(0).setName("P_384")); - clazz.getFieldByName("P521").ifPresent(field -> field.getVariable(0).setName("P_521")); - })); + Editor rawEditor = libraryCustomization.getRawEditor(); + + // Remove unnecessary files. + removeFiles(rawEditor); + + // Customize the CertificateClientImpl class. + ClassCustomization classCustomization = libraryCustomization + .getPackage("com.azure.security.keyvault.certificates.implementation") + .getClass("CertificateClientImpl"); + String classPath = + "src/main/java/com/azure/security/keyvault/certificates/implementation/CertificateClientImpl.java"; + + replaceInFile(classCustomization, classPath, "KeyVault", "Certificate"); + } + + private static void removeFiles(Editor editor) { + // Remove the next line in favor of renaming to CertificateServiceVersion once the TSP spec includes all service + // versions. + editor.removeFile("src/main/java/com/azure/security/keyvault/certificates/KeyVaultServiceVersion.java"); + editor.removeFile("src/main/java/com/azure/security/keyvault/certificates/CertificateAsyncClient.java"); + editor.removeFile("src/main/java/com/azure/security/keyvault/certificates/CertificateClient.java"); + editor.removeFile("src/main/java/com/azure/security/keyvault/certificates/CertificateClientBuilder.java"); + } + + /** + * This method replaces all the provided strings in the specified file with new strings provided in the latter half + * of the 'strings' parameter. + * + * @param classCustomization The class customization to use to edit the file. + * @param classPath The path to the file to edit. + * @param strings The strings to replace. The first half of the strings will be replaced with the second half in the + * order they are provided. + */ + private static void replaceInFile(ClassCustomization classCustomization, String classPath, + String... strings) { + // Replace all instances of KeyVaultServiceVersion with CertificateServiceVersion. We'll remove this once the + // TSP spec includes all service versions. + Editor editor = classCustomization.getEditor(); + String fileContent = editor.getFileContent(classPath); + + // Ensure names has an even length. + if (strings.length % 2 != 0) { + throw new IllegalArgumentException("The 'names' parameter must have an even number of elements."); + } + + for (int i = 0; i < (strings.length / 2); i++) { + fileContent = fileContent.replace(strings[i], strings[i + strings.length / 2]); + } + + editor.replaceFile(classPath, fileContent); + + // Uncomment once there's a new version of the AutoRest library out. + /*List ranges = editor.searchText(classPath, "KeyVaultServiceVersion"); + + for (Range range : ranges) { + editor.replace(classPath, range.getStart(), range.getEnd(), "CertificateServiceVersion"); + }*/ } } diff --git a/sdk/keyvault/azure-security-keyvault-certificates/tsp-location.yaml b/sdk/keyvault/azure-security-keyvault-certificates/tsp-location.yaml new file mode 100644 index 0000000000000..e1d8fb262ddbb --- /dev/null +++ b/sdk/keyvault/azure-security-keyvault-certificates/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/keyvault/Security.KeyVault.Certificates +commit: 290aa25c26f89a06e86c7c864c591d780d370de9 +repo: Azure/azure-rest-api-specs +cleanup: true