From 96a3e93bee358f95083c3a7ba7e08946861fc8d1 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Mon, 23 Sep 2024 16:39:30 +0000 Subject: [PATCH] CodeGen from PR 30685 in Azure/azure-rest-api-specs Merge 544ce606ecc25506dfa1e33188e5af8703bca69c into b0e24ca8d7f0ed95ae33d72abe8ae59bc0750438 --- eng/versioning/version_client.txt | 1 + pom.xml | 1 + .../CHANGELOG.md | 8 + .../README.md | 104 ++ .../SAMPLE.md | 384 +++++ .../azure-resourcemanager-codesigning/pom.xml | 67 + .../codesigning/CodeSigningManager.java | 307 ++++ .../fluent/CertificateProfilesClient.java | 232 +++ .../fluent/CodeSigningAccountsClient.java | 297 ++++ .../fluent/CodeSigningManagementClient.java | 69 + .../codesigning/fluent/OperationsClient.java | 40 + .../models/CertificateProfileInner.java | 353 +++++ .../models/CertificateProfileProperties.java | 346 ++++ .../CheckNameAvailabilityResultInner.java | 121 ++ .../models/CodeSigningAccountInner.java | 223 +++ .../CodeSigningAccountPatchProperties.java | 98 ++ .../models/CodeSigningAccountProperties.java | 131 ++ .../fluent/models/OperationInner.java | 172 ++ .../codesigning/fluent/models/Revocation.java | 229 +++ .../fluent/models/package-info.java | 9 + .../codesigning/fluent/package-info.java | 9 + .../CertificateProfileImpl.java | 191 +++ .../CertificateProfilesClientImpl.java | 1076 +++++++++++++ .../CertificateProfilesImpl.java | 171 ++ .../CheckNameAvailabilityResultImpl.java | 41 + .../CodeSigningAccountImpl.java | 193 +++ .../CodeSigningAccountsClientImpl.java | 1397 +++++++++++++++++ .../CodeSigningAccountsImpl.java | 171 ++ .../CodeSigningManagementClientBuilder.java | 138 ++ .../CodeSigningManagementClientImpl.java | 320 ++++ .../implementation/OperationImpl.java | 50 + .../implementation/OperationsClientImpl.java | 235 +++ .../implementation/OperationsImpl.java | 45 + .../implementation/ResourceManagerUtils.java | 195 +++ .../implementation/package-info.java | 9 + .../codesigning/models/AccountSku.java | 101 ++ .../codesigning/models/AccountSkuPatch.java | 93 ++ .../codesigning/models/ActionType.java | 46 + .../codesigning/models/Certificate.java | 407 +++++ .../models/CertificateProfile.java | 314 ++++ .../models/CertificateProfileListResult.java | 136 ++ .../models/CertificateProfileStatus.java | 56 + .../models/CertificateProfiles.java | 174 ++ .../codesigning/models/CertificateStatus.java | 56 + .../models/CheckNameAvailability.java | 101 ++ .../models/CheckNameAvailabilityResult.java | 42 + .../models/CodeSigningAccount.java | 279 ++++ .../models/CodeSigningAccountListResult.java | 136 ++ .../models/CodeSigningAccountPatch.java | 140 ++ .../models/CodeSigningAccounts.java | 182 +++ .../models/NameUnavailabilityReason.java | 52 + .../codesigning/models/Operation.java | 58 + .../codesigning/models/OperationDisplay.java | 136 ++ .../models/OperationListResult.java | 104 ++ .../codesigning/models/Operations.java | 35 + .../codesigning/models/Origin.java | 57 + .../codesigning/models/ProfileType.java | 66 + .../codesigning/models/ProvisioningState.java | 71 + .../codesigning/models/RevocationStatus.java | 56 + .../codesigning/models/RevokeCertificate.java | 230 +++ .../codesigning/models/SkuName.java | 51 + .../codesigning/models/package-info.java | 9 + .../codesigning/package-info.java | 9 + .../src/main/java/module-info.java | 13 + .../proxy-config.json | 1 + .../reflect-config.json | 1 + .../CertificateProfilesCreateSamples.java | 33 + .../CertificateProfilesDeleteSamples.java | 25 + .../CertificateProfilesGetSamples.java | 26 + ...ofilesListByCodeSigningAccountSamples.java | 26 + ...icateProfilesRevokeCertificateSamples.java | 35 + ...gAccountsCheckNameAvailabilitySamples.java | 29 + .../CodeSigningAccountsCreateSamples.java | 32 + .../CodeSigningAccountsDeleteSamples.java | 24 + ...ningAccountsGetByResourceGroupSamples.java | 25 + ...ingAccountsListByResourceGroupSamples.java | 25 + .../CodeSigningAccountsListSamples.java | 25 + .../CodeSigningAccountsUpdateSamples.java | 43 + .../generated/OperationsListSamples.java | 25 + sdk/codesigning/ci.yml | 46 + sdk/codesigning/pom.xml | 15 + .../azure-resourcemanager-fabric/pom.xml | 2 +- 82 files changed, 11080 insertions(+), 1 deletion(-) create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/CHANGELOG.md create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/README.md create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/SAMPLE.md create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/pom.xml create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/CodeSigningManager.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/fluent/CertificateProfilesClient.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/fluent/CodeSigningAccountsClient.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/fluent/CodeSigningManagementClient.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/fluent/OperationsClient.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/fluent/models/CertificateProfileInner.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/fluent/models/CertificateProfileProperties.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/fluent/models/CheckNameAvailabilityResultInner.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/fluent/models/CodeSigningAccountInner.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/fluent/models/CodeSigningAccountPatchProperties.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/fluent/models/CodeSigningAccountProperties.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/fluent/models/OperationInner.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/fluent/models/Revocation.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/fluent/models/package-info.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/fluent/package-info.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/implementation/CertificateProfileImpl.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/implementation/CertificateProfilesClientImpl.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/implementation/CertificateProfilesImpl.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/implementation/CheckNameAvailabilityResultImpl.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/implementation/CodeSigningAccountImpl.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/implementation/CodeSigningAccountsClientImpl.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/implementation/CodeSigningAccountsImpl.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/implementation/CodeSigningManagementClientBuilder.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/implementation/CodeSigningManagementClientImpl.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/implementation/OperationImpl.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/implementation/OperationsClientImpl.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/implementation/OperationsImpl.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/implementation/ResourceManagerUtils.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/implementation/package-info.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/AccountSku.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/AccountSkuPatch.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/ActionType.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/Certificate.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/CertificateProfile.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/CertificateProfileListResult.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/CertificateProfileStatus.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/CertificateProfiles.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/CertificateStatus.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/CheckNameAvailability.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/CheckNameAvailabilityResult.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/CodeSigningAccount.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/CodeSigningAccountListResult.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/CodeSigningAccountPatch.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/CodeSigningAccounts.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/NameUnavailabilityReason.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/Operation.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/OperationDisplay.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/OperationListResult.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/Operations.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/Origin.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/ProfileType.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/ProvisioningState.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/RevocationStatus.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/RevokeCertificate.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/SkuName.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/package-info.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/package-info.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/module-info.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-codesigning/proxy-config.json create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-codesigning/reflect-config.json create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/samples/java/com/azure/resourcemanager/codesigning/generated/CertificateProfilesCreateSamples.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/samples/java/com/azure/resourcemanager/codesigning/generated/CertificateProfilesDeleteSamples.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/samples/java/com/azure/resourcemanager/codesigning/generated/CertificateProfilesGetSamples.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/samples/java/com/azure/resourcemanager/codesigning/generated/CertificateProfilesListByCodeSigningAccountSamples.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/samples/java/com/azure/resourcemanager/codesigning/generated/CertificateProfilesRevokeCertificateSamples.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/samples/java/com/azure/resourcemanager/codesigning/generated/CodeSigningAccountsCheckNameAvailabilitySamples.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/samples/java/com/azure/resourcemanager/codesigning/generated/CodeSigningAccountsCreateSamples.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/samples/java/com/azure/resourcemanager/codesigning/generated/CodeSigningAccountsDeleteSamples.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/samples/java/com/azure/resourcemanager/codesigning/generated/CodeSigningAccountsGetByResourceGroupSamples.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/samples/java/com/azure/resourcemanager/codesigning/generated/CodeSigningAccountsListByResourceGroupSamples.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/samples/java/com/azure/resourcemanager/codesigning/generated/CodeSigningAccountsListSamples.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/samples/java/com/azure/resourcemanager/codesigning/generated/CodeSigningAccountsUpdateSamples.java create mode 100644 sdk/codesigning/azure-resourcemanager-codesigning/src/samples/java/com/azure/resourcemanager/codesigning/generated/OperationsListSamples.java create mode 100644 sdk/codesigning/ci.yml create mode 100644 sdk/codesigning/pom.xml diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 957f2cb5557da..141348fb84ee0 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -472,6 +472,7 @@ com.azure.resourcemanager:azure-resourcemanager-servicefabricmanagedclusters;1.0 com.azure.resourcemanager:azure-resourcemanager-healthdataaiservices;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-redhatopenshift;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-fabric;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-codesigning;1.0.0-beta.1;1.0.0-beta.1 com.azure.tools:azure-sdk-archetype;1.0.0;1.2.0-beta.1 com.azure.tools:azure-sdk-build-tool;1.0.0;1.1.0-beta.1 io.clientcore:clientcore-parent;1.0.0-beta.1;1.0.0-beta.1 diff --git a/pom.xml b/pom.xml index 4b2d9941ab25b..2d54905cfe1d9 100644 --- a/pom.xml +++ b/pom.xml @@ -42,6 +42,7 @@ sdk/changeanalysis sdk/chaos sdk/clientcore + sdk/codesigning sdk/cognitiveservices sdk/commerce sdk/communication diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/CHANGELOG.md b/sdk/codesigning/azure-resourcemanager-codesigning/CHANGELOG.md new file mode 100644 index 0000000000000..cecc7ac6c45cd --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 1.0.0-beta.1 (2024-09-23) + +- Azure Resource Manager CodeSigning client library for Java. This package contains Microsoft Azure SDK for CodeSigning Management SDK. Code Signing resource provider api. Package tag package-2024-09-30-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). +### Features Added + +- Initial release for the azure-resourcemanager-codesigning Java SDK. diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/README.md b/sdk/codesigning/azure-resourcemanager-codesigning/README.md new file mode 100644 index 0000000000000..7c7c4697df502 --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/README.md @@ -0,0 +1,104 @@ +# Azure Resource Manager CodeSigning client library for Java + +Azure Resource Manager CodeSigning client library for Java. + +This package contains Microsoft Azure SDK for CodeSigning Management SDK. Code Signing resource provider api. Package tag package-2024-09-30-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +## We'd love to hear your feedback + +We're always working on improving our products and the way we communicate with our users. So we'd love to learn what's working and how we can do better. + +If you haven't already, please take a few minutes to [complete this short survey][survey] we have put together. + +Thank you in advance for your collaboration. We really appreciate your time! + +## Documentation + +Various documentation is available to help you get started + +- [API reference documentation][docs] + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-codesigning;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-codesigning + 1.0.0-beta.1 + +``` +[//]: # ({x-version-update-end}) + +### Include the recommended packages + +Azure Management Libraries require a `TokenCredential` implementation for authentication and an `HttpClient` implementation for HTTP client. + +[Azure Identity][azure_identity] and [Azure Core Netty HTTP][azure_core_http_netty] packages provide the default implementation. + +### Authentication + +Microsoft Entra ID token authentication relies on the [credential class][azure_identity_credentials] from [Azure Identity][azure_identity] package. + +Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment variable. + +Assuming the use of the `DefaultAzureCredential` credential class, the client can be authenticated using the following code: + +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +CodeSigningManager manager = CodeSigningManager + .authenticate(credential, profile); +``` + +The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise. + +See [Authentication][authenticate] for more options. + +## Key concepts + +See [API design][design] for general introduction on design and key concepts on Azure Management Libraries. + +## Examples + +[Code snippets and samples](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/codesigning/azure-resourcemanager-codesigning/SAMPLE.md) + + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide][cg]. + +This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit . + +When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repositories using our CLA. + +This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For more information see the [Code of Conduct FAQ][coc_faq] or contact with any additional questions or comments. + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://learn.microsoft.com/azure/developer/java/fundamentals/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity +[azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/identity/azure-identity#credentials +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/DESIGN.md +[cg]: https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md +[coc]: https://opensource.microsoft.com/codeofconduct/ +[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java%2Fsdk%2Fcodesigning%2Fazure-resourcemanager-codesigning%2FREADME.png) diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/SAMPLE.md b/sdk/codesigning/azure-resourcemanager-codesigning/SAMPLE.md new file mode 100644 index 0000000000000..2a2b311536049 --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/SAMPLE.md @@ -0,0 +1,384 @@ +# Code snippets and samples + + +## CertificateProfiles + +- [Create](#certificateprofiles_create) +- [Delete](#certificateprofiles_delete) +- [Get](#certificateprofiles_get) +- [ListByCodeSigningAccount](#certificateprofiles_listbycodesigningaccount) +- [RevokeCertificate](#certificateprofiles_revokecertificate) + +## CodeSigningAccounts + +- [CheckNameAvailability](#codesigningaccounts_checknameavailability) +- [Create](#codesigningaccounts_create) +- [Delete](#codesigningaccounts_delete) +- [GetByResourceGroup](#codesigningaccounts_getbyresourcegroup) +- [List](#codesigningaccounts_list) +- [ListByResourceGroup](#codesigningaccounts_listbyresourcegroup) +- [Update](#codesigningaccounts_update) + +## Operations + +- [List](#operations_list) +### CertificateProfiles_Create + +```java +import com.azure.resourcemanager.codesigning.models.ProfileType; + +/** + * Samples for CertificateProfiles Create. + */ +public final class CertificateProfilesCreateSamples { + /* + * x-ms-original-file: + * specification/codesigning/resource-manager/Microsoft.CodeSigning/preview/2024-09-30-preview/examples/ + * CertificateProfiles_Create.json + */ + /** + * Sample code: Create a certificate profile. + * + * @param manager Entry point to CodeSigningManager. + */ + public static void createACertificateProfile(com.azure.resourcemanager.codesigning.CodeSigningManager manager) { + manager.certificateProfiles() + .define("profileA") + .withExistingCodeSigningAccount("MyResourceGroup", "MyAccount") + .withProfileType(ProfileType.PUBLIC_TRUST) + .withIncludeStreetAddress(false) + .withIncludePostalCode(true) + .withIdentityValidationId("00000000-1234-5678-3333-444444444444") + .create(); + } +} +``` + +### CertificateProfiles_Delete + +```java +/** + * Samples for CertificateProfiles Delete. + */ +public final class CertificateProfilesDeleteSamples { + /* + * x-ms-original-file: + * specification/codesigning/resource-manager/Microsoft.CodeSigning/preview/2024-09-30-preview/examples/ + * CertificateProfiles_Delete.json + */ + /** + * Sample code: Delete a certificate profile. + * + * @param manager Entry point to CodeSigningManager. + */ + public static void deleteACertificateProfile(com.azure.resourcemanager.codesigning.CodeSigningManager manager) { + manager.certificateProfiles() + .delete("MyResourceGroup", "MyAccount", "profileA", com.azure.core.util.Context.NONE); + } +} +``` + +### CertificateProfiles_Get + +```java +/** + * Samples for CertificateProfiles Get. + */ +public final class CertificateProfilesGetSamples { + /* + * x-ms-original-file: + * specification/codesigning/resource-manager/Microsoft.CodeSigning/preview/2024-09-30-preview/examples/ + * CertificateProfiles_Get.json + */ + /** + * Sample code: Get details of a certificate profile. + * + * @param manager Entry point to CodeSigningManager. + */ + public static void + getDetailsOfACertificateProfile(com.azure.resourcemanager.codesigning.CodeSigningManager manager) { + manager.certificateProfiles() + .getWithResponse("MyResourceGroup", "MyAccount", "profileA", com.azure.core.util.Context.NONE); + } +} +``` + +### CertificateProfiles_ListByCodeSigningAccount + +```java +/** + * Samples for CertificateProfiles ListByCodeSigningAccount. + */ +public final class CertificateProfilesListByCodeSigningAccountSamples { + /* + * x-ms-original-file: + * specification/codesigning/resource-manager/Microsoft.CodeSigning/preview/2024-09-30-preview/examples/ + * CertificateProfiles_ListByCodeSigningAccount.json + */ + /** + * Sample code: List certificate profiles under a trusted signing account. + * + * @param manager Entry point to CodeSigningManager. + */ + public static void listCertificateProfilesUnderATrustedSigningAccount( + com.azure.resourcemanager.codesigning.CodeSigningManager manager) { + manager.certificateProfiles() + .listByCodeSigningAccount("MyResourceGroup", "MyAccount", com.azure.core.util.Context.NONE); + } +} +``` + +### CertificateProfiles_RevokeCertificate + +```java +import com.azure.resourcemanager.codesigning.models.RevokeCertificate; +import java.time.OffsetDateTime; + +/** + * Samples for CertificateProfiles RevokeCertificate. + */ +public final class CertificateProfilesRevokeCertificateSamples { + /* + * x-ms-original-file: + * specification/codesigning/resource-manager/Microsoft.CodeSigning/preview/2024-09-30-preview/examples/ + * CertificateProfiles_RevokeCertificate.json + */ + /** + * Sample code: Revoke a certificate under a certificate profile. + * + * @param manager Entry point to CodeSigningManager. + */ + public static void + revokeACertificateUnderACertificateProfile(com.azure.resourcemanager.codesigning.CodeSigningManager manager) { + manager.certificateProfiles() + .revokeCertificateWithResponse("MyResourceGroup", "MyAccount", "profileA", + new RevokeCertificate().withSerialNumber("xxxxxxxxxxxxxxxxxx") + .withThumbprint("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx") + .withEffectiveAt(OffsetDateTime.parse("2023-11-12T23:40:25+00:00")) + .withReason("KeyCompromised") + .withRemarks("test"), + com.azure.core.util.Context.NONE); + } +} +``` + +### CodeSigningAccounts_CheckNameAvailability + +```java +import com.azure.resourcemanager.codesigning.models.CheckNameAvailability; + +/** + * Samples for CodeSigningAccounts CheckNameAvailability. + */ +public final class CodeSigningAccountsCheckNameAvailabilitySamples { + /* + * x-ms-original-file: + * specification/codesigning/resource-manager/Microsoft.CodeSigning/preview/2024-09-30-preview/examples/ + * CodeSigningAccounts_CheckNameAvailability.json + */ + /** + * Sample code: Checks that the trusted signing account name is available. + * + * @param manager Entry point to CodeSigningManager. + */ + public static void checksThatTheTrustedSigningAccountNameIsAvailable( + com.azure.resourcemanager.codesigning.CodeSigningManager manager) { + manager.codeSigningAccounts() + .checkNameAvailabilityWithResponse(new CheckNameAvailability().withName("sample-account"), + com.azure.core.util.Context.NONE); + } +} +``` + +### CodeSigningAccounts_Create + +```java +import com.azure.resourcemanager.codesigning.models.AccountSku; +import com.azure.resourcemanager.codesigning.models.SkuName; + +/** + * Samples for CodeSigningAccounts Create. + */ +public final class CodeSigningAccountsCreateSamples { + /* + * x-ms-original-file: + * specification/codesigning/resource-manager/Microsoft.CodeSigning/preview/2024-09-30-preview/examples/ + * CodeSigningAccounts_Create.json + */ + /** + * Sample code: Create a trusted Signing Account. + * + * @param manager Entry point to CodeSigningManager. + */ + public static void createATrustedSigningAccount(com.azure.resourcemanager.codesigning.CodeSigningManager manager) { + manager.codeSigningAccounts() + .define("MyAccount") + .withRegion("westus") + .withExistingResourceGroup("MyResourceGroup") + .withSku(new AccountSku().withName(SkuName.BASIC)) + .create(); + } +} +``` + +### CodeSigningAccounts_Delete + +```java +/** + * Samples for CodeSigningAccounts Delete. + */ +public final class CodeSigningAccountsDeleteSamples { + /* + * x-ms-original-file: + * specification/codesigning/resource-manager/Microsoft.CodeSigning/preview/2024-09-30-preview/examples/ + * CodeSigningAccounts_Delete.json + */ + /** + * Sample code: Delete a trusted signing account. + * + * @param manager Entry point to CodeSigningManager. + */ + public static void deleteATrustedSigningAccount(com.azure.resourcemanager.codesigning.CodeSigningManager manager) { + manager.codeSigningAccounts().delete("MyResourceGroup", "MyAccount", com.azure.core.util.Context.NONE); + } +} +``` + +### CodeSigningAccounts_GetByResourceGroup + +```java +/** + * Samples for CodeSigningAccounts GetByResourceGroup. + */ +public final class CodeSigningAccountsGetByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/codesigning/resource-manager/Microsoft.CodeSigning/preview/2024-09-30-preview/examples/ + * CodeSigningAccounts_Get.json + */ + /** + * Sample code: Get a Trusted Signing Account. + * + * @param manager Entry point to CodeSigningManager. + */ + public static void getATrustedSigningAccount(com.azure.resourcemanager.codesigning.CodeSigningManager manager) { + manager.codeSigningAccounts() + .getByResourceGroupWithResponse("MyResourceGroup", "MyAccount", com.azure.core.util.Context.NONE); + } +} +``` + +### CodeSigningAccounts_List + +```java +/** + * Samples for CodeSigningAccounts List. + */ +public final class CodeSigningAccountsListSamples { + /* + * x-ms-original-file: + * specification/codesigning/resource-manager/Microsoft.CodeSigning/preview/2024-09-30-preview/examples/ + * CodeSigningAccounts_ListBySubscription.json + */ + /** + * Sample code: Lists trusted signing accounts within a subscription. + * + * @param manager Entry point to CodeSigningManager. + */ + public static void listsTrustedSigningAccountsWithinASubscription( + com.azure.resourcemanager.codesigning.CodeSigningManager manager) { + manager.codeSigningAccounts().list(com.azure.core.util.Context.NONE); + } +} +``` + +### CodeSigningAccounts_ListByResourceGroup + +```java +/** + * Samples for CodeSigningAccounts ListByResourceGroup. + */ +public final class CodeSigningAccountsListByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/codesigning/resource-manager/Microsoft.CodeSigning/preview/2024-09-30-preview/examples/ + * CodeSigningAccounts_ListByResourceGroup.json + */ + /** + * Sample code: Lists trusted signing accounts within a resource group. + * + * @param manager Entry point to CodeSigningManager. + */ + public static void listsTrustedSigningAccountsWithinAResourceGroup( + com.azure.resourcemanager.codesigning.CodeSigningManager manager) { + manager.codeSigningAccounts().listByResourceGroup("MyResourceGroup", com.azure.core.util.Context.NONE); + } +} +``` + +### CodeSigningAccounts_Update + +```java +import com.azure.resourcemanager.codesigning.models.CodeSigningAccount; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for CodeSigningAccounts Update. + */ +public final class CodeSigningAccountsUpdateSamples { + /* + * x-ms-original-file: + * specification/codesigning/resource-manager/Microsoft.CodeSigning/preview/2024-09-30-preview/examples/ + * CodeSigningAccounts_Update.json + */ + /** + * Sample code: Update a trusted signing account. + * + * @param manager Entry point to CodeSigningManager. + */ + public static void updateATrustedSigningAccount(com.azure.resourcemanager.codesigning.CodeSigningManager manager) { + CodeSigningAccount resource = manager.codeSigningAccounts() + .getByResourceGroupWithResponse("MyResourceGroup", "MyAccount", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("key1", "fakeTokenPlaceholder")).apply(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### Operations_List + +```java +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: + * specification/codesigning/resource-manager/Microsoft.CodeSigning/preview/2024-09-30-preview/examples/ + * Operations_List.json + */ + /** + * Sample code: List trusted signing account operations. + * + * @param manager Entry point to CodeSigningManager. + */ + public static void + listTrustedSigningAccountOperations(com.azure.resourcemanager.codesigning.CodeSigningManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} +``` + diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/pom.xml b/sdk/codesigning/azure-resourcemanager-codesigning/pom.xml new file mode 100644 index 0000000000000..d26a0f5a37cbe --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/pom.xml @@ -0,0 +1,67 @@ + + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-codesigning + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for CodeSigning Management + This package contains Microsoft Azure SDK for CodeSigning Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Code Signing resource provider api. Package tag package-2024-09-30-preview. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + 0 + 0 + true + + + + com.azure + azure-json + 1.3.0 + + + com.azure + azure-core + 1.52.0 + + + com.azure + azure-core-management + 1.15.3 + + + diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/CodeSigningManager.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/CodeSigningManager.java new file mode 100644 index 0000000000000..0a1416a28a4cd --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/CodeSigningManager.java @@ -0,0 +1,307 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.codesigning; + +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.http.policy.ArmChallengeAuthenticationPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.codesigning.fluent.CodeSigningManagementClient; +import com.azure.resourcemanager.codesigning.implementation.CertificateProfilesImpl; +import com.azure.resourcemanager.codesigning.implementation.CodeSigningAccountsImpl; +import com.azure.resourcemanager.codesigning.implementation.CodeSigningManagementClientBuilder; +import com.azure.resourcemanager.codesigning.implementation.OperationsImpl; +import com.azure.resourcemanager.codesigning.models.CertificateProfiles; +import com.azure.resourcemanager.codesigning.models.CodeSigningAccounts; +import com.azure.resourcemanager.codesigning.models.Operations; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * Entry point to CodeSigningManager. + * Code Signing resource provider api. + */ +public final class CodeSigningManager { + private Operations operations; + + private CodeSigningAccounts codeSigningAccounts; + + private CertificateProfiles certificateProfiles; + + private final CodeSigningManagementClient clientObject; + + private CodeSigningManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = new CodeSigningManagementClientBuilder().pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of CodeSigning service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the CodeSigning service API instance. + */ + public static CodeSigningManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return configure().authenticate(credential, profile); + } + + /** + * Creates an instance of CodeSigning service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the CodeSigning service API instance. + */ + public static CodeSigningManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new CodeSigningManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create CodeSigningManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new CodeSigningManager.Configurable(); + } + + /** + * The Configurable allowing configurations to be set. + */ + public static final class Configurable { + private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); + private RetryPolicy retryPolicy; + private RetryOptions retryOptions; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the retry options for the HTTP pipeline retry policy. + *

+ * This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. + * + * @param retryOptions the retry options for the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryOptions(RetryOptions retryOptions) { + this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval + = Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of CodeSigning service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the CodeSigning service API instance. + */ + public CodeSigningManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder.append("azsdk-java") + .append("-") + .append("com.azure.resourcemanager.codesigning") + .append("/") + .append("1.0.0-beta.1"); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder.append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } + if (retryPolicy == null) { + if (retryOptions != null) { + retryPolicy = new RetryPolicy(retryOptions); + } else { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new AddHeadersFromContextPolicy()); + policies.add(new RequestIdPolicy()); + policies.addAll(this.policies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies.addAll(this.policies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .collect(Collectors.toList())); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new CodeSigningManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** + * Gets the resource collection API of Operations. + * + * @return Resource collection API of Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** + * Gets the resource collection API of CodeSigningAccounts. It manages CodeSigningAccount. + * + * @return Resource collection API of CodeSigningAccounts. + */ + public CodeSigningAccounts codeSigningAccounts() { + if (this.codeSigningAccounts == null) { + this.codeSigningAccounts = new CodeSigningAccountsImpl(clientObject.getCodeSigningAccounts(), this); + } + return codeSigningAccounts; + } + + /** + * Gets the resource collection API of CertificateProfiles. It manages CertificateProfile. + * + * @return Resource collection API of CertificateProfiles. + */ + public CertificateProfiles certificateProfiles() { + if (this.certificateProfiles == null) { + this.certificateProfiles = new CertificateProfilesImpl(clientObject.getCertificateProfiles(), this); + } + return certificateProfiles; + } + + /** + * Gets wrapped service client CodeSigningManagementClient providing direct access to the underlying auto-generated + * API implementation, based on Azure REST API. + * + * @return Wrapped service client CodeSigningManagementClient. + */ + public CodeSigningManagementClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/fluent/CertificateProfilesClient.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/fluent/CertificateProfilesClient.java new file mode 100644 index 0000000000000..592078b71000d --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/fluent/CertificateProfilesClient.java @@ -0,0 +1,232 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.codesigning.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.codesigning.fluent.models.CertificateProfileInner; +import com.azure.resourcemanager.codesigning.models.RevokeCertificate; + +/** + * An instance of this class provides access to all the operations defined in CertificateProfilesClient. + */ +public interface CertificateProfilesClient { + /** + * List certificate profiles under a trusted signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CertificateProfile list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByCodeSigningAccount(String resourceGroupName, String accountName); + + /** + * List certificate profiles under a trusted signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CertificateProfile list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByCodeSigningAccount(String resourceGroupName, String accountName, + Context context); + + /** + * Get details of a certificate profile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param profileName Certificate profile name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return details of a certificate profile along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String accountName, String profileName, + Context context); + + /** + * Get details of a certificate profile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param profileName Certificate profile name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return details of a certificate profile. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CertificateProfileInner get(String resourceGroupName, String accountName, String profileName); + + /** + * Create a certificate profile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param profileName Certificate profile name. + * @param resource Parameters to create the certificate profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 SyncPoller} for polling of certificate profile resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CertificateProfileInner> beginCreate(String resourceGroupName, + String accountName, String profileName, CertificateProfileInner resource); + + /** + * Create a certificate profile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param profileName Certificate profile name. + * @param resource Parameters to create the certificate profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 SyncPoller} for polling of certificate profile resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CertificateProfileInner> beginCreate(String resourceGroupName, + String accountName, String profileName, CertificateProfileInner resource, Context context); + + /** + * Create a certificate profile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param profileName Certificate profile name. + * @param resource Parameters to create the certificate profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return certificate profile resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CertificateProfileInner create(String resourceGroupName, String accountName, String profileName, + CertificateProfileInner resource); + + /** + * Create a certificate profile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param profileName Certificate profile name. + * @param resource Parameters to create the certificate profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return certificate profile resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CertificateProfileInner create(String resourceGroupName, String accountName, String profileName, + CertificateProfileInner resource, Context context); + + /** + * Delete a certificate profile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param profileName Certificate profile name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String accountName, String profileName); + + /** + * Delete a certificate profile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param profileName Certificate profile name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String accountName, String profileName, + Context context); + + /** + * Delete a certificate profile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param profileName Certificate profile name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String accountName, String profileName); + + /** + * Delete a certificate profile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param profileName Certificate profile name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String accountName, String profileName, Context context); + + /** + * Revoke a certificate under a certificate profile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param profileName Certificate profile name. + * @param body Parameters to revoke the certificate profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response revokeCertificateWithResponse(String resourceGroupName, String accountName, String profileName, + RevokeCertificate body, Context context); + + /** + * Revoke a certificate under a certificate profile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param profileName Certificate profile name. + * @param body Parameters to revoke the certificate profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void revokeCertificate(String resourceGroupName, String accountName, String profileName, RevokeCertificate body); +} diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/fluent/CodeSigningAccountsClient.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/fluent/CodeSigningAccountsClient.java new file mode 100644 index 0000000000000..f34e7ce2002c9 --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/fluent/CodeSigningAccountsClient.java @@ -0,0 +1,297 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.codesigning.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.codesigning.fluent.models.CheckNameAvailabilityResultInner; +import com.azure.resourcemanager.codesigning.fluent.models.CodeSigningAccountInner; +import com.azure.resourcemanager.codesigning.models.CheckNameAvailability; +import com.azure.resourcemanager.codesigning.models.CodeSigningAccountPatch; + +/** + * An instance of this class provides access to all the operations defined in CodeSigningAccountsClient. + */ +public interface CodeSigningAccountsClient { + /** + * Checks that the trusted signing account name is valid and is not already in use. + * + * @param body The CheckAvailability request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the CheckNameAvailability operation response along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response checkNameAvailabilityWithResponse(CheckNameAvailability body, + Context context); + + /** + * Checks that the trusted signing account name is valid and is not already in use. + * + * @param body The CheckAvailability request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the CheckNameAvailability operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CheckNameAvailabilityResultInner checkNameAvailability(CheckNameAvailability body); + + /** + * Lists trusted signing accounts within a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CodeSigningAccount list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists trusted signing accounts within a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CodeSigningAccount list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Lists trusted signing accounts within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CodeSigningAccount list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists trusted signing accounts within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CodeSigningAccount list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Get a trusted Signing Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a trusted Signing Account along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, String accountName, + Context context); + + /** + * Get a trusted Signing Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a trusted Signing Account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CodeSigningAccountInner getByResourceGroup(String resourceGroupName, String accountName); + + /** + * Create a trusted Signing Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param resource Parameters to create the trusted signing account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 SyncPoller} for polling of trusted signing account resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CodeSigningAccountInner> beginCreate(String resourceGroupName, + String accountName, CodeSigningAccountInner resource); + + /** + * Create a trusted Signing Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param resource Parameters to create the trusted signing account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 SyncPoller} for polling of trusted signing account resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CodeSigningAccountInner> beginCreate(String resourceGroupName, + String accountName, CodeSigningAccountInner resource, Context context); + + /** + * Create a trusted Signing Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param resource Parameters to create the trusted signing account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return trusted signing account resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CodeSigningAccountInner create(String resourceGroupName, String accountName, CodeSigningAccountInner resource); + + /** + * Create a trusted Signing Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param resource Parameters to create the trusted signing account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return trusted signing account resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CodeSigningAccountInner create(String resourceGroupName, String accountName, CodeSigningAccountInner resource, + Context context); + + /** + * Update a trusted signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param properties Parameters supplied to update the trusted signing account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 SyncPoller} for polling of trusted signing account resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CodeSigningAccountInner> beginUpdate(String resourceGroupName, + String accountName, CodeSigningAccountPatch properties); + + /** + * Update a trusted signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param properties Parameters supplied to update the trusted signing account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 SyncPoller} for polling of trusted signing account resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CodeSigningAccountInner> beginUpdate(String resourceGroupName, + String accountName, CodeSigningAccountPatch properties, Context context); + + /** + * Update a trusted signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param properties Parameters supplied to update the trusted signing account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return trusted signing account resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CodeSigningAccountInner update(String resourceGroupName, String accountName, CodeSigningAccountPatch properties); + + /** + * Update a trusted signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param properties Parameters supplied to update the trusted signing account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return trusted signing account resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CodeSigningAccountInner update(String resourceGroupName, String accountName, CodeSigningAccountPatch properties, + Context context); + + /** + * Delete a trusted signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String accountName); + + /** + * Delete a trusted signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String accountName, Context context); + + /** + * Delete a trusted signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String accountName); + + /** + * Delete a trusted signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String accountName, Context context); +} diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/fluent/CodeSigningManagementClient.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/fluent/CodeSigningManagementClient.java new file mode 100644 index 0000000000000..4617af15344fa --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/fluent/CodeSigningManagementClient.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.codesigning.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** + * The interface for CodeSigningManagementClient class. + */ +public interface CodeSigningManagementClient { + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the CodeSigningAccountsClient object to access its operations. + * + * @return the CodeSigningAccountsClient object. + */ + CodeSigningAccountsClient getCodeSigningAccounts(); + + /** + * Gets the CertificateProfilesClient object to access its operations. + * + * @return the CertificateProfilesClient object. + */ + CertificateProfilesClient getCertificateProfiles(); +} diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/fluent/OperationsClient.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/fluent/OperationsClient.java new file mode 100644 index 0000000000000..1380579bd06da --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/fluent/OperationsClient.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.codesigning.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.codesigning.fluent.models.OperationInner; + +/** + * An instance of this class provides access to all the operations defined in OperationsClient. + */ +public interface OperationsClient { + /** + * List the operations for the provider. + * + * @throws com.azure.core.management.exception.ManagementException 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 REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/fluent/models/CertificateProfileInner.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/fluent/models/CertificateProfileInner.java new file mode 100644 index 0000000000000..83bb1e38cf627 --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/fluent/models/CertificateProfileInner.java @@ -0,0 +1,353 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.codesigning.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.codesigning.models.Certificate; +import com.azure.resourcemanager.codesigning.models.CertificateProfileStatus; +import com.azure.resourcemanager.codesigning.models.ProfileType; +import com.azure.resourcemanager.codesigning.models.ProvisioningState; +import java.io.IOException; +import java.util.List; + +/** + * Certificate profile resource. + */ +@Fluent +public final class CertificateProfileInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + private CertificateProfileProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of CertificateProfileInner class. + */ + public CertificateProfileInner() { + } + + /** + * Get the innerProperties property: The resource-specific properties for this resource. + * + * @return the innerProperties value. + */ + private CertificateProfileProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Get the profileType property: Profile type of the certificate. + * + * @return the profileType value. + */ + public ProfileType profileType() { + return this.innerProperties() == null ? null : this.innerProperties().profileType(); + } + + /** + * Set the profileType property: Profile type of the certificate. + * + * @param profileType the profileType value to set. + * @return the CertificateProfileInner object itself. + */ + public CertificateProfileInner withProfileType(ProfileType profileType) { + if (this.innerProperties() == null) { + this.innerProperties = new CertificateProfileProperties(); + } + this.innerProperties().withProfileType(profileType); + return this; + } + + /** + * Get the includeStreetAddress property: Whether to include STREET in the certificate subject name. + * + * @return the includeStreetAddress value. + */ + public Boolean includeStreetAddress() { + return this.innerProperties() == null ? null : this.innerProperties().includeStreetAddress(); + } + + /** + * Set the includeStreetAddress property: Whether to include STREET in the certificate subject name. + * + * @param includeStreetAddress the includeStreetAddress value to set. + * @return the CertificateProfileInner object itself. + */ + public CertificateProfileInner withIncludeStreetAddress(Boolean includeStreetAddress) { + if (this.innerProperties() == null) { + this.innerProperties = new CertificateProfileProperties(); + } + this.innerProperties().withIncludeStreetAddress(includeStreetAddress); + return this; + } + + /** + * Get the includeCity property: Whether to include L in the certificate subject name. Applicable only for private + * trust, private trust ci profile types. + * + * @return the includeCity value. + */ + public Boolean includeCity() { + return this.innerProperties() == null ? null : this.innerProperties().includeCity(); + } + + /** + * Set the includeCity property: Whether to include L in the certificate subject name. Applicable only for private + * trust, private trust ci profile types. + * + * @param includeCity the includeCity value to set. + * @return the CertificateProfileInner object itself. + */ + public CertificateProfileInner withIncludeCity(Boolean includeCity) { + if (this.innerProperties() == null) { + this.innerProperties = new CertificateProfileProperties(); + } + this.innerProperties().withIncludeCity(includeCity); + return this; + } + + /** + * Get the includeState property: Whether to include S in the certificate subject name. Applicable only for private + * trust, private trust ci profile types. + * + * @return the includeState value. + */ + public Boolean includeState() { + return this.innerProperties() == null ? null : this.innerProperties().includeState(); + } + + /** + * Set the includeState property: Whether to include S in the certificate subject name. Applicable only for private + * trust, private trust ci profile types. + * + * @param includeState the includeState value to set. + * @return the CertificateProfileInner object itself. + */ + public CertificateProfileInner withIncludeState(Boolean includeState) { + if (this.innerProperties() == null) { + this.innerProperties = new CertificateProfileProperties(); + } + this.innerProperties().withIncludeState(includeState); + return this; + } + + /** + * Get the includeCountry property: Whether to include C in the certificate subject name. Applicable only for + * private trust, private trust ci profile types. + * + * @return the includeCountry value. + */ + public Boolean includeCountry() { + return this.innerProperties() == null ? null : this.innerProperties().includeCountry(); + } + + /** + * Set the includeCountry property: Whether to include C in the certificate subject name. Applicable only for + * private trust, private trust ci profile types. + * + * @param includeCountry the includeCountry value to set. + * @return the CertificateProfileInner object itself. + */ + public CertificateProfileInner withIncludeCountry(Boolean includeCountry) { + if (this.innerProperties() == null) { + this.innerProperties = new CertificateProfileProperties(); + } + this.innerProperties().withIncludeCountry(includeCountry); + return this; + } + + /** + * Get the includePostalCode property: Whether to include PC in the certificate subject name. + * + * @return the includePostalCode value. + */ + public Boolean includePostalCode() { + return this.innerProperties() == null ? null : this.innerProperties().includePostalCode(); + } + + /** + * Set the includePostalCode property: Whether to include PC in the certificate subject name. + * + * @param includePostalCode the includePostalCode value to set. + * @return the CertificateProfileInner object itself. + */ + public CertificateProfileInner withIncludePostalCode(Boolean includePostalCode) { + if (this.innerProperties() == null) { + this.innerProperties = new CertificateProfileProperties(); + } + this.innerProperties().withIncludePostalCode(includePostalCode); + return this; + } + + /** + * Get the identityValidationId property: Identity validation id used for the certificate subject name. + * + * @return the identityValidationId value. + */ + public String identityValidationId() { + return this.innerProperties() == null ? null : this.innerProperties().identityValidationId(); + } + + /** + * Set the identityValidationId property: Identity validation id used for the certificate subject name. + * + * @param identityValidationId the identityValidationId value to set. + * @return the CertificateProfileInner object itself. + */ + public CertificateProfileInner withIdentityValidationId(String identityValidationId) { + if (this.innerProperties() == null) { + this.innerProperties = new CertificateProfileProperties(); + } + this.innerProperties().withIdentityValidationId(identityValidationId); + return this; + } + + /** + * Get the provisioningState property: Status of the current operation on certificate profile. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the status property: Status of the certificate profile. + * + * @return the status value. + */ + public CertificateProfileStatus status() { + return this.innerProperties() == null ? null : this.innerProperties().status(); + } + + /** + * Get the certificates property: List of renewed certificates. + * + * @return the certificates value. + */ + public List certificates() { + return this.innerProperties() == null ? null : this.innerProperties().certificates(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CertificateProfileInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CertificateProfileInner 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 CertificateProfileInner. + */ + public static CertificateProfileInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CertificateProfileInner deserializedCertificateProfileInner = new CertificateProfileInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedCertificateProfileInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedCertificateProfileInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedCertificateProfileInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedCertificateProfileInner.innerProperties = CertificateProfileProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedCertificateProfileInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedCertificateProfileInner; + }); + } +} diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/fluent/models/CertificateProfileProperties.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/fluent/models/CertificateProfileProperties.java new file mode 100644 index 0000000000000..107d6690c191b --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/fluent/models/CertificateProfileProperties.java @@ -0,0 +1,346 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.codesigning.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.codesigning.models.Certificate; +import com.azure.resourcemanager.codesigning.models.CertificateProfileStatus; +import com.azure.resourcemanager.codesigning.models.ProfileType; +import com.azure.resourcemanager.codesigning.models.ProvisioningState; +import java.io.IOException; +import java.util.List; + +/** + * Properties of the certificate profile. + */ +@Fluent +public final class CertificateProfileProperties implements JsonSerializable { + /* + * Profile type of the certificate. + */ + private ProfileType profileType; + + /* + * Whether to include STREET in the certificate subject name. + */ + private Boolean includeStreetAddress; + + /* + * Whether to include L in the certificate subject name. Applicable only for private trust, private trust ci profile + * types + */ + private Boolean includeCity; + + /* + * Whether to include S in the certificate subject name. Applicable only for private trust, private trust ci profile + * types + */ + private Boolean includeState; + + /* + * Whether to include C in the certificate subject name. Applicable only for private trust, private trust ci profile + * types + */ + private Boolean includeCountry; + + /* + * Whether to include PC in the certificate subject name. + */ + private Boolean includePostalCode; + + /* + * Identity validation id used for the certificate subject name. + */ + private String identityValidationId; + + /* + * Status of the current operation on certificate profile. + */ + private ProvisioningState provisioningState; + + /* + * Status of the certificate profile. + */ + private CertificateProfileStatus status; + + /* + * List of renewed certificates. + */ + private List certificates; + + /** + * Creates an instance of CertificateProfileProperties class. + */ + public CertificateProfileProperties() { + } + + /** + * Get the profileType property: Profile type of the certificate. + * + * @return the profileType value. + */ + public ProfileType profileType() { + return this.profileType; + } + + /** + * Set the profileType property: Profile type of the certificate. + * + * @param profileType the profileType value to set. + * @return the CertificateProfileProperties object itself. + */ + public CertificateProfileProperties withProfileType(ProfileType profileType) { + this.profileType = profileType; + return this; + } + + /** + * Get the includeStreetAddress property: Whether to include STREET in the certificate subject name. + * + * @return the includeStreetAddress value. + */ + public Boolean includeStreetAddress() { + return this.includeStreetAddress; + } + + /** + * Set the includeStreetAddress property: Whether to include STREET in the certificate subject name. + * + * @param includeStreetAddress the includeStreetAddress value to set. + * @return the CertificateProfileProperties object itself. + */ + public CertificateProfileProperties withIncludeStreetAddress(Boolean includeStreetAddress) { + this.includeStreetAddress = includeStreetAddress; + return this; + } + + /** + * Get the includeCity property: Whether to include L in the certificate subject name. Applicable only for private + * trust, private trust ci profile types. + * + * @return the includeCity value. + */ + public Boolean includeCity() { + return this.includeCity; + } + + /** + * Set the includeCity property: Whether to include L in the certificate subject name. Applicable only for private + * trust, private trust ci profile types. + * + * @param includeCity the includeCity value to set. + * @return the CertificateProfileProperties object itself. + */ + public CertificateProfileProperties withIncludeCity(Boolean includeCity) { + this.includeCity = includeCity; + return this; + } + + /** + * Get the includeState property: Whether to include S in the certificate subject name. Applicable only for private + * trust, private trust ci profile types. + * + * @return the includeState value. + */ + public Boolean includeState() { + return this.includeState; + } + + /** + * Set the includeState property: Whether to include S in the certificate subject name. Applicable only for private + * trust, private trust ci profile types. + * + * @param includeState the includeState value to set. + * @return the CertificateProfileProperties object itself. + */ + public CertificateProfileProperties withIncludeState(Boolean includeState) { + this.includeState = includeState; + return this; + } + + /** + * Get the includeCountry property: Whether to include C in the certificate subject name. Applicable only for + * private trust, private trust ci profile types. + * + * @return the includeCountry value. + */ + public Boolean includeCountry() { + return this.includeCountry; + } + + /** + * Set the includeCountry property: Whether to include C in the certificate subject name. Applicable only for + * private trust, private trust ci profile types. + * + * @param includeCountry the includeCountry value to set. + * @return the CertificateProfileProperties object itself. + */ + public CertificateProfileProperties withIncludeCountry(Boolean includeCountry) { + this.includeCountry = includeCountry; + return this; + } + + /** + * Get the includePostalCode property: Whether to include PC in the certificate subject name. + * + * @return the includePostalCode value. + */ + public Boolean includePostalCode() { + return this.includePostalCode; + } + + /** + * Set the includePostalCode property: Whether to include PC in the certificate subject name. + * + * @param includePostalCode the includePostalCode value to set. + * @return the CertificateProfileProperties object itself. + */ + public CertificateProfileProperties withIncludePostalCode(Boolean includePostalCode) { + this.includePostalCode = includePostalCode; + return this; + } + + /** + * Get the identityValidationId property: Identity validation id used for the certificate subject name. + * + * @return the identityValidationId value. + */ + public String identityValidationId() { + return this.identityValidationId; + } + + /** + * Set the identityValidationId property: Identity validation id used for the certificate subject name. + * + * @param identityValidationId the identityValidationId value to set. + * @return the CertificateProfileProperties object itself. + */ + public CertificateProfileProperties withIdentityValidationId(String identityValidationId) { + this.identityValidationId = identityValidationId; + return this; + } + + /** + * Get the provisioningState property: Status of the current operation on certificate profile. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the status property: Status of the certificate profile. + * + * @return the status value. + */ + public CertificateProfileStatus status() { + return this.status; + } + + /** + * Get the certificates property: List of renewed certificates. + * + * @return the certificates value. + */ + public List certificates() { + return this.certificates; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (profileType() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property profileType in model CertificateProfileProperties")); + } + if (identityValidationId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property identityValidationId in model CertificateProfileProperties")); + } + if (certificates() != null) { + certificates().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(CertificateProfileProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("profileType", this.profileType == null ? null : this.profileType.toString()); + jsonWriter.writeStringField("identityValidationId", this.identityValidationId); + jsonWriter.writeBooleanField("includeStreetAddress", this.includeStreetAddress); + jsonWriter.writeBooleanField("includeCity", this.includeCity); + jsonWriter.writeBooleanField("includeState", this.includeState); + jsonWriter.writeBooleanField("includeCountry", this.includeCountry); + jsonWriter.writeBooleanField("includePostalCode", this.includePostalCode); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CertificateProfileProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CertificateProfileProperties 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 CertificateProfileProperties. + */ + public static CertificateProfileProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CertificateProfileProperties deserializedCertificateProfileProperties = new CertificateProfileProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("profileType".equals(fieldName)) { + deserializedCertificateProfileProperties.profileType = ProfileType.fromString(reader.getString()); + } else if ("identityValidationId".equals(fieldName)) { + deserializedCertificateProfileProperties.identityValidationId = reader.getString(); + } else if ("includeStreetAddress".equals(fieldName)) { + deserializedCertificateProfileProperties.includeStreetAddress + = reader.getNullable(JsonReader::getBoolean); + } else if ("includeCity".equals(fieldName)) { + deserializedCertificateProfileProperties.includeCity = reader.getNullable(JsonReader::getBoolean); + } else if ("includeState".equals(fieldName)) { + deserializedCertificateProfileProperties.includeState = reader.getNullable(JsonReader::getBoolean); + } else if ("includeCountry".equals(fieldName)) { + deserializedCertificateProfileProperties.includeCountry + = reader.getNullable(JsonReader::getBoolean); + } else if ("includePostalCode".equals(fieldName)) { + deserializedCertificateProfileProperties.includePostalCode + = reader.getNullable(JsonReader::getBoolean); + } else if ("provisioningState".equals(fieldName)) { + deserializedCertificateProfileProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else if ("status".equals(fieldName)) { + deserializedCertificateProfileProperties.status + = CertificateProfileStatus.fromString(reader.getString()); + } else if ("certificates".equals(fieldName)) { + List certificates = reader.readArray(reader1 -> Certificate.fromJson(reader1)); + deserializedCertificateProfileProperties.certificates = certificates; + } else { + reader.skipChildren(); + } + } + + return deserializedCertificateProfileProperties; + }); + } +} diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/fluent/models/CheckNameAvailabilityResultInner.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/fluent/models/CheckNameAvailabilityResultInner.java new file mode 100644 index 0000000000000..d35041d3c5c18 --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/fluent/models/CheckNameAvailabilityResultInner.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.codesigning.fluent.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.resourcemanager.codesigning.models.NameUnavailabilityReason; +import java.io.IOException; + +/** + * The CheckNameAvailability operation response. + */ +@Immutable +public final class CheckNameAvailabilityResultInner implements JsonSerializable { + /* + * A boolean value that indicates whether the name is available for you to use. If true, the name is available. If + * false, the name has already been taken or is invalid and cannot be used. + */ + private Boolean nameAvailable; + + /* + * The reason that a trusted signing account name could not be used. The Reason element is only returned if + * nameAvailable is false. + */ + private NameUnavailabilityReason reason; + + /* + * An error message explaining the Reason value in more detail. + */ + private String message; + + /** + * Creates an instance of CheckNameAvailabilityResultInner class. + */ + public CheckNameAvailabilityResultInner() { + } + + /** + * Get the nameAvailable property: A boolean value that indicates whether the name is available for you to use. If + * true, the name is available. If false, the name has already been taken or is invalid and cannot be used. + * + * @return the nameAvailable value. + */ + public Boolean nameAvailable() { + return this.nameAvailable; + } + + /** + * Get the reason property: The reason that a trusted signing account name could not be used. The Reason element is + * only returned if nameAvailable is false. + * + * @return the reason value. + */ + public NameUnavailabilityReason reason() { + return this.reason; + } + + /** + * Get the message property: An error message explaining the Reason value in more detail. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CheckNameAvailabilityResultInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CheckNameAvailabilityResultInner 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 CheckNameAvailabilityResultInner. + */ + public static CheckNameAvailabilityResultInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CheckNameAvailabilityResultInner deserializedCheckNameAvailabilityResultInner + = new CheckNameAvailabilityResultInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("nameAvailable".equals(fieldName)) { + deserializedCheckNameAvailabilityResultInner.nameAvailable + = reader.getNullable(JsonReader::getBoolean); + } else if ("reason".equals(fieldName)) { + deserializedCheckNameAvailabilityResultInner.reason + = NameUnavailabilityReason.fromString(reader.getString()); + } else if ("message".equals(fieldName)) { + deserializedCheckNameAvailabilityResultInner.message = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCheckNameAvailabilityResultInner; + }); + } +} diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/fluent/models/CodeSigningAccountInner.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/fluent/models/CodeSigningAccountInner.java new file mode 100644 index 0000000000000..79cc884c72e25 --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/fluent/models/CodeSigningAccountInner.java @@ -0,0 +1,223 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.codesigning.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.codesigning.models.AccountSku; +import com.azure.resourcemanager.codesigning.models.ProvisioningState; +import java.io.IOException; +import java.util.Map; + +/** + * Trusted signing account resource. + */ +@Fluent +public final class CodeSigningAccountInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + private CodeSigningAccountProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of CodeSigningAccountInner class. + */ + public CodeSigningAccountInner() { + } + + /** + * Get the innerProperties property: The resource-specific properties for this resource. + * + * @return the innerProperties value. + */ + private CodeSigningAccountProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public CodeSigningAccountInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public CodeSigningAccountInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the accountUri property: The URI of the trusted signing account which is used during signing files. + * + * @return the accountUri value. + */ + public String accountUri() { + return this.innerProperties() == null ? null : this.innerProperties().accountUri(); + } + + /** + * Get the sku property: SKU of the trusted signing account. + * + * @return the sku value. + */ + public AccountSku sku() { + return this.innerProperties() == null ? null : this.innerProperties().sku(); + } + + /** + * Set the sku property: SKU of the trusted signing account. + * + * @param sku the sku value to set. + * @return the CodeSigningAccountInner object itself. + */ + public CodeSigningAccountInner withSku(AccountSku sku) { + if (this.innerProperties() == null) { + this.innerProperties = new CodeSigningAccountProperties(); + } + this.innerProperties().withSku(sku); + return this; + } + + /** + * Get the provisioningState property: Status of the current operation on trusted signing account. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CodeSigningAccountInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CodeSigningAccountInner 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 CodeSigningAccountInner. + */ + public static CodeSigningAccountInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CodeSigningAccountInner deserializedCodeSigningAccountInner = new CodeSigningAccountInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedCodeSigningAccountInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedCodeSigningAccountInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedCodeSigningAccountInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedCodeSigningAccountInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedCodeSigningAccountInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedCodeSigningAccountInner.innerProperties = CodeSigningAccountProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedCodeSigningAccountInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedCodeSigningAccountInner; + }); + } +} diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/fluent/models/CodeSigningAccountPatchProperties.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/fluent/models/CodeSigningAccountPatchProperties.java new file mode 100644 index 0000000000000..10cd001cd1c21 --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/fluent/models/CodeSigningAccountPatchProperties.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.codesigning.fluent.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 com.azure.resourcemanager.codesigning.models.AccountSkuPatch; +import java.io.IOException; + +/** + * Properties of the trusted signing account. + */ +@Fluent +public final class CodeSigningAccountPatchProperties implements JsonSerializable { + /* + * SKU of the trusted signing account. + */ + private AccountSkuPatch sku; + + /** + * Creates an instance of CodeSigningAccountPatchProperties class. + */ + public CodeSigningAccountPatchProperties() { + } + + /** + * Get the sku property: SKU of the trusted signing account. + * + * @return the sku value. + */ + public AccountSkuPatch sku() { + return this.sku; + } + + /** + * Set the sku property: SKU of the trusted signing account. + * + * @param sku the sku value to set. + * @return the CodeSigningAccountPatchProperties object itself. + */ + public CodeSigningAccountPatchProperties withSku(AccountSkuPatch sku) { + this.sku = sku; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sku() != null) { + sku().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("sku", this.sku); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CodeSigningAccountPatchProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CodeSigningAccountPatchProperties 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 CodeSigningAccountPatchProperties. + */ + public static CodeSigningAccountPatchProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CodeSigningAccountPatchProperties deserializedCodeSigningAccountPatchProperties + = new CodeSigningAccountPatchProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("sku".equals(fieldName)) { + deserializedCodeSigningAccountPatchProperties.sku = AccountSkuPatch.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedCodeSigningAccountPatchProperties; + }); + } +} diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/fluent/models/CodeSigningAccountProperties.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/fluent/models/CodeSigningAccountProperties.java new file mode 100644 index 0000000000000..448801b300a5f --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/fluent/models/CodeSigningAccountProperties.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.codesigning.fluent.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 com.azure.resourcemanager.codesigning.models.AccountSku; +import com.azure.resourcemanager.codesigning.models.ProvisioningState; +import java.io.IOException; + +/** + * Properties of the trusted signing account. + */ +@Fluent +public final class CodeSigningAccountProperties implements JsonSerializable { + /* + * The URI of the trusted signing account which is used during signing files. + */ + private String accountUri; + + /* + * SKU of the trusted signing account. + */ + private AccountSku sku; + + /* + * Status of the current operation on trusted signing account. + */ + private ProvisioningState provisioningState; + + /** + * Creates an instance of CodeSigningAccountProperties class. + */ + public CodeSigningAccountProperties() { + } + + /** + * Get the accountUri property: The URI of the trusted signing account which is used during signing files. + * + * @return the accountUri value. + */ + public String accountUri() { + return this.accountUri; + } + + /** + * Get the sku property: SKU of the trusted signing account. + * + * @return the sku value. + */ + public AccountSku sku() { + return this.sku; + } + + /** + * Set the sku property: SKU of the trusted signing account. + * + * @param sku the sku value to set. + * @return the CodeSigningAccountProperties object itself. + */ + public CodeSigningAccountProperties withSku(AccountSku sku) { + this.sku = sku; + return this; + } + + /** + * Get the provisioningState property: Status of the current operation on trusted signing account. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sku() != null) { + sku().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("sku", this.sku); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CodeSigningAccountProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CodeSigningAccountProperties 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 CodeSigningAccountProperties. + */ + public static CodeSigningAccountProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CodeSigningAccountProperties deserializedCodeSigningAccountProperties = new CodeSigningAccountProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("accountUri".equals(fieldName)) { + deserializedCodeSigningAccountProperties.accountUri = reader.getString(); + } else if ("sku".equals(fieldName)) { + deserializedCodeSigningAccountProperties.sku = AccountSku.fromJson(reader); + } else if ("provisioningState".equals(fieldName)) { + deserializedCodeSigningAccountProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedCodeSigningAccountProperties; + }); + } +} diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/fluent/models/OperationInner.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/fluent/models/OperationInner.java new file mode 100644 index 0000000000000..18ba852f0a730 --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/fluent/models/OperationInner.java @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.codesigning.fluent.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 com.azure.resourcemanager.codesigning.models.ActionType; +import com.azure.resourcemanager.codesigning.models.OperationDisplay; +import com.azure.resourcemanager.codesigning.models.Origin; +import java.io.IOException; + +/** + * REST API Operation + * + * Details of a REST API operation, returned from the Resource Provider Operations API. + */ +@Fluent +public final class OperationInner implements JsonSerializable { + /* + * The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" + */ + private String name; + + /* + * Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for + * ARM/control-plane operations. + */ + private Boolean isDataAction; + + /* + * Localized display information for this particular operation. + */ + private OperationDisplay display; + + /* + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default + * value is "user,system" + */ + private Origin origin; + + /* + * Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ + private ActionType actionType; + + /** + * Creates an instance of OperationInner class. + */ + public OperationInner() { + } + + /** + * Get the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane + * operations and "false" for ARM/control-plane operations. + * + * @return the isDataAction value. + */ + public Boolean isDataAction() { + return this.isDataAction; + } + + /** + * Get the display property: Localized display information for this particular operation. + * + * @return the display value. + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the display property: Localized display information for this particular operation. + * + * @param display the display value to set. + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + + /** + * Get the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and + * audit logs UX. Default value is "user,system". + * + * @return the origin value. + */ + public Origin origin() { + return this.origin; + } + + /** + * Get the actionType property: Enum. Indicates the action type. "Internal" refers to actions that are for internal + * only APIs. + * + * @return the actionType value. + */ + public ActionType actionType() { + return this.actionType; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("display", this.display); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationInner 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 OperationInner. + */ + public static OperationInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationInner deserializedOperationInner = new OperationInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedOperationInner.name = reader.getString(); + } else if ("isDataAction".equals(fieldName)) { + deserializedOperationInner.isDataAction = reader.getNullable(JsonReader::getBoolean); + } else if ("display".equals(fieldName)) { + deserializedOperationInner.display = OperationDisplay.fromJson(reader); + } else if ("origin".equals(fieldName)) { + deserializedOperationInner.origin = Origin.fromString(reader.getString()); + } else if ("actionType".equals(fieldName)) { + deserializedOperationInner.actionType = ActionType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationInner; + }); + } +} diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/fluent/models/Revocation.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/fluent/models/Revocation.java new file mode 100644 index 0000000000000..cdb7054301365 --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/fluent/models/Revocation.java @@ -0,0 +1,229 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.codesigning.fluent.models; + +import com.azure.core.annotation.Fluent; +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 com.azure.resourcemanager.codesigning.models.RevocationStatus; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * Revocation details of the certificate. + */ +@Fluent +public final class Revocation implements JsonSerializable { + /* + * The timestamp when the revocation is requested. + */ + private OffsetDateTime requestedAt; + + /* + * The timestamp when the revocation is effective. + */ + private OffsetDateTime effectiveAt; + + /* + * Reason for revocation. + */ + private String reason; + + /* + * Remarks for the revocation. + */ + private String remarks; + + /* + * Status of the revocation. + */ + private RevocationStatus status; + + /* + * Reason for the revocation failure. + */ + private String failureReason; + + /** + * Creates an instance of Revocation class. + */ + public Revocation() { + } + + /** + * Get the requestedAt property: The timestamp when the revocation is requested. + * + * @return the requestedAt value. + */ + public OffsetDateTime requestedAt() { + return this.requestedAt; + } + + /** + * Set the requestedAt property: The timestamp when the revocation is requested. + * + * @param requestedAt the requestedAt value to set. + * @return the Revocation object itself. + */ + public Revocation withRequestedAt(OffsetDateTime requestedAt) { + this.requestedAt = requestedAt; + return this; + } + + /** + * Get the effectiveAt property: The timestamp when the revocation is effective. + * + * @return the effectiveAt value. + */ + public OffsetDateTime effectiveAt() { + return this.effectiveAt; + } + + /** + * Set the effectiveAt property: The timestamp when the revocation is effective. + * + * @param effectiveAt the effectiveAt value to set. + * @return the Revocation object itself. + */ + public Revocation withEffectiveAt(OffsetDateTime effectiveAt) { + this.effectiveAt = effectiveAt; + return this; + } + + /** + * Get the reason property: Reason for revocation. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason property: Reason for revocation. + * + * @param reason the reason value to set. + * @return the Revocation object itself. + */ + public Revocation withReason(String reason) { + this.reason = reason; + return this; + } + + /** + * Get the remarks property: Remarks for the revocation. + * + * @return the remarks value. + */ + public String remarks() { + return this.remarks; + } + + /** + * Set the remarks property: Remarks for the revocation. + * + * @param remarks the remarks value to set. + * @return the Revocation object itself. + */ + public Revocation withRemarks(String remarks) { + this.remarks = remarks; + return this; + } + + /** + * Get the status property: Status of the revocation. + * + * @return the status value. + */ + public RevocationStatus status() { + return this.status; + } + + /** + * Get the failureReason property: Reason for the revocation failure. + * + * @return the failureReason value. + */ + public String failureReason() { + return this.failureReason; + } + + /** + * Set the failureReason property: Reason for the revocation failure. + * + * @param failureReason the failureReason value to set. + * @return the Revocation object itself. + */ + public Revocation withFailureReason(String failureReason) { + this.failureReason = failureReason; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("requestedAt", + this.requestedAt == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.requestedAt)); + jsonWriter.writeStringField("effectiveAt", + this.effectiveAt == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.effectiveAt)); + jsonWriter.writeStringField("reason", this.reason); + jsonWriter.writeStringField("remarks", this.remarks); + jsonWriter.writeStringField("failureReason", this.failureReason); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Revocation from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Revocation 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 Revocation. + */ + public static Revocation fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Revocation deserializedRevocation = new Revocation(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("requestedAt".equals(fieldName)) { + deserializedRevocation.requestedAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("effectiveAt".equals(fieldName)) { + deserializedRevocation.effectiveAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("reason".equals(fieldName)) { + deserializedRevocation.reason = reader.getString(); + } else if ("remarks".equals(fieldName)) { + deserializedRevocation.remarks = reader.getString(); + } else if ("status".equals(fieldName)) { + deserializedRevocation.status = RevocationStatus.fromString(reader.getString()); + } else if ("failureReason".equals(fieldName)) { + deserializedRevocation.failureReason = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedRevocation; + }); + } +} diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/fluent/models/package-info.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/fluent/models/package-info.java new file mode 100644 index 0000000000000..a86b94ba4f572 --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/fluent/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the inner data models for CodeSigningManagementClient. + * Code Signing resource provider api. + */ +package com.azure.resourcemanager.codesigning.fluent.models; diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/fluent/package-info.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/fluent/package-info.java new file mode 100644 index 0000000000000..cf5cc6e8eb235 --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/fluent/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the service clients for CodeSigningManagementClient. + * Code Signing resource provider api. + */ +package com.azure.resourcemanager.codesigning.fluent; diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/implementation/CertificateProfileImpl.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/implementation/CertificateProfileImpl.java new file mode 100644 index 0000000000000..6e4ad965ddb4e --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/implementation/CertificateProfileImpl.java @@ -0,0 +1,191 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.codesigning.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.codesigning.fluent.models.CertificateProfileInner; +import com.azure.resourcemanager.codesigning.models.Certificate; +import com.azure.resourcemanager.codesigning.models.CertificateProfile; +import com.azure.resourcemanager.codesigning.models.CertificateProfileStatus; +import com.azure.resourcemanager.codesigning.models.ProfileType; +import com.azure.resourcemanager.codesigning.models.ProvisioningState; +import com.azure.resourcemanager.codesigning.models.RevokeCertificate; +import java.util.Collections; +import java.util.List; + +public final class CertificateProfileImpl implements CertificateProfile, CertificateProfile.Definition { + private CertificateProfileInner innerObject; + + private final com.azure.resourcemanager.codesigning.CodeSigningManager serviceManager; + + CertificateProfileImpl(CertificateProfileInner innerObject, + com.azure.resourcemanager.codesigning.CodeSigningManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public ProfileType profileType() { + return this.innerModel().profileType(); + } + + public Boolean includeStreetAddress() { + return this.innerModel().includeStreetAddress(); + } + + public Boolean includeCity() { + return this.innerModel().includeCity(); + } + + public Boolean includeState() { + return this.innerModel().includeState(); + } + + public Boolean includeCountry() { + return this.innerModel().includeCountry(); + } + + public Boolean includePostalCode() { + return this.innerModel().includePostalCode(); + } + + public String identityValidationId() { + return this.innerModel().identityValidationId(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public CertificateProfileStatus status() { + return this.innerModel().status(); + } + + public List certificates() { + List inner = this.innerModel().certificates(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public CertificateProfileInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.codesigning.CodeSigningManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String accountName; + + private String profileName; + + public CertificateProfileImpl withExistingCodeSigningAccount(String resourceGroupName, String accountName) { + this.resourceGroupName = resourceGroupName; + this.accountName = accountName; + return this; + } + + public CertificateProfile create() { + this.innerObject = serviceManager.serviceClient() + .getCertificateProfiles() + .create(resourceGroupName, accountName, profileName, this.innerModel(), Context.NONE); + return this; + } + + public CertificateProfile create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getCertificateProfiles() + .create(resourceGroupName, accountName, profileName, this.innerModel(), context); + return this; + } + + CertificateProfileImpl(String name, com.azure.resourcemanager.codesigning.CodeSigningManager serviceManager) { + this.innerObject = new CertificateProfileInner(); + this.serviceManager = serviceManager; + this.profileName = name; + } + + public CertificateProfile refresh() { + this.innerObject = serviceManager.serviceClient() + .getCertificateProfiles() + .getWithResponse(resourceGroupName, accountName, profileName, Context.NONE) + .getValue(); + return this; + } + + public CertificateProfile refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getCertificateProfiles() + .getWithResponse(resourceGroupName, accountName, profileName, context) + .getValue(); + return this; + } + + public Response revokeCertificateWithResponse(RevokeCertificate body, Context context) { + return serviceManager.certificateProfiles() + .revokeCertificateWithResponse(resourceGroupName, accountName, profileName, body, context); + } + + public void revokeCertificate(RevokeCertificate body) { + serviceManager.certificateProfiles().revokeCertificate(resourceGroupName, accountName, profileName, body); + } + + public CertificateProfileImpl withProfileType(ProfileType profileType) { + this.innerModel().withProfileType(profileType); + return this; + } + + public CertificateProfileImpl withIncludeStreetAddress(Boolean includeStreetAddress) { + this.innerModel().withIncludeStreetAddress(includeStreetAddress); + return this; + } + + public CertificateProfileImpl withIncludeCity(Boolean includeCity) { + this.innerModel().withIncludeCity(includeCity); + return this; + } + + public CertificateProfileImpl withIncludeState(Boolean includeState) { + this.innerModel().withIncludeState(includeState); + return this; + } + + public CertificateProfileImpl withIncludeCountry(Boolean includeCountry) { + this.innerModel().withIncludeCountry(includeCountry); + return this; + } + + public CertificateProfileImpl withIncludePostalCode(Boolean includePostalCode) { + this.innerModel().withIncludePostalCode(includePostalCode); + return this; + } + + public CertificateProfileImpl withIdentityValidationId(String identityValidationId) { + this.innerModel().withIdentityValidationId(identityValidationId); + return this; + } +} diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/implementation/CertificateProfilesClientImpl.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/implementation/CertificateProfilesClientImpl.java new file mode 100644 index 0000000000000..e61276c745b2d --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/implementation/CertificateProfilesClientImpl.java @@ -0,0 +1,1076 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.codesigning.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +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.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.codesigning.fluent.CertificateProfilesClient; +import com.azure.resourcemanager.codesigning.fluent.models.CertificateProfileInner; +import com.azure.resourcemanager.codesigning.models.CertificateProfileListResult; +import com.azure.resourcemanager.codesigning.models.RevokeCertificate; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in CertificateProfilesClient. + */ +public final class CertificateProfilesClientImpl implements CertificateProfilesClient { + /** + * The proxy service used to perform REST calls. + */ + private final CertificateProfilesService service; + + /** + * The service client containing this operation class. + */ + private final CodeSigningManagementClientImpl client; + + /** + * Initializes an instance of CertificateProfilesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CertificateProfilesClientImpl(CodeSigningManagementClientImpl client) { + this.service = RestProxy.create(CertificateProfilesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CodeSigningManagementClientCertificateProfiles to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CodeSigningManagemen") + public interface CertificateProfilesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}/certificateProfiles") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByCodeSigningAccount(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("accountName") String accountName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}/certificateProfiles/{profileName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("accountName") String accountName, + @PathParam("profileName") String profileName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}/certificateProfiles/{profileName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> create(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("accountName") String accountName, + @PathParam("profileName") String profileName, + @BodyParam("application/json") CertificateProfileInner resource, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}/certificateProfiles/{profileName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("accountName") String accountName, + @PathParam("profileName") String profileName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}/certificateProfiles/{profileName}/revokeCertificate") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> revokeCertificate(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("accountName") String accountName, + @PathParam("profileName") String profileName, @BodyParam("application/json") RevokeCertificate body, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByCodeSigningAccountNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * List certificate profiles under a trusted signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CertificateProfile list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByCodeSigningAccountSinglePageAsync(String resourceGroupName, String accountName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByCodeSigningAccount(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accountName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List certificate profiles under a trusted signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CertificateProfile list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByCodeSigningAccountSinglePageAsync(String resourceGroupName, String accountName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByCodeSigningAccount(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accountName, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List certificate profiles under a trusted signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CertificateProfile list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByCodeSigningAccountAsync(String resourceGroupName, + String accountName) { + return new PagedFlux<>(() -> listByCodeSigningAccountSinglePageAsync(resourceGroupName, accountName), + nextLink -> listByCodeSigningAccountNextSinglePageAsync(nextLink)); + } + + /** + * List certificate profiles under a trusted signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CertificateProfile list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByCodeSigningAccountAsync(String resourceGroupName, + String accountName, Context context) { + return new PagedFlux<>(() -> listByCodeSigningAccountSinglePageAsync(resourceGroupName, accountName, context), + nextLink -> listByCodeSigningAccountNextSinglePageAsync(nextLink, context)); + } + + /** + * List certificate profiles under a trusted signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CertificateProfile list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByCodeSigningAccount(String resourceGroupName, + String accountName) { + return new PagedIterable<>(listByCodeSigningAccountAsync(resourceGroupName, accountName)); + } + + /** + * List certificate profiles under a trusted signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CertificateProfile list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByCodeSigningAccount(String resourceGroupName, String accountName, + Context context) { + return new PagedIterable<>(listByCodeSigningAccountAsync(resourceGroupName, accountName, context)); + } + + /** + * Get details of a certificate profile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param profileName Certificate profile name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return details of a certificate profile along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String accountName, + String profileName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (profileName == null) { + return Mono.error(new IllegalArgumentException("Parameter profileName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accountName, profileName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get details of a certificate profile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param profileName Certificate profile name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return details of a certificate profile along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String accountName, + String profileName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (profileName == null) { + return Mono.error(new IllegalArgumentException("Parameter profileName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, accountName, profileName, accept, context); + } + + /** + * Get details of a certificate profile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param profileName Certificate profile name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return details of a certificate profile on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String accountName, String profileName) { + return getWithResponseAsync(resourceGroupName, accountName, profileName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get details of a certificate profile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param profileName Certificate profile name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return details of a certificate profile along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String accountName, + String profileName, Context context) { + return getWithResponseAsync(resourceGroupName, accountName, profileName, context).block(); + } + + /** + * Get details of a certificate profile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param profileName Certificate profile name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return details of a certificate profile. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CertificateProfileInner get(String resourceGroupName, String accountName, String profileName) { + return getWithResponse(resourceGroupName, accountName, profileName, Context.NONE).getValue(); + } + + /** + * Create a certificate profile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param profileName Certificate profile name. + * @param resource Parameters to create the certificate profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return certificate profile resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync(String resourceGroupName, String accountName, + String profileName, CertificateProfileInner resource) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (profileName == null) { + return Mono.error(new IllegalArgumentException("Parameter profileName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.create(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accountName, profileName, resource, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a certificate profile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param profileName Certificate profile name. + * @param resource Parameters to create the certificate profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return certificate profile resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync(String resourceGroupName, String accountName, + String profileName, CertificateProfileInner resource, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (profileName == null) { + return Mono.error(new IllegalArgumentException("Parameter profileName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.create(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, accountName, profileName, resource, accept, context); + } + + /** + * Create a certificate profile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param profileName Certificate profile name. + * @param resource Parameters to create the certificate profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 PollerFlux} for polling of certificate profile resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, CertificateProfileInner> beginCreateAsync( + String resourceGroupName, String accountName, String profileName, CertificateProfileInner resource) { + Mono>> mono + = createWithResponseAsync(resourceGroupName, accountName, profileName, resource); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), CertificateProfileInner.class, CertificateProfileInner.class, + this.client.getContext()); + } + + /** + * Create a certificate profile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param profileName Certificate profile name. + * @param resource Parameters to create the certificate profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 PollerFlux} for polling of certificate profile resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, CertificateProfileInner> beginCreateAsync( + String resourceGroupName, String accountName, String profileName, CertificateProfileInner resource, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = createWithResponseAsync(resourceGroupName, accountName, profileName, resource, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), CertificateProfileInner.class, CertificateProfileInner.class, context); + } + + /** + * Create a certificate profile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param profileName Certificate profile name. + * @param resource Parameters to create the certificate profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 SyncPoller} for polling of certificate profile resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CertificateProfileInner> beginCreate( + String resourceGroupName, String accountName, String profileName, CertificateProfileInner resource) { + return this.beginCreateAsync(resourceGroupName, accountName, profileName, resource).getSyncPoller(); + } + + /** + * Create a certificate profile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param profileName Certificate profile name. + * @param resource Parameters to create the certificate profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 SyncPoller} for polling of certificate profile resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CertificateProfileInner> beginCreate( + String resourceGroupName, String accountName, String profileName, CertificateProfileInner resource, + Context context) { + return this.beginCreateAsync(resourceGroupName, accountName, profileName, resource, context).getSyncPoller(); + } + + /** + * Create a certificate profile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param profileName Certificate profile name. + * @param resource Parameters to create the certificate profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return certificate profile resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String accountName, String profileName, + CertificateProfileInner resource) { + return beginCreateAsync(resourceGroupName, accountName, profileName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a certificate profile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param profileName Certificate profile name. + * @param resource Parameters to create the certificate profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return certificate profile resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String accountName, String profileName, + CertificateProfileInner resource, Context context) { + return beginCreateAsync(resourceGroupName, accountName, profileName, resource, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a certificate profile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param profileName Certificate profile name. + * @param resource Parameters to create the certificate profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return certificate profile resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CertificateProfileInner create(String resourceGroupName, String accountName, String profileName, + CertificateProfileInner resource) { + return createAsync(resourceGroupName, accountName, profileName, resource).block(); + } + + /** + * Create a certificate profile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param profileName Certificate profile name. + * @param resource Parameters to create the certificate profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return certificate profile resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CertificateProfileInner create(String resourceGroupName, String accountName, String profileName, + CertificateProfileInner resource, Context context) { + return createAsync(resourceGroupName, accountName, profileName, resource, context).block(); + } + + /** + * Delete a certificate profile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param profileName Certificate profile name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, String accountName, + String profileName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (profileName == null) { + return Mono.error(new IllegalArgumentException("Parameter profileName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accountName, profileName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a certificate profile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param profileName Certificate profile name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, String accountName, + String profileName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (profileName == null) { + return Mono.error(new IllegalArgumentException("Parameter profileName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, accountName, profileName, accept, context); + } + + /** + * Delete a certificate profile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param profileName Certificate profile name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String accountName, + String profileName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, accountName, profileName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Delete a certificate profile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param profileName Certificate profile name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String accountName, + String profileName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, accountName, profileName, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); + } + + /** + * Delete a certificate profile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param profileName Certificate profile name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String accountName, + String profileName) { + return this.beginDeleteAsync(resourceGroupName, accountName, profileName).getSyncPoller(); + } + + /** + * Delete a certificate profile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param profileName Certificate profile name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String accountName, + String profileName, Context context) { + return this.beginDeleteAsync(resourceGroupName, accountName, profileName, context).getSyncPoller(); + } + + /** + * Delete a certificate profile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param profileName Certificate profile name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String accountName, String profileName) { + return beginDeleteAsync(resourceGroupName, accountName, profileName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a certificate profile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param profileName Certificate profile name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String accountName, String profileName, Context context) { + return beginDeleteAsync(resourceGroupName, accountName, profileName, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a certificate profile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param profileName Certificate profile name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String accountName, String profileName) { + deleteAsync(resourceGroupName, accountName, profileName).block(); + } + + /** + * Delete a certificate profile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param profileName Certificate profile name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String accountName, String profileName, Context context) { + deleteAsync(resourceGroupName, accountName, profileName, context).block(); + } + + /** + * Revoke a certificate under a certificate profile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param profileName Certificate profile name. + * @param body Parameters to revoke the certificate profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> revokeCertificateWithResponseAsync(String resourceGroupName, String accountName, + String profileName, RevokeCertificate body) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (profileName == null) { + return Mono.error(new IllegalArgumentException("Parameter profileName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.revokeCertificate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accountName, profileName, body, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Revoke a certificate under a certificate profile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param profileName Certificate profile name. + * @param body Parameters to revoke the certificate profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> revokeCertificateWithResponseAsync(String resourceGroupName, String accountName, + String profileName, RevokeCertificate body, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (profileName == null) { + return Mono.error(new IllegalArgumentException("Parameter profileName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.revokeCertificate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accountName, profileName, body, accept, context); + } + + /** + * Revoke a certificate under a certificate profile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param profileName Certificate profile name. + * @param body Parameters to revoke the certificate profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono revokeCertificateAsync(String resourceGroupName, String accountName, String profileName, + RevokeCertificate body) { + return revokeCertificateWithResponseAsync(resourceGroupName, accountName, profileName, body) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Revoke a certificate under a certificate profile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param profileName Certificate profile name. + * @param body Parameters to revoke the certificate profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response revokeCertificateWithResponse(String resourceGroupName, String accountName, + String profileName, RevokeCertificate body, Context context) { + return revokeCertificateWithResponseAsync(resourceGroupName, accountName, profileName, body, context).block(); + } + + /** + * Revoke a certificate under a certificate profile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param profileName Certificate profile name. + * @param body Parameters to revoke the certificate profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void revokeCertificate(String resourceGroupName, String accountName, String profileName, + RevokeCertificate body) { + revokeCertificateWithResponse(resourceGroupName, accountName, profileName, body, Context.NONE); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CertificateProfile list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByCodeSigningAccountNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByCodeSigningAccountNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CertificateProfile list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByCodeSigningAccountNextSinglePageAsync(String nextLink, + Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listByCodeSigningAccountNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/implementation/CertificateProfilesImpl.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/implementation/CertificateProfilesImpl.java new file mode 100644 index 0000000000000..e94375a633036 --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/implementation/CertificateProfilesImpl.java @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.codesigning.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.codesigning.fluent.CertificateProfilesClient; +import com.azure.resourcemanager.codesigning.fluent.models.CertificateProfileInner; +import com.azure.resourcemanager.codesigning.models.CertificateProfile; +import com.azure.resourcemanager.codesigning.models.CertificateProfiles; +import com.azure.resourcemanager.codesigning.models.RevokeCertificate; + +public final class CertificateProfilesImpl implements CertificateProfiles { + private static final ClientLogger LOGGER = new ClientLogger(CertificateProfilesImpl.class); + + private final CertificateProfilesClient innerClient; + + private final com.azure.resourcemanager.codesigning.CodeSigningManager serviceManager; + + public CertificateProfilesImpl(CertificateProfilesClient innerClient, + com.azure.resourcemanager.codesigning.CodeSigningManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByCodeSigningAccount(String resourceGroupName, String accountName) { + PagedIterable inner + = this.serviceClient().listByCodeSigningAccount(resourceGroupName, accountName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new CertificateProfileImpl(inner1, this.manager())); + } + + public PagedIterable listByCodeSigningAccount(String resourceGroupName, String accountName, + Context context) { + PagedIterable inner + = this.serviceClient().listByCodeSigningAccount(resourceGroupName, accountName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new CertificateProfileImpl(inner1, this.manager())); + } + + public Response getWithResponse(String resourceGroupName, String accountName, + String profileName, Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, accountName, profileName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new CertificateProfileImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public CertificateProfile get(String resourceGroupName, String accountName, String profileName) { + CertificateProfileInner inner = this.serviceClient().get(resourceGroupName, accountName, profileName); + if (inner != null) { + return new CertificateProfileImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String accountName, String profileName) { + this.serviceClient().delete(resourceGroupName, accountName, profileName); + } + + public void delete(String resourceGroupName, String accountName, String profileName, Context context) { + this.serviceClient().delete(resourceGroupName, accountName, profileName, context); + } + + public Response revokeCertificateWithResponse(String resourceGroupName, String accountName, + String profileName, RevokeCertificate body, Context context) { + return this.serviceClient() + .revokeCertificateWithResponse(resourceGroupName, accountName, profileName, body, context); + } + + public void revokeCertificate(String resourceGroupName, String accountName, String profileName, + RevokeCertificate body) { + this.serviceClient().revokeCertificate(resourceGroupName, accountName, profileName, body); + } + + public CertificateProfile getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = ResourceManagerUtils.getValueFromIdByName(id, "codeSigningAccounts"); + if (accountName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'codeSigningAccounts'.", id))); + } + String profileName = ResourceManagerUtils.getValueFromIdByName(id, "certificateProfiles"); + if (profileName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'certificateProfiles'.", id))); + } + return this.getWithResponse(resourceGroupName, accountName, profileName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = ResourceManagerUtils.getValueFromIdByName(id, "codeSigningAccounts"); + if (accountName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'codeSigningAccounts'.", id))); + } + String profileName = ResourceManagerUtils.getValueFromIdByName(id, "certificateProfiles"); + if (profileName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'certificateProfiles'.", id))); + } + return this.getWithResponse(resourceGroupName, accountName, profileName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = ResourceManagerUtils.getValueFromIdByName(id, "codeSigningAccounts"); + if (accountName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'codeSigningAccounts'.", id))); + } + String profileName = ResourceManagerUtils.getValueFromIdByName(id, "certificateProfiles"); + if (profileName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'certificateProfiles'.", id))); + } + this.delete(resourceGroupName, accountName, profileName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = ResourceManagerUtils.getValueFromIdByName(id, "codeSigningAccounts"); + if (accountName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'codeSigningAccounts'.", id))); + } + String profileName = ResourceManagerUtils.getValueFromIdByName(id, "certificateProfiles"); + if (profileName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'certificateProfiles'.", id))); + } + this.delete(resourceGroupName, accountName, profileName, context); + } + + private CertificateProfilesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.codesigning.CodeSigningManager manager() { + return this.serviceManager; + } + + public CertificateProfileImpl define(String name) { + return new CertificateProfileImpl(name, this.manager()); + } +} diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/implementation/CheckNameAvailabilityResultImpl.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/implementation/CheckNameAvailabilityResultImpl.java new file mode 100644 index 0000000000000..84453c07b3bf4 --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/implementation/CheckNameAvailabilityResultImpl.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.codesigning.implementation; + +import com.azure.resourcemanager.codesigning.fluent.models.CheckNameAvailabilityResultInner; +import com.azure.resourcemanager.codesigning.models.CheckNameAvailabilityResult; +import com.azure.resourcemanager.codesigning.models.NameUnavailabilityReason; + +public final class CheckNameAvailabilityResultImpl implements CheckNameAvailabilityResult { + private CheckNameAvailabilityResultInner innerObject; + + private final com.azure.resourcemanager.codesigning.CodeSigningManager serviceManager; + + CheckNameAvailabilityResultImpl(CheckNameAvailabilityResultInner innerObject, + com.azure.resourcemanager.codesigning.CodeSigningManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public Boolean nameAvailable() { + return this.innerModel().nameAvailable(); + } + + public NameUnavailabilityReason reason() { + return this.innerModel().reason(); + } + + public String message() { + return this.innerModel().message(); + } + + public CheckNameAvailabilityResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.codesigning.CodeSigningManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/implementation/CodeSigningAccountImpl.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/implementation/CodeSigningAccountImpl.java new file mode 100644 index 0000000000000..f47434c228339 --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/implementation/CodeSigningAccountImpl.java @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.codesigning.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.codesigning.fluent.models.CodeSigningAccountInner; +import com.azure.resourcemanager.codesigning.models.AccountSku; +import com.azure.resourcemanager.codesigning.models.AccountSkuPatch; +import com.azure.resourcemanager.codesigning.models.CodeSigningAccount; +import com.azure.resourcemanager.codesigning.models.CodeSigningAccountPatch; +import com.azure.resourcemanager.codesigning.models.ProvisioningState; +import java.util.Collections; +import java.util.Map; + +public final class CodeSigningAccountImpl + implements CodeSigningAccount, CodeSigningAccount.Definition, CodeSigningAccount.Update { + private CodeSigningAccountInner innerObject; + + private final com.azure.resourcemanager.codesigning.CodeSigningManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String accountUri() { + return this.innerModel().accountUri(); + } + + public AccountSku sku() { + return this.innerModel().sku(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public CodeSigningAccountInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.codesigning.CodeSigningManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String accountName; + + private CodeSigningAccountPatch updateProperties; + + public CodeSigningAccountImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public CodeSigningAccount create() { + this.innerObject = serviceManager.serviceClient() + .getCodeSigningAccounts() + .create(resourceGroupName, accountName, this.innerModel(), Context.NONE); + return this; + } + + public CodeSigningAccount create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getCodeSigningAccounts() + .create(resourceGroupName, accountName, this.innerModel(), context); + return this; + } + + CodeSigningAccountImpl(String name, com.azure.resourcemanager.codesigning.CodeSigningManager serviceManager) { + this.innerObject = new CodeSigningAccountInner(); + this.serviceManager = serviceManager; + this.accountName = name; + } + + public CodeSigningAccountImpl update() { + this.updateProperties = new CodeSigningAccountPatch(); + return this; + } + + public CodeSigningAccount apply() { + this.innerObject = serviceManager.serviceClient() + .getCodeSigningAccounts() + .update(resourceGroupName, accountName, updateProperties, Context.NONE); + return this; + } + + public CodeSigningAccount apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getCodeSigningAccounts() + .update(resourceGroupName, accountName, updateProperties, context); + return this; + } + + CodeSigningAccountImpl(CodeSigningAccountInner innerObject, + com.azure.resourcemanager.codesigning.CodeSigningManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.accountName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "codeSigningAccounts"); + } + + public CodeSigningAccount refresh() { + this.innerObject = serviceManager.serviceClient() + .getCodeSigningAccounts() + .getByResourceGroupWithResponse(resourceGroupName, accountName, Context.NONE) + .getValue(); + return this; + } + + public CodeSigningAccount refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getCodeSigningAccounts() + .getByResourceGroupWithResponse(resourceGroupName, accountName, context) + .getValue(); + return this; + } + + public CodeSigningAccountImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public CodeSigningAccountImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public CodeSigningAccountImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateProperties.withTags(tags); + return this; + } + } + + public CodeSigningAccountImpl withSku(AccountSku sku) { + this.innerModel().withSku(sku); + return this; + } + + public CodeSigningAccountImpl withSku(AccountSkuPatch sku) { + this.updateProperties.withSku(sku); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/implementation/CodeSigningAccountsClientImpl.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/implementation/CodeSigningAccountsClientImpl.java new file mode 100644 index 0000000000000..3dc04156affcb --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/implementation/CodeSigningAccountsClientImpl.java @@ -0,0 +1,1397 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.codesigning.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +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.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.codesigning.fluent.CodeSigningAccountsClient; +import com.azure.resourcemanager.codesigning.fluent.models.CheckNameAvailabilityResultInner; +import com.azure.resourcemanager.codesigning.fluent.models.CodeSigningAccountInner; +import com.azure.resourcemanager.codesigning.models.CheckNameAvailability; +import com.azure.resourcemanager.codesigning.models.CodeSigningAccountListResult; +import com.azure.resourcemanager.codesigning.models.CodeSigningAccountPatch; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in CodeSigningAccountsClient. + */ +public final class CodeSigningAccountsClientImpl implements CodeSigningAccountsClient { + /** + * The proxy service used to perform REST calls. + */ + private final CodeSigningAccountsService service; + + /** + * The service client containing this operation class. + */ + private final CodeSigningManagementClientImpl client; + + /** + * Initializes an instance of CodeSigningAccountsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CodeSigningAccountsClientImpl(CodeSigningManagementClientImpl client) { + this.service = RestProxy.create(CodeSigningAccountsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CodeSigningManagementClientCodeSigningAccounts to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CodeSigningManagemen") + public interface CodeSigningAccountsService { + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.CodeSigning/checkNameAvailability") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> checkNameAvailability(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") CheckNameAvailability body, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.CodeSigning/codeSigningAccounts") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("accountName") String accountName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> create(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("accountName") String accountName, + @BodyParam("application/json") CodeSigningAccountInner resource, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("accountName") String accountName, + @BodyParam("application/json") CodeSigningAccountPatch properties, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("accountName") String accountName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Checks that the trusted signing account name is valid and is not already in use. + * + * @param body The CheckAvailability request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the CheckNameAvailability operation response along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + checkNameAvailabilityWithResponseAsync(CheckNameAvailability body) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.checkNameAvailability(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), body, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Checks that the trusted signing account name is valid and is not already in use. + * + * @param body The CheckAvailability request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the CheckNameAvailability operation response along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + checkNameAvailabilityWithResponseAsync(CheckNameAvailability body, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.checkNameAvailability(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), body, accept, context); + } + + /** + * Checks that the trusted signing account name is valid and is not already in use. + * + * @param body The CheckAvailability request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the CheckNameAvailability operation response on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono checkNameAvailabilityAsync(CheckNameAvailability body) { + return checkNameAvailabilityWithResponseAsync(body).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Checks that the trusted signing account name is valid and is not already in use. + * + * @param body The CheckAvailability request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the CheckNameAvailability operation response along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response checkNameAvailabilityWithResponse(CheckNameAvailability body, + Context context) { + return checkNameAvailabilityWithResponseAsync(body, context).block(); + } + + /** + * Checks that the trusted signing account name is valid and is not already in use. + * + * @param body The CheckAvailability request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the CheckNameAvailability operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CheckNameAvailabilityResultInner checkNameAvailability(CheckNameAvailability body) { + return checkNameAvailabilityWithResponse(body, Context.NONE).getValue(); + } + + /** + * Lists trusted signing accounts within a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CodeSigningAccount list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists trusted signing accounts within a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CodeSigningAccount list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), accept, + context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Lists trusted signing accounts within a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CodeSigningAccount list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Lists trusted signing accounts within a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CodeSigningAccount list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists trusted signing accounts within a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CodeSigningAccount list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists trusted signing accounts within a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CodeSigningAccount list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Lists trusted signing accounts within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CodeSigningAccount list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists trusted signing accounts within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CodeSigningAccount list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Lists trusted signing accounts within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CodeSigningAccount list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Lists trusted signing accounts within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CodeSigningAccount list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists trusted signing accounts within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CodeSigningAccount list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Lists trusted signing accounts within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CodeSigningAccount list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Get a trusted Signing Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a trusted Signing Account along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String accountName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accountName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a trusted Signing Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a trusted Signing Account along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String accountName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accountName, accept, context); + } + + /** + * Get a trusted Signing Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a trusted Signing Account on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String accountName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, accountName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a trusted Signing Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a trusted Signing Account along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, + String accountName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, accountName, context).block(); + } + + /** + * Get a trusted Signing Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a trusted Signing Account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CodeSigningAccountInner getByResourceGroup(String resourceGroupName, String accountName) { + return getByResourceGroupWithResponse(resourceGroupName, accountName, Context.NONE).getValue(); + } + + /** + * Create a trusted Signing Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param resource Parameters to create the trusted signing account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return trusted signing account resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync(String resourceGroupName, String accountName, + CodeSigningAccountInner resource) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.create(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accountName, resource, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a trusted Signing Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param resource Parameters to create the trusted signing account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return trusted signing account resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync(String resourceGroupName, String accountName, + CodeSigningAccountInner resource, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.create(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, accountName, resource, accept, context); + } + + /** + * Create a trusted Signing Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param resource Parameters to create the trusted signing account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 PollerFlux} for polling of trusted signing account resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, CodeSigningAccountInner> + beginCreateAsync(String resourceGroupName, String accountName, CodeSigningAccountInner resource) { + Mono>> mono = createWithResponseAsync(resourceGroupName, accountName, resource); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), CodeSigningAccountInner.class, CodeSigningAccountInner.class, + this.client.getContext()); + } + + /** + * Create a trusted Signing Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param resource Parameters to create the trusted signing account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 PollerFlux} for polling of trusted signing account resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, CodeSigningAccountInner> beginCreateAsync( + String resourceGroupName, String accountName, CodeSigningAccountInner resource, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = createWithResponseAsync(resourceGroupName, accountName, resource, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), CodeSigningAccountInner.class, CodeSigningAccountInner.class, context); + } + + /** + * Create a trusted Signing Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param resource Parameters to create the trusted signing account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 SyncPoller} for polling of trusted signing account resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CodeSigningAccountInner> + beginCreate(String resourceGroupName, String accountName, CodeSigningAccountInner resource) { + return this.beginCreateAsync(resourceGroupName, accountName, resource).getSyncPoller(); + } + + /** + * Create a trusted Signing Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param resource Parameters to create the trusted signing account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 SyncPoller} for polling of trusted signing account resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CodeSigningAccountInner> + beginCreate(String resourceGroupName, String accountName, CodeSigningAccountInner resource, Context context) { + return this.beginCreateAsync(resourceGroupName, accountName, resource, context).getSyncPoller(); + } + + /** + * Create a trusted Signing Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param resource Parameters to create the trusted signing account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return trusted signing account resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String accountName, + CodeSigningAccountInner resource) { + return beginCreateAsync(resourceGroupName, accountName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a trusted Signing Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param resource Parameters to create the trusted signing account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return trusted signing account resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String accountName, + CodeSigningAccountInner resource, Context context) { + return beginCreateAsync(resourceGroupName, accountName, resource, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a trusted Signing Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param resource Parameters to create the trusted signing account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return trusted signing account resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CodeSigningAccountInner create(String resourceGroupName, String accountName, + CodeSigningAccountInner resource) { + return createAsync(resourceGroupName, accountName, resource).block(); + } + + /** + * Create a trusted Signing Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param resource Parameters to create the trusted signing account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return trusted signing account resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CodeSigningAccountInner create(String resourceGroupName, String accountName, + CodeSigningAccountInner resource, Context context) { + return createAsync(resourceGroupName, accountName, resource, context).block(); + } + + /** + * Update a trusted signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param properties Parameters supplied to update the trusted signing account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return trusted signing account resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, String accountName, + CodeSigningAccountPatch properties) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accountName, properties, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a trusted signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param properties Parameters supplied to update the trusted signing account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return trusted signing account resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, String accountName, + CodeSigningAccountPatch properties, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.update(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, accountName, properties, accept, context); + } + + /** + * Update a trusted signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param properties Parameters supplied to update the trusted signing account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 PollerFlux} for polling of trusted signing account resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, CodeSigningAccountInner> + beginUpdateAsync(String resourceGroupName, String accountName, CodeSigningAccountPatch properties) { + Mono>> mono = updateWithResponseAsync(resourceGroupName, accountName, properties); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), CodeSigningAccountInner.class, CodeSigningAccountInner.class, + this.client.getContext()); + } + + /** + * Update a trusted signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param properties Parameters supplied to update the trusted signing account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 PollerFlux} for polling of trusted signing account resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, CodeSigningAccountInner> beginUpdateAsync( + String resourceGroupName, String accountName, CodeSigningAccountPatch properties, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = updateWithResponseAsync(resourceGroupName, accountName, properties, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), CodeSigningAccountInner.class, CodeSigningAccountInner.class, context); + } + + /** + * Update a trusted signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param properties Parameters supplied to update the trusted signing account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 SyncPoller} for polling of trusted signing account resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CodeSigningAccountInner> + beginUpdate(String resourceGroupName, String accountName, CodeSigningAccountPatch properties) { + return this.beginUpdateAsync(resourceGroupName, accountName, properties).getSyncPoller(); + } + + /** + * Update a trusted signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param properties Parameters supplied to update the trusted signing account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 SyncPoller} for polling of trusted signing account resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CodeSigningAccountInner> + beginUpdate(String resourceGroupName, String accountName, CodeSigningAccountPatch properties, Context context) { + return this.beginUpdateAsync(resourceGroupName, accountName, properties, context).getSyncPoller(); + } + + /** + * Update a trusted signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param properties Parameters supplied to update the trusted signing account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return trusted signing account resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String accountName, + CodeSigningAccountPatch properties) { + return beginUpdateAsync(resourceGroupName, accountName, properties).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a trusted signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param properties Parameters supplied to update the trusted signing account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return trusted signing account resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String accountName, + CodeSigningAccountPatch properties, Context context) { + return beginUpdateAsync(resourceGroupName, accountName, properties, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a trusted signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param properties Parameters supplied to update the trusted signing account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return trusted signing account resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CodeSigningAccountInner update(String resourceGroupName, String accountName, + CodeSigningAccountPatch properties) { + return updateAsync(resourceGroupName, accountName, properties).block(); + } + + /** + * Update a trusted signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param properties Parameters supplied to update the trusted signing account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return trusted signing account resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CodeSigningAccountInner update(String resourceGroupName, String accountName, + CodeSigningAccountPatch properties, Context context) { + return updateAsync(resourceGroupName, accountName, properties, context).block(); + } + + /** + * Delete a trusted signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, String accountName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accountName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a trusted signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, String accountName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (accountName == null) { + return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, accountName, accept, context); + } + + /** + * Delete a trusted signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String accountName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, accountName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Delete a trusted signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String accountName, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, accountName, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); + } + + /** + * Delete a trusted signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String accountName) { + return this.beginDeleteAsync(resourceGroupName, accountName).getSyncPoller(); + } + + /** + * Delete a trusted signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String accountName, + Context context) { + return this.beginDeleteAsync(resourceGroupName, accountName, context).getSyncPoller(); + } + + /** + * Delete a trusted signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String accountName) { + return beginDeleteAsync(resourceGroupName, accountName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a trusted signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String accountName, Context context) { + return beginDeleteAsync(resourceGroupName, accountName, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a trusted signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String accountName) { + deleteAsync(resourceGroupName, accountName).block(); + } + + /** + * Delete a trusted signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String accountName, Context context) { + deleteAsync(resourceGroupName, accountName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CodeSigningAccount list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CodeSigningAccount list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink, + Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CodeSigningAccount list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CodeSigningAccount list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink, + Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/implementation/CodeSigningAccountsImpl.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/implementation/CodeSigningAccountsImpl.java new file mode 100644 index 0000000000000..cf39d5a81f5ad --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/implementation/CodeSigningAccountsImpl.java @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.codesigning.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.codesigning.fluent.CodeSigningAccountsClient; +import com.azure.resourcemanager.codesigning.fluent.models.CheckNameAvailabilityResultInner; +import com.azure.resourcemanager.codesigning.fluent.models.CodeSigningAccountInner; +import com.azure.resourcemanager.codesigning.models.CheckNameAvailability; +import com.azure.resourcemanager.codesigning.models.CheckNameAvailabilityResult; +import com.azure.resourcemanager.codesigning.models.CodeSigningAccount; +import com.azure.resourcemanager.codesigning.models.CodeSigningAccounts; + +public final class CodeSigningAccountsImpl implements CodeSigningAccounts { + private static final ClientLogger LOGGER = new ClientLogger(CodeSigningAccountsImpl.class); + + private final CodeSigningAccountsClient innerClient; + + private final com.azure.resourcemanager.codesigning.CodeSigningManager serviceManager; + + public CodeSigningAccountsImpl(CodeSigningAccountsClient innerClient, + com.azure.resourcemanager.codesigning.CodeSigningManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response checkNameAvailabilityWithResponse(CheckNameAvailability body, + Context context) { + Response inner + = this.serviceClient().checkNameAvailabilityWithResponse(body, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new CheckNameAvailabilityResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public CheckNameAvailabilityResult checkNameAvailability(CheckNameAvailability body) { + CheckNameAvailabilityResultInner inner = this.serviceClient().checkNameAvailability(body); + if (inner != null) { + return new CheckNameAvailabilityResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new CodeSigningAccountImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new CodeSigningAccountImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new CodeSigningAccountImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner + = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new CodeSigningAccountImpl(inner1, this.manager())); + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, String accountName, + Context context) { + Response inner + = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, accountName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new CodeSigningAccountImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public CodeSigningAccount getByResourceGroup(String resourceGroupName, String accountName) { + CodeSigningAccountInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, accountName); + if (inner != null) { + return new CodeSigningAccountImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String accountName) { + this.serviceClient().delete(resourceGroupName, accountName); + } + + public void delete(String resourceGroupName, String accountName, Context context) { + this.serviceClient().delete(resourceGroupName, accountName, context); + } + + public CodeSigningAccount getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = ResourceManagerUtils.getValueFromIdByName(id, "codeSigningAccounts"); + if (accountName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'codeSigningAccounts'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, accountName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = ResourceManagerUtils.getValueFromIdByName(id, "codeSigningAccounts"); + if (accountName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'codeSigningAccounts'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, accountName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = ResourceManagerUtils.getValueFromIdByName(id, "codeSigningAccounts"); + if (accountName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'codeSigningAccounts'.", id))); + } + this.delete(resourceGroupName, accountName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String accountName = ResourceManagerUtils.getValueFromIdByName(id, "codeSigningAccounts"); + if (accountName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'codeSigningAccounts'.", id))); + } + this.delete(resourceGroupName, accountName, context); + } + + private CodeSigningAccountsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.codesigning.CodeSigningManager manager() { + return this.serviceManager; + } + + public CodeSigningAccountImpl define(String name) { + return new CodeSigningAccountImpl(name, this.manager()); + } +} diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/implementation/CodeSigningManagementClientBuilder.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/implementation/CodeSigningManagementClientBuilder.java new file mode 100644 index 0000000000000..1fe26b6b72d88 --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/implementation/CodeSigningManagementClientBuilder.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.codesigning.implementation; + +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerAdapter; +import java.time.Duration; + +/** + * A builder for creating a new instance of the CodeSigningManagementClientImpl type. + */ +@ServiceClientBuilder(serviceClients = { CodeSigningManagementClientImpl.class }) +public final class CodeSigningManagementClientBuilder { + /* + * The ID of the target subscription. The value must be an UUID. + */ + private String subscriptionId; + + /** + * Sets The ID of the target subscription. The value must be an UUID. + * + * @param subscriptionId the subscriptionId value. + * @return the CodeSigningManagementClientBuilder. + */ + public CodeSigningManagementClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the CodeSigningManagementClientBuilder. + */ + public CodeSigningManagementClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The environment to connect to + */ + private AzureEnvironment environment; + + /** + * Sets The environment to connect to. + * + * @param environment the environment value. + * @return the CodeSigningManagementClientBuilder. + */ + public CodeSigningManagementClientBuilder environment(AzureEnvironment environment) { + this.environment = environment; + return this; + } + + /* + * The HTTP pipeline to send requests through + */ + private HttpPipeline pipeline; + + /** + * Sets The HTTP pipeline to send requests through. + * + * @param pipeline the pipeline value. + * @return the CodeSigningManagementClientBuilder. + */ + public CodeSigningManagementClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The default poll interval for long-running operation + */ + private Duration defaultPollInterval; + + /** + * Sets The default poll interval for long-running operation. + * + * @param defaultPollInterval the defaultPollInterval value. + * @return the CodeSigningManagementClientBuilder. + */ + public CodeSigningManagementClientBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + return this; + } + + /* + * The serializer to serialize an object into a string + */ + private SerializerAdapter serializerAdapter; + + /** + * Sets The serializer to serialize an object into a string. + * + * @param serializerAdapter the serializerAdapter value. + * @return the CodeSigningManagementClientBuilder. + */ + public CodeSigningManagementClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of CodeSigningManagementClientImpl with the provided parameters. + * + * @return an instance of CodeSigningManagementClientImpl. + */ + public CodeSigningManagementClientImpl buildClient() { + String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; + AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; + HttpPipeline localPipeline = (pipeline != null) + ? pipeline + : new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); + Duration localDefaultPollInterval + = (defaultPollInterval != null) ? defaultPollInterval : Duration.ofSeconds(30); + SerializerAdapter localSerializerAdapter = (serializerAdapter != null) + ? serializerAdapter + : SerializerFactory.createDefaultManagementSerializerAdapter(); + CodeSigningManagementClientImpl client = new CodeSigningManagementClientImpl(localPipeline, + localSerializerAdapter, localDefaultPollInterval, localEnvironment, this.subscriptionId, localEndpoint); + return client; + } +} diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/implementation/CodeSigningManagementClientImpl.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/implementation/CodeSigningManagementClientImpl.java new file mode 100644 index 0000000000000..32b68ae8280d0 --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/implementation/CodeSigningManagementClientImpl.java @@ -0,0 +1,320 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.codesigning.implementation; + +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.codesigning.fluent.CertificateProfilesClient; +import com.azure.resourcemanager.codesigning.fluent.CodeSigningAccountsClient; +import com.azure.resourcemanager.codesigning.fluent.CodeSigningManagementClient; +import com.azure.resourcemanager.codesigning.fluent.OperationsClient; +import java.io.IOException; +import java.lang.reflect.Type; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the CodeSigningManagementClientImpl type. + */ +@ServiceClient(builder = CodeSigningManagementClientBuilder.class) +public final class CodeSigningManagementClientImpl implements CodeSigningManagementClient { + /** + * The ID of the target subscription. The value must be an UUID. + */ + private final String subscriptionId; + + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** + * server parameter. + */ + private final String endpoint; + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Api Version. + */ + private final String apiVersion; + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** + * The HTTP pipeline to send requests through. + */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** + * The serializer to serialize an object into a string. + */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** + * The default poll interval for long-running operation. + */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** + * The OperationsClient object to access its operations. + */ + private final OperationsClient operations; + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + public OperationsClient getOperations() { + return this.operations; + } + + /** + * The CodeSigningAccountsClient object to access its operations. + */ + private final CodeSigningAccountsClient codeSigningAccounts; + + /** + * Gets the CodeSigningAccountsClient object to access its operations. + * + * @return the CodeSigningAccountsClient object. + */ + public CodeSigningAccountsClient getCodeSigningAccounts() { + return this.codeSigningAccounts; + } + + /** + * The CertificateProfilesClient object to access its operations. + */ + private final CertificateProfilesClient certificateProfiles; + + /** + * Gets the CertificateProfilesClient object to access its operations. + * + * @return the CertificateProfilesClient object. + */ + public CertificateProfilesClient getCertificateProfiles() { + return this.certificateProfiles; + } + + /** + * Initializes an instance of CodeSigningManagementClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param endpoint server parameter. + */ + CodeSigningManagementClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, + Duration defaultPollInterval, AzureEnvironment environment, String subscriptionId, String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + this.apiVersion = "2024-09-30-preview"; + this.operations = new OperationsClientImpl(this); + this.codeSigningAccounts = new CodeSigningAccountsClientImpl(this); + this.certificateProfiles = new CertificateProfilesClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + return CoreUtils.mergeContexts(this.getContext(), context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult(Mono>> activationResponse, + HttpPipeline httpPipeline, Type pollResultType, Type finalResultType, Context context) { + return PollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, + defaultPollInterval, activationResponse, context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = new HttpResponseImpl(lroError.getResponseStatusCode(), lroError.getResponseHeaders(), + lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = this.getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + LOGGER.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(HttpHeaderName.fromString(s)); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(CodeSigningManagementClientImpl.class); +} diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/implementation/OperationImpl.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/implementation/OperationImpl.java new file mode 100644 index 0000000000000..6920aea4dc6ec --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/implementation/OperationImpl.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.codesigning.implementation; + +import com.azure.resourcemanager.codesigning.fluent.models.OperationInner; +import com.azure.resourcemanager.codesigning.models.ActionType; +import com.azure.resourcemanager.codesigning.models.Operation; +import com.azure.resourcemanager.codesigning.models.OperationDisplay; +import com.azure.resourcemanager.codesigning.models.Origin; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.codesigning.CodeSigningManager serviceManager; + + OperationImpl(OperationInner innerObject, com.azure.resourcemanager.codesigning.CodeSigningManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public Boolean isDataAction() { + return this.innerModel().isDataAction(); + } + + public OperationDisplay display() { + return this.innerModel().display(); + } + + public Origin origin() { + return this.innerModel().origin(); + } + + public ActionType actionType() { + return this.innerModel().actionType(); + } + + public OperationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.codesigning.CodeSigningManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/implementation/OperationsClientImpl.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/implementation/OperationsClientImpl.java new file mode 100644 index 0000000000000..1cceddbc9d41a --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/implementation/OperationsClientImpl.java @@ -0,0 +1,235 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.codesigning.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +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.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.codesigning.fluent.OperationsClient; +import com.azure.resourcemanager.codesigning.fluent.models.OperationInner; +import com.azure.resourcemanager.codesigning.models.OperationListResult; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in OperationsClient. + */ +public final class OperationsClientImpl implements OperationsClient { + /** + * The proxy service used to perform REST calls. + */ + private final OperationsService service; + + /** + * The service client containing this operation class. + */ + private final CodeSigningManagementClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(CodeSigningManagementClientImpl client) { + this.service + = RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for CodeSigningManagementClientOperations to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "CodeSigningManagemen") + public interface OperationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.CodeSigning/operations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException 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 REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException 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 REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException 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 REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/implementation/OperationsImpl.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..5b00c5c2cb085 --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/implementation/OperationsImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.codesigning.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.codesigning.fluent.OperationsClient; +import com.azure.resourcemanager.codesigning.fluent.models.OperationInner; +import com.azure.resourcemanager.codesigning.models.Operation; +import com.azure.resourcemanager.codesigning.models.Operations; + +public final class OperationsImpl implements Operations { + private static final ClientLogger LOGGER = new ClientLogger(OperationsImpl.class); + + private final OperationsClient innerClient; + + private final com.azure.resourcemanager.codesigning.CodeSigningManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, + com.azure.resourcemanager.codesigning.CodeSigningManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.codesigning.CodeSigningManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/implementation/ResourceManagerUtils.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/implementation/ResourceManagerUtils.java new file mode 100644 index 0000000000000..03583b80bc50d --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/implementation/ResourceManagerUtils.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.codesigning.implementation; + +import com.azure.core.http.rest.PagedFlux; +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.util.CoreUtils; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import reactor.core.publisher.Flux; + +final class ResourceManagerUtils { + private ResourceManagerUtils() { + } + + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterator itr = Arrays.stream(id.split("/")).iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && !part.trim().isEmpty()) { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { + if (id == null || pathTemplate == null) { + return null; + } + String parameterNameParentheses = "{" + parameterName + "}"; + List idSegmentsReverted = Arrays.asList(id.split("/")); + List pathSegments = Arrays.asList(pathTemplate.split("/")); + Collections.reverse(idSegmentsReverted); + Iterator idItrReverted = idSegmentsReverted.iterator(); + int pathIndex = pathSegments.size(); + while (idItrReverted.hasNext() && pathIndex > 0) { + String idSegment = idItrReverted.next(); + String pathSegment = pathSegments.get(--pathIndex); + if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { + if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { + if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { + List segments = new ArrayList<>(); + segments.add(idSegment); + idItrReverted.forEachRemaining(segments::add); + Collections.reverse(segments); + if (!segments.isEmpty() && segments.get(0).isEmpty()) { + segments.remove(0); + } + return String.join("/", segments); + } else { + return idSegment; + } + } + } + } + return null; + } + + static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { + return new PagedIterableImpl<>(pageIterable, mapper); + } + + private static final class PagedIterableImpl extends PagedIterable { + + private final PagedIterable pagedIterable; + private final Function mapper; + private final Function, PagedResponse> pageMapper; + + private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { + super(PagedFlux.create(() -> (continuationToken, pageSize) -> Flux + .fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); + this.pagedIterable = pagedIterable; + this.mapper = mapper; + this.pageMapper = getPageMapper(mapper); + } + + private static Function, PagedResponse> getPageMapper(Function mapper) { + return page -> new PagedResponseBase(page.getRequest(), page.getStatusCode(), page.getHeaders(), + page.getElements().stream().map(mapper).collect(Collectors.toList()), page.getContinuationToken(), + null); + } + + @Override + public Stream stream() { + return pagedIterable.stream().map(mapper); + } + + @Override + public Stream> streamByPage() { + return pagedIterable.streamByPage().map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken) { + return pagedIterable.streamByPage(continuationToken).map(pageMapper); + } + + @Override + public Stream> streamByPage(int preferredPageSize) { + return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken, int preferredPageSize) { + return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + } + + @Override + public Iterator iterator() { + return new IteratorImpl<>(pagedIterable.iterator(), mapper); + } + + @Override + public Iterable> iterableByPage() { + return new IterableImpl<>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl<>(pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); + } + } + + private static final class IteratorImpl implements Iterator { + + private final Iterator iterator; + private final Function mapper; + + private IteratorImpl(Iterator iterator, Function mapper) { + this.iterator = iterator; + this.mapper = mapper; + } + + @Override + public boolean hasNext() { + return iterator.hasNext(); + } + + @Override + public S next() { + return mapper.apply(iterator.next()); + } + + @Override + public void remove() { + iterator.remove(); + } + } + + private static final class IterableImpl implements Iterable { + + private final Iterable iterable; + private final Function mapper; + + private IterableImpl(Iterable iterable, Function mapper) { + this.iterable = iterable; + this.mapper = mapper; + } + + @Override + public Iterator iterator() { + return new IteratorImpl<>(iterable.iterator(), mapper); + } + } +} diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/implementation/package-info.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/implementation/package-info.java new file mode 100644 index 0000000000000..5e74e975d4889 --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/implementation/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the implementations for CodeSigningManagementClient. + * Code Signing resource provider api. + */ +package com.azure.resourcemanager.codesigning.implementation; diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/AccountSku.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/AccountSku.java new file mode 100644 index 0000000000000..1ffe6642a775b --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/AccountSku.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.codesigning.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * SKU of the trusted signing account. + */ +@Fluent +public final class AccountSku implements JsonSerializable { + /* + * Name of the SKU. + */ + private SkuName name; + + /** + * Creates an instance of AccountSku class. + */ + public AccountSku() { + } + + /** + * Get the name property: Name of the SKU. + * + * @return the name value. + */ + public SkuName name() { + return this.name; + } + + /** + * Set the name property: Name of the SKU. + * + * @param name the name value to set. + * @return the AccountSku object itself. + */ + public AccountSku withName(SkuName name) { + this.name = name; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property name in model AccountSku")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AccountSku.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name == null ? null : this.name.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AccountSku from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AccountSku 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 AccountSku. + */ + public static AccountSku fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AccountSku deserializedAccountSku = new AccountSku(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedAccountSku.name = SkuName.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedAccountSku; + }); + } +} diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/AccountSkuPatch.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/AccountSkuPatch.java new file mode 100644 index 0000000000000..5b2285b036b42 --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/AccountSkuPatch.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.codesigning.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; + +/** + * SKU of the trusted signing account. + */ +@Fluent +public final class AccountSkuPatch implements JsonSerializable { + /* + * Name of the SKU. + */ + private SkuName name; + + /** + * Creates an instance of AccountSkuPatch class. + */ + public AccountSkuPatch() { + } + + /** + * Get the name property: Name of the SKU. + * + * @return the name value. + */ + public SkuName name() { + return this.name; + } + + /** + * Set the name property: Name of the SKU. + * + * @param name the name value to set. + * @return the AccountSkuPatch object itself. + */ + public AccountSkuPatch withName(SkuName name) { + this.name = name; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name == null ? null : this.name.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AccountSkuPatch from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AccountSkuPatch 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 AccountSkuPatch. + */ + public static AccountSkuPatch fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AccountSkuPatch deserializedAccountSkuPatch = new AccountSkuPatch(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedAccountSkuPatch.name = SkuName.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedAccountSkuPatch; + }); + } +} diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/ActionType.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/ActionType.java new file mode 100644 index 0000000000000..a059ada4408c1 --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/ActionType.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.codesigning.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ +public final class ActionType extends ExpandableStringEnum { + /** + * Static value Internal for ActionType. + */ + public static final ActionType INTERNAL = fromString("Internal"); + + /** + * Creates a new instance of ActionType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ActionType() { + } + + /** + * Creates or finds a ActionType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ActionType. + */ + public static ActionType fromString(String name) { + return fromString(name, ActionType.class); + } + + /** + * Gets known ActionType values. + * + * @return known ActionType values. + */ + public static Collection values() { + return values(ActionType.class); + } +} diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/Certificate.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/Certificate.java new file mode 100644 index 0000000000000..26017f70b081b --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/Certificate.java @@ -0,0 +1,407 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.codesigning.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 com.azure.resourcemanager.codesigning.fluent.models.Revocation; +import java.io.IOException; +import java.time.OffsetDateTime; + +/** + * Properties of the certificate. + */ +@Fluent +public final class Certificate implements JsonSerializable { + /* + * Serial number of the certificate. + */ + private String serialNumber; + + /* + * Enhanced key usage of the certificate. + */ + private String enhancedKeyUsage; + + /* + * Subject name of the certificate. + */ + private String subjectName; + + /* + * Thumbprint of the certificate. + */ + private String thumbprint; + + /* + * Certificate created date. + */ + private String createdDate; + + /* + * Certificate expiry date. + */ + private String expiryDate; + + /* + * Status of the certificate. + */ + private CertificateStatus status; + + /* + * Revocations history of a certificate. + */ + private Revocation innerRevocation; + + /** + * Creates an instance of Certificate class. + */ + public Certificate() { + } + + /** + * Get the serialNumber property: Serial number of the certificate. + * + * @return the serialNumber value. + */ + public String serialNumber() { + return this.serialNumber; + } + + /** + * Set the serialNumber property: Serial number of the certificate. + * + * @param serialNumber the serialNumber value to set. + * @return the Certificate object itself. + */ + public Certificate withSerialNumber(String serialNumber) { + this.serialNumber = serialNumber; + return this; + } + + /** + * Get the enhancedKeyUsage property: Enhanced key usage of the certificate. + * + * @return the enhancedKeyUsage value. + */ + public String enhancedKeyUsage() { + return this.enhancedKeyUsage; + } + + /** + * Set the enhancedKeyUsage property: Enhanced key usage of the certificate. + * + * @param enhancedKeyUsage the enhancedKeyUsage value to set. + * @return the Certificate object itself. + */ + public Certificate withEnhancedKeyUsage(String enhancedKeyUsage) { + this.enhancedKeyUsage = enhancedKeyUsage; + return this; + } + + /** + * Get the subjectName property: Subject name of the certificate. + * + * @return the subjectName value. + */ + public String subjectName() { + return this.subjectName; + } + + /** + * Set the subjectName property: Subject name of the certificate. + * + * @param subjectName the subjectName value to set. + * @return the Certificate object itself. + */ + public Certificate withSubjectName(String subjectName) { + this.subjectName = subjectName; + return this; + } + + /** + * Get the thumbprint property: Thumbprint of the certificate. + * + * @return the thumbprint value. + */ + public String thumbprint() { + return this.thumbprint; + } + + /** + * Set the thumbprint property: Thumbprint of the certificate. + * + * @param thumbprint the thumbprint value to set. + * @return the Certificate object itself. + */ + public Certificate withThumbprint(String thumbprint) { + this.thumbprint = thumbprint; + return this; + } + + /** + * Get the createdDate property: Certificate created date. + * + * @return the createdDate value. + */ + public String createdDate() { + return this.createdDate; + } + + /** + * Set the createdDate property: Certificate created date. + * + * @param createdDate the createdDate value to set. + * @return the Certificate object itself. + */ + public Certificate withCreatedDate(String createdDate) { + this.createdDate = createdDate; + return this; + } + + /** + * Get the expiryDate property: Certificate expiry date. + * + * @return the expiryDate value. + */ + public String expiryDate() { + return this.expiryDate; + } + + /** + * Set the expiryDate property: Certificate expiry date. + * + * @param expiryDate the expiryDate value to set. + * @return the Certificate object itself. + */ + public Certificate withExpiryDate(String expiryDate) { + this.expiryDate = expiryDate; + return this; + } + + /** + * Get the status property: Status of the certificate. + * + * @return the status value. + */ + public CertificateStatus status() { + return this.status; + } + + /** + * Set the status property: Status of the certificate. + * + * @param status the status value to set. + * @return the Certificate object itself. + */ + public Certificate withStatus(CertificateStatus status) { + this.status = status; + return this; + } + + /** + * Get the innerRevocation property: Revocations history of a certificate. + * + * @return the innerRevocation value. + */ + private Revocation innerRevocation() { + return this.innerRevocation; + } + + /** + * Get the requestedAt property: The timestamp when the revocation is requested. + * + * @return the requestedAt value. + */ + public OffsetDateTime requestedAt() { + return this.innerRevocation() == null ? null : this.innerRevocation().requestedAt(); + } + + /** + * Set the requestedAt property: The timestamp when the revocation is requested. + * + * @param requestedAt the requestedAt value to set. + * @return the Certificate object itself. + */ + public Certificate withRequestedAt(OffsetDateTime requestedAt) { + if (this.innerRevocation() == null) { + this.innerRevocation = new Revocation(); + } + this.innerRevocation().withRequestedAt(requestedAt); + return this; + } + + /** + * Get the effectiveAt property: The timestamp when the revocation is effective. + * + * @return the effectiveAt value. + */ + public OffsetDateTime effectiveAt() { + return this.innerRevocation() == null ? null : this.innerRevocation().effectiveAt(); + } + + /** + * Set the effectiveAt property: The timestamp when the revocation is effective. + * + * @param effectiveAt the effectiveAt value to set. + * @return the Certificate object itself. + */ + public Certificate withEffectiveAt(OffsetDateTime effectiveAt) { + if (this.innerRevocation() == null) { + this.innerRevocation = new Revocation(); + } + this.innerRevocation().withEffectiveAt(effectiveAt); + return this; + } + + /** + * Get the reason property: Reason for revocation. + * + * @return the reason value. + */ + public String reason() { + return this.innerRevocation() == null ? null : this.innerRevocation().reason(); + } + + /** + * Set the reason property: Reason for revocation. + * + * @param reason the reason value to set. + * @return the Certificate object itself. + */ + public Certificate withReason(String reason) { + if (this.innerRevocation() == null) { + this.innerRevocation = new Revocation(); + } + this.innerRevocation().withReason(reason); + return this; + } + + /** + * Get the remarks property: Remarks for the revocation. + * + * @return the remarks value. + */ + public String remarks() { + return this.innerRevocation() == null ? null : this.innerRevocation().remarks(); + } + + /** + * Set the remarks property: Remarks for the revocation. + * + * @param remarks the remarks value to set. + * @return the Certificate object itself. + */ + public Certificate withRemarks(String remarks) { + if (this.innerRevocation() == null) { + this.innerRevocation = new Revocation(); + } + this.innerRevocation().withRemarks(remarks); + return this; + } + + /** + * Get the status property: Status of the revocation. + * + * @return the status value. + */ + public RevocationStatus statusRevocationStatus() { + return this.innerRevocation() == null ? null : this.innerRevocation().status(); + } + + /** + * Get the failureReason property: Reason for the revocation failure. + * + * @return the failureReason value. + */ + public String failureReason() { + return this.innerRevocation() == null ? null : this.innerRevocation().failureReason(); + } + + /** + * Set the failureReason property: Reason for the revocation failure. + * + * @param failureReason the failureReason value to set. + * @return the Certificate object itself. + */ + public Certificate withFailureReason(String failureReason) { + if (this.innerRevocation() == null) { + this.innerRevocation = new Revocation(); + } + this.innerRevocation().withFailureReason(failureReason); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerRevocation() != null) { + innerRevocation().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("serialNumber", this.serialNumber); + jsonWriter.writeStringField("enhancedKeyUsage", this.enhancedKeyUsage); + jsonWriter.writeStringField("subjectName", this.subjectName); + jsonWriter.writeStringField("thumbprint", this.thumbprint); + jsonWriter.writeStringField("createdDate", this.createdDate); + jsonWriter.writeStringField("expiryDate", this.expiryDate); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + jsonWriter.writeJsonField("revocation", this.innerRevocation); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Certificate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Certificate 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 Certificate. + */ + public static Certificate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Certificate deserializedCertificate = new Certificate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("serialNumber".equals(fieldName)) { + deserializedCertificate.serialNumber = reader.getString(); + } else if ("enhancedKeyUsage".equals(fieldName)) { + deserializedCertificate.enhancedKeyUsage = reader.getString(); + } else if ("subjectName".equals(fieldName)) { + deserializedCertificate.subjectName = reader.getString(); + } else if ("thumbprint".equals(fieldName)) { + deserializedCertificate.thumbprint = reader.getString(); + } else if ("createdDate".equals(fieldName)) { + deserializedCertificate.createdDate = reader.getString(); + } else if ("expiryDate".equals(fieldName)) { + deserializedCertificate.expiryDate = reader.getString(); + } else if ("status".equals(fieldName)) { + deserializedCertificate.status = CertificateStatus.fromString(reader.getString()); + } else if ("revocation".equals(fieldName)) { + deserializedCertificate.innerRevocation = Revocation.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedCertificate; + }); + } +} diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/CertificateProfile.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/CertificateProfile.java new file mode 100644 index 0000000000000..0444c7df8fa08 --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/CertificateProfile.java @@ -0,0 +1,314 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.codesigning.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.codesigning.fluent.models.CertificateProfileInner; +import java.util.List; + +/** + * An immutable client-side representation of CertificateProfile. + */ +public interface CertificateProfile { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the profileType property: Profile type of the certificate. + * + * @return the profileType value. + */ + ProfileType profileType(); + + /** + * Gets the includeStreetAddress property: Whether to include STREET in the certificate subject name. + * + * @return the includeStreetAddress value. + */ + Boolean includeStreetAddress(); + + /** + * Gets the includeCity property: Whether to include L in the certificate subject name. Applicable only for private + * trust, private trust ci profile types. + * + * @return the includeCity value. + */ + Boolean includeCity(); + + /** + * Gets the includeState property: Whether to include S in the certificate subject name. Applicable only for private + * trust, private trust ci profile types. + * + * @return the includeState value. + */ + Boolean includeState(); + + /** + * Gets the includeCountry property: Whether to include C in the certificate subject name. Applicable only for + * private trust, private trust ci profile types. + * + * @return the includeCountry value. + */ + Boolean includeCountry(); + + /** + * Gets the includePostalCode property: Whether to include PC in the certificate subject name. + * + * @return the includePostalCode value. + */ + Boolean includePostalCode(); + + /** + * Gets the identityValidationId property: Identity validation id used for the certificate subject name. + * + * @return the identityValidationId value. + */ + String identityValidationId(); + + /** + * Gets the provisioningState property: Status of the current operation on certificate profile. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the status property: Status of the certificate profile. + * + * @return the status value. + */ + CertificateProfileStatus status(); + + /** + * Gets the certificates property: List of renewed certificates. + * + * @return the certificates value. + */ + List certificates(); + + /** + * Gets the inner com.azure.resourcemanager.codesigning.fluent.models.CertificateProfileInner object. + * + * @return the inner object. + */ + CertificateProfileInner innerModel(); + + /** + * The entirety of the CertificateProfile definition. + */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The CertificateProfile definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the CertificateProfile definition. + */ + interface Blank extends WithParentResource { + } + + /** + * The stage of the CertificateProfile definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, accountName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @return the next definition stage. + */ + WithCreate withExistingCodeSigningAccount(String resourceGroupName, String accountName); + } + + /** + * The stage of the CertificateProfile definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithProfileType, DefinitionStages.WithIncludeStreetAddress, + DefinitionStages.WithIncludeCity, DefinitionStages.WithIncludeState, DefinitionStages.WithIncludeCountry, + DefinitionStages.WithIncludePostalCode, DefinitionStages.WithIdentityValidationId { + /** + * Executes the create request. + * + * @return the created resource. + */ + CertificateProfile create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + CertificateProfile create(Context context); + } + + /** + * The stage of the CertificateProfile definition allowing to specify profileType. + */ + interface WithProfileType { + /** + * Specifies the profileType property: Profile type of the certificate.. + * + * @param profileType Profile type of the certificate. + * @return the next definition stage. + */ + WithCreate withProfileType(ProfileType profileType); + } + + /** + * The stage of the CertificateProfile definition allowing to specify includeStreetAddress. + */ + interface WithIncludeStreetAddress { + /** + * Specifies the includeStreetAddress property: Whether to include STREET in the certificate subject name.. + * + * @param includeStreetAddress Whether to include STREET in the certificate subject name. + * @return the next definition stage. + */ + WithCreate withIncludeStreetAddress(Boolean includeStreetAddress); + } + + /** + * The stage of the CertificateProfile definition allowing to specify includeCity. + */ + interface WithIncludeCity { + /** + * Specifies the includeCity property: Whether to include L in the certificate subject name. Applicable only + * for private trust, private trust ci profile types. + * + * @param includeCity Whether to include L in the certificate subject name. Applicable only for private + * trust, private trust ci profile types. + * @return the next definition stage. + */ + WithCreate withIncludeCity(Boolean includeCity); + } + + /** + * The stage of the CertificateProfile definition allowing to specify includeState. + */ + interface WithIncludeState { + /** + * Specifies the includeState property: Whether to include S in the certificate subject name. Applicable + * only for private trust, private trust ci profile types. + * + * @param includeState Whether to include S in the certificate subject name. Applicable only for private + * trust, private trust ci profile types. + * @return the next definition stage. + */ + WithCreate withIncludeState(Boolean includeState); + } + + /** + * The stage of the CertificateProfile definition allowing to specify includeCountry. + */ + interface WithIncludeCountry { + /** + * Specifies the includeCountry property: Whether to include C in the certificate subject name. Applicable + * only for private trust, private trust ci profile types. + * + * @param includeCountry Whether to include C in the certificate subject name. Applicable only for private + * trust, private trust ci profile types. + * @return the next definition stage. + */ + WithCreate withIncludeCountry(Boolean includeCountry); + } + + /** + * The stage of the CertificateProfile definition allowing to specify includePostalCode. + */ + interface WithIncludePostalCode { + /** + * Specifies the includePostalCode property: Whether to include PC in the certificate subject name.. + * + * @param includePostalCode Whether to include PC in the certificate subject name. + * @return the next definition stage. + */ + WithCreate withIncludePostalCode(Boolean includePostalCode); + } + + /** + * The stage of the CertificateProfile definition allowing to specify identityValidationId. + */ + interface WithIdentityValidationId { + /** + * Specifies the identityValidationId property: Identity validation id used for the certificate subject + * name.. + * + * @param identityValidationId Identity validation id used for the certificate subject name. + * @return the next definition stage. + */ + WithCreate withIdentityValidationId(String identityValidationId); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + CertificateProfile refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + CertificateProfile refresh(Context context); + + /** + * Revoke a certificate under a certificate profile. + * + * @param body Parameters to revoke the certificate profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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}. + */ + Response revokeCertificateWithResponse(RevokeCertificate body, Context context); + + /** + * Revoke a certificate under a certificate profile. + * + * @param body Parameters to revoke the certificate profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void revokeCertificate(RevokeCertificate body); +} diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/CertificateProfileListResult.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/CertificateProfileListResult.java new file mode 100644 index 0000000000000..4b52c33a7d36a --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/CertificateProfileListResult.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.codesigning.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.codesigning.fluent.models.CertificateProfileInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a CertificateProfile list operation. + */ +@Fluent +public final class CertificateProfileListResult implements JsonSerializable { + /* + * The CertificateProfile items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of CertificateProfileListResult class. + */ + public CertificateProfileListResult() { + } + + /** + * Get the value property: The CertificateProfile items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The CertificateProfile items on this page. + * + * @param value the value value to set. + * @return the CertificateProfileListResult object itself. + */ + public CertificateProfileListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the CertificateProfileListResult object itself. + */ + public CertificateProfileListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property value in model CertificateProfileListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(CertificateProfileListResult.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CertificateProfileListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CertificateProfileListResult 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 CertificateProfileListResult. + */ + public static CertificateProfileListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CertificateProfileListResult deserializedCertificateProfileListResult = new CertificateProfileListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> CertificateProfileInner.fromJson(reader1)); + deserializedCertificateProfileListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedCertificateProfileListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCertificateProfileListResult; + }); + } +} diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/CertificateProfileStatus.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/CertificateProfileStatus.java new file mode 100644 index 0000000000000..3b94768197281 --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/CertificateProfileStatus.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.codesigning.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Status of the certificate profiles. + */ +public final class CertificateProfileStatus extends ExpandableStringEnum { + /** + * Static value Active for CertificateProfileStatus. + */ + public static final CertificateProfileStatus ACTIVE = fromString("Active"); + + /** + * Static value Disabled for CertificateProfileStatus. + */ + public static final CertificateProfileStatus DISABLED = fromString("Disabled"); + + /** + * Static value Suspended for CertificateProfileStatus. + */ + public static final CertificateProfileStatus SUSPENDED = fromString("Suspended"); + + /** + * Creates a new instance of CertificateProfileStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public CertificateProfileStatus() { + } + + /** + * Creates or finds a CertificateProfileStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding CertificateProfileStatus. + */ + public static CertificateProfileStatus fromString(String name) { + return fromString(name, CertificateProfileStatus.class); + } + + /** + * Gets known CertificateProfileStatus values. + * + * @return known CertificateProfileStatus values. + */ + public static Collection values() { + return values(CertificateProfileStatus.class); + } +} diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/CertificateProfiles.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/CertificateProfiles.java new file mode 100644 index 0000000000000..01637ab7030f0 --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/CertificateProfiles.java @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.codesigning.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of CertificateProfiles. + */ +public interface CertificateProfiles { + /** + * List certificate profiles under a trusted signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CertificateProfile list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByCodeSigningAccount(String resourceGroupName, String accountName); + + /** + * List certificate profiles under a trusted signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CertificateProfile list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByCodeSigningAccount(String resourceGroupName, String accountName, + Context context); + + /** + * Get details of a certificate profile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param profileName Certificate profile name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return details of a certificate profile along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String accountName, String profileName, + Context context); + + /** + * Get details of a certificate profile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param profileName Certificate profile name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return details of a certificate profile. + */ + CertificateProfile get(String resourceGroupName, String accountName, String profileName); + + /** + * Delete a certificate profile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param profileName Certificate profile name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String accountName, String profileName); + + /** + * Delete a certificate profile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param profileName Certificate profile name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String accountName, String profileName, Context context); + + /** + * Revoke a certificate under a certificate profile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param profileName Certificate profile name. + * @param body Parameters to revoke the certificate profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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}. + */ + Response revokeCertificateWithResponse(String resourceGroupName, String accountName, String profileName, + RevokeCertificate body, Context context); + + /** + * Revoke a certificate under a certificate profile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param profileName Certificate profile name. + * @param body Parameters to revoke the certificate profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void revokeCertificate(String resourceGroupName, String accountName, String profileName, RevokeCertificate body); + + /** + * Get details of a certificate profile. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return details of a certificate profile along with {@link Response}. + */ + CertificateProfile getById(String id); + + /** + * Get details of a certificate profile. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return details of a certificate profile along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a certificate profile. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a certificate profile. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new CertificateProfile resource. + * + * @param name resource name. + * @return the first stage of the new CertificateProfile definition. + */ + CertificateProfile.DefinitionStages.Blank define(String name); +} diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/CertificateStatus.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/CertificateStatus.java new file mode 100644 index 0000000000000..3f0859ce81a0e --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/CertificateStatus.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.codesigning.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Status of the certificate. + */ +public final class CertificateStatus extends ExpandableStringEnum { + /** + * Static value Active for CertificateStatus. + */ + public static final CertificateStatus ACTIVE = fromString("Active"); + + /** + * Static value Expired for CertificateStatus. + */ + public static final CertificateStatus EXPIRED = fromString("Expired"); + + /** + * Static value Revoked for CertificateStatus. + */ + public static final CertificateStatus REVOKED = fromString("Revoked"); + + /** + * Creates a new instance of CertificateStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public CertificateStatus() { + } + + /** + * Creates or finds a CertificateStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding CertificateStatus. + */ + public static CertificateStatus fromString(String name) { + return fromString(name, CertificateStatus.class); + } + + /** + * Gets known CertificateStatus values. + * + * @return known CertificateStatus values. + */ + public static Collection values() { + return values(CertificateStatus.class); + } +} diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/CheckNameAvailability.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/CheckNameAvailability.java new file mode 100644 index 0000000000000..8667359cd3e34 --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/CheckNameAvailability.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.codesigning.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +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 parameters used to check the availability of the trusted signing account name. + */ +@Fluent +public final class CheckNameAvailability implements JsonSerializable { + /* + * Trusted signing account name. + */ + private String name; + + /** + * Creates an instance of CheckNameAvailability class. + */ + public CheckNameAvailability() { + } + + /** + * Get the name property: Trusted signing account name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Trusted signing account name. + * + * @param name the name value to set. + * @return the CheckNameAvailability object itself. + */ + public CheckNameAvailability withName(String name) { + this.name = name; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property name in model CheckNameAvailability")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(CheckNameAvailability.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CheckNameAvailability from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CheckNameAvailability 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 CheckNameAvailability. + */ + public static CheckNameAvailability fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CheckNameAvailability deserializedCheckNameAvailability = new CheckNameAvailability(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedCheckNameAvailability.name = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCheckNameAvailability; + }); + } +} diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/CheckNameAvailabilityResult.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/CheckNameAvailabilityResult.java new file mode 100644 index 0000000000000..1d0436ccd0ac3 --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/CheckNameAvailabilityResult.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.codesigning.models; + +import com.azure.resourcemanager.codesigning.fluent.models.CheckNameAvailabilityResultInner; + +/** + * An immutable client-side representation of CheckNameAvailabilityResult. + */ +public interface CheckNameAvailabilityResult { + /** + * Gets the nameAvailable property: A boolean value that indicates whether the name is available for you to use. If + * true, the name is available. If false, the name has already been taken or is invalid and cannot be used. + * + * @return the nameAvailable value. + */ + Boolean nameAvailable(); + + /** + * Gets the reason property: The reason that a trusted signing account name could not be used. The Reason element is + * only returned if nameAvailable is false. + * + * @return the reason value. + */ + NameUnavailabilityReason reason(); + + /** + * Gets the message property: An error message explaining the Reason value in more detail. + * + * @return the message value. + */ + String message(); + + /** + * Gets the inner com.azure.resourcemanager.codesigning.fluent.models.CheckNameAvailabilityResultInner object. + * + * @return the inner object. + */ + CheckNameAvailabilityResultInner innerModel(); +} diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/CodeSigningAccount.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/CodeSigningAccount.java new file mode 100644 index 0000000000000..4662c083586d3 --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/CodeSigningAccount.java @@ -0,0 +1,279 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.codesigning.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.codesigning.fluent.models.CodeSigningAccountInner; +import java.util.Map; + +/** + * An immutable client-side representation of CodeSigningAccount. + */ +public interface CodeSigningAccount { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the accountUri property: The URI of the trusted signing account which is used during signing files. + * + * @return the accountUri value. + */ + String accountUri(); + + /** + * Gets the sku property: SKU of the trusted signing account. + * + * @return the sku value. + */ + AccountSku sku(); + + /** + * Gets the provisioningState property: Status of the current operation on trusted signing account. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.codesigning.fluent.models.CodeSigningAccountInner object. + * + * @return the inner object. + */ + CodeSigningAccountInner innerModel(); + + /** + * The entirety of the CodeSigningAccount definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { + } + + /** + * The CodeSigningAccount definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the CodeSigningAccount definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the CodeSigningAccount definition allowing to specify location. + */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + + /** + * The stage of the CodeSigningAccount definition allowing to specify parent resource. + */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + + /** + * The stage of the CodeSigningAccount definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithSku { + /** + * Executes the create request. + * + * @return the created resource. + */ + CodeSigningAccount create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + CodeSigningAccount create(Context context); + } + + /** + * The stage of the CodeSigningAccount definition allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the CodeSigningAccount definition allowing to specify sku. + */ + interface WithSku { + /** + * Specifies the sku property: SKU of the trusted signing account.. + * + * @param sku SKU of the trusted signing account. + * @return the next definition stage. + */ + WithCreate withSku(AccountSku sku); + } + } + + /** + * Begins update for the CodeSigningAccount resource. + * + * @return the stage of resource update. + */ + CodeSigningAccount.Update update(); + + /** + * The template for CodeSigningAccount update. + */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithSku { + /** + * Executes the update request. + * + * @return the updated resource. + */ + CodeSigningAccount apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + CodeSigningAccount apply(Context context); + } + + /** + * The CodeSigningAccount update stages. + */ + interface UpdateStages { + /** + * The stage of the CodeSigningAccount update allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + + /** + * The stage of the CodeSigningAccount update allowing to specify sku. + */ + interface WithSku { + /** + * Specifies the sku property: SKU of the trusted signing account.. + * + * @param sku SKU of the trusted signing account. + * @return the next definition stage. + */ + Update withSku(AccountSkuPatch sku); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + CodeSigningAccount refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + CodeSigningAccount refresh(Context context); +} diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/CodeSigningAccountListResult.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/CodeSigningAccountListResult.java new file mode 100644 index 0000000000000..4c5a23f5e0113 --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/CodeSigningAccountListResult.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.codesigning.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.codesigning.fluent.models.CodeSigningAccountInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a CodeSigningAccount list operation. + */ +@Fluent +public final class CodeSigningAccountListResult implements JsonSerializable { + /* + * The CodeSigningAccount items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of CodeSigningAccountListResult class. + */ + public CodeSigningAccountListResult() { + } + + /** + * Get the value property: The CodeSigningAccount items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The CodeSigningAccount items on this page. + * + * @param value the value value to set. + * @return the CodeSigningAccountListResult object itself. + */ + public CodeSigningAccountListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the CodeSigningAccountListResult object itself. + */ + public CodeSigningAccountListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property value in model CodeSigningAccountListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(CodeSigningAccountListResult.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CodeSigningAccountListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CodeSigningAccountListResult 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 CodeSigningAccountListResult. + */ + public static CodeSigningAccountListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CodeSigningAccountListResult deserializedCodeSigningAccountListResult = new CodeSigningAccountListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> CodeSigningAccountInner.fromJson(reader1)); + deserializedCodeSigningAccountListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedCodeSigningAccountListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCodeSigningAccountListResult; + }); + } +} diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/CodeSigningAccountPatch.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/CodeSigningAccountPatch.java new file mode 100644 index 0000000000000..8b13c06511c3c --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/CodeSigningAccountPatch.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.codesigning.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 com.azure.resourcemanager.codesigning.fluent.models.CodeSigningAccountPatchProperties; +import java.io.IOException; +import java.util.Map; + +/** + * Parameters for creating or updating a trusted signing account. + */ +@Fluent +public final class CodeSigningAccountPatch implements JsonSerializable { + /* + * Resource tags. + */ + private Map tags; + + /* + * Properties of the trusted signing account. + */ + private CodeSigningAccountPatchProperties innerProperties; + + /** + * Creates an instance of CodeSigningAccountPatch class. + */ + public CodeSigningAccountPatch() { + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the CodeSigningAccountPatch object itself. + */ + public CodeSigningAccountPatch withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the innerProperties property: Properties of the trusted signing account. + * + * @return the innerProperties value. + */ + private CodeSigningAccountPatchProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the sku property: SKU of the trusted signing account. + * + * @return the sku value. + */ + public AccountSkuPatch sku() { + return this.innerProperties() == null ? null : this.innerProperties().sku(); + } + + /** + * Set the sku property: SKU of the trusted signing account. + * + * @param sku the sku value to set. + * @return the CodeSigningAccountPatch object itself. + */ + public CodeSigningAccountPatch withSku(AccountSkuPatch sku) { + if (this.innerProperties() == null) { + this.innerProperties = new CodeSigningAccountPatchProperties(); + } + this.innerProperties().withSku(sku); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CodeSigningAccountPatch from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CodeSigningAccountPatch 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 CodeSigningAccountPatch. + */ + public static CodeSigningAccountPatch fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CodeSigningAccountPatch deserializedCodeSigningAccountPatch = new CodeSigningAccountPatch(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedCodeSigningAccountPatch.tags = tags; + } else if ("properties".equals(fieldName)) { + deserializedCodeSigningAccountPatch.innerProperties + = CodeSigningAccountPatchProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedCodeSigningAccountPatch; + }); + } +} diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/CodeSigningAccounts.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/CodeSigningAccounts.java new file mode 100644 index 0000000000000..b7a5208c6271a --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/CodeSigningAccounts.java @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.codesigning.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of CodeSigningAccounts. + */ +public interface CodeSigningAccounts { + /** + * Checks that the trusted signing account name is valid and is not already in use. + * + * @param body The CheckAvailability request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the CheckNameAvailability operation response along with {@link Response}. + */ + Response checkNameAvailabilityWithResponse(CheckNameAvailability body, + Context context); + + /** + * Checks that the trusted signing account name is valid and is not already in use. + * + * @param body The CheckAvailability request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the CheckNameAvailability operation response. + */ + CheckNameAvailabilityResult checkNameAvailability(CheckNameAvailability body); + + /** + * Lists trusted signing accounts within a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CodeSigningAccount list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Lists trusted signing accounts within a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CodeSigningAccount list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Lists trusted signing accounts within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CodeSigningAccount list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists trusted signing accounts within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a CodeSigningAccount list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Get a trusted Signing Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a trusted Signing Account along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String accountName, + Context context); + + /** + * Get a trusted Signing Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a trusted Signing Account. + */ + CodeSigningAccount getByResourceGroup(String resourceGroupName, String accountName); + + /** + * Delete a trusted signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String accountName); + + /** + * Delete a trusted signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Trusted Signing account name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String accountName, Context context); + + /** + * Get a trusted Signing Account. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a trusted Signing Account along with {@link Response}. + */ + CodeSigningAccount getById(String id); + + /** + * Get a trusted Signing Account. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a trusted Signing Account along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a trusted signing account. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a trusted signing account. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new CodeSigningAccount resource. + * + * @param name resource name. + * @return the first stage of the new CodeSigningAccount definition. + */ + CodeSigningAccount.DefinitionStages.Blank define(String name); +} diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/NameUnavailabilityReason.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/NameUnavailabilityReason.java new file mode 100644 index 0000000000000..f2985569b4424 --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/NameUnavailabilityReason.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.codesigning.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The reason that a trusted signing account name could not be used. The Reason element is only returned if + * nameAvailable is false. + */ +public final class NameUnavailabilityReason extends ExpandableStringEnum { + /** + * Static value AccountNameInvalid for NameUnavailabilityReason. + */ + public static final NameUnavailabilityReason ACCOUNT_NAME_INVALID = fromString("AccountNameInvalid"); + + /** + * Static value AlreadyExists for NameUnavailabilityReason. + */ + public static final NameUnavailabilityReason ALREADY_EXISTS = fromString("AlreadyExists"); + + /** + * Creates a new instance of NameUnavailabilityReason value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public NameUnavailabilityReason() { + } + + /** + * Creates or finds a NameUnavailabilityReason from its string representation. + * + * @param name a name to look for. + * @return the corresponding NameUnavailabilityReason. + */ + public static NameUnavailabilityReason fromString(String name) { + return fromString(name, NameUnavailabilityReason.class); + } + + /** + * Gets known NameUnavailabilityReason values. + * + * @return known NameUnavailabilityReason values. + */ + public static Collection values() { + return values(NameUnavailabilityReason.class); + } +} diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/Operation.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/Operation.java new file mode 100644 index 0000000000000..a174a5a95d396 --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/Operation.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.codesigning.models; + +import com.azure.resourcemanager.codesigning.fluent.models.OperationInner; + +/** + * An immutable client-side representation of Operation. + */ +public interface Operation { + /** + * Gets the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + * + * @return the name value. + */ + String name(); + + /** + * Gets the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane + * operations and "false" for ARM/control-plane operations. + * + * @return the isDataAction value. + */ + Boolean isDataAction(); + + /** + * Gets the display property: Localized display information for this particular operation. + * + * @return the display value. + */ + OperationDisplay display(); + + /** + * Gets the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and + * audit logs UX. Default value is "user,system". + * + * @return the origin value. + */ + Origin origin(); + + /** + * Gets the actionType property: Enum. Indicates the action type. "Internal" refers to actions that are for internal + * only APIs. + * + * @return the actionType value. + */ + ActionType actionType(); + + /** + * Gets the inner com.azure.resourcemanager.codesigning.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/OperationDisplay.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/OperationDisplay.java new file mode 100644 index 0000000000000..126c6ffc5500c --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/OperationDisplay.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.codesigning.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; + +/** + * Localized display information for this particular operation. + */ +@Immutable +public final class OperationDisplay implements JsonSerializable { + /* + * The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or + * "Microsoft Compute". + */ + private String provider; + + /* + * The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or + * "Job Schedule Collections". + */ + private String resource; + + /* + * The concise, localized friendly name for the operation; suitable for dropdowns. E.g. + * "Create or Update Virtual Machine", "Restart Virtual Machine". + */ + private String operation; + + /* + * The short, localized friendly description of the operation; suitable for tool tips and detailed views. + */ + private String description; + + /** + * Creates an instance of OperationDisplay class. + */ + public OperationDisplay() { + } + + /** + * Get the provider property: The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring + * Insights" or "Microsoft Compute". + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Get the resource property: The localized friendly name of the resource type related to this operation. E.g. + * "Virtual Machines" or "Job Schedule Collections". + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Get the operation property: The concise, localized friendly name for the operation; suitable for dropdowns. E.g. + * "Create or Update Virtual Machine", "Restart Virtual Machine". + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Get the description property: The short, localized friendly description of the operation; suitable for tool tips + * and detailed views. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationDisplay from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationDisplay 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 OperationDisplay. + */ + public static OperationDisplay fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationDisplay deserializedOperationDisplay = new OperationDisplay(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provider".equals(fieldName)) { + deserializedOperationDisplay.provider = reader.getString(); + } else if ("resource".equals(fieldName)) { + deserializedOperationDisplay.resource = reader.getString(); + } else if ("operation".equals(fieldName)) { + deserializedOperationDisplay.operation = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedOperationDisplay.description = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationDisplay; + }); + } +} diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/OperationListResult.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/OperationListResult.java new file mode 100644 index 0000000000000..3c8f98d6d5cde --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/OperationListResult.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.codesigning.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.resourcemanager.codesigning.fluent.models.OperationInner; +import java.io.IOException; +import java.util.List; + +/** + * A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of + * results. + */ +@Immutable +public final class OperationListResult implements JsonSerializable { + /* + * List of operations supported by the resource provider + */ + private List value; + + /* + * URL to get the next set of operation list results (if there are any). + */ + private String nextLink; + + /** + * Creates an instance of OperationListResult class. + */ + public OperationListResult() { + } + + /** + * Get the value property: List of operations supported by the resource provider. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: URL to get the next set of operation list results (if there are any). + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationListResult 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 OperationListResult. + */ + public static OperationListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationListResult deserializedOperationListResult = new OperationListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> OperationInner.fromJson(reader1)); + deserializedOperationListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedOperationListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationListResult; + }); + } +} diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/Operations.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/Operations.java new file mode 100644 index 0000000000000..a1afc85d81a06 --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/Operations.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.codesigning.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** + * Resource collection API of Operations. + */ +public interface Operations { + /** + * List the operations for the provider. + * + * @throws com.azure.core.management.exception.ManagementException 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 REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(Context context); +} diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/Origin.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/Origin.java new file mode 100644 index 0000000000000..d44fb3d0c1bd6 --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/Origin.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.codesigning.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value + * is "user,system". + */ +public final class Origin extends ExpandableStringEnum { + /** + * Static value user for Origin. + */ + public static final Origin USER = fromString("user"); + + /** + * Static value system for Origin. + */ + public static final Origin SYSTEM = fromString("system"); + + /** + * Static value user,system for Origin. + */ + public static final Origin USER_SYSTEM = fromString("user,system"); + + /** + * Creates a new instance of Origin value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Origin() { + } + + /** + * Creates or finds a Origin from its string representation. + * + * @param name a name to look for. + * @return the corresponding Origin. + */ + public static Origin fromString(String name) { + return fromString(name, Origin.class); + } + + /** + * Gets known Origin values. + * + * @return known Origin values. + */ + public static Collection values() { + return values(Origin.class); + } +} diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/ProfileType.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/ProfileType.java new file mode 100644 index 0000000000000..b91ea6b138963 --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/ProfileType.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.codesigning.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Type of the certificate. + */ +public final class ProfileType extends ExpandableStringEnum { + /** + * Static value PublicTrust for ProfileType. + */ + public static final ProfileType PUBLIC_TRUST = fromString("PublicTrust"); + + /** + * Static value PrivateTrust for ProfileType. + */ + public static final ProfileType PRIVATE_TRUST = fromString("PrivateTrust"); + + /** + * Static value PrivateTrustCIPolicy for ProfileType. + */ + public static final ProfileType PRIVATE_TRUST_CIPOLICY = fromString("PrivateTrustCIPolicy"); + + /** + * Static value VBSEnclave for ProfileType. + */ + public static final ProfileType VBSENCLAVE = fromString("VBSEnclave"); + + /** + * Static value PublicTrustTest for ProfileType. + */ + public static final ProfileType PUBLIC_TRUST_TEST = fromString("PublicTrustTest"); + + /** + * Creates a new instance of ProfileType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ProfileType() { + } + + /** + * Creates or finds a ProfileType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProfileType. + */ + public static ProfileType fromString(String name) { + return fromString(name, ProfileType.class); + } + + /** + * Gets known ProfileType values. + * + * @return known ProfileType values. + */ + public static Collection values() { + return values(ProfileType.class); + } +} diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/ProvisioningState.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/ProvisioningState.java new file mode 100644 index 0000000000000..68277cfc9bdd3 --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/ProvisioningState.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.codesigning.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The status of the current operation. + */ +public final class ProvisioningState extends ExpandableStringEnum { + /** + * Static value Succeeded for ProvisioningState. + */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** + * Static value Failed for ProvisioningState. + */ + public static final ProvisioningState FAILED = fromString("Failed"); + + /** + * Static value Canceled for ProvisioningState. + */ + public static final ProvisioningState CANCELED = fromString("Canceled"); + + /** + * Static value Updating for ProvisioningState. + */ + public static final ProvisioningState UPDATING = fromString("Updating"); + + /** + * Static value Deleting for ProvisioningState. + */ + public static final ProvisioningState DELETING = fromString("Deleting"); + + /** + * Static value Accepted for ProvisioningState. + */ + public static final ProvisioningState ACCEPTED = fromString("Accepted"); + + /** + * Creates a new instance of ProvisioningState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ProvisioningState() { + } + + /** + * Creates or finds a ProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProvisioningState. + */ + public static ProvisioningState fromString(String name) { + return fromString(name, ProvisioningState.class); + } + + /** + * Gets known ProvisioningState values. + * + * @return known ProvisioningState values. + */ + public static Collection values() { + return values(ProvisioningState.class); + } +} diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/RevocationStatus.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/RevocationStatus.java new file mode 100644 index 0000000000000..8433038f0beb2 --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/RevocationStatus.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.codesigning.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Revocation status of the certificate. + */ +public final class RevocationStatus extends ExpandableStringEnum { + /** + * Static value Succeeded for RevocationStatus. + */ + public static final RevocationStatus SUCCEEDED = fromString("Succeeded"); + + /** + * Static value InProgress for RevocationStatus. + */ + public static final RevocationStatus IN_PROGRESS = fromString("InProgress"); + + /** + * Static value Failed for RevocationStatus. + */ + public static final RevocationStatus FAILED = fromString("Failed"); + + /** + * Creates a new instance of RevocationStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public RevocationStatus() { + } + + /** + * Creates or finds a RevocationStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding RevocationStatus. + */ + public static RevocationStatus fromString(String name) { + return fromString(name, RevocationStatus.class); + } + + /** + * Gets known RevocationStatus values. + * + * @return known RevocationStatus values. + */ + public static Collection values() { + return values(RevocationStatus.class); + } +} diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/RevokeCertificate.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/RevokeCertificate.java new file mode 100644 index 0000000000000..fc2df42ff572b --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/RevokeCertificate.java @@ -0,0 +1,230 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.codesigning.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +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.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * Defines the certificate revocation properties. + */ +@Fluent +public final class RevokeCertificate implements JsonSerializable { + /* + * Serial number of the certificate. + */ + private String serialNumber; + + /* + * Thumbprint of the certificate. + */ + private String thumbprint; + + /* + * The timestamp when the revocation is effective. + */ + private OffsetDateTime effectiveAt; + + /* + * Reason for the revocation. + */ + private String reason; + + /* + * Remarks for the revocation. + */ + private String remarks; + + /** + * Creates an instance of RevokeCertificate class. + */ + public RevokeCertificate() { + } + + /** + * Get the serialNumber property: Serial number of the certificate. + * + * @return the serialNumber value. + */ + public String serialNumber() { + return this.serialNumber; + } + + /** + * Set the serialNumber property: Serial number of the certificate. + * + * @param serialNumber the serialNumber value to set. + * @return the RevokeCertificate object itself. + */ + public RevokeCertificate withSerialNumber(String serialNumber) { + this.serialNumber = serialNumber; + return this; + } + + /** + * Get the thumbprint property: Thumbprint of the certificate. + * + * @return the thumbprint value. + */ + public String thumbprint() { + return this.thumbprint; + } + + /** + * Set the thumbprint property: Thumbprint of the certificate. + * + * @param thumbprint the thumbprint value to set. + * @return the RevokeCertificate object itself. + */ + public RevokeCertificate withThumbprint(String thumbprint) { + this.thumbprint = thumbprint; + return this; + } + + /** + * Get the effectiveAt property: The timestamp when the revocation is effective. + * + * @return the effectiveAt value. + */ + public OffsetDateTime effectiveAt() { + return this.effectiveAt; + } + + /** + * Set the effectiveAt property: The timestamp when the revocation is effective. + * + * @param effectiveAt the effectiveAt value to set. + * @return the RevokeCertificate object itself. + */ + public RevokeCertificate withEffectiveAt(OffsetDateTime effectiveAt) { + this.effectiveAt = effectiveAt; + return this; + } + + /** + * Get the reason property: Reason for the revocation. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason property: Reason for the revocation. + * + * @param reason the reason value to set. + * @return the RevokeCertificate object itself. + */ + public RevokeCertificate withReason(String reason) { + this.reason = reason; + return this; + } + + /** + * Get the remarks property: Remarks for the revocation. + * + * @return the remarks value. + */ + public String remarks() { + return this.remarks; + } + + /** + * Set the remarks property: Remarks for the revocation. + * + * @param remarks the remarks value to set. + * @return the RevokeCertificate object itself. + */ + public RevokeCertificate withRemarks(String remarks) { + this.remarks = remarks; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (serialNumber() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property serialNumber in model RevokeCertificate")); + } + if (thumbprint() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property thumbprint in model RevokeCertificate")); + } + if (effectiveAt() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property effectiveAt in model RevokeCertificate")); + } + if (reason() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property reason in model RevokeCertificate")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(RevokeCertificate.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("serialNumber", this.serialNumber); + jsonWriter.writeStringField("thumbprint", this.thumbprint); + jsonWriter.writeStringField("effectiveAt", + this.effectiveAt == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.effectiveAt)); + jsonWriter.writeStringField("reason", this.reason); + jsonWriter.writeStringField("remarks", this.remarks); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RevokeCertificate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RevokeCertificate 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 RevokeCertificate. + */ + public static RevokeCertificate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RevokeCertificate deserializedRevokeCertificate = new RevokeCertificate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("serialNumber".equals(fieldName)) { + deserializedRevokeCertificate.serialNumber = reader.getString(); + } else if ("thumbprint".equals(fieldName)) { + deserializedRevokeCertificate.thumbprint = reader.getString(); + } else if ("effectiveAt".equals(fieldName)) { + deserializedRevokeCertificate.effectiveAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("reason".equals(fieldName)) { + deserializedRevokeCertificate.reason = reader.getString(); + } else if ("remarks".equals(fieldName)) { + deserializedRevokeCertificate.remarks = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedRevokeCertificate; + }); + } +} diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/SkuName.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/SkuName.java new file mode 100644 index 0000000000000..18e554a09a453 --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/SkuName.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.codesigning.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Name of the sku. + */ +public final class SkuName extends ExpandableStringEnum { + /** + * Static value Basic for SkuName. + */ + public static final SkuName BASIC = fromString("Basic"); + + /** + * Static value Premium for SkuName. + */ + public static final SkuName PREMIUM = fromString("Premium"); + + /** + * Creates a new instance of SkuName value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SkuName() { + } + + /** + * Creates or finds a SkuName from its string representation. + * + * @param name a name to look for. + * @return the corresponding SkuName. + */ + public static SkuName fromString(String name) { + return fromString(name, SkuName.class); + } + + /** + * Gets known SkuName values. + * + * @return known SkuName values. + */ + public static Collection values() { + return values(SkuName.class); + } +} diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/package-info.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/package-info.java new file mode 100644 index 0000000000000..37e9df8a244ea --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/models/package-info.java @@ -0,0 +1,9 @@ +// 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 CodeSigningManagementClient. + * Code Signing resource provider api. + */ +package com.azure.resourcemanager.codesigning.models; diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/package-info.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/package-info.java new file mode 100644 index 0000000000000..4789ca7f5d311 --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/com/azure/resourcemanager/codesigning/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the classes for CodeSigningManagementClient. + * Code Signing resource provider api. + */ +package com.azure.resourcemanager.codesigning; diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/module-info.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/module-info.java new file mode 100644 index 0000000000000..b118875ad940e --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/java/module-info.java @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +module com.azure.resourcemanager.codesigning { + requires transitive com.azure.core.management; + exports com.azure.resourcemanager.codesigning; + exports com.azure.resourcemanager.codesigning.fluent; + exports com.azure.resourcemanager.codesigning.fluent.models; + exports com.azure.resourcemanager.codesigning.models; + opens com.azure.resourcemanager.codesigning.fluent.models to com.azure.core; + opens com.azure.resourcemanager.codesigning.models to com.azure.core; +} \ No newline at end of file diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-codesigning/proxy-config.json b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-codesigning/proxy-config.json new file mode 100644 index 0000000000000..f429cf769d2d1 --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-codesigning/proxy-config.json @@ -0,0 +1 @@ +[["com.azure.resourcemanager.codesigning.implementation.CertificateProfilesClientImpl$CertificateProfilesService"],["com.azure.resourcemanager.codesigning.implementation.CodeSigningAccountsClientImpl$CodeSigningAccountsService"],["com.azure.resourcemanager.codesigning.implementation.OperationsClientImpl$OperationsService"]] \ No newline at end of file diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-codesigning/reflect-config.json b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-codesigning/reflect-config.json new file mode 100644 index 0000000000000..0637a088a01e8 --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-codesigning/reflect-config.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/samples/java/com/azure/resourcemanager/codesigning/generated/CertificateProfilesCreateSamples.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/samples/java/com/azure/resourcemanager/codesigning/generated/CertificateProfilesCreateSamples.java new file mode 100644 index 0000000000000..edeff03c32e2f --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/samples/java/com/azure/resourcemanager/codesigning/generated/CertificateProfilesCreateSamples.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.codesigning.generated; + +import com.azure.resourcemanager.codesigning.models.ProfileType; + +/** + * Samples for CertificateProfiles Create. + */ +public final class CertificateProfilesCreateSamples { + /* + * x-ms-original-file: + * specification/codesigning/resource-manager/Microsoft.CodeSigning/preview/2024-09-30-preview/examples/ + * CertificateProfiles_Create.json + */ + /** + * Sample code: Create a certificate profile. + * + * @param manager Entry point to CodeSigningManager. + */ + public static void createACertificateProfile(com.azure.resourcemanager.codesigning.CodeSigningManager manager) { + manager.certificateProfiles() + .define("profileA") + .withExistingCodeSigningAccount("MyResourceGroup", "MyAccount") + .withProfileType(ProfileType.PUBLIC_TRUST) + .withIncludeStreetAddress(false) + .withIncludePostalCode(true) + .withIdentityValidationId("00000000-1234-5678-3333-444444444444") + .create(); + } +} diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/samples/java/com/azure/resourcemanager/codesigning/generated/CertificateProfilesDeleteSamples.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/samples/java/com/azure/resourcemanager/codesigning/generated/CertificateProfilesDeleteSamples.java new file mode 100644 index 0000000000000..d0d1b5b98c962 --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/samples/java/com/azure/resourcemanager/codesigning/generated/CertificateProfilesDeleteSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.codesigning.generated; + +/** + * Samples for CertificateProfiles Delete. + */ +public final class CertificateProfilesDeleteSamples { + /* + * x-ms-original-file: + * specification/codesigning/resource-manager/Microsoft.CodeSigning/preview/2024-09-30-preview/examples/ + * CertificateProfiles_Delete.json + */ + /** + * Sample code: Delete a certificate profile. + * + * @param manager Entry point to CodeSigningManager. + */ + public static void deleteACertificateProfile(com.azure.resourcemanager.codesigning.CodeSigningManager manager) { + manager.certificateProfiles() + .delete("MyResourceGroup", "MyAccount", "profileA", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/samples/java/com/azure/resourcemanager/codesigning/generated/CertificateProfilesGetSamples.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/samples/java/com/azure/resourcemanager/codesigning/generated/CertificateProfilesGetSamples.java new file mode 100644 index 0000000000000..093fd3521b8ed --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/samples/java/com/azure/resourcemanager/codesigning/generated/CertificateProfilesGetSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.codesigning.generated; + +/** + * Samples for CertificateProfiles Get. + */ +public final class CertificateProfilesGetSamples { + /* + * x-ms-original-file: + * specification/codesigning/resource-manager/Microsoft.CodeSigning/preview/2024-09-30-preview/examples/ + * CertificateProfiles_Get.json + */ + /** + * Sample code: Get details of a certificate profile. + * + * @param manager Entry point to CodeSigningManager. + */ + public static void + getDetailsOfACertificateProfile(com.azure.resourcemanager.codesigning.CodeSigningManager manager) { + manager.certificateProfiles() + .getWithResponse("MyResourceGroup", "MyAccount", "profileA", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/samples/java/com/azure/resourcemanager/codesigning/generated/CertificateProfilesListByCodeSigningAccountSamples.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/samples/java/com/azure/resourcemanager/codesigning/generated/CertificateProfilesListByCodeSigningAccountSamples.java new file mode 100644 index 0000000000000..b621d284044eb --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/samples/java/com/azure/resourcemanager/codesigning/generated/CertificateProfilesListByCodeSigningAccountSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.codesigning.generated; + +/** + * Samples for CertificateProfiles ListByCodeSigningAccount. + */ +public final class CertificateProfilesListByCodeSigningAccountSamples { + /* + * x-ms-original-file: + * specification/codesigning/resource-manager/Microsoft.CodeSigning/preview/2024-09-30-preview/examples/ + * CertificateProfiles_ListByCodeSigningAccount.json + */ + /** + * Sample code: List certificate profiles under a trusted signing account. + * + * @param manager Entry point to CodeSigningManager. + */ + public static void listCertificateProfilesUnderATrustedSigningAccount( + com.azure.resourcemanager.codesigning.CodeSigningManager manager) { + manager.certificateProfiles() + .listByCodeSigningAccount("MyResourceGroup", "MyAccount", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/samples/java/com/azure/resourcemanager/codesigning/generated/CertificateProfilesRevokeCertificateSamples.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/samples/java/com/azure/resourcemanager/codesigning/generated/CertificateProfilesRevokeCertificateSamples.java new file mode 100644 index 0000000000000..1baef1de8029e --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/samples/java/com/azure/resourcemanager/codesigning/generated/CertificateProfilesRevokeCertificateSamples.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.codesigning.generated; + +import com.azure.resourcemanager.codesigning.models.RevokeCertificate; +import java.time.OffsetDateTime; + +/** + * Samples for CertificateProfiles RevokeCertificate. + */ +public final class CertificateProfilesRevokeCertificateSamples { + /* + * x-ms-original-file: + * specification/codesigning/resource-manager/Microsoft.CodeSigning/preview/2024-09-30-preview/examples/ + * CertificateProfiles_RevokeCertificate.json + */ + /** + * Sample code: Revoke a certificate under a certificate profile. + * + * @param manager Entry point to CodeSigningManager. + */ + public static void + revokeACertificateUnderACertificateProfile(com.azure.resourcemanager.codesigning.CodeSigningManager manager) { + manager.certificateProfiles() + .revokeCertificateWithResponse("MyResourceGroup", "MyAccount", "profileA", + new RevokeCertificate().withSerialNumber("xxxxxxxxxxxxxxxxxx") + .withThumbprint("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx") + .withEffectiveAt(OffsetDateTime.parse("2023-11-12T23:40:25+00:00")) + .withReason("KeyCompromised") + .withRemarks("test"), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/samples/java/com/azure/resourcemanager/codesigning/generated/CodeSigningAccountsCheckNameAvailabilitySamples.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/samples/java/com/azure/resourcemanager/codesigning/generated/CodeSigningAccountsCheckNameAvailabilitySamples.java new file mode 100644 index 0000000000000..b1c143b2d1e5e --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/samples/java/com/azure/resourcemanager/codesigning/generated/CodeSigningAccountsCheckNameAvailabilitySamples.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.codesigning.generated; + +import com.azure.resourcemanager.codesigning.models.CheckNameAvailability; + +/** + * Samples for CodeSigningAccounts CheckNameAvailability. + */ +public final class CodeSigningAccountsCheckNameAvailabilitySamples { + /* + * x-ms-original-file: + * specification/codesigning/resource-manager/Microsoft.CodeSigning/preview/2024-09-30-preview/examples/ + * CodeSigningAccounts_CheckNameAvailability.json + */ + /** + * Sample code: Checks that the trusted signing account name is available. + * + * @param manager Entry point to CodeSigningManager. + */ + public static void checksThatTheTrustedSigningAccountNameIsAvailable( + com.azure.resourcemanager.codesigning.CodeSigningManager manager) { + manager.codeSigningAccounts() + .checkNameAvailabilityWithResponse(new CheckNameAvailability().withName("sample-account"), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/samples/java/com/azure/resourcemanager/codesigning/generated/CodeSigningAccountsCreateSamples.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/samples/java/com/azure/resourcemanager/codesigning/generated/CodeSigningAccountsCreateSamples.java new file mode 100644 index 0000000000000..f4515aa7fa8ef --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/samples/java/com/azure/resourcemanager/codesigning/generated/CodeSigningAccountsCreateSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.codesigning.generated; + +import com.azure.resourcemanager.codesigning.models.AccountSku; +import com.azure.resourcemanager.codesigning.models.SkuName; + +/** + * Samples for CodeSigningAccounts Create. + */ +public final class CodeSigningAccountsCreateSamples { + /* + * x-ms-original-file: + * specification/codesigning/resource-manager/Microsoft.CodeSigning/preview/2024-09-30-preview/examples/ + * CodeSigningAccounts_Create.json + */ + /** + * Sample code: Create a trusted Signing Account. + * + * @param manager Entry point to CodeSigningManager. + */ + public static void createATrustedSigningAccount(com.azure.resourcemanager.codesigning.CodeSigningManager manager) { + manager.codeSigningAccounts() + .define("MyAccount") + .withRegion("westus") + .withExistingResourceGroup("MyResourceGroup") + .withSku(new AccountSku().withName(SkuName.BASIC)) + .create(); + } +} diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/samples/java/com/azure/resourcemanager/codesigning/generated/CodeSigningAccountsDeleteSamples.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/samples/java/com/azure/resourcemanager/codesigning/generated/CodeSigningAccountsDeleteSamples.java new file mode 100644 index 0000000000000..fee6aa9ba1970 --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/samples/java/com/azure/resourcemanager/codesigning/generated/CodeSigningAccountsDeleteSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.codesigning.generated; + +/** + * Samples for CodeSigningAccounts Delete. + */ +public final class CodeSigningAccountsDeleteSamples { + /* + * x-ms-original-file: + * specification/codesigning/resource-manager/Microsoft.CodeSigning/preview/2024-09-30-preview/examples/ + * CodeSigningAccounts_Delete.json + */ + /** + * Sample code: Delete a trusted signing account. + * + * @param manager Entry point to CodeSigningManager. + */ + public static void deleteATrustedSigningAccount(com.azure.resourcemanager.codesigning.CodeSigningManager manager) { + manager.codeSigningAccounts().delete("MyResourceGroup", "MyAccount", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/samples/java/com/azure/resourcemanager/codesigning/generated/CodeSigningAccountsGetByResourceGroupSamples.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/samples/java/com/azure/resourcemanager/codesigning/generated/CodeSigningAccountsGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..885a4612b2ab5 --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/samples/java/com/azure/resourcemanager/codesigning/generated/CodeSigningAccountsGetByResourceGroupSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.codesigning.generated; + +/** + * Samples for CodeSigningAccounts GetByResourceGroup. + */ +public final class CodeSigningAccountsGetByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/codesigning/resource-manager/Microsoft.CodeSigning/preview/2024-09-30-preview/examples/ + * CodeSigningAccounts_Get.json + */ + /** + * Sample code: Get a Trusted Signing Account. + * + * @param manager Entry point to CodeSigningManager. + */ + public static void getATrustedSigningAccount(com.azure.resourcemanager.codesigning.CodeSigningManager manager) { + manager.codeSigningAccounts() + .getByResourceGroupWithResponse("MyResourceGroup", "MyAccount", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/samples/java/com/azure/resourcemanager/codesigning/generated/CodeSigningAccountsListByResourceGroupSamples.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/samples/java/com/azure/resourcemanager/codesigning/generated/CodeSigningAccountsListByResourceGroupSamples.java new file mode 100644 index 0000000000000..c76c002356762 --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/samples/java/com/azure/resourcemanager/codesigning/generated/CodeSigningAccountsListByResourceGroupSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.codesigning.generated; + +/** + * Samples for CodeSigningAccounts ListByResourceGroup. + */ +public final class CodeSigningAccountsListByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/codesigning/resource-manager/Microsoft.CodeSigning/preview/2024-09-30-preview/examples/ + * CodeSigningAccounts_ListByResourceGroup.json + */ + /** + * Sample code: Lists trusted signing accounts within a resource group. + * + * @param manager Entry point to CodeSigningManager. + */ + public static void listsTrustedSigningAccountsWithinAResourceGroup( + com.azure.resourcemanager.codesigning.CodeSigningManager manager) { + manager.codeSigningAccounts().listByResourceGroup("MyResourceGroup", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/samples/java/com/azure/resourcemanager/codesigning/generated/CodeSigningAccountsListSamples.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/samples/java/com/azure/resourcemanager/codesigning/generated/CodeSigningAccountsListSamples.java new file mode 100644 index 0000000000000..a9ae9f5eecb89 --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/samples/java/com/azure/resourcemanager/codesigning/generated/CodeSigningAccountsListSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.codesigning.generated; + +/** + * Samples for CodeSigningAccounts List. + */ +public final class CodeSigningAccountsListSamples { + /* + * x-ms-original-file: + * specification/codesigning/resource-manager/Microsoft.CodeSigning/preview/2024-09-30-preview/examples/ + * CodeSigningAccounts_ListBySubscription.json + */ + /** + * Sample code: Lists trusted signing accounts within a subscription. + * + * @param manager Entry point to CodeSigningManager. + */ + public static void listsTrustedSigningAccountsWithinASubscription( + com.azure.resourcemanager.codesigning.CodeSigningManager manager) { + manager.codeSigningAccounts().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/samples/java/com/azure/resourcemanager/codesigning/generated/CodeSigningAccountsUpdateSamples.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/samples/java/com/azure/resourcemanager/codesigning/generated/CodeSigningAccountsUpdateSamples.java new file mode 100644 index 0000000000000..18a6f4b1ad43e --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/samples/java/com/azure/resourcemanager/codesigning/generated/CodeSigningAccountsUpdateSamples.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.codesigning.generated; + +import com.azure.resourcemanager.codesigning.models.CodeSigningAccount; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for CodeSigningAccounts Update. + */ +public final class CodeSigningAccountsUpdateSamples { + /* + * x-ms-original-file: + * specification/codesigning/resource-manager/Microsoft.CodeSigning/preview/2024-09-30-preview/examples/ + * CodeSigningAccounts_Update.json + */ + /** + * Sample code: Update a trusted signing account. + * + * @param manager Entry point to CodeSigningManager. + */ + public static void updateATrustedSigningAccount(com.azure.resourcemanager.codesigning.CodeSigningManager manager) { + CodeSigningAccount resource = manager.codeSigningAccounts() + .getByResourceGroupWithResponse("MyResourceGroup", "MyAccount", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("key1", "fakeTokenPlaceholder")).apply(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/codesigning/azure-resourcemanager-codesigning/src/samples/java/com/azure/resourcemanager/codesigning/generated/OperationsListSamples.java b/sdk/codesigning/azure-resourcemanager-codesigning/src/samples/java/com/azure/resourcemanager/codesigning/generated/OperationsListSamples.java new file mode 100644 index 0000000000000..60f2765009dfb --- /dev/null +++ b/sdk/codesigning/azure-resourcemanager-codesigning/src/samples/java/com/azure/resourcemanager/codesigning/generated/OperationsListSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.codesigning.generated; + +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: + * specification/codesigning/resource-manager/Microsoft.CodeSigning/preview/2024-09-30-preview/examples/ + * Operations_List.json + */ + /** + * Sample code: List trusted signing account operations. + * + * @param manager Entry point to CodeSigningManager. + */ + public static void + listTrustedSigningAccountOperations(com.azure.resourcemanager.codesigning.CodeSigningManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/codesigning/ci.yml b/sdk/codesigning/ci.yml new file mode 100644 index 0000000000000..3324cc261bd65 --- /dev/null +++ b/sdk/codesigning/ci.yml @@ -0,0 +1,46 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + paths: + include: + - sdk/codesigning/ci.yml + - sdk/codesigning/azure-resourcemanager-codesigning/ + exclude: + - sdk/codesigning/pom.xml + - sdk/codesigning/azure-resourcemanager-codesigning/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/codesigning/ci.yml + - sdk/codesigning/azure-resourcemanager-codesigning/ + exclude: + - sdk/codesigning/pom.xml + - sdk/codesigning/azure-resourcemanager-codesigning/pom.xml + +parameters: + - name: release_azureresourcemanagercodesigning + displayName: azure-resourcemanager-codesigning + type: boolean + default: false + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: codesigning + Artifacts: + - name: azure-resourcemanager-codesigning + groupId: com.azure.resourcemanager + safeName: azureresourcemanagercodesigning + releaseInBatch: ${{ parameters.release_azureresourcemanagercodesigning }} diff --git a/sdk/codesigning/pom.xml b/sdk/codesigning/pom.xml new file mode 100644 index 0000000000000..56524684e8f2d --- /dev/null +++ b/sdk/codesigning/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + com.azure + azure-codesigning-service + pom + 1.0.0 + + + azure-resourcemanager-codesigning + + diff --git a/sdk/fabric/azure-resourcemanager-fabric/pom.xml b/sdk/fabric/azure-resourcemanager-fabric/pom.xml index 7a77f7f6000d4..ce4f5692fb686 100644 --- a/sdk/fabric/azure-resourcemanager-fabric/pom.xml +++ b/sdk/fabric/azure-resourcemanager-fabric/pom.xml @@ -66,7 +66,7 @@ com.azure azure-core-test - 1.26.2 + 1.27.0-beta.1 test