diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index f5278c2caf7c..87feb509f287 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -517,6 +517,7 @@ com.azure.resourcemanager:azure-resourcemanager-containerregistry-tasks;1.0.0-be com.azure.resourcemanager:azure-resourcemanager-virtualenclaves;1.0.0-beta.1;1.0.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-edgeactions;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-computebulkactions;1.0.0-beta.1;1.0.0-beta.1 +com.azure.resourcemanager:azure-resourcemanager-artifactsigning;1.0.0;1.0.0 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 com.azure.v2:azure-client-sdk-parent;2.0.0-beta.2;2.0.0-beta.2 diff --git a/pom.xml b/pom.xml index 01f8d17ea4dc..9009a2b88fcd 100644 --- a/pom.xml +++ b/pom.xml @@ -25,6 +25,7 @@ sdk/appplatform sdk/appservice sdk/arizeaiobservabilityeval + sdk/artifactsigning sdk/astro sdk/attestation sdk/authorization diff --git a/sdk/artifactsigning/azure-resourcemanager-artifactsigning/CHANGELOG.md b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/CHANGELOG.md new file mode 100644 index 000000000000..1abca64bcef0 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 1.0.0 (2026-02-11) + +- Azure Resource Manager Artifact Signing client library for Java. This package contains Microsoft Azure SDK for Artifact Signing Management SDK. Code Signing resource provider api. Package api-version 1.0.0. 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-artifactsigning Java SDK. diff --git a/sdk/artifactsigning/azure-resourcemanager-artifactsigning/README.md b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/README.md new file mode 100644 index 000000000000..c26ff4b5d9d3 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/README.md @@ -0,0 +1,102 @@ +# Azure Resource Manager Artifact Signing client library for Java + +Azure Resource Manager Artifact Signing client library for Java. + +This package contains Microsoft Azure SDK for Artifact Signing Management SDK. Code Signing resource provider api. Package api-version 1.0.0. 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-artifactsigning;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-artifactsigning + 1.0.0 + +``` +[//]: # ({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(AzureCloud.AZURE_PUBLIC_CLOUD); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +ArtifactSigningManager manager = ArtifactSigningManager + .authenticate(credential, profile); +``` + +The sample code assumes global Azure. Please change the `AzureCloud.AZURE_PUBLIC_CLOUD` 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/artifactsigning/azure-resourcemanager-artifactsigning/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/ diff --git a/sdk/artifactsigning/azure-resourcemanager-artifactsigning/SAMPLE.md b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/SAMPLE.md new file mode 100644 index 000000000000..7d3a44603f78 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/SAMPLE.md @@ -0,0 +1,366 @@ +# 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.artifactsigning.models.ProfileType; + +/** + * Samples for CertificateProfiles Create. + */ +public final class CertificateProfilesCreateSamples { + /* + * x-ms-original-file: 2025-10-13/CertificateProfiles_Create.json + */ + /** + * Sample code: Create a certificate profile. + * + * @param manager Entry point to ArtifactSigningManager. + */ + public static void + createACertificateProfile(com.azure.resourcemanager.artifactsigning.ArtifactSigningManager 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: 2025-10-13/CertificateProfiles_Delete.json + */ + /** + * Sample code: Delete a certificate profile. + * + * @param manager Entry point to ArtifactSigningManager. + */ + public static void + deleteACertificateProfile(com.azure.resourcemanager.artifactsigning.ArtifactSigningManager 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: 2025-10-13/CertificateProfiles_Get.json + */ + /** + * Sample code: Get details of a certificate profile. + * + * @param manager Entry point to ArtifactSigningManager. + */ + public static void + getDetailsOfACertificateProfile(com.azure.resourcemanager.artifactsigning.ArtifactSigningManager 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: 2025-10-13/CertificateProfiles_ListByCodeSigningAccount.json + */ + /** + * Sample code: List certificate profiles under an artifact signing account. + * + * @param manager Entry point to ArtifactSigningManager. + */ + public static void listCertificateProfilesUnderAnArtifactSigningAccount( + com.azure.resourcemanager.artifactsigning.ArtifactSigningManager manager) { + manager.certificateProfiles() + .listByCodeSigningAccount("MyResourceGroup", "MyAccount", com.azure.core.util.Context.NONE); + } +} +``` + +### CertificateProfiles_RevokeCertificate + +```java +import com.azure.resourcemanager.artifactsigning.models.RevokeCertificate; +import java.time.OffsetDateTime; + +/** + * Samples for CertificateProfiles RevokeCertificate. + */ +public final class CertificateProfilesRevokeCertificateSamples { + /* + * x-ms-original-file: 2025-10-13/CertificateProfiles_RevokeCertificate.json + */ + /** + * Sample code: Revoke a certificate under a certificate profile. + * + * @param manager Entry point to ArtifactSigningManager. + */ + public static void revokeACertificateUnderACertificateProfile( + com.azure.resourcemanager.artifactsigning.ArtifactSigningManager 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.artifactsigning.models.CheckNameAvailability; + +/** + * Samples for CodeSigningAccounts CheckNameAvailability. + */ +public final class CodeSigningAccountsCheckNameAvailabilitySamples { + /* + * x-ms-original-file: 2025-10-13/CodeSigningAccounts_CheckNameAvailability.json + */ + /** + * Sample code: Checks if the artifact signing account name is available. + * + * @param manager Entry point to ArtifactSigningManager. + */ + public static void checksIfTheArtifactSigningAccountNameIsAvailable( + com.azure.resourcemanager.artifactsigning.ArtifactSigningManager manager) { + manager.codeSigningAccounts() + .checkNameAvailabilityWithResponse( + new CheckNameAvailability().withType("Microsoft.CodeSigning/codeSigningAccounts") + .withName("sample-account"), + com.azure.core.util.Context.NONE); + } +} +``` + +### CodeSigningAccounts_Create + +```java +import com.azure.resourcemanager.artifactsigning.models.AccountSku; +import com.azure.resourcemanager.artifactsigning.models.SkuName; + +/** + * Samples for CodeSigningAccounts Create. + */ +public final class CodeSigningAccountsCreateSamples { + /* + * x-ms-original-file: 2025-10-13/CodeSigningAccounts_Create.json + */ + /** + * Sample code: Create an artifact signing account. + * + * @param manager Entry point to ArtifactSigningManager. + */ + public static void + createAnArtifactSigningAccount(com.azure.resourcemanager.artifactsigning.ArtifactSigningManager 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: 2025-10-13/CodeSigningAccounts_Delete.json + */ + /** + * Sample code: Delete an artifact signing account. + * + * @param manager Entry point to ArtifactSigningManager. + */ + public static void + deleteAnArtifactSigningAccount(com.azure.resourcemanager.artifactsigning.ArtifactSigningManager 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: 2025-10-13/CodeSigningAccounts_Get.json + */ + /** + * Sample code: Get an artifact signing account. + * + * @param manager Entry point to ArtifactSigningManager. + */ + public static void + getAnArtifactSigningAccount(com.azure.resourcemanager.artifactsigning.ArtifactSigningManager 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: 2025-10-13/CodeSigningAccounts_ListBySubscription.json + */ + /** + * Sample code: Lists artifact signing accounts within a subscription. + * + * @param manager Entry point to ArtifactSigningManager. + */ + public static void listsArtifactSigningAccountsWithinASubscription( + com.azure.resourcemanager.artifactsigning.ArtifactSigningManager 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: 2025-10-13/CodeSigningAccounts_ListByResourceGroup.json + */ + /** + * Sample code: Lists artifact signing accounts within a resource group. + * + * @param manager Entry point to ArtifactSigningManager. + */ + public static void listsArtifactSigningAccountsWithinAResourceGroup( + com.azure.resourcemanager.artifactsigning.ArtifactSigningManager manager) { + manager.codeSigningAccounts().listByResourceGroup("MyResourceGroup", com.azure.core.util.Context.NONE); + } +} +``` + +### CodeSigningAccounts_Update + +```java +import com.azure.resourcemanager.artifactsigning.models.CodeSigningAccount; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for CodeSigningAccounts Update. + */ +public final class CodeSigningAccountsUpdateSamples { + /* + * x-ms-original-file: 2025-10-13/CodeSigningAccounts_Update.json + */ + /** + * Sample code: Update an artifact signing account. + * + * @param manager Entry point to ArtifactSigningManager. + */ + public static void + updateAnArtifactSigningAccount(com.azure.resourcemanager.artifactsigning.ArtifactSigningManager 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: 2025-10-13/Operations_List.json + */ + /** + * Sample code: List artifact signing account operations. + * + * @param manager Entry point to ArtifactSigningManager. + */ + public static void + listArtifactSigningAccountOperations(com.azure.resourcemanager.artifactsigning.ArtifactSigningManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} +``` + diff --git a/sdk/artifactsigning/azure-resourcemanager-artifactsigning/pom.xml b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/pom.xml new file mode 100644 index 000000000000..602edf96dbd6 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/pom.xml @@ -0,0 +1,73 @@ + + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-artifactsigning + 1.0.0 + jar + + Microsoft Azure SDK for Artifact Signing Management + This package contains Microsoft Azure SDK for Artifact Signing Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Code Signing resource provider api. Package api-version 1.0.0. + 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 + + + + com.azure + azure-core + 1.57.1 + + + com.azure + azure-core-management + 1.19.3 + + + com.azure + azure-core-test + 1.27.0-beta.14 + test + + + com.azure + azure-identity + 1.18.2 + test + + + diff --git a/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/ArtifactSigningManager.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/ArtifactSigningManager.java new file mode 100644 index 000000000000..7712fdecefbe --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/ArtifactSigningManager.java @@ -0,0 +1,314 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning; + +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.BearerTokenAuthenticationPolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +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.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.artifactsigning.fluent.ArtifactSigningManagementClient; +import com.azure.resourcemanager.artifactsigning.implementation.ArtifactSigningManagementClientBuilder; +import com.azure.resourcemanager.artifactsigning.implementation.CertificateProfilesImpl; +import com.azure.resourcemanager.artifactsigning.implementation.CodeSigningAccountsImpl; +import com.azure.resourcemanager.artifactsigning.implementation.OperationsImpl; +import com.azure.resourcemanager.artifactsigning.models.CertificateProfiles; +import com.azure.resourcemanager.artifactsigning.models.CodeSigningAccounts; +import com.azure.resourcemanager.artifactsigning.models.Operations; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * Entry point to ArtifactSigningManager. + * Code Signing resource provider api. + */ +public final class ArtifactSigningManager { + private Operations operations; + + private CodeSigningAccounts codeSigningAccounts; + + private CertificateProfiles certificateProfiles; + + private final ArtifactSigningManagementClient clientObject; + + private ArtifactSigningManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = new ArtifactSigningManagementClientBuilder().pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of Artifact Signing service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Artifact Signing service API instance. + */ + public static ArtifactSigningManager 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 Artifact Signing service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the Artifact Signing service API instance. + */ + public static ArtifactSigningManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new ArtifactSigningManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create ArtifactSigningManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new ArtifactSigningManager.Configurable(); + } + + /** + * The Configurable allowing configurations to be set. + */ + public static final class Configurable { + private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); + private static final String SDK_VERSION = "version"; + private static final Map PROPERTIES + = CoreUtils.getProperties("azure-resourcemanager-artifactsigning.properties"); + + 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 Artifact Signing service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Artifact Signing service API instance. + */ + public ArtifactSigningManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder.append("azsdk-java") + .append("-") + .append("com.azure.resourcemanager.artifactsigning") + .append("/") + .append(clientVersion); + 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 BearerTokenAuthenticationPolicy(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 ArtifactSigningManager(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 ArtifactSigningManagementClient providing direct access to the underlying + * auto-generated API implementation, based on Azure REST API. + * + * @return Wrapped service client ArtifactSigningManagementClient. + */ + public ArtifactSigningManagementClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/fluent/ArtifactSigningManagementClient.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/fluent/ArtifactSigningManagementClient.java new file mode 100644 index 000000000000..937e4cd5f31c --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/fluent/ArtifactSigningManagementClient.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** + * The interface for ArtifactSigningManagementClient class. + */ +public interface ArtifactSigningManagementClient { + /** + * Gets Service host. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Version parameter. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * 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/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/fluent/CertificateProfilesClient.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/fluent/CertificateProfilesClient.java new file mode 100644 index 000000000000..98828edc0ba4 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/fluent/CertificateProfilesClient.java @@ -0,0 +1,232 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.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.artifactsigning.fluent.models.CertificateProfileInner; +import com.azure.resourcemanager.artifactsigning.models.RevokeCertificate; + +/** + * An instance of this class provides access to all the operations defined in CertificateProfilesClient. + */ +public interface CertificateProfilesClient { + /** + * Get details of a certificate profile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact 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 Artifact 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 Artifact 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 Artifact 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 Artifact 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 Artifact 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 Artifact 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 Artifact 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 Artifact 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 Artifact 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); + + /** + * List certificate profiles under an artifact signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact 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 an artifact signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact 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); + + /** + * Revoke a certificate under a certificate profile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact 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 Artifact 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/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/fluent/CodeSigningAccountsClient.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/fluent/CodeSigningAccountsClient.java new file mode 100644 index 000000000000..12bc9dbee111 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/fluent/CodeSigningAccountsClient.java @@ -0,0 +1,297 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.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.artifactsigning.fluent.models.CheckNameAvailabilityResultInner; +import com.azure.resourcemanager.artifactsigning.fluent.models.CodeSigningAccountInner; +import com.azure.resourcemanager.artifactsigning.models.CheckNameAvailability; +import com.azure.resourcemanager.artifactsigning.models.CodeSigningAccountPatch; + +/** + * An instance of this class provides access to all the operations defined in CodeSigningAccountsClient. + */ +public interface CodeSigningAccountsClient { + /** + * Get an artifact Signing Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact 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 an artifact Signing Account along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, String accountName, + Context context); + + /** + * Get an artifact Signing Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact 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 an artifact Signing Account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CodeSigningAccountInner getByResourceGroup(String resourceGroupName, String accountName); + + /** + * Create an artifact Signing Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact Signing account name. + * @param resource Parameters to create the artifact 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 artifact signing account resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CodeSigningAccountInner> beginCreate(String resourceGroupName, + String accountName, CodeSigningAccountInner resource); + + /** + * Create an artifact Signing Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact Signing account name. + * @param resource Parameters to create the artifact 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 artifact signing account resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CodeSigningAccountInner> beginCreate(String resourceGroupName, + String accountName, CodeSigningAccountInner resource, Context context); + + /** + * Create an artifact Signing Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact Signing account name. + * @param resource Parameters to create the artifact 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 artifact signing account resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CodeSigningAccountInner create(String resourceGroupName, String accountName, CodeSigningAccountInner resource); + + /** + * Create an artifact Signing Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact Signing account name. + * @param resource Parameters to create the artifact 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 artifact signing account resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CodeSigningAccountInner create(String resourceGroupName, String accountName, CodeSigningAccountInner resource, + Context context); + + /** + * Update an artifact signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact Signing account name. + * @param properties Parameters supplied to update the artifact 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 artifact signing account resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CodeSigningAccountInner> beginUpdate(String resourceGroupName, + String accountName, CodeSigningAccountPatch properties); + + /** + * Update an artifact signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact Signing account name. + * @param properties Parameters supplied to update the artifact 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 artifact signing account resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, CodeSigningAccountInner> beginUpdate(String resourceGroupName, + String accountName, CodeSigningAccountPatch properties, Context context); + + /** + * Update an artifact signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact Signing account name. + * @param properties Parameters supplied to update the artifact 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 artifact signing account resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CodeSigningAccountInner update(String resourceGroupName, String accountName, CodeSigningAccountPatch properties); + + /** + * Update an artifact signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact Signing account name. + * @param properties Parameters supplied to update the artifact 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 artifact signing account resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CodeSigningAccountInner update(String resourceGroupName, String accountName, CodeSigningAccountPatch properties, + Context context); + + /** + * Delete an artifact signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact 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 an artifact signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact 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 an artifact signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact 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 an artifact signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact 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); + + /** + * Lists artifact 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 artifact 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); + + /** + * Lists artifact 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 artifact 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); + + /** + * Checks if the artifact 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 if the artifact 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); +} diff --git a/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/fluent/OperationsClient.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/fluent/OperationsClient.java new file mode 100644 index 000000000000..d11eb0130a86 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/fluent/OperationsClient.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.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.artifactsigning.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/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/fluent/models/CertificateProfileInner.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/fluent/models/CertificateProfileInner.java new file mode 100644 index 000000000000..cb685263393a --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/fluent/models/CertificateProfileInner.java @@ -0,0 +1,342 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.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.artifactsigning.models.Certificate; +import com.azure.resourcemanager.artifactsigning.models.CertificateProfileStatus; +import com.azure.resourcemanager.artifactsigning.models.ProfileType; +import com.azure.resourcemanager.artifactsigning.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(); + } + + /** + * {@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/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/fluent/models/CertificateProfileProperties.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/fluent/models/CertificateProfileProperties.java new file mode 100644 index 000000000000..00b30001d9b5 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/fluent/models/CertificateProfileProperties.java @@ -0,0 +1,322 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.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.artifactsigning.models.Certificate; +import com.azure.resourcemanager.artifactsigning.models.CertificateProfileStatus; +import com.azure.resourcemanager.artifactsigning.models.ProfileType; +import com.azure.resourcemanager.artifactsigning.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; + } + + /** + * {@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/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/fluent/models/CheckNameAvailabilityResultInner.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/fluent/models/CheckNameAvailabilityResultInner.java new file mode 100644 index 000000000000..17c9680cca81 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/fluent/models/CheckNameAvailabilityResultInner.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.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.artifactsigning.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 an artifact 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. + */ + private 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 an artifact 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; + } + + /** + * {@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/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/fluent/models/CodeSigningAccountInner.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/fluent/models/CodeSigningAccountInner.java new file mode 100644 index 000000000000..e99093ac2658 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/fluent/models/CodeSigningAccountInner.java @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.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.artifactsigning.models.AccountSku; +import com.azure.resourcemanager.artifactsigning.models.ProvisioningState; +import java.io.IOException; +import java.util.Map; + +/** + * Artifact 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 artifact 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 artifact signing account. + * + * @return the sku value. + */ + public AccountSku sku() { + return this.innerProperties() == null ? null : this.innerProperties().sku(); + } + + /** + * Set the sku property: SKU of the artifact 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 artifact signing account. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * {@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/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/fluent/models/CodeSigningAccountPatchProperties.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/fluent/models/CodeSigningAccountPatchProperties.java new file mode 100644 index 000000000000..30637e011621 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/fluent/models/CodeSigningAccountPatchProperties.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.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.artifactsigning.models.AccountSkuPatch; +import java.io.IOException; + +/** + * Properties of the artifact signing account. + */ +@Fluent +public final class CodeSigningAccountPatchProperties implements JsonSerializable { + /* + * SKU of the artifact signing account. + */ + private AccountSkuPatch sku; + + /** + * Creates an instance of CodeSigningAccountPatchProperties class. + */ + public CodeSigningAccountPatchProperties() { + } + + /** + * Get the sku property: SKU of the artifact signing account. + * + * @return the sku value. + */ + public AccountSkuPatch sku() { + return this.sku; + } + + /** + * Set the sku property: SKU of the artifact signing account. + * + * @param sku the sku value to set. + * @return the CodeSigningAccountPatchProperties object itself. + */ + public CodeSigningAccountPatchProperties withSku(AccountSkuPatch sku) { + this.sku = sku; + return this; + } + + /** + * {@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/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/fluent/models/CodeSigningAccountProperties.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/fluent/models/CodeSigningAccountProperties.java new file mode 100644 index 000000000000..367a0761f7a4 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/fluent/models/CodeSigningAccountProperties.java @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.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.artifactsigning.models.AccountSku; +import com.azure.resourcemanager.artifactsigning.models.ProvisioningState; +import java.io.IOException; + +/** + * Properties of the artifact signing account. + */ +@Fluent +public final class CodeSigningAccountProperties implements JsonSerializable { + /* + * The URI of the artifact signing account which is used during signing files. + */ + private String accountUri; + + /* + * SKU of the artifact signing account. + */ + private AccountSku sku; + + /* + * Status of the current operation on artifact signing account. + */ + private ProvisioningState provisioningState; + + /** + * Creates an instance of CodeSigningAccountProperties class. + */ + public CodeSigningAccountProperties() { + } + + /** + * Get the accountUri property: The URI of the artifact 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 artifact signing account. + * + * @return the sku value. + */ + public AccountSku sku() { + return this.sku; + } + + /** + * Set the sku property: SKU of the artifact 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 artifact signing account. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * {@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/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/fluent/models/OperationInner.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/fluent/models/OperationInner.java new file mode 100644 index 000000000000..fa01270734c6 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/fluent/models/OperationInner.java @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.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.artifactsigning.models.ActionType; +import com.azure.resourcemanager.artifactsigning.models.OperationDisplay; +import com.azure.resourcemanager.artifactsigning.models.Origin; +import java.io.IOException; + +/** + * REST API Operation + * + * Details of a REST API operation, returned from the Resource Provider Operations API. + */ +@Immutable +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 Azure + * Resource Manager/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; + + /* + * Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ + private ActionType actionType; + + /** + * Creates an instance of OperationInner class. + */ + private 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 Azure Resource Manager/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; + } + + /** + * 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: Extensible 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; + } + + /** + * {@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/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/fluent/models/Revocation.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/fluent/models/Revocation.java new file mode 100644 index 000000000000..48189f855d96 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/fluent/models/Revocation.java @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.fluent.models; + +import com.azure.core.annotation.Immutable; +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.artifactsigning.models.RevocationStatus; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * Revocation details of the certificate. + */ +@Immutable +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. + */ + private Revocation() { + } + + /** + * Get the requestedAt property: The timestamp when the revocation is requested. + * + * @return the requestedAt value. + */ + public OffsetDateTime requestedAt() { + return this.requestedAt; + } + + /** + * Get the effectiveAt property: The timestamp when the revocation is effective. + * + * @return the effectiveAt value. + */ + public OffsetDateTime effectiveAt() { + return this.effectiveAt; + } + + /** + * Get the reason property: Reason for revocation. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * Get the remarks property: Remarks for the revocation. + * + * @return the remarks value. + */ + public String remarks() { + return this.remarks; + } + + /** + * 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; + } + + /** + * {@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("status", this.status == null ? null : this.status.toString()); + 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/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/fluent/models/package-info.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/fluent/models/package-info.java new file mode 100644 index 000000000000..ef1ad4e2d0f9 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/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) TypeSpec Code Generator. + +/** + * Package containing the inner data models for ArtifactSigning. + * Code Signing resource provider api. + */ +package com.azure.resourcemanager.artifactsigning.fluent.models; diff --git a/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/fluent/package-info.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/fluent/package-info.java new file mode 100644 index 000000000000..1a410e3f1c79 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/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) TypeSpec Code Generator. + +/** + * Package containing the service clients for ArtifactSigning. + * Code Signing resource provider api. + */ +package com.azure.resourcemanager.artifactsigning.fluent; diff --git a/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/implementation/ArtifactSigningManagementClientBuilder.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/implementation/ArtifactSigningManagementClientBuilder.java new file mode 100644 index 000000000000..8639e4073384 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/implementation/ArtifactSigningManagementClientBuilder.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.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 ArtifactSigningManagementClientImpl type. + */ +@ServiceClientBuilder(serviceClients = { ArtifactSigningManagementClientImpl.class }) +public final class ArtifactSigningManagementClientBuilder { + /* + * Service host + */ + private String endpoint; + + /** + * Sets Service host. + * + * @param endpoint the endpoint value. + * @return the ArtifactSigningManagementClientBuilder. + */ + public ArtifactSigningManagementClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * 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 ArtifactSigningManagementClientBuilder. + */ + public ArtifactSigningManagementClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * The environment to connect to + */ + private AzureEnvironment environment; + + /** + * Sets The environment to connect to. + * + * @param environment the environment value. + * @return the ArtifactSigningManagementClientBuilder. + */ + public ArtifactSigningManagementClientBuilder 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 ArtifactSigningManagementClientBuilder. + */ + public ArtifactSigningManagementClientBuilder 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 ArtifactSigningManagementClientBuilder. + */ + public ArtifactSigningManagementClientBuilder 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 ArtifactSigningManagementClientBuilder. + */ + public ArtifactSigningManagementClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of ArtifactSigningManagementClientImpl with the provided parameters. + * + * @return an instance of ArtifactSigningManagementClientImpl. + */ + public ArtifactSigningManagementClientImpl 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(); + ArtifactSigningManagementClientImpl client = new ArtifactSigningManagementClientImpl(localPipeline, + localSerializerAdapter, localDefaultPollInterval, localEnvironment, localEndpoint, this.subscriptionId); + return client; + } +} diff --git a/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/implementation/ArtifactSigningManagementClientImpl.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/implementation/ArtifactSigningManagementClientImpl.java new file mode 100644 index 000000000000..a7b52f4890d5 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/implementation/ArtifactSigningManagementClientImpl.java @@ -0,0 +1,340 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.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.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.management.polling.SyncPollerFactory; +import com.azure.core.util.BinaryData; +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.polling.SyncPoller; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.artifactsigning.fluent.ArtifactSigningManagementClient; +import com.azure.resourcemanager.artifactsigning.fluent.CertificateProfilesClient; +import com.azure.resourcemanager.artifactsigning.fluent.CodeSigningAccountsClient; +import com.azure.resourcemanager.artifactsigning.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 ArtifactSigningManagementClientImpl type. + */ +@ServiceClient(builder = ArtifactSigningManagementClientBuilder.class) +public final class ArtifactSigningManagementClientImpl implements ArtifactSigningManagementClient { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Version parameter. + */ + private final String apiVersion; + + /** + * Gets Version parameter. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** + * 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; + } + + /** + * 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 ArtifactSigningManagementClient 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 endpoint Service host. + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + */ + ArtifactSigningManagementClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, + Duration defaultPollInterval, AzureEnvironment environment, String endpoint, String subscriptionId) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.endpoint = endpoint; + this.subscriptionId = subscriptionId; + this.apiVersion = "2025-10-13"; + 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 long running operation result. + * + * @param activationResponse the response of activation operation. + * @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 SyncPoller for poll result and final result. + */ + public SyncPoller, U> getLroResult(Response activationResponse, + Type pollResultType, Type finalResultType, Context context) { + return SyncPollerFactory.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(ArtifactSigningManagementClientImpl.class); +} diff --git a/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/implementation/CertificateProfileImpl.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/implementation/CertificateProfileImpl.java new file mode 100644 index 000000000000..c17cfd51b9e4 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/implementation/CertificateProfileImpl.java @@ -0,0 +1,192 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.artifactsigning.fluent.models.CertificateProfileInner; +import com.azure.resourcemanager.artifactsigning.models.Certificate; +import com.azure.resourcemanager.artifactsigning.models.CertificateProfile; +import com.azure.resourcemanager.artifactsigning.models.CertificateProfileStatus; +import com.azure.resourcemanager.artifactsigning.models.ProfileType; +import com.azure.resourcemanager.artifactsigning.models.ProvisioningState; +import com.azure.resourcemanager.artifactsigning.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.artifactsigning.ArtifactSigningManager serviceManager; + + CertificateProfileImpl(CertificateProfileInner innerObject, + com.azure.resourcemanager.artifactsigning.ArtifactSigningManager 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.artifactsigning.ArtifactSigningManager 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.artifactsigning.ArtifactSigningManager 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/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/implementation/CertificateProfilesClientImpl.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/implementation/CertificateProfilesClientImpl.java new file mode 100644 index 000000000000..e7f7b14988c5 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/implementation/CertificateProfilesClientImpl.java @@ -0,0 +1,868 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.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.BinaryData; +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.artifactsigning.fluent.CertificateProfilesClient; +import com.azure.resourcemanager.artifactsigning.fluent.models.CertificateProfileInner; +import com.azure.resourcemanager.artifactsigning.implementation.models.CertificateProfileListResult; +import com.azure.resourcemanager.artifactsigning.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 ArtifactSigningManagementClientImpl client; + + /** + * Initializes an instance of CertificateProfilesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CertificateProfilesClientImpl(ArtifactSigningManagementClientImpl client) { + this.service = RestProxy.create(CertificateProfilesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ArtifactSigningManagementClientCertificateProfiles to be used by the + * proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ArtifactSigningManagementClientCertificateProfiles") + public interface CertificateProfilesService { + @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("endpoint") 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" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}/certificateProfiles/{profileName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("endpoint") 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); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}/certificateProfiles/{profileName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> create(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("accountName") String accountName, + @PathParam("profileName") String profileName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") CertificateProfileInner resource, + Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}/certificateProfiles/{profileName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("accountName") String accountName, + @PathParam("profileName") String profileName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") CertificateProfileInner resource, + Context context); + + @Headers({ "Accept: application/json;q=0.9", "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("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("accountName") String accountName, + @PathParam("profileName") String profileName, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}/certificateProfiles/{profileName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("accountName") String accountName, + @PathParam("profileName") String profileName, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}/certificateProfiles") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByCodeSigningAccount(@HostParam("endpoint") 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") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByCodeSigningAccountSync(@HostParam("endpoint") 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({ "Accept: application/json;q=0.9" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}/certificateProfiles/{profileName}/revokeCertificate") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> revokeCertificate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("accountName") String accountName, + @PathParam("profileName") String profileName, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") RevokeCertificate body, Context context); + + @Headers({ "Accept: application/json;q=0.9" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}/certificateProfiles/{profileName}/revokeCertificate") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response revokeCertificateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("accountName") String accountName, + @PathParam("profileName") String profileName, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") RevokeCertificate body, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByCodeSigningAccountNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByCodeSigningAccountNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get details of a certificate profile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact 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) { + 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 Artifact 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 Artifact 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) { + final String accept = "application/json"; + return service.getSync(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 Artifact 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 Artifact 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) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.create(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accountName, profileName, contentType, accept, + resource, 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 Artifact 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createWithResponse(String resourceGroupName, String accountName, String profileName, + CertificateProfileInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accountName, profileName, contentType, accept, resource, + Context.NONE); + } + + /** + * Create a certificate profile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createWithResponse(String resourceGroupName, String accountName, String profileName, + CertificateProfileInner resource, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accountName, profileName, contentType, accept, resource, + context); + } + + /** + * Create a certificate profile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact 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 Artifact 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) { + Response response = createWithResponse(resourceGroupName, accountName, profileName, resource); + return this.client.getLroResult(response, + CertificateProfileInner.class, CertificateProfileInner.class, Context.NONE); + } + + /** + * Create a certificate profile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact 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) { + Response response + = createWithResponse(resourceGroupName, accountName, profileName, resource, context); + return this.client.getLroResult(response, + CertificateProfileInner.class, CertificateProfileInner.class, context); + } + + /** + * Create a certificate profile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact 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 Artifact 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 beginCreate(resourceGroupName, accountName, profileName, resource).getFinalResult(); + } + + /** + * Create a certificate profile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact 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 beginCreate(resourceGroupName, accountName, profileName, resource, context).getFinalResult(); + } + + /** + * Delete a certificate profile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact 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) { + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accountName, profileName, 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 Artifact 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 response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String accountName, String profileName) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accountName, profileName, Context.NONE); + } + + /** + * Delete a certificate profile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact 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 response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String accountName, String profileName, + Context context) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accountName, profileName, context); + } + + /** + * Delete a certificate profile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact 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 Artifact 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) { + Response response = deleteWithResponse(resourceGroupName, accountName, profileName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * Delete a certificate profile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact 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) { + Response response = deleteWithResponse(resourceGroupName, accountName, profileName, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * Delete a certificate profile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact 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 Artifact 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) { + beginDelete(resourceGroupName, accountName, profileName).getFinalResult(); + } + + /** + * Delete a certificate profile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact 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) { + beginDelete(resourceGroupName, accountName, profileName, context).getFinalResult(); + } + + /** + * List certificate profiles under an artifact signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact 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) { + 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 an artifact signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact 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 an artifact signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByCodeSigningAccountSinglePage(String resourceGroupName, + String accountName) { + final String accept = "application/json"; + Response res + = service.listByCodeSigningAccountSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accountName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List certificate profiles under an artifact signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByCodeSigningAccountSinglePage(String resourceGroupName, + String accountName, Context context) { + final String accept = "application/json"; + Response res + = service.listByCodeSigningAccountSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accountName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List certificate profiles under an artifact signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact 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<>(() -> listByCodeSigningAccountSinglePage(resourceGroupName, accountName), + nextLink -> listByCodeSigningAccountNextSinglePage(nextLink)); + } + + /** + * List certificate profiles under an artifact signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact 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<>(() -> listByCodeSigningAccountSinglePage(resourceGroupName, accountName, context), + nextLink -> listByCodeSigningAccountNextSinglePage(nextLink, context)); + } + + /** + * Revoke a certificate under a certificate profile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact 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) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.revokeCertificate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accountName, profileName, contentType, body, + 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 Artifact 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 Artifact 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) { + final String contentType = "application/json"; + return service.revokeCertificateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accountName, profileName, contentType, body, context); + } + + /** + * Revoke a certificate under a certificate profile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact 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) { + 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. + * @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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByCodeSigningAccountNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listByCodeSigningAccountNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return 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. + * @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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByCodeSigningAccountNextSinglePage(String nextLink, + Context context) { + final String accept = "application/json"; + Response res + = service.listByCodeSigningAccountNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/implementation/CertificateProfilesImpl.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/implementation/CertificateProfilesImpl.java new file mode 100644 index 000000000000..3b41b741dc96 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/implementation/CertificateProfilesImpl.java @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.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.artifactsigning.fluent.CertificateProfilesClient; +import com.azure.resourcemanager.artifactsigning.fluent.models.CertificateProfileInner; +import com.azure.resourcemanager.artifactsigning.models.CertificateProfile; +import com.azure.resourcemanager.artifactsigning.models.CertificateProfiles; +import com.azure.resourcemanager.artifactsigning.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.artifactsigning.ArtifactSigningManager serviceManager; + + public CertificateProfilesImpl(CertificateProfilesClient innerClient, + com.azure.resourcemanager.artifactsigning.ArtifactSigningManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + 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 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 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.artifactsigning.ArtifactSigningManager manager() { + return this.serviceManager; + } + + public CertificateProfileImpl define(String name) { + return new CertificateProfileImpl(name, this.manager()); + } +} diff --git a/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/implementation/CheckNameAvailabilityResultImpl.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/implementation/CheckNameAvailabilityResultImpl.java new file mode 100644 index 000000000000..e968ec78bef7 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/implementation/CheckNameAvailabilityResultImpl.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.implementation; + +import com.azure.resourcemanager.artifactsigning.fluent.models.CheckNameAvailabilityResultInner; +import com.azure.resourcemanager.artifactsigning.models.CheckNameAvailabilityResult; +import com.azure.resourcemanager.artifactsigning.models.NameUnavailabilityReason; + +public final class CheckNameAvailabilityResultImpl implements CheckNameAvailabilityResult { + private CheckNameAvailabilityResultInner innerObject; + + private final com.azure.resourcemanager.artifactsigning.ArtifactSigningManager serviceManager; + + CheckNameAvailabilityResultImpl(CheckNameAvailabilityResultInner innerObject, + com.azure.resourcemanager.artifactsigning.ArtifactSigningManager 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.artifactsigning.ArtifactSigningManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/implementation/CodeSigningAccountImpl.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/implementation/CodeSigningAccountImpl.java new file mode 100644 index 000000000000..0324bea9aa55 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/implementation/CodeSigningAccountImpl.java @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.artifactsigning.fluent.models.CodeSigningAccountInner; +import com.azure.resourcemanager.artifactsigning.models.AccountSku; +import com.azure.resourcemanager.artifactsigning.models.AccountSkuPatch; +import com.azure.resourcemanager.artifactsigning.models.CodeSigningAccount; +import com.azure.resourcemanager.artifactsigning.models.CodeSigningAccountPatch; +import com.azure.resourcemanager.artifactsigning.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.artifactsigning.ArtifactSigningManager 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.artifactsigning.ArtifactSigningManager 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.artifactsigning.ArtifactSigningManager 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.artifactsigning.ArtifactSigningManager 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() == null || this.innerModel().id() == null; + } +} diff --git a/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/implementation/CodeSigningAccountsClientImpl.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/implementation/CodeSigningAccountsClientImpl.java new file mode 100644 index 000000000000..7607f54c4fb7 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/implementation/CodeSigningAccountsClientImpl.java @@ -0,0 +1,1181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.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.BinaryData; +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.artifactsigning.fluent.CodeSigningAccountsClient; +import com.azure.resourcemanager.artifactsigning.fluent.models.CheckNameAvailabilityResultInner; +import com.azure.resourcemanager.artifactsigning.fluent.models.CodeSigningAccountInner; +import com.azure.resourcemanager.artifactsigning.implementation.models.CodeSigningAccountListResult; +import com.azure.resourcemanager.artifactsigning.models.CheckNameAvailability; +import com.azure.resourcemanager.artifactsigning.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 ArtifactSigningManagementClientImpl client; + + /** + * Initializes an instance of CodeSigningAccountsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CodeSigningAccountsClientImpl(ArtifactSigningManagementClientImpl client) { + this.service = RestProxy.create(CodeSigningAccountsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ArtifactSigningManagementClientCodeSigningAccounts to be used by the + * proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ArtifactSigningManagementClientCodeSigningAccounts") + public interface CodeSigningAccountsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("endpoint") 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}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByResourceGroupSync(@HostParam("endpoint") 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); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> create(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("accountName") String accountName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") CodeSigningAccountInner resource, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("accountName") String accountName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") CodeSigningAccountInner resource, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("accountName") String accountName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") CodeSigningAccountPatch properties, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("accountName") String accountName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") CodeSigningAccountPatch properties, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("accountName") String accountName, + Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts/{accountName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("accountName") String accountName, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CodeSigning/codeSigningAccounts") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("endpoint") 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") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupSync(@HostParam("endpoint") 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}/providers/Microsoft.CodeSigning/codeSigningAccounts") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") 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}/providers/Microsoft.CodeSigning/codeSigningAccounts") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.CodeSigning/checkNameAvailability") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> checkNameAvailability(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") CheckNameAvailability body, Context context); + + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.CodeSigning/checkNameAvailability") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response checkNameAvailabilitySync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") CheckNameAvailability body, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @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("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listBySubscriptionNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get an artifact Signing Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact 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 an artifact Signing Account along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String accountName) { + 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 an artifact Signing Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact 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 an artifact 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 an artifact Signing Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact 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 an artifact Signing Account along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, + String accountName, Context context) { + final String accept = "application/json"; + return service.getByResourceGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accountName, accept, context); + } + + /** + * Get an artifact Signing Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact 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 an artifact Signing Account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CodeSigningAccountInner getByResourceGroup(String resourceGroupName, String accountName) { + return getByResourceGroupWithResponse(resourceGroupName, accountName, Context.NONE).getValue(); + } + + /** + * Create an artifact Signing Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact Signing account name. + * @param resource Parameters to create the artifact 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 artifact 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) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.create(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accountName, contentType, accept, resource, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create an artifact Signing Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact Signing account name. + * @param resource Parameters to create the artifact 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 artifact signing account resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createWithResponse(String resourceGroupName, String accountName, + CodeSigningAccountInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accountName, contentType, accept, resource, + Context.NONE); + } + + /** + * Create an artifact Signing Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact Signing account name. + * @param resource Parameters to create the artifact 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 artifact signing account resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createWithResponse(String resourceGroupName, String accountName, + CodeSigningAccountInner resource, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accountName, contentType, accept, resource, context); + } + + /** + * Create an artifact Signing Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact Signing account name. + * @param resource Parameters to create the artifact 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 artifact 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 an artifact Signing Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact Signing account name. + * @param resource Parameters to create the artifact 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 artifact signing account resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CodeSigningAccountInner> + beginCreate(String resourceGroupName, String accountName, CodeSigningAccountInner resource) { + Response response = createWithResponse(resourceGroupName, accountName, resource); + return this.client.getLroResult(response, + CodeSigningAccountInner.class, CodeSigningAccountInner.class, Context.NONE); + } + + /** + * Create an artifact Signing Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact Signing account name. + * @param resource Parameters to create the artifact 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 artifact signing account resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CodeSigningAccountInner> + beginCreate(String resourceGroupName, String accountName, CodeSigningAccountInner resource, Context context) { + Response response = createWithResponse(resourceGroupName, accountName, resource, context); + return this.client.getLroResult(response, + CodeSigningAccountInner.class, CodeSigningAccountInner.class, context); + } + + /** + * Create an artifact Signing Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact Signing account name. + * @param resource Parameters to create the artifact 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 artifact 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 an artifact Signing Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact Signing account name. + * @param resource Parameters to create the artifact 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 artifact signing account resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CodeSigningAccountInner create(String resourceGroupName, String accountName, + CodeSigningAccountInner resource) { + return beginCreate(resourceGroupName, accountName, resource).getFinalResult(); + } + + /** + * Create an artifact Signing Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact Signing account name. + * @param resource Parameters to create the artifact 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 artifact signing account resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CodeSigningAccountInner create(String resourceGroupName, String accountName, + CodeSigningAccountInner resource, Context context) { + return beginCreate(resourceGroupName, accountName, resource, context).getFinalResult(); + } + + /** + * Update an artifact signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact Signing account name. + * @param properties Parameters supplied to update the artifact 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 artifact 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) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accountName, contentType, accept, properties, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update an artifact signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact Signing account name. + * @param properties Parameters supplied to update the artifact 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 artifact signing account resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String accountName, + CodeSigningAccountPatch properties) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accountName, contentType, accept, properties, + Context.NONE); + } + + /** + * Update an artifact signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact Signing account name. + * @param properties Parameters supplied to update the artifact 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 artifact signing account resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String accountName, + CodeSigningAccountPatch properties, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accountName, contentType, accept, properties, context); + } + + /** + * Update an artifact signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact Signing account name. + * @param properties Parameters supplied to update the artifact 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 artifact 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 an artifact signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact Signing account name. + * @param properties Parameters supplied to update the artifact 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 artifact signing account resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CodeSigningAccountInner> + beginUpdate(String resourceGroupName, String accountName, CodeSigningAccountPatch properties) { + Response response = updateWithResponse(resourceGroupName, accountName, properties); + return this.client.getLroResult(response, + CodeSigningAccountInner.class, CodeSigningAccountInner.class, Context.NONE); + } + + /** + * Update an artifact signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact Signing account name. + * @param properties Parameters supplied to update the artifact 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 artifact signing account resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, CodeSigningAccountInner> + beginUpdate(String resourceGroupName, String accountName, CodeSigningAccountPatch properties, Context context) { + Response response = updateWithResponse(resourceGroupName, accountName, properties, context); + return this.client.getLroResult(response, + CodeSigningAccountInner.class, CodeSigningAccountInner.class, context); + } + + /** + * Update an artifact signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact Signing account name. + * @param properties Parameters supplied to update the artifact 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 artifact 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 an artifact signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact Signing account name. + * @param properties Parameters supplied to update the artifact 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 artifact signing account resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CodeSigningAccountInner update(String resourceGroupName, String accountName, + CodeSigningAccountPatch properties) { + return beginUpdate(resourceGroupName, accountName, properties).getFinalResult(); + } + + /** + * Update an artifact signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact Signing account name. + * @param properties Parameters supplied to update the artifact 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 artifact signing account resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CodeSigningAccountInner update(String resourceGroupName, String accountName, + CodeSigningAccountPatch properties, Context context) { + return beginUpdate(resourceGroupName, accountName, properties, context).getFinalResult(); + } + + /** + * Delete an artifact signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact 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) { + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accountName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete an artifact signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact 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 body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String accountName) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accountName, Context.NONE); + } + + /** + * Delete an artifact signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact 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 body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String accountName, Context context) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accountName, context); + } + + /** + * Delete an artifact signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact 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 an artifact signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact 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) { + Response response = deleteWithResponse(resourceGroupName, accountName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * Delete an artifact signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact 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) { + Response response = deleteWithResponse(resourceGroupName, accountName, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * Delete an artifact signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact 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 an artifact signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact 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) { + beginDelete(resourceGroupName, accountName).getFinalResult(); + } + + /** + * Delete an artifact signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact 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) { + beginDelete(resourceGroupName, accountName, context).getFinalResult(); + } + + /** + * Lists artifact 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) { + 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 artifact 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 artifact 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName) { + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Lists artifact 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName, + Context context) { + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Lists artifact 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<>(() -> listByResourceGroupSinglePage(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePage(nextLink)); + } + + /** + * Lists artifact 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<>(() -> listByResourceGroupSinglePage(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePage(nextLink, context)); + } + + /** + * Lists artifact 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() { + 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 artifact 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 artifact 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Lists artifact 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Lists artifact 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<>(() -> listSinglePage(), nextLink -> listBySubscriptionNextSinglePage(nextLink)); + } + + /** + * Lists artifact 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<>(() -> listSinglePage(context), + nextLink -> listBySubscriptionNextSinglePage(nextLink, context)); + } + + /** + * Checks if the artifact 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) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.checkNameAvailability(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), contentType, accept, body, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Checks if the artifact 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 if the artifact 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) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.checkNameAvailabilitySync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), contentType, accept, body, context); + } + + /** + * Checks if the artifact 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(); + } + + /** + * 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) { + 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. + * @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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return 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. + * @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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, context); + return 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> listBySubscriptionNextSinglePageAsync(String nextLink) { + 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. + * @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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return 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. + * @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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res + = service.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/implementation/CodeSigningAccountsImpl.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/implementation/CodeSigningAccountsImpl.java new file mode 100644 index 000000000000..3726d4041dc2 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/implementation/CodeSigningAccountsImpl.java @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.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.artifactsigning.fluent.CodeSigningAccountsClient; +import com.azure.resourcemanager.artifactsigning.fluent.models.CheckNameAvailabilityResultInner; +import com.azure.resourcemanager.artifactsigning.fluent.models.CodeSigningAccountInner; +import com.azure.resourcemanager.artifactsigning.models.CheckNameAvailability; +import com.azure.resourcemanager.artifactsigning.models.CheckNameAvailabilityResult; +import com.azure.resourcemanager.artifactsigning.models.CodeSigningAccount; +import com.azure.resourcemanager.artifactsigning.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.artifactsigning.ArtifactSigningManager serviceManager; + + public CodeSigningAccountsImpl(CodeSigningAccountsClient innerClient, + com.azure.resourcemanager.artifactsigning.ArtifactSigningManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + 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 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 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 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 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.artifactsigning.ArtifactSigningManager manager() { + return this.serviceManager; + } + + public CodeSigningAccountImpl define(String name) { + return new CodeSigningAccountImpl(name, this.manager()); + } +} diff --git a/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/implementation/OperationImpl.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/implementation/OperationImpl.java new file mode 100644 index 000000000000..1d158d863002 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/implementation/OperationImpl.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.implementation; + +import com.azure.resourcemanager.artifactsigning.fluent.models.OperationInner; +import com.azure.resourcemanager.artifactsigning.models.ActionType; +import com.azure.resourcemanager.artifactsigning.models.Operation; +import com.azure.resourcemanager.artifactsigning.models.OperationDisplay; +import com.azure.resourcemanager.artifactsigning.models.Origin; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.artifactsigning.ArtifactSigningManager serviceManager; + + OperationImpl(OperationInner innerObject, + com.azure.resourcemanager.artifactsigning.ArtifactSigningManager 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.artifactsigning.ArtifactSigningManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/implementation/OperationsClientImpl.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/implementation/OperationsClientImpl.java new file mode 100644 index 000000000000..432ef59308b7 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/implementation/OperationsClientImpl.java @@ -0,0 +1,242 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.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.artifactsigning.fluent.OperationsClient; +import com.azure.resourcemanager.artifactsigning.fluent.models.OperationInner; +import com.azure.resourcemanager.artifactsigning.implementation.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 ArtifactSigningManagementClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(ArtifactSigningManagementClientImpl client) { + this.service + = RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ArtifactSigningManagementClientOperations to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ArtifactSigningManagementClientOperations") + public interface OperationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.CodeSigning/operations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.CodeSigning/operations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("endpoint") 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("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") 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() { + 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. + * + * @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. + * + * @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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), accept, context); + return 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 PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listNextSinglePage(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 PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(() -> listSinglePage(context), nextLink -> listNextSinglePage(nextLink, 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) { + 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. + * @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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return 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. + * @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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/implementation/OperationsImpl.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/implementation/OperationsImpl.java new file mode 100644 index 000000000000..e166f2967c94 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/implementation/OperationsImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.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.artifactsigning.fluent.OperationsClient; +import com.azure.resourcemanager.artifactsigning.fluent.models.OperationInner; +import com.azure.resourcemanager.artifactsigning.models.Operation; +import com.azure.resourcemanager.artifactsigning.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.artifactsigning.ArtifactSigningManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, + com.azure.resourcemanager.artifactsigning.ArtifactSigningManager 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.artifactsigning.ArtifactSigningManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/implementation/ResourceManagerUtils.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/implementation/ResourceManagerUtils.java new file mode 100644 index 000000000000..980dff65e477 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/implementation/ResourceManagerUtils.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.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/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/implementation/models/CertificateProfileListResult.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/implementation/models/CertificateProfileListResult.java new file mode 100644 index 000000000000..d5d690169f29 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/implementation/models/CertificateProfileListResult.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.artifactsigning.fluent.models.CertificateProfileInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a CertificateProfile list operation. + */ +@Immutable +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. + */ + private CertificateProfileListResult() { + } + + /** + * Get the value property: The CertificateProfile items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@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/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/implementation/models/CodeSigningAccountListResult.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/implementation/models/CodeSigningAccountListResult.java new file mode 100644 index 000000000000..2277920bab18 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/implementation/models/CodeSigningAccountListResult.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.artifactsigning.fluent.models.CodeSigningAccountInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a CodeSigningAccount list operation. + */ +@Immutable +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. + */ + private CodeSigningAccountListResult() { + } + + /** + * Get the value property: The CodeSigningAccount items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@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/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/implementation/models/OperationListResult.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/implementation/models/OperationListResult.java new file mode 100644 index 000000000000..e9647c60c686 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/implementation/models/OperationListResult.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.artifactsigning.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 { + /* + * The Operation items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of OperationListResult class. + */ + private OperationListResult() { + } + + /** + * Get the value property: The Operation items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@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 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 IllegalStateException If the deserialized JSON object was missing any required properties. + * @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/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/implementation/package-info.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/implementation/package-info.java new file mode 100644 index 000000000000..88eb4a429bb8 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/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) TypeSpec Code Generator. + +/** + * Package containing the implementations for ArtifactSigning. + * Code Signing resource provider api. + */ +package com.azure.resourcemanager.artifactsigning.implementation; diff --git a/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/AccountSku.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/AccountSku.java new file mode 100644 index 000000000000..94d0e053c50c --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/AccountSku.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.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 artifact 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; + } + + /** + * {@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/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/AccountSkuPatch.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/AccountSkuPatch.java new file mode 100644 index 000000000000..928c27928568 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/AccountSkuPatch.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.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 artifact 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; + } + + /** + * {@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/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/ActionType.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/ActionType.java new file mode 100644 index 000000000000..a2898223b003 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/ActionType.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ +public final class ActionType extends ExpandableStringEnum { + /** + * Actions are for internal-only APIs. + */ + 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/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/Certificate.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/Certificate.java new file mode 100644 index 000000000000..e74e041db705 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/Certificate.java @@ -0,0 +1,249 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.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.artifactsigning.fluent.models.Revocation; +import java.io.IOException; +import java.time.OffsetDateTime; + +/** + * Properties of the certificate. + */ +@Immutable +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. + */ + private Certificate() { + } + + /** + * Get the serialNumber property: Serial number of the certificate. + * + * @return the serialNumber value. + */ + public String serialNumber() { + return this.serialNumber; + } + + /** + * Get the enhancedKeyUsage property: Enhanced key usage of the certificate. + * + * @return the enhancedKeyUsage value. + */ + public String enhancedKeyUsage() { + return this.enhancedKeyUsage; + } + + /** + * Get the subjectName property: Subject name of the certificate. + * + * @return the subjectName value. + */ + public String subjectName() { + return this.subjectName; + } + + /** + * Get the thumbprint property: Thumbprint of the certificate. + * + * @return the thumbprint value. + */ + public String thumbprint() { + return this.thumbprint; + } + + /** + * Get the createdDate property: Certificate created date. + * + * @return the createdDate value. + */ + public String createdDate() { + return this.createdDate; + } + + /** + * Get the expiryDate property: Certificate expiry date. + * + * @return the expiryDate value. + */ + public String expiryDate() { + return this.expiryDate; + } + + /** + * Get the status property: Status of the certificate. + * + * @return the status value. + */ + public CertificateStatus status() { + return this.status; + } + + /** + * 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(); + } + + /** + * 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(); + } + + /** + * Get the reason property: Reason for revocation. + * + * @return the reason value. + */ + public String reason() { + return this.innerRevocation() == null ? null : this.innerRevocation().reason(); + } + + /** + * Get the remarks property: Remarks for the revocation. + * + * @return the remarks value. + */ + public String remarks() { + return this.innerRevocation() == null ? null : this.innerRevocation().remarks(); + } + + /** + * 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(); + } + + /** + * {@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/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/CertificateProfile.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/CertificateProfile.java new file mode 100644 index 000000000000..812e4a06a7f0 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/CertificateProfile.java @@ -0,0 +1,314 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.artifactsigning.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.artifactsigning.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 Artifact 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/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/CertificateProfileStatus.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/CertificateProfileStatus.java new file mode 100644 index 000000000000..186d7974a17f --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/CertificateProfileStatus.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Status of the certificate profiles. + */ +public final class CertificateProfileStatus extends ExpandableStringEnum { + /** + * The certificate profile is active. + */ + public static final CertificateProfileStatus ACTIVE = fromString("Active"); + + /** + * The certificate profile is disabled. + */ + public static final CertificateProfileStatus DISABLED = fromString("Disabled"); + + /** + * The certificate profile is suspended. + */ + 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/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/CertificateProfiles.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/CertificateProfiles.java new file mode 100644 index 000000000000..0905e2f7c758 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/CertificateProfiles.java @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.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 { + /** + * Get details of a certificate profile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact 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 Artifact 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 Artifact 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 Artifact 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); + + /** + * List certificate profiles under an artifact signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact 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 an artifact signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact 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); + + /** + * Revoke a certificate under a certificate profile. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact 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 Artifact 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/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/CertificateStatus.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/CertificateStatus.java new file mode 100644 index 000000000000..b327b24ac9a0 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/CertificateStatus.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Status of the certificate. + */ +public final class CertificateStatus extends ExpandableStringEnum { + /** + * The certificate is active. + */ + public static final CertificateStatus ACTIVE = fromString("Active"); + + /** + * The certificate is expired. + */ + public static final CertificateStatus EXPIRED = fromString("Expired"); + + /** + * The certificate is revoked. + */ + 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/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/CheckNameAvailability.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/CheckNameAvailability.java new file mode 100644 index 000000000000..bb181120c5fa --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/CheckNameAvailability.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.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; + +/** + * The parameters used to check the availability of the artifact signing account name. + */ +@Fluent +public final class CheckNameAvailability implements JsonSerializable { + /* + * The type of the resource, "Microsoft.CodeSigning/codeSigningAccounts". + */ + private String type; + + /* + * Artifact signing account name. + */ + private String name; + + /** + * Creates an instance of CheckNameAvailability class. + */ + public CheckNameAvailability() { + } + + /** + * Get the type property: The type of the resource, "Microsoft.CodeSigning/codeSigningAccounts". + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: The type of the resource, "Microsoft.CodeSigning/codeSigningAccounts". + * + * @param type the type value to set. + * @return the CheckNameAvailability object itself. + */ + public CheckNameAvailability withType(String type) { + this.type = type; + return this; + } + + /** + * Get the name property: Artifact signing account name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Artifact 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; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type); + 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 ("type".equals(fieldName)) { + deserializedCheckNameAvailability.type = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedCheckNameAvailability.name = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCheckNameAvailability; + }); + } +} diff --git a/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/CheckNameAvailabilityResult.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/CheckNameAvailabilityResult.java new file mode 100644 index 000000000000..55845d71eebc --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/CheckNameAvailabilityResult.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.models; + +import com.azure.resourcemanager.artifactsigning.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 an artifact 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.artifactsigning.fluent.models.CheckNameAvailabilityResultInner object. + * + * @return the inner object. + */ + CheckNameAvailabilityResultInner innerModel(); +} diff --git a/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/CodeSigningAccount.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/CodeSigningAccount.java new file mode 100644 index 000000000000..8f96608e8d24 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/CodeSigningAccount.java @@ -0,0 +1,279 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.artifactsigning.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 artifact signing account which is used during signing files. + * + * @return the accountUri value. + */ + String accountUri(); + + /** + * Gets the sku property: SKU of the artifact signing account. + * + * @return the sku value. + */ + AccountSku sku(); + + /** + * Gets the provisioningState property: Status of the current operation on artifact 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.artifactsigning.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 artifact signing account.. + * + * @param sku SKU of the artifact 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 artifact signing account.. + * + * @param sku SKU of the artifact 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/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/CodeSigningAccountPatch.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/CodeSigningAccountPatch.java new file mode 100644 index 000000000000..d589930bd5f3 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/CodeSigningAccountPatch.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.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.artifactsigning.fluent.models.CodeSigningAccountPatchProperties; +import java.io.IOException; +import java.util.Map; + +/** + * Parameters for creating or updating an artifact signing account. + */ +@Fluent +public final class CodeSigningAccountPatch implements JsonSerializable { + /* + * Resource tags. + */ + private Map tags; + + /* + * Properties of the artifact 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 artifact signing account. + * + * @return the innerProperties value. + */ + private CodeSigningAccountPatchProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the sku property: SKU of the artifact signing account. + * + * @return the sku value. + */ + public AccountSkuPatch sku() { + return this.innerProperties() == null ? null : this.innerProperties().sku(); + } + + /** + * Set the sku property: SKU of the artifact 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; + } + + /** + * {@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/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/CodeSigningAccounts.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/CodeSigningAccounts.java new file mode 100644 index 000000000000..cc45e4310ae8 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/CodeSigningAccounts.java @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.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 { + /** + * Get an artifact Signing Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact 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 an artifact Signing Account along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String accountName, + Context context); + + /** + * Get an artifact Signing Account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact 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 an artifact Signing Account. + */ + CodeSigningAccount getByResourceGroup(String resourceGroupName, String accountName); + + /** + * Delete an artifact signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact 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 an artifact signing account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Artifact 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); + + /** + * Lists artifact 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 artifact 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); + + /** + * Lists artifact 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 artifact 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); + + /** + * Checks if the artifact 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 if the artifact 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); + + /** + * Get an artifact 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 an artifact Signing Account along with {@link Response}. + */ + CodeSigningAccount getById(String id); + + /** + * Get an artifact 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 an artifact Signing Account along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete an artifact 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 an artifact 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/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/NameUnavailabilityReason.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/NameUnavailabilityReason.java new file mode 100644 index 000000000000..ebb7f748e4b0 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/NameUnavailabilityReason.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The reason that an artifact signing account name could not be used. The Reason element is only returned if + * nameAvailable is false. + */ +public final class NameUnavailabilityReason extends ExpandableStringEnum { + /** + * Account name is invalid. + */ + public static final NameUnavailabilityReason ACCOUNT_NAME_INVALID = fromString("AccountNameInvalid"); + + /** + * Account name already exists. + */ + 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/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/Operation.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/Operation.java new file mode 100644 index 000000000000..d34aee90d1a4 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/Operation.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.models; + +import com.azure.resourcemanager.artifactsigning.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 Azure Resource Manager/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: Extensible 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.artifactsigning.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/OperationDisplay.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/OperationDisplay.java new file mode 100644 index 000000000000..a782d430a883 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/OperationDisplay.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.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 an 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. + */ + private 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; + } + + /** + * {@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/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/Operations.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/Operations.java new file mode 100644 index 000000000000..89c7ffab2c27 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/Operations.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.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/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/Origin.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/Origin.java new file mode 100644 index 000000000000..40be6204202b --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/Origin.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.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 { + /** + * Indicates the operation is initiated by a user. + */ + public static final Origin USER = fromString("user"); + + /** + * Indicates the operation is initiated by a system. + */ + public static final Origin SYSTEM = fromString("system"); + + /** + * Indicates the operation is initiated by a user or system. + */ + 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/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/ProfileType.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/ProfileType.java new file mode 100644 index 000000000000..5fbb46d2f8fe --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/ProfileType.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Type of the certificate. + */ +public final class ProfileType extends ExpandableStringEnum { + /** + * Used for signing files which are distributed publicly. + */ + public static final ProfileType PUBLIC_TRUST = fromString("PublicTrust"); + + /** + * Used for signing files which are distributed internally within organization or group boundary. + */ + public static final ProfileType PRIVATE_TRUST = fromString("PrivateTrust"); + + /** + * Used for signing CI policy files. + */ + public static final ProfileType PRIVATE_TRUST_CIPOLICY = fromString("PrivateTrustCIPolicy"); + + /** + * Used for signing files which are run in secure vbs enclave. + */ + public static final ProfileType VBSENCLAVE = fromString("VBSEnclave"); + + /** + * Used for signing files for testing purpose. + */ + 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/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/ProvisioningState.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/ProvisioningState.java new file mode 100644 index 000000000000..9b741fd649bf --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/ProvisioningState.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The status of the current operation. + */ +public final class ProvisioningState extends ExpandableStringEnum { + /** + * Resource has been created. + */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** + * Resource creation failed. + */ + public static final ProvisioningState FAILED = fromString("Failed"); + + /** + * Resource creation was canceled. + */ + public static final ProvisioningState CANCELED = fromString("Canceled"); + + /** + * Updating in progress. + */ + public static final ProvisioningState UPDATING = fromString("Updating"); + + /** + * Deletion in progress. + */ + public static final ProvisioningState DELETING = fromString("Deleting"); + + /** + * Resource creation started. + */ + 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/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/RevocationStatus.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/RevocationStatus.java new file mode 100644 index 000000000000..c3c6a9b5ae1c --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/RevocationStatus.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Revocation status of the certificate. + */ +public final class RevocationStatus extends ExpandableStringEnum { + /** + * Certificate revocation succeeded. + */ + public static final RevocationStatus SUCCEEDED = fromString("Succeeded"); + + /** + * Certificate revocation is in progress. + */ + public static final RevocationStatus IN_PROGRESS = fromString("InProgress"); + + /** + * Certificate revocation failed. + */ + 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/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/RevokeCertificate.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/RevokeCertificate.java new file mode 100644 index 000000000000..11bd92c92974 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/RevokeCertificate.java @@ -0,0 +1,203 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.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 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; + } + + /** + * {@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/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/SkuName.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/SkuName.java new file mode 100644 index 000000000000..1aeef47b07ca --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/SkuName.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Name of the sku. + */ +public final class SkuName extends ExpandableStringEnum { + /** + * Basic sku. + */ + public static final SkuName BASIC = fromString("Basic"); + + /** + * Premium sku. + */ + 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/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/package-info.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/models/package-info.java new file mode 100644 index 000000000000..cecf2954af5a --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/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) TypeSpec Code Generator. + +/** + * Package containing the data models for ArtifactSigning. + * Code Signing resource provider api. + */ +package com.azure.resourcemanager.artifactsigning.models; diff --git a/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/package-info.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/package-info.java new file mode 100644 index 000000000000..7ebde1483e21 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/com/azure/resourcemanager/artifactsigning/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the classes for ArtifactSigning. + * Code Signing resource provider api. + */ +package com.azure.resourcemanager.artifactsigning; diff --git a/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/module-info.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/module-info.java new file mode 100644 index 000000000000..0ddafa2c003c --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/java/module-info.java @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +module com.azure.resourcemanager.artifactsigning { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.artifactsigning; + exports com.azure.resourcemanager.artifactsigning.fluent; + exports com.azure.resourcemanager.artifactsigning.fluent.models; + exports com.azure.resourcemanager.artifactsigning.models; + + opens com.azure.resourcemanager.artifactsigning.fluent.models to com.azure.core; + opens com.azure.resourcemanager.artifactsigning.models to com.azure.core; + opens com.azure.resourcemanager.artifactsigning.implementation.models to com.azure.core; +} diff --git a/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/resources/META-INF/azure-resourcemanager-artifactsigning_apiview_properties.json b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/resources/META-INF/azure-resourcemanager-artifactsigning_apiview_properties.json new file mode 100644 index 000000000000..69bf5b763f80 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/resources/META-INF/azure-resourcemanager-artifactsigning_apiview_properties.json @@ -0,0 +1,59 @@ +{ + "flavor": "azure", + "CrossLanguageDefinitionId": { + "com.azure.resourcemanager.artifactsigning.fluent.ArtifactSigningManagementClient": "Microsoft.CodeSigning", + "com.azure.resourcemanager.artifactsigning.fluent.CertificateProfilesClient": "Microsoft.CodeSigning.CertificateProfiles", + "com.azure.resourcemanager.artifactsigning.fluent.CertificateProfilesClient.beginCreate": "Microsoft.CodeSigning.CertificateProfiles.create", + "com.azure.resourcemanager.artifactsigning.fluent.CertificateProfilesClient.beginDelete": "Microsoft.CodeSigning.CertificateProfiles.delete", + "com.azure.resourcemanager.artifactsigning.fluent.CertificateProfilesClient.create": "Microsoft.CodeSigning.CertificateProfiles.create", + "com.azure.resourcemanager.artifactsigning.fluent.CertificateProfilesClient.delete": "Microsoft.CodeSigning.CertificateProfiles.delete", + "com.azure.resourcemanager.artifactsigning.fluent.CertificateProfilesClient.get": "Microsoft.CodeSigning.CertificateProfiles.get", + "com.azure.resourcemanager.artifactsigning.fluent.CertificateProfilesClient.getWithResponse": "Microsoft.CodeSigning.CertificateProfiles.get", + "com.azure.resourcemanager.artifactsigning.fluent.CertificateProfilesClient.listByCodeSigningAccount": "Microsoft.CodeSigning.CertificateProfiles.listByCodeSigningAccount", + "com.azure.resourcemanager.artifactsigning.fluent.CertificateProfilesClient.revokeCertificate": "Microsoft.CodeSigning.CertificateProfiles.revokeCertificate", + "com.azure.resourcemanager.artifactsigning.fluent.CertificateProfilesClient.revokeCertificateWithResponse": "Microsoft.CodeSigning.CertificateProfiles.revokeCertificate", + "com.azure.resourcemanager.artifactsigning.fluent.CodeSigningAccountsClient": "Microsoft.CodeSigning.CodeSigningAccounts", + "com.azure.resourcemanager.artifactsigning.fluent.CodeSigningAccountsClient.beginCreate": "Microsoft.CodeSigning.CodeSigningAccounts.create", + "com.azure.resourcemanager.artifactsigning.fluent.CodeSigningAccountsClient.beginDelete": "Microsoft.CodeSigning.CodeSigningAccounts.delete", + "com.azure.resourcemanager.artifactsigning.fluent.CodeSigningAccountsClient.beginUpdate": "Microsoft.CodeSigning.CodeSigningAccounts.update", + "com.azure.resourcemanager.artifactsigning.fluent.CodeSigningAccountsClient.checkNameAvailability": "Microsoft.CodeSigning.CodeSigningAccounts.checkNameAvailability", + "com.azure.resourcemanager.artifactsigning.fluent.CodeSigningAccountsClient.checkNameAvailabilityWithResponse": "Microsoft.CodeSigning.CodeSigningAccounts.checkNameAvailability", + "com.azure.resourcemanager.artifactsigning.fluent.CodeSigningAccountsClient.create": "Microsoft.CodeSigning.CodeSigningAccounts.create", + "com.azure.resourcemanager.artifactsigning.fluent.CodeSigningAccountsClient.delete": "Microsoft.CodeSigning.CodeSigningAccounts.delete", + "com.azure.resourcemanager.artifactsigning.fluent.CodeSigningAccountsClient.getByResourceGroup": "Microsoft.CodeSigning.CodeSigningAccounts.get", + "com.azure.resourcemanager.artifactsigning.fluent.CodeSigningAccountsClient.getByResourceGroupWithResponse": "Microsoft.CodeSigning.CodeSigningAccounts.get", + "com.azure.resourcemanager.artifactsigning.fluent.CodeSigningAccountsClient.list": "Microsoft.CodeSigning.CodeSigningAccounts.listBySubscription", + "com.azure.resourcemanager.artifactsigning.fluent.CodeSigningAccountsClient.listByResourceGroup": "Microsoft.CodeSigning.CodeSigningAccounts.listByResourceGroup", + "com.azure.resourcemanager.artifactsigning.fluent.CodeSigningAccountsClient.update": "Microsoft.CodeSigning.CodeSigningAccounts.update", + "com.azure.resourcemanager.artifactsigning.fluent.OperationsClient": "Microsoft.CodeSigning.Operations", + "com.azure.resourcemanager.artifactsigning.fluent.OperationsClient.list": "Azure.ResourceManager.Operations.list", + "com.azure.resourcemanager.artifactsigning.fluent.models.CertificateProfileInner": "Microsoft.CodeSigning.CertificateProfile", + "com.azure.resourcemanager.artifactsigning.fluent.models.CertificateProfileProperties": "Microsoft.CodeSigning.CertificateProfileProperties", + "com.azure.resourcemanager.artifactsigning.fluent.models.CheckNameAvailabilityResultInner": "Microsoft.CodeSigning.CheckNameAvailabilityResult", + "com.azure.resourcemanager.artifactsigning.fluent.models.CodeSigningAccountInner": "Microsoft.CodeSigning.CodeSigningAccount", + "com.azure.resourcemanager.artifactsigning.fluent.models.CodeSigningAccountPatchProperties": "Microsoft.CodeSigning.CodeSigningAccountPatchProperties", + "com.azure.resourcemanager.artifactsigning.fluent.models.CodeSigningAccountProperties": "Microsoft.CodeSigning.CodeSigningAccountProperties", + "com.azure.resourcemanager.artifactsigning.fluent.models.OperationInner": "Azure.ResourceManager.CommonTypes.Operation", + "com.azure.resourcemanager.artifactsigning.fluent.models.Revocation": "Microsoft.CodeSigning.Revocation", + "com.azure.resourcemanager.artifactsigning.implementation.ArtifactSigningManagementClientBuilder": "Microsoft.CodeSigning", + "com.azure.resourcemanager.artifactsigning.implementation.models.CertificateProfileListResult": "Azure.ResourceManager.ResourceListResult", + "com.azure.resourcemanager.artifactsigning.implementation.models.CodeSigningAccountListResult": "Azure.ResourceManager.ResourceListResult", + "com.azure.resourcemanager.artifactsigning.implementation.models.OperationListResult": "Azure.ResourceManager.CommonTypes.OperationListResult", + "com.azure.resourcemanager.artifactsigning.models.AccountSku": "Microsoft.CodeSigning.AccountSku", + "com.azure.resourcemanager.artifactsigning.models.AccountSkuPatch": "Microsoft.CodeSigning.AccountSkuPatch", + "com.azure.resourcemanager.artifactsigning.models.ActionType": "Azure.ResourceManager.CommonTypes.ActionType", + "com.azure.resourcemanager.artifactsigning.models.Certificate": "Microsoft.CodeSigning.Certificate", + "com.azure.resourcemanager.artifactsigning.models.CertificateProfileStatus": "Microsoft.CodeSigning.CertificateProfileStatus", + "com.azure.resourcemanager.artifactsigning.models.CertificateStatus": "Microsoft.CodeSigning.CertificateStatus", + "com.azure.resourcemanager.artifactsigning.models.CheckNameAvailability": "Microsoft.CodeSigning.CheckNameAvailability", + "com.azure.resourcemanager.artifactsigning.models.CodeSigningAccountPatch": "Microsoft.CodeSigning.CodeSigningAccountPatch", + "com.azure.resourcemanager.artifactsigning.models.NameUnavailabilityReason": "Microsoft.CodeSigning.NameUnavailabilityReason", + "com.azure.resourcemanager.artifactsigning.models.OperationDisplay": "Azure.ResourceManager.CommonTypes.OperationDisplay", + "com.azure.resourcemanager.artifactsigning.models.Origin": "Azure.ResourceManager.CommonTypes.Origin", + "com.azure.resourcemanager.artifactsigning.models.ProfileType": "Microsoft.CodeSigning.ProfileType", + "com.azure.resourcemanager.artifactsigning.models.ProvisioningState": "Microsoft.CodeSigning.ProvisioningState", + "com.azure.resourcemanager.artifactsigning.models.RevocationStatus": "Microsoft.CodeSigning.RevocationStatus", + "com.azure.resourcemanager.artifactsigning.models.RevokeCertificate": "Microsoft.CodeSigning.RevokeCertificate", + "com.azure.resourcemanager.artifactsigning.models.SkuName": "Microsoft.CodeSigning.SkuName" + } +} diff --git a/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/resources/META-INF/azure-resourcemanager-artifactsigning_metadata.json b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/resources/META-INF/azure-resourcemanager-artifactsigning_metadata.json new file mode 100644 index 000000000000..036054fd274e --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/resources/META-INF/azure-resourcemanager-artifactsigning_metadata.json @@ -0,0 +1 @@ +{"flavor":"azure","apiVersion":"1.0.0","crossLanguageDefinitions":{"com.azure.resourcemanager.artifactsigning.fluent.ArtifactSigningManagementClient":"Microsoft.CodeSigning","com.azure.resourcemanager.artifactsigning.fluent.CertificateProfilesClient":"Microsoft.CodeSigning.CertificateProfiles","com.azure.resourcemanager.artifactsigning.fluent.CertificateProfilesClient.beginCreate":"Microsoft.CodeSigning.CertificateProfiles.create","com.azure.resourcemanager.artifactsigning.fluent.CertificateProfilesClient.beginDelete":"Microsoft.CodeSigning.CertificateProfiles.delete","com.azure.resourcemanager.artifactsigning.fluent.CertificateProfilesClient.create":"Microsoft.CodeSigning.CertificateProfiles.create","com.azure.resourcemanager.artifactsigning.fluent.CertificateProfilesClient.delete":"Microsoft.CodeSigning.CertificateProfiles.delete","com.azure.resourcemanager.artifactsigning.fluent.CertificateProfilesClient.get":"Microsoft.CodeSigning.CertificateProfiles.get","com.azure.resourcemanager.artifactsigning.fluent.CertificateProfilesClient.getWithResponse":"Microsoft.CodeSigning.CertificateProfiles.get","com.azure.resourcemanager.artifactsigning.fluent.CertificateProfilesClient.listByCodeSigningAccount":"Microsoft.CodeSigning.CertificateProfiles.listByCodeSigningAccount","com.azure.resourcemanager.artifactsigning.fluent.CertificateProfilesClient.revokeCertificate":"Microsoft.CodeSigning.CertificateProfiles.revokeCertificate","com.azure.resourcemanager.artifactsigning.fluent.CertificateProfilesClient.revokeCertificateWithResponse":"Microsoft.CodeSigning.CertificateProfiles.revokeCertificate","com.azure.resourcemanager.artifactsigning.fluent.CodeSigningAccountsClient":"Microsoft.CodeSigning.CodeSigningAccounts","com.azure.resourcemanager.artifactsigning.fluent.CodeSigningAccountsClient.beginCreate":"Microsoft.CodeSigning.CodeSigningAccounts.create","com.azure.resourcemanager.artifactsigning.fluent.CodeSigningAccountsClient.beginDelete":"Microsoft.CodeSigning.CodeSigningAccounts.delete","com.azure.resourcemanager.artifactsigning.fluent.CodeSigningAccountsClient.beginUpdate":"Microsoft.CodeSigning.CodeSigningAccounts.update","com.azure.resourcemanager.artifactsigning.fluent.CodeSigningAccountsClient.checkNameAvailability":"Microsoft.CodeSigning.CodeSigningAccounts.checkNameAvailability","com.azure.resourcemanager.artifactsigning.fluent.CodeSigningAccountsClient.checkNameAvailabilityWithResponse":"Microsoft.CodeSigning.CodeSigningAccounts.checkNameAvailability","com.azure.resourcemanager.artifactsigning.fluent.CodeSigningAccountsClient.create":"Microsoft.CodeSigning.CodeSigningAccounts.create","com.azure.resourcemanager.artifactsigning.fluent.CodeSigningAccountsClient.delete":"Microsoft.CodeSigning.CodeSigningAccounts.delete","com.azure.resourcemanager.artifactsigning.fluent.CodeSigningAccountsClient.getByResourceGroup":"Microsoft.CodeSigning.CodeSigningAccounts.get","com.azure.resourcemanager.artifactsigning.fluent.CodeSigningAccountsClient.getByResourceGroupWithResponse":"Microsoft.CodeSigning.CodeSigningAccounts.get","com.azure.resourcemanager.artifactsigning.fluent.CodeSigningAccountsClient.list":"Microsoft.CodeSigning.CodeSigningAccounts.listBySubscription","com.azure.resourcemanager.artifactsigning.fluent.CodeSigningAccountsClient.listByResourceGroup":"Microsoft.CodeSigning.CodeSigningAccounts.listByResourceGroup","com.azure.resourcemanager.artifactsigning.fluent.CodeSigningAccountsClient.update":"Microsoft.CodeSigning.CodeSigningAccounts.update","com.azure.resourcemanager.artifactsigning.fluent.OperationsClient":"Microsoft.CodeSigning.Operations","com.azure.resourcemanager.artifactsigning.fluent.OperationsClient.list":"Azure.ResourceManager.Operations.list","com.azure.resourcemanager.artifactsigning.fluent.models.CertificateProfileInner":"Microsoft.CodeSigning.CertificateProfile","com.azure.resourcemanager.artifactsigning.fluent.models.CertificateProfileProperties":"Microsoft.CodeSigning.CertificateProfileProperties","com.azure.resourcemanager.artifactsigning.fluent.models.CheckNameAvailabilityResultInner":"Microsoft.CodeSigning.CheckNameAvailabilityResult","com.azure.resourcemanager.artifactsigning.fluent.models.CodeSigningAccountInner":"Microsoft.CodeSigning.CodeSigningAccount","com.azure.resourcemanager.artifactsigning.fluent.models.CodeSigningAccountPatchProperties":"Microsoft.CodeSigning.CodeSigningAccountPatchProperties","com.azure.resourcemanager.artifactsigning.fluent.models.CodeSigningAccountProperties":"Microsoft.CodeSigning.CodeSigningAccountProperties","com.azure.resourcemanager.artifactsigning.fluent.models.OperationInner":"Azure.ResourceManager.CommonTypes.Operation","com.azure.resourcemanager.artifactsigning.fluent.models.Revocation":"Microsoft.CodeSigning.Revocation","com.azure.resourcemanager.artifactsigning.implementation.ArtifactSigningManagementClientBuilder":"Microsoft.CodeSigning","com.azure.resourcemanager.artifactsigning.implementation.models.CertificateProfileListResult":"Azure.ResourceManager.ResourceListResult","com.azure.resourcemanager.artifactsigning.implementation.models.CodeSigningAccountListResult":"Azure.ResourceManager.ResourceListResult","com.azure.resourcemanager.artifactsigning.implementation.models.OperationListResult":"Azure.ResourceManager.CommonTypes.OperationListResult","com.azure.resourcemanager.artifactsigning.models.AccountSku":"Microsoft.CodeSigning.AccountSku","com.azure.resourcemanager.artifactsigning.models.AccountSkuPatch":"Microsoft.CodeSigning.AccountSkuPatch","com.azure.resourcemanager.artifactsigning.models.ActionType":"Azure.ResourceManager.CommonTypes.ActionType","com.azure.resourcemanager.artifactsigning.models.Certificate":"Microsoft.CodeSigning.Certificate","com.azure.resourcemanager.artifactsigning.models.CertificateProfileStatus":"Microsoft.CodeSigning.CertificateProfileStatus","com.azure.resourcemanager.artifactsigning.models.CertificateStatus":"Microsoft.CodeSigning.CertificateStatus","com.azure.resourcemanager.artifactsigning.models.CheckNameAvailability":"Microsoft.CodeSigning.CheckNameAvailability","com.azure.resourcemanager.artifactsigning.models.CodeSigningAccountPatch":"Microsoft.CodeSigning.CodeSigningAccountPatch","com.azure.resourcemanager.artifactsigning.models.NameUnavailabilityReason":"Microsoft.CodeSigning.NameUnavailabilityReason","com.azure.resourcemanager.artifactsigning.models.OperationDisplay":"Azure.ResourceManager.CommonTypes.OperationDisplay","com.azure.resourcemanager.artifactsigning.models.Origin":"Azure.ResourceManager.CommonTypes.Origin","com.azure.resourcemanager.artifactsigning.models.ProfileType":"Microsoft.CodeSigning.ProfileType","com.azure.resourcemanager.artifactsigning.models.ProvisioningState":"Microsoft.CodeSigning.ProvisioningState","com.azure.resourcemanager.artifactsigning.models.RevocationStatus":"Microsoft.CodeSigning.RevocationStatus","com.azure.resourcemanager.artifactsigning.models.RevokeCertificate":"Microsoft.CodeSigning.RevokeCertificate","com.azure.resourcemanager.artifactsigning.models.SkuName":"Microsoft.CodeSigning.SkuName"},"generatedFiles":["src/main/java/com/azure/resourcemanager/artifactsigning/ArtifactSigningManager.java","src/main/java/com/azure/resourcemanager/artifactsigning/fluent/ArtifactSigningManagementClient.java","src/main/java/com/azure/resourcemanager/artifactsigning/fluent/CertificateProfilesClient.java","src/main/java/com/azure/resourcemanager/artifactsigning/fluent/CodeSigningAccountsClient.java","src/main/java/com/azure/resourcemanager/artifactsigning/fluent/OperationsClient.java","src/main/java/com/azure/resourcemanager/artifactsigning/fluent/models/CertificateProfileInner.java","src/main/java/com/azure/resourcemanager/artifactsigning/fluent/models/CertificateProfileProperties.java","src/main/java/com/azure/resourcemanager/artifactsigning/fluent/models/CheckNameAvailabilityResultInner.java","src/main/java/com/azure/resourcemanager/artifactsigning/fluent/models/CodeSigningAccountInner.java","src/main/java/com/azure/resourcemanager/artifactsigning/fluent/models/CodeSigningAccountPatchProperties.java","src/main/java/com/azure/resourcemanager/artifactsigning/fluent/models/CodeSigningAccountProperties.java","src/main/java/com/azure/resourcemanager/artifactsigning/fluent/models/OperationInner.java","src/main/java/com/azure/resourcemanager/artifactsigning/fluent/models/Revocation.java","src/main/java/com/azure/resourcemanager/artifactsigning/fluent/models/package-info.java","src/main/java/com/azure/resourcemanager/artifactsigning/fluent/package-info.java","src/main/java/com/azure/resourcemanager/artifactsigning/implementation/ArtifactSigningManagementClientBuilder.java","src/main/java/com/azure/resourcemanager/artifactsigning/implementation/ArtifactSigningManagementClientImpl.java","src/main/java/com/azure/resourcemanager/artifactsigning/implementation/CertificateProfileImpl.java","src/main/java/com/azure/resourcemanager/artifactsigning/implementation/CertificateProfilesClientImpl.java","src/main/java/com/azure/resourcemanager/artifactsigning/implementation/CertificateProfilesImpl.java","src/main/java/com/azure/resourcemanager/artifactsigning/implementation/CheckNameAvailabilityResultImpl.java","src/main/java/com/azure/resourcemanager/artifactsigning/implementation/CodeSigningAccountImpl.java","src/main/java/com/azure/resourcemanager/artifactsigning/implementation/CodeSigningAccountsClientImpl.java","src/main/java/com/azure/resourcemanager/artifactsigning/implementation/CodeSigningAccountsImpl.java","src/main/java/com/azure/resourcemanager/artifactsigning/implementation/OperationImpl.java","src/main/java/com/azure/resourcemanager/artifactsigning/implementation/OperationsClientImpl.java","src/main/java/com/azure/resourcemanager/artifactsigning/implementation/OperationsImpl.java","src/main/java/com/azure/resourcemanager/artifactsigning/implementation/ResourceManagerUtils.java","src/main/java/com/azure/resourcemanager/artifactsigning/implementation/models/CertificateProfileListResult.java","src/main/java/com/azure/resourcemanager/artifactsigning/implementation/models/CodeSigningAccountListResult.java","src/main/java/com/azure/resourcemanager/artifactsigning/implementation/models/OperationListResult.java","src/main/java/com/azure/resourcemanager/artifactsigning/implementation/package-info.java","src/main/java/com/azure/resourcemanager/artifactsigning/models/AccountSku.java","src/main/java/com/azure/resourcemanager/artifactsigning/models/AccountSkuPatch.java","src/main/java/com/azure/resourcemanager/artifactsigning/models/ActionType.java","src/main/java/com/azure/resourcemanager/artifactsigning/models/Certificate.java","src/main/java/com/azure/resourcemanager/artifactsigning/models/CertificateProfile.java","src/main/java/com/azure/resourcemanager/artifactsigning/models/CertificateProfileStatus.java","src/main/java/com/azure/resourcemanager/artifactsigning/models/CertificateProfiles.java","src/main/java/com/azure/resourcemanager/artifactsigning/models/CertificateStatus.java","src/main/java/com/azure/resourcemanager/artifactsigning/models/CheckNameAvailability.java","src/main/java/com/azure/resourcemanager/artifactsigning/models/CheckNameAvailabilityResult.java","src/main/java/com/azure/resourcemanager/artifactsigning/models/CodeSigningAccount.java","src/main/java/com/azure/resourcemanager/artifactsigning/models/CodeSigningAccountPatch.java","src/main/java/com/azure/resourcemanager/artifactsigning/models/CodeSigningAccounts.java","src/main/java/com/azure/resourcemanager/artifactsigning/models/NameUnavailabilityReason.java","src/main/java/com/azure/resourcemanager/artifactsigning/models/Operation.java","src/main/java/com/azure/resourcemanager/artifactsigning/models/OperationDisplay.java","src/main/java/com/azure/resourcemanager/artifactsigning/models/Operations.java","src/main/java/com/azure/resourcemanager/artifactsigning/models/Origin.java","src/main/java/com/azure/resourcemanager/artifactsigning/models/ProfileType.java","src/main/java/com/azure/resourcemanager/artifactsigning/models/ProvisioningState.java","src/main/java/com/azure/resourcemanager/artifactsigning/models/RevocationStatus.java","src/main/java/com/azure/resourcemanager/artifactsigning/models/RevokeCertificate.java","src/main/java/com/azure/resourcemanager/artifactsigning/models/SkuName.java","src/main/java/com/azure/resourcemanager/artifactsigning/models/package-info.java","src/main/java/com/azure/resourcemanager/artifactsigning/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-artifactsigning/proxy-config.json b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-artifactsigning/proxy-config.json new file mode 100644 index 000000000000..de7f309f5eae --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-artifactsigning/proxy-config.json @@ -0,0 +1 @@ +[["com.azure.resourcemanager.artifactsigning.implementation.CertificateProfilesClientImpl$CertificateProfilesService"],["com.azure.resourcemanager.artifactsigning.implementation.CodeSigningAccountsClientImpl$CodeSigningAccountsService"],["com.azure.resourcemanager.artifactsigning.implementation.OperationsClientImpl$OperationsService"]] \ No newline at end of file diff --git a/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-artifactsigning/reflect-config.json b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-artifactsigning/reflect-config.json new file mode 100644 index 000000000000..0637a088a01e --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-artifactsigning/reflect-config.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/resources/azure-resourcemanager-artifactsigning.properties b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/resources/azure-resourcemanager-artifactsigning.properties new file mode 100644 index 000000000000..defbd48204e4 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/main/resources/azure-resourcemanager-artifactsigning.properties @@ -0,0 +1 @@ +version=${project.version} diff --git a/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/samples/java/com/azure/resourcemanager/artifactsigning/generated/CertificateProfilesCreateSamples.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/samples/java/com/azure/resourcemanager/artifactsigning/generated/CertificateProfilesCreateSamples.java new file mode 100644 index 000000000000..271e0817dff1 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/samples/java/com/azure/resourcemanager/artifactsigning/generated/CertificateProfilesCreateSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.generated; + +import com.azure.resourcemanager.artifactsigning.models.ProfileType; + +/** + * Samples for CertificateProfiles Create. + */ +public final class CertificateProfilesCreateSamples { + /* + * x-ms-original-file: 2025-10-13/CertificateProfiles_Create.json + */ + /** + * Sample code: Create a certificate profile. + * + * @param manager Entry point to ArtifactSigningManager. + */ + public static void + createACertificateProfile(com.azure.resourcemanager.artifactsigning.ArtifactSigningManager 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/artifactsigning/azure-resourcemanager-artifactsigning/src/samples/java/com/azure/resourcemanager/artifactsigning/generated/CertificateProfilesDeleteSamples.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/samples/java/com/azure/resourcemanager/artifactsigning/generated/CertificateProfilesDeleteSamples.java new file mode 100644 index 000000000000..fc839588c9a5 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/samples/java/com/azure/resourcemanager/artifactsigning/generated/CertificateProfilesDeleteSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.generated; + +/** + * Samples for CertificateProfiles Delete. + */ +public final class CertificateProfilesDeleteSamples { + /* + * x-ms-original-file: 2025-10-13/CertificateProfiles_Delete.json + */ + /** + * Sample code: Delete a certificate profile. + * + * @param manager Entry point to ArtifactSigningManager. + */ + public static void + deleteACertificateProfile(com.azure.resourcemanager.artifactsigning.ArtifactSigningManager manager) { + manager.certificateProfiles() + .delete("MyResourceGroup", "MyAccount", "profileA", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/samples/java/com/azure/resourcemanager/artifactsigning/generated/CertificateProfilesGetSamples.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/samples/java/com/azure/resourcemanager/artifactsigning/generated/CertificateProfilesGetSamples.java new file mode 100644 index 000000000000..1ca3c0171a55 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/samples/java/com/azure/resourcemanager/artifactsigning/generated/CertificateProfilesGetSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.generated; + +/** + * Samples for CertificateProfiles Get. + */ +public final class CertificateProfilesGetSamples { + /* + * x-ms-original-file: 2025-10-13/CertificateProfiles_Get.json + */ + /** + * Sample code: Get details of a certificate profile. + * + * @param manager Entry point to ArtifactSigningManager. + */ + public static void + getDetailsOfACertificateProfile(com.azure.resourcemanager.artifactsigning.ArtifactSigningManager manager) { + manager.certificateProfiles() + .getWithResponse("MyResourceGroup", "MyAccount", "profileA", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/samples/java/com/azure/resourcemanager/artifactsigning/generated/CertificateProfilesListByCodeSigningAccountSamples.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/samples/java/com/azure/resourcemanager/artifactsigning/generated/CertificateProfilesListByCodeSigningAccountSamples.java new file mode 100644 index 000000000000..2a0be8028444 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/samples/java/com/azure/resourcemanager/artifactsigning/generated/CertificateProfilesListByCodeSigningAccountSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.generated; + +/** + * Samples for CertificateProfiles ListByCodeSigningAccount. + */ +public final class CertificateProfilesListByCodeSigningAccountSamples { + /* + * x-ms-original-file: 2025-10-13/CertificateProfiles_ListByCodeSigningAccount.json + */ + /** + * Sample code: List certificate profiles under an artifact signing account. + * + * @param manager Entry point to ArtifactSigningManager. + */ + public static void listCertificateProfilesUnderAnArtifactSigningAccount( + com.azure.resourcemanager.artifactsigning.ArtifactSigningManager manager) { + manager.certificateProfiles() + .listByCodeSigningAccount("MyResourceGroup", "MyAccount", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/samples/java/com/azure/resourcemanager/artifactsigning/generated/CertificateProfilesRevokeCertificateSamples.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/samples/java/com/azure/resourcemanager/artifactsigning/generated/CertificateProfilesRevokeCertificateSamples.java new file mode 100644 index 000000000000..9641773385b4 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/samples/java/com/azure/resourcemanager/artifactsigning/generated/CertificateProfilesRevokeCertificateSamples.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.generated; + +import com.azure.resourcemanager.artifactsigning.models.RevokeCertificate; +import java.time.OffsetDateTime; + +/** + * Samples for CertificateProfiles RevokeCertificate. + */ +public final class CertificateProfilesRevokeCertificateSamples { + /* + * x-ms-original-file: 2025-10-13/CertificateProfiles_RevokeCertificate.json + */ + /** + * Sample code: Revoke a certificate under a certificate profile. + * + * @param manager Entry point to ArtifactSigningManager. + */ + public static void revokeACertificateUnderACertificateProfile( + com.azure.resourcemanager.artifactsigning.ArtifactSigningManager 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/artifactsigning/azure-resourcemanager-artifactsigning/src/samples/java/com/azure/resourcemanager/artifactsigning/generated/CodeSigningAccountsCheckNameAvailabilitySamples.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/samples/java/com/azure/resourcemanager/artifactsigning/generated/CodeSigningAccountsCheckNameAvailabilitySamples.java new file mode 100644 index 000000000000..a2623fb20a77 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/samples/java/com/azure/resourcemanager/artifactsigning/generated/CodeSigningAccountsCheckNameAvailabilitySamples.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.generated; + +import com.azure.resourcemanager.artifactsigning.models.CheckNameAvailability; + +/** + * Samples for CodeSigningAccounts CheckNameAvailability. + */ +public final class CodeSigningAccountsCheckNameAvailabilitySamples { + /* + * x-ms-original-file: 2025-10-13/CodeSigningAccounts_CheckNameAvailability.json + */ + /** + * Sample code: Checks if the artifact signing account name is available. + * + * @param manager Entry point to ArtifactSigningManager. + */ + public static void checksIfTheArtifactSigningAccountNameIsAvailable( + com.azure.resourcemanager.artifactsigning.ArtifactSigningManager manager) { + manager.codeSigningAccounts() + .checkNameAvailabilityWithResponse( + new CheckNameAvailability().withType("Microsoft.CodeSigning/codeSigningAccounts") + .withName("sample-account"), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/samples/java/com/azure/resourcemanager/artifactsigning/generated/CodeSigningAccountsCreateSamples.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/samples/java/com/azure/resourcemanager/artifactsigning/generated/CodeSigningAccountsCreateSamples.java new file mode 100644 index 000000000000..7d700cf66492 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/samples/java/com/azure/resourcemanager/artifactsigning/generated/CodeSigningAccountsCreateSamples.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.generated; + +import com.azure.resourcemanager.artifactsigning.models.AccountSku; +import com.azure.resourcemanager.artifactsigning.models.SkuName; + +/** + * Samples for CodeSigningAccounts Create. + */ +public final class CodeSigningAccountsCreateSamples { + /* + * x-ms-original-file: 2025-10-13/CodeSigningAccounts_Create.json + */ + /** + * Sample code: Create an artifact signing account. + * + * @param manager Entry point to ArtifactSigningManager. + */ + public static void + createAnArtifactSigningAccount(com.azure.resourcemanager.artifactsigning.ArtifactSigningManager manager) { + manager.codeSigningAccounts() + .define("MyAccount") + .withRegion("westus") + .withExistingResourceGroup("MyResourceGroup") + .withSku(new AccountSku().withName(SkuName.BASIC)) + .create(); + } +} diff --git a/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/samples/java/com/azure/resourcemanager/artifactsigning/generated/CodeSigningAccountsDeleteSamples.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/samples/java/com/azure/resourcemanager/artifactsigning/generated/CodeSigningAccountsDeleteSamples.java new file mode 100644 index 000000000000..529a810106ea --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/samples/java/com/azure/resourcemanager/artifactsigning/generated/CodeSigningAccountsDeleteSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.generated; + +/** + * Samples for CodeSigningAccounts Delete. + */ +public final class CodeSigningAccountsDeleteSamples { + /* + * x-ms-original-file: 2025-10-13/CodeSigningAccounts_Delete.json + */ + /** + * Sample code: Delete an artifact signing account. + * + * @param manager Entry point to ArtifactSigningManager. + */ + public static void + deleteAnArtifactSigningAccount(com.azure.resourcemanager.artifactsigning.ArtifactSigningManager manager) { + manager.codeSigningAccounts().delete("MyResourceGroup", "MyAccount", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/samples/java/com/azure/resourcemanager/artifactsigning/generated/CodeSigningAccountsGetByResourceGroupSamples.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/samples/java/com/azure/resourcemanager/artifactsigning/generated/CodeSigningAccountsGetByResourceGroupSamples.java new file mode 100644 index 000000000000..c271b9497eba --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/samples/java/com/azure/resourcemanager/artifactsigning/generated/CodeSigningAccountsGetByResourceGroupSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.generated; + +/** + * Samples for CodeSigningAccounts GetByResourceGroup. + */ +public final class CodeSigningAccountsGetByResourceGroupSamples { + /* + * x-ms-original-file: 2025-10-13/CodeSigningAccounts_Get.json + */ + /** + * Sample code: Get an artifact signing account. + * + * @param manager Entry point to ArtifactSigningManager. + */ + public static void + getAnArtifactSigningAccount(com.azure.resourcemanager.artifactsigning.ArtifactSigningManager manager) { + manager.codeSigningAccounts() + .getByResourceGroupWithResponse("MyResourceGroup", "MyAccount", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/samples/java/com/azure/resourcemanager/artifactsigning/generated/CodeSigningAccountsListByResourceGroupSamples.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/samples/java/com/azure/resourcemanager/artifactsigning/generated/CodeSigningAccountsListByResourceGroupSamples.java new file mode 100644 index 000000000000..b882d9d6e8bd --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/samples/java/com/azure/resourcemanager/artifactsigning/generated/CodeSigningAccountsListByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.generated; + +/** + * Samples for CodeSigningAccounts ListByResourceGroup. + */ +public final class CodeSigningAccountsListByResourceGroupSamples { + /* + * x-ms-original-file: 2025-10-13/CodeSigningAccounts_ListByResourceGroup.json + */ + /** + * Sample code: Lists artifact signing accounts within a resource group. + * + * @param manager Entry point to ArtifactSigningManager. + */ + public static void listsArtifactSigningAccountsWithinAResourceGroup( + com.azure.resourcemanager.artifactsigning.ArtifactSigningManager manager) { + manager.codeSigningAccounts().listByResourceGroup("MyResourceGroup", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/samples/java/com/azure/resourcemanager/artifactsigning/generated/CodeSigningAccountsListSamples.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/samples/java/com/azure/resourcemanager/artifactsigning/generated/CodeSigningAccountsListSamples.java new file mode 100644 index 000000000000..ed1b92dec6d5 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/samples/java/com/azure/resourcemanager/artifactsigning/generated/CodeSigningAccountsListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.generated; + +/** + * Samples for CodeSigningAccounts List. + */ +public final class CodeSigningAccountsListSamples { + /* + * x-ms-original-file: 2025-10-13/CodeSigningAccounts_ListBySubscription.json + */ + /** + * Sample code: Lists artifact signing accounts within a subscription. + * + * @param manager Entry point to ArtifactSigningManager. + */ + public static void listsArtifactSigningAccountsWithinASubscription( + com.azure.resourcemanager.artifactsigning.ArtifactSigningManager manager) { + manager.codeSigningAccounts().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/samples/java/com/azure/resourcemanager/artifactsigning/generated/CodeSigningAccountsUpdateSamples.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/samples/java/com/azure/resourcemanager/artifactsigning/generated/CodeSigningAccountsUpdateSamples.java new file mode 100644 index 000000000000..5c221575c48e --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/samples/java/com/azure/resourcemanager/artifactsigning/generated/CodeSigningAccountsUpdateSamples.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.generated; + +import com.azure.resourcemanager.artifactsigning.models.CodeSigningAccount; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for CodeSigningAccounts Update. + */ +public final class CodeSigningAccountsUpdateSamples { + /* + * x-ms-original-file: 2025-10-13/CodeSigningAccounts_Update.json + */ + /** + * Sample code: Update an artifact signing account. + * + * @param manager Entry point to ArtifactSigningManager. + */ + public static void + updateAnArtifactSigningAccount(com.azure.resourcemanager.artifactsigning.ArtifactSigningManager 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/artifactsigning/azure-resourcemanager-artifactsigning/src/samples/java/com/azure/resourcemanager/artifactsigning/generated/OperationsListSamples.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/samples/java/com/azure/resourcemanager/artifactsigning/generated/OperationsListSamples.java new file mode 100644 index 000000000000..44f4bf2d8e40 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/samples/java/com/azure/resourcemanager/artifactsigning/generated/OperationsListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.generated; + +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: 2025-10-13/Operations_List.json + */ + /** + * Sample code: List artifact signing account operations. + * + * @param manager Entry point to ArtifactSigningManager. + */ + public static void + listArtifactSigningAccountOperations(com.azure.resourcemanager.artifactsigning.ArtifactSigningManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/test/java/com/azure/resourcemanager/artifactsigning/generated/AccountSkuPatchTests.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/test/java/com/azure/resourcemanager/artifactsigning/generated/AccountSkuPatchTests.java new file mode 100644 index 000000000000..75de95f957fa --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/test/java/com/azure/resourcemanager/artifactsigning/generated/AccountSkuPatchTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.artifactsigning.models.AccountSkuPatch; +import com.azure.resourcemanager.artifactsigning.models.SkuName; +import org.junit.jupiter.api.Assertions; + +public final class AccountSkuPatchTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AccountSkuPatch model = BinaryData.fromString("{\"name\":\"Premium\"}").toObject(AccountSkuPatch.class); + Assertions.assertEquals(SkuName.PREMIUM, model.name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AccountSkuPatch model = new AccountSkuPatch().withName(SkuName.PREMIUM); + model = BinaryData.fromObject(model).toObject(AccountSkuPatch.class); + Assertions.assertEquals(SkuName.PREMIUM, model.name()); + } +} diff --git a/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/test/java/com/azure/resourcemanager/artifactsigning/generated/AccountSkuTests.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/test/java/com/azure/resourcemanager/artifactsigning/generated/AccountSkuTests.java new file mode 100644 index 000000000000..58a741921fa0 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/test/java/com/azure/resourcemanager/artifactsigning/generated/AccountSkuTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.artifactsigning.models.AccountSku; +import com.azure.resourcemanager.artifactsigning.models.SkuName; +import org.junit.jupiter.api.Assertions; + +public final class AccountSkuTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AccountSku model = BinaryData.fromString("{\"name\":\"Basic\"}").toObject(AccountSku.class); + Assertions.assertEquals(SkuName.BASIC, model.name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AccountSku model = new AccountSku().withName(SkuName.BASIC); + model = BinaryData.fromObject(model).toObject(AccountSku.class); + Assertions.assertEquals(SkuName.BASIC, model.name()); + } +} diff --git a/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/test/java/com/azure/resourcemanager/artifactsigning/generated/CertificateProfilesRevokeCertificateWithResponseMockTests.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/test/java/com/azure/resourcemanager/artifactsigning/generated/CertificateProfilesRevokeCertificateWithResponseMockTests.java new file mode 100644 index 000000000000..375a383f3d63 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/test/java/com/azure/resourcemanager/artifactsigning/generated/CertificateProfilesRevokeCertificateWithResponseMockTests.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.artifactsigning.ArtifactSigningManager; +import com.azure.resourcemanager.artifactsigning.models.RevokeCertificate; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class CertificateProfilesRevokeCertificateWithResponseMockTests { + @Test + public void testRevokeCertificateWithResponse() throws Exception { + String responseStr = "{}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 204, responseStr.getBytes(StandardCharsets.UTF_8))); + ArtifactSigningManager manager = ArtifactSigningManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + manager.certificateProfiles() + .revokeCertificateWithResponse("og", "m", "w", + new RevokeCertificate().withSerialNumber("a") + .withThumbprint("a") + .withEffectiveAt(OffsetDateTime.parse("2021-01-27T21:23:24Z")) + .withReason("rzayv") + .withRemarks("pgvdf"), + com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/test/java/com/azure/resourcemanager/artifactsigning/generated/CheckNameAvailabilityResultInnerTests.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/test/java/com/azure/resourcemanager/artifactsigning/generated/CheckNameAvailabilityResultInnerTests.java new file mode 100644 index 000000000000..ce554f245bda --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/test/java/com/azure/resourcemanager/artifactsigning/generated/CheckNameAvailabilityResultInnerTests.java @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.artifactsigning.fluent.models.CheckNameAvailabilityResultInner; + +public final class CheckNameAvailabilityResultInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CheckNameAvailabilityResultInner model = BinaryData + .fromString("{\"nameAvailable\":false,\"reason\":\"AccountNameInvalid\",\"message\":\"nhutjeltmrldhugj\"}") + .toObject(CheckNameAvailabilityResultInner.class); + } +} diff --git a/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/test/java/com/azure/resourcemanager/artifactsigning/generated/CheckNameAvailabilityTests.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/test/java/com/azure/resourcemanager/artifactsigning/generated/CheckNameAvailabilityTests.java new file mode 100644 index 000000000000..3fe17a9423be --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/test/java/com/azure/resourcemanager/artifactsigning/generated/CheckNameAvailabilityTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.artifactsigning.models.CheckNameAvailability; +import org.junit.jupiter.api.Assertions; + +public final class CheckNameAvailabilityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CheckNameAvailability model = BinaryData.fromString("{\"type\":\"vndhkrwpdapp\",\"name\":\"sbdkvwr\"}") + .toObject(CheckNameAvailability.class); + Assertions.assertEquals("vndhkrwpdapp", model.type()); + Assertions.assertEquals("sbdkvwr", model.name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CheckNameAvailability model = new CheckNameAvailability().withType("vndhkrwpdapp").withName("sbdkvwr"); + model = BinaryData.fromObject(model).toObject(CheckNameAvailability.class); + Assertions.assertEquals("vndhkrwpdapp", model.type()); + Assertions.assertEquals("sbdkvwr", model.name()); + } +} diff --git a/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/test/java/com/azure/resourcemanager/artifactsigning/generated/CodeSigningAccountInnerTests.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/test/java/com/azure/resourcemanager/artifactsigning/generated/CodeSigningAccountInnerTests.java new file mode 100644 index 000000000000..2944ba3d2246 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/test/java/com/azure/resourcemanager/artifactsigning/generated/CodeSigningAccountInnerTests.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.artifactsigning.fluent.models.CodeSigningAccountInner; +import com.azure.resourcemanager.artifactsigning.models.AccountSku; +import com.azure.resourcemanager.artifactsigning.models.SkuName; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class CodeSigningAccountInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CodeSigningAccountInner model = BinaryData.fromString( + "{\"properties\":{\"accountUri\":\"jbpzvgnwzsymg\",\"sku\":{\"name\":\"Basic\"},\"provisioningState\":\"Updating\"},\"location\":\"zk\",\"tags\":{\"fcbjysagithxqha\":\"bihanuf\",\"cnpqxuhivyqniwby\":\"ifpikxwczby\",\"grtfwvu\":\"rkxvdum\",\"h\":\"xgaudccs\"},\"id\":\"jcny\",\"name\":\"j\",\"type\":\"kryhtnapczwlokj\"}") + .toObject(CodeSigningAccountInner.class); + Assertions.assertEquals("zk", model.location()); + Assertions.assertEquals("bihanuf", model.tags().get("fcbjysagithxqha")); + Assertions.assertEquals(SkuName.BASIC, model.sku().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CodeSigningAccountInner model = new CodeSigningAccountInner().withLocation("zk") + .withTags(mapOf("fcbjysagithxqha", "bihanuf", "cnpqxuhivyqniwby", "ifpikxwczby", "grtfwvu", "rkxvdum", "h", + "xgaudccs")) + .withSku(new AccountSku().withName(SkuName.BASIC)); + model = BinaryData.fromObject(model).toObject(CodeSigningAccountInner.class); + Assertions.assertEquals("zk", model.location()); + Assertions.assertEquals("bihanuf", model.tags().get("fcbjysagithxqha")); + Assertions.assertEquals(SkuName.BASIC, model.sku().name()); + } + + // 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/artifactsigning/azure-resourcemanager-artifactsigning/src/test/java/com/azure/resourcemanager/artifactsigning/generated/CodeSigningAccountListResultTests.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/test/java/com/azure/resourcemanager/artifactsigning/generated/CodeSigningAccountListResultTests.java new file mode 100644 index 000000000000..20b7a76ac634 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/test/java/com/azure/resourcemanager/artifactsigning/generated/CodeSigningAccountListResultTests.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.artifactsigning.implementation.models.CodeSigningAccountListResult; +import com.azure.resourcemanager.artifactsigning.models.SkuName; +import org.junit.jupiter.api.Assertions; + +public final class CodeSigningAccountListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CodeSigningAccountListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"accountUri\":\"ozkrwfndiodjpslw\",\"sku\":{\"name\":\"Premium\"},\"provisioningState\":\"Updating\"},\"location\":\"ryo\",\"tags\":{\"ljlahbcryf\":\"oacctaza\",\"ojakhmsbzjhcrze\":\"dfdosygexp\",\"qtrgqjbpfzfsinzg\":\"dphlxaolt\"},\"id\":\"f\",\"name\":\"jrwzox\",\"type\":\"j\"},{\"properties\":{\"accountUri\":\"lluwfzitonpeq\",\"sku\":{\"name\":\"Premium\"},\"provisioningState\":\"Canceled\"},\"location\":\"xofpdvhpfxxypi\",\"tags\":{\"inuvamiheogn\":\"mayhuybbkpodepoo\",\"usivye\":\"rxzxtheo\",\"nfygxgispemvtz\":\"cciqihnhungbwjz\"},\"id\":\"kufubljo\",\"name\":\"xqeofjaeqjhqjba\",\"type\":\"v\"},{\"properties\":{\"accountUri\":\"jqul\",\"sku\":{\"name\":\"Premium\"},\"provisioningState\":\"Accepted\"},\"location\":\"bybkzgcwrwclxx\",\"tags\":{\"cqvkocrcjdkwtn\":\"jdous\",\"gls\":\"xbnjbiksq\"},\"id\":\"ainqpjwnzlljfm\",\"name\":\"pee\",\"type\":\"vmgxsab\"}],\"nextLink\":\"qduujitcjczdz\"}") + .toObject(CodeSigningAccountListResult.class); + Assertions.assertEquals("ryo", model.value().get(0).location()); + Assertions.assertEquals("oacctaza", model.value().get(0).tags().get("ljlahbcryf")); + Assertions.assertEquals(SkuName.PREMIUM, model.value().get(0).sku().name()); + Assertions.assertEquals("qduujitcjczdz", model.nextLink()); + } +} diff --git a/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/test/java/com/azure/resourcemanager/artifactsigning/generated/CodeSigningAccountPatchPropertiesTests.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/test/java/com/azure/resourcemanager/artifactsigning/generated/CodeSigningAccountPatchPropertiesTests.java new file mode 100644 index 000000000000..15344fb0d2a7 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/test/java/com/azure/resourcemanager/artifactsigning/generated/CodeSigningAccountPatchPropertiesTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.artifactsigning.fluent.models.CodeSigningAccountPatchProperties; +import com.azure.resourcemanager.artifactsigning.models.AccountSkuPatch; +import com.azure.resourcemanager.artifactsigning.models.SkuName; +import org.junit.jupiter.api.Assertions; + +public final class CodeSigningAccountPatchPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CodeSigningAccountPatchProperties model = BinaryData.fromString("{\"sku\":{\"name\":\"Premium\"}}") + .toObject(CodeSigningAccountPatchProperties.class); + Assertions.assertEquals(SkuName.PREMIUM, model.sku().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CodeSigningAccountPatchProperties model + = new CodeSigningAccountPatchProperties().withSku(new AccountSkuPatch().withName(SkuName.PREMIUM)); + model = BinaryData.fromObject(model).toObject(CodeSigningAccountPatchProperties.class); + Assertions.assertEquals(SkuName.PREMIUM, model.sku().name()); + } +} diff --git a/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/test/java/com/azure/resourcemanager/artifactsigning/generated/CodeSigningAccountPatchTests.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/test/java/com/azure/resourcemanager/artifactsigning/generated/CodeSigningAccountPatchTests.java new file mode 100644 index 000000000000..65c425c085c6 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/test/java/com/azure/resourcemanager/artifactsigning/generated/CodeSigningAccountPatchTests.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.artifactsigning.models.AccountSkuPatch; +import com.azure.resourcemanager.artifactsigning.models.CodeSigningAccountPatch; +import com.azure.resourcemanager.artifactsigning.models.SkuName; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class CodeSigningAccountPatchTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CodeSigningAccountPatch model = BinaryData.fromString( + "{\"tags\":{\"o\":\"gejspodmailzyde\",\"wixjsprozvcp\":\"wyahuxinpmqnja\",\"atscmd\":\"tegjvwmf\"},\"properties\":{\"sku\":{\"name\":\"Basic\"}}}") + .toObject(CodeSigningAccountPatch.class); + Assertions.assertEquals("gejspodmailzyde", model.tags().get("o")); + Assertions.assertEquals(SkuName.BASIC, model.sku().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CodeSigningAccountPatch model = new CodeSigningAccountPatch() + .withTags(mapOf("o", "gejspodmailzyde", "wixjsprozvcp", "wyahuxinpmqnja", "atscmd", "tegjvwmf")) + .withSku(new AccountSkuPatch().withName(SkuName.BASIC)); + model = BinaryData.fromObject(model).toObject(CodeSigningAccountPatch.class); + Assertions.assertEquals("gejspodmailzyde", model.tags().get("o")); + Assertions.assertEquals(SkuName.BASIC, model.sku().name()); + } + + // 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/artifactsigning/azure-resourcemanager-artifactsigning/src/test/java/com/azure/resourcemanager/artifactsigning/generated/CodeSigningAccountPropertiesTests.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/test/java/com/azure/resourcemanager/artifactsigning/generated/CodeSigningAccountPropertiesTests.java new file mode 100644 index 000000000000..d022e76f98bd --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/test/java/com/azure/resourcemanager/artifactsigning/generated/CodeSigningAccountPropertiesTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.artifactsigning.fluent.models.CodeSigningAccountProperties; +import com.azure.resourcemanager.artifactsigning.models.AccountSku; +import com.azure.resourcemanager.artifactsigning.models.SkuName; +import org.junit.jupiter.api.Assertions; + +public final class CodeSigningAccountPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + CodeSigningAccountProperties model = BinaryData + .fromString( + "{\"accountUri\":\"mkkvnip\",\"sku\":{\"name\":\"Premium\"},\"provisioningState\":\"Accepted\"}") + .toObject(CodeSigningAccountProperties.class); + Assertions.assertEquals(SkuName.PREMIUM, model.sku().name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + CodeSigningAccountProperties model + = new CodeSigningAccountProperties().withSku(new AccountSku().withName(SkuName.PREMIUM)); + model = BinaryData.fromObject(model).toObject(CodeSigningAccountProperties.class); + Assertions.assertEquals(SkuName.PREMIUM, model.sku().name()); + } +} diff --git a/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/test/java/com/azure/resourcemanager/artifactsigning/generated/CodeSigningAccountsCheckNameAvailabilityWithResponseMockTests.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/test/java/com/azure/resourcemanager/artifactsigning/generated/CodeSigningAccountsCheckNameAvailabilityWithResponseMockTests.java new file mode 100644 index 000000000000..da32e72ab338 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/test/java/com/azure/resourcemanager/artifactsigning/generated/CodeSigningAccountsCheckNameAvailabilityWithResponseMockTests.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.artifactsigning.ArtifactSigningManager; +import com.azure.resourcemanager.artifactsigning.models.CheckNameAvailability; +import com.azure.resourcemanager.artifactsigning.models.CheckNameAvailabilityResult; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class CodeSigningAccountsCheckNameAvailabilityWithResponseMockTests { + @Test + public void testCheckNameAvailabilityWithResponse() throws Exception { + String responseStr = "{\"nameAvailable\":false,\"reason\":\"AlreadyExists\",\"message\":\"cjxvsnbyxqab\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + ArtifactSigningManager manager = ArtifactSigningManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + CheckNameAvailabilityResult response = manager.codeSigningAccounts() + .checkNameAvailabilityWithResponse(new CheckNameAvailability().withType("soifiyipjxsqw").withName("gr"), + com.azure.core.util.Context.NONE) + .getValue(); + + } +} diff --git a/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/test/java/com/azure/resourcemanager/artifactsigning/generated/CodeSigningAccountsCreateMockTests.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/test/java/com/azure/resourcemanager/artifactsigning/generated/CodeSigningAccountsCreateMockTests.java new file mode 100644 index 000000000000..52480227e16d --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/test/java/com/azure/resourcemanager/artifactsigning/generated/CodeSigningAccountsCreateMockTests.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.artifactsigning.ArtifactSigningManager; +import com.azure.resourcemanager.artifactsigning.models.AccountSku; +import com.azure.resourcemanager.artifactsigning.models.CodeSigningAccount; +import com.azure.resourcemanager.artifactsigning.models.SkuName; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class CodeSigningAccountsCreateMockTests { + @Test + public void testCreate() throws Exception { + String responseStr + = "{\"properties\":{\"accountUri\":\"qsycbkbfkgu\",\"sku\":{\"name\":\"Basic\"},\"provisioningState\":\"Succeeded\"},\"location\":\"ppofmxaxcfjpgdd\",\"tags\":{\"exhd\":\"jjxhvpmo\"},\"id\":\"xibqeojnx\",\"name\":\"bzv\",\"type\":\"dntwndeicbtw\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + ArtifactSigningManager manager = ArtifactSigningManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + CodeSigningAccount response = manager.codeSigningAccounts() + .define("shurzafbljjgpbto") + .withRegion("jzyulpk") + .withExistingResourceGroup("mocpc") + .withTags(mapOf("gqexzlocxs", "krlkhbzhfepg", "bcsglumma", "paierh", "xkqpxo", "tjaodxobnb", "po", + "ajionpimexgstxg")) + .withSku(new AccountSku().withName(SkuName.PREMIUM)) + .create(); + + Assertions.assertEquals("ppofmxaxcfjpgdd", response.location()); + Assertions.assertEquals("jjxhvpmo", response.tags().get("exhd")); + Assertions.assertEquals(SkuName.BASIC, response.sku().name()); + } + + // 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/artifactsigning/azure-resourcemanager-artifactsigning/src/test/java/com/azure/resourcemanager/artifactsigning/generated/CodeSigningAccountsGetByResourceGroupWithResponseMockTests.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/test/java/com/azure/resourcemanager/artifactsigning/generated/CodeSigningAccountsGetByResourceGroupWithResponseMockTests.java new file mode 100644 index 000000000000..469f8a404761 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/test/java/com/azure/resourcemanager/artifactsigning/generated/CodeSigningAccountsGetByResourceGroupWithResponseMockTests.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.artifactsigning.ArtifactSigningManager; +import com.azure.resourcemanager.artifactsigning.models.CodeSigningAccount; +import com.azure.resourcemanager.artifactsigning.models.SkuName; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class CodeSigningAccountsGetByResourceGroupWithResponseMockTests { + @Test + public void testGetByResourceGroupWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"accountUri\":\"o\",\"sku\":{\"name\":\"Basic\"},\"provisioningState\":\"Succeeded\"},\"location\":\"mdgbbjfdd\",\"tags\":{\"ppbhtqqrolfp\":\"mbe\",\"gjyjgzjaoyfhrtxi\":\"psalgbqux\",\"rkujy\":\"n\",\"rlyxwjkcprbnw\":\"vlejuvfqa\"},\"id\":\"xgjvtbv\",\"name\":\"ysszdnrujqguh\",\"type\":\"uouq\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + ArtifactSigningManager manager = ArtifactSigningManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + CodeSigningAccount response = manager.codeSigningAccounts() + .getByResourceGroupWithResponse("uqktap", "pwgcuertu", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("mdgbbjfdd", response.location()); + Assertions.assertEquals("mbe", response.tags().get("ppbhtqqrolfp")); + Assertions.assertEquals(SkuName.BASIC, response.sku().name()); + } +} diff --git a/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/test/java/com/azure/resourcemanager/artifactsigning/generated/CodeSigningAccountsListByResourceGroupMockTests.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/test/java/com/azure/resourcemanager/artifactsigning/generated/CodeSigningAccountsListByResourceGroupMockTests.java new file mode 100644 index 000000000000..c9cf1cdc6a53 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/test/java/com/azure/resourcemanager/artifactsigning/generated/CodeSigningAccountsListByResourceGroupMockTests.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.artifactsigning.ArtifactSigningManager; +import com.azure.resourcemanager.artifactsigning.models.CodeSigningAccount; +import com.azure.resourcemanager.artifactsigning.models.SkuName; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class CodeSigningAccountsListByResourceGroupMockTests { + @Test + public void testListByResourceGroup() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"accountUri\":\"zxufiz\",\"sku\":{\"name\":\"Basic\"},\"provisioningState\":\"Deleting\"},\"location\":\"hr\",\"tags\":{\"wisdkft\":\"fvzwdzuhty\",\"vkmijcmmxdcuf\":\"wxmnteiwao\",\"cxtbzsg\":\"fsrpymzidnse\"},\"id\":\"yc\",\"name\":\"sne\",\"type\":\"mdwzjeiachboo\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + ArtifactSigningManager manager = ArtifactSigningManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response + = manager.codeSigningAccounts().listByResourceGroup("prwzwbnguitnwui", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("hr", response.iterator().next().location()); + Assertions.assertEquals("fvzwdzuhty", response.iterator().next().tags().get("wisdkft")); + Assertions.assertEquals(SkuName.BASIC, response.iterator().next().sku().name()); + } +} diff --git a/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/test/java/com/azure/resourcemanager/artifactsigning/generated/CodeSigningAccountsListMockTests.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/test/java/com/azure/resourcemanager/artifactsigning/generated/CodeSigningAccountsListMockTests.java new file mode 100644 index 000000000000..58cd5f740e23 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/test/java/com/azure/resourcemanager/artifactsigning/generated/CodeSigningAccountsListMockTests.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.artifactsigning.ArtifactSigningManager; +import com.azure.resourcemanager.artifactsigning.models.CodeSigningAccount; +import com.azure.resourcemanager.artifactsigning.models.SkuName; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class CodeSigningAccountsListMockTests { + @Test + public void testList() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"accountUri\":\"nrosfqpte\",\"sku\":{\"name\":\"Premium\"},\"provisioningState\":\"Accepted\"},\"location\":\"pyqr\",\"tags\":{\"hc\":\"inpvswjdkirsoodq\"},\"id\":\"mnoh\",\"name\":\"t\",\"type\":\"kwh\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + ArtifactSigningManager manager = ArtifactSigningManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response + = manager.codeSigningAccounts().list(com.azure.core.util.Context.NONE); + + Assertions.assertEquals("pyqr", response.iterator().next().location()); + Assertions.assertEquals("inpvswjdkirsoodq", response.iterator().next().tags().get("hc")); + Assertions.assertEquals(SkuName.PREMIUM, response.iterator().next().sku().name()); + } +} diff --git a/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/test/java/com/azure/resourcemanager/artifactsigning/generated/OperationDisplayTests.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/test/java/com/azure/resourcemanager/artifactsigning/generated/OperationDisplayTests.java new file mode 100644 index 000000000000..9c9feb14aa1b --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/test/java/com/azure/resourcemanager/artifactsigning/generated/OperationDisplayTests.java @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.artifactsigning.models.OperationDisplay; + +public final class OperationDisplayTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperationDisplay model = BinaryData.fromString( + "{\"provider\":\"cdm\",\"resource\":\"rcryuanzwuxzdxta\",\"operation\":\"lhmwhfpmrqobm\",\"description\":\"kknryrtihf\"}") + .toObject(OperationDisplay.class); + } +} diff --git a/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/test/java/com/azure/resourcemanager/artifactsigning/generated/OperationInnerTests.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/test/java/com/azure/resourcemanager/artifactsigning/generated/OperationInnerTests.java new file mode 100644 index 000000000000..c65d01685ec0 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/test/java/com/azure/resourcemanager/artifactsigning/generated/OperationInnerTests.java @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.artifactsigning.fluent.models.OperationInner; + +public final class OperationInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperationInner model = BinaryData.fromString( + "{\"name\":\"nygj\",\"isDataAction\":true,\"display\":{\"provider\":\"eqsrdeupewnwreit\",\"resource\":\"yflusarhmofc\",\"operation\":\"smy\",\"description\":\"kdtmlxhekuk\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"}") + .toObject(OperationInner.class); + } +} diff --git a/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/test/java/com/azure/resourcemanager/artifactsigning/generated/OperationListResultTests.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/test/java/com/azure/resourcemanager/artifactsigning/generated/OperationListResultTests.java new file mode 100644 index 000000000000..255e94d2d2db --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/test/java/com/azure/resourcemanager/artifactsigning/generated/OperationListResultTests.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.artifactsigning.implementation.models.OperationListResult; +import org.junit.jupiter.api.Assertions; + +public final class OperationListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperationListResult model = BinaryData.fromString( + "{\"value\":[{\"name\":\"hq\",\"isDataAction\":true,\"display\":{\"provider\":\"pybczmehmtzopb\",\"resource\":\"h\",\"operation\":\"pidgsybbejhphoyc\",\"description\":\"xaobhdxbmtqioqjz\"},\"origin\":\"system\",\"actionType\":\"Internal\"},{\"name\":\"fpownoizhwlr\",\"isDataAction\":false,\"display\":{\"provider\":\"oqijgkdmbpaz\",\"resource\":\"bc\",\"operation\":\"pdznrbtcqqjnqgl\",\"description\":\"gnufoooj\"},\"origin\":\"system\",\"actionType\":\"Internal\"},{\"name\":\"esaagdfm\",\"isDataAction\":true,\"display\":{\"provider\":\"j\",\"resource\":\"ifkwmrvktsizntoc\",\"operation\":\"a\",\"description\":\"ajpsquc\"},\"origin\":\"system\",\"actionType\":\"Internal\"}],\"nextLink\":\"kfo\"}") + .toObject(OperationListResult.class); + Assertions.assertEquals("kfo", model.nextLink()); + } +} diff --git a/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/test/java/com/azure/resourcemanager/artifactsigning/generated/OperationsListMockTests.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/test/java/com/azure/resourcemanager/artifactsigning/generated/OperationsListMockTests.java new file mode 100644 index 000000000000..0b3b047dab76 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/test/java/com/azure/resourcemanager/artifactsigning/generated/OperationsListMockTests.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.artifactsigning.ArtifactSigningManager; +import com.azure.resourcemanager.artifactsigning.models.Operation; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class OperationsListMockTests { + @Test + public void testList() throws Exception { + String responseStr + = "{\"value\":[{\"name\":\"yb\",\"isDataAction\":true,\"display\":{\"provider\":\"qytbciq\",\"resource\":\"uflmm\",\"operation\":\"zsm\",\"description\":\"mglougpbkw\"},\"origin\":\"system\",\"actionType\":\"Internal\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + ArtifactSigningManager manager = ArtifactSigningManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response = manager.operations().list(com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/test/java/com/azure/resourcemanager/artifactsigning/generated/RevocationTests.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/test/java/com/azure/resourcemanager/artifactsigning/generated/RevocationTests.java new file mode 100644 index 000000000000..a9aec8a73397 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/test/java/com/azure/resourcemanager/artifactsigning/generated/RevocationTests.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.artifactsigning.fluent.models.Revocation; +import com.azure.resourcemanager.artifactsigning.models.RevocationStatus; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; + +public final class RevocationTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + Revocation model = BinaryData.fromString( + "{\"requestedAt\":\"2021-07-24T14:43:12Z\",\"effectiveAt\":\"2021-09-11T06:04:38Z\",\"reason\":\"fkgiawxk\",\"remarks\":\"ypl\",\"status\":\"Failed\",\"failureReason\":\"asy\"}") + .toObject(Revocation.class); + Assertions.assertEquals(OffsetDateTime.parse("2021-07-24T14:43:12Z"), model.requestedAt()); + Assertions.assertEquals(OffsetDateTime.parse("2021-09-11T06:04:38Z"), model.effectiveAt()); + Assertions.assertEquals("fkgiawxk", model.reason()); + Assertions.assertEquals("ypl", model.remarks()); + Assertions.assertEquals(RevocationStatus.FAILED, model.status()); + Assertions.assertEquals("asy", model.failureReason()); + } +} diff --git a/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/test/java/com/azure/resourcemanager/artifactsigning/generated/RevokeCertificateTests.java b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/test/java/com/azure/resourcemanager/artifactsigning/generated/RevokeCertificateTests.java new file mode 100644 index 000000000000..db1dc3deda92 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/src/test/java/com/azure/resourcemanager/artifactsigning/generated/RevokeCertificateTests.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.artifactsigning.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.artifactsigning.models.RevokeCertificate; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; + +public final class RevokeCertificateTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RevokeCertificate model = BinaryData.fromString( + "{\"serialNumber\":\"ejk\",\"thumbprint\":\"tynqgoul\",\"effectiveAt\":\"2021-01-30T20:47:53Z\",\"reason\":\"dlikwyqkgfgibma\",\"remarks\":\"akeqs\"}") + .toObject(RevokeCertificate.class); + Assertions.assertEquals("ejk", model.serialNumber()); + Assertions.assertEquals("tynqgoul", model.thumbprint()); + Assertions.assertEquals(OffsetDateTime.parse("2021-01-30T20:47:53Z"), model.effectiveAt()); + Assertions.assertEquals("dlikwyqkgfgibma", model.reason()); + Assertions.assertEquals("akeqs", model.remarks()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RevokeCertificate model = new RevokeCertificate().withSerialNumber("ejk") + .withThumbprint("tynqgoul") + .withEffectiveAt(OffsetDateTime.parse("2021-01-30T20:47:53Z")) + .withReason("dlikwyqkgfgibma") + .withRemarks("akeqs"); + model = BinaryData.fromObject(model).toObject(RevokeCertificate.class); + Assertions.assertEquals("ejk", model.serialNumber()); + Assertions.assertEquals("tynqgoul", model.thumbprint()); + Assertions.assertEquals(OffsetDateTime.parse("2021-01-30T20:47:53Z"), model.effectiveAt()); + Assertions.assertEquals("dlikwyqkgfgibma", model.reason()); + Assertions.assertEquals("akeqs", model.remarks()); + } +} diff --git a/sdk/artifactsigning/azure-resourcemanager-artifactsigning/tsp-location.yaml b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/tsp-location.yaml new file mode 100644 index 000000000000..98197b250642 --- /dev/null +++ b/sdk/artifactsigning/azure-resourcemanager-artifactsigning/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/codesigning/CodeSigning.Management +commit: 095b67fa70bf85a51667949506fe090e987d2475 +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/artifactsigning/ci.yml b/sdk/artifactsigning/ci.yml new file mode 100644 index 000000000000..624733aed1d5 --- /dev/null +++ b/sdk/artifactsigning/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/artifactsigning/ci.yml + - sdk/artifactsigning/azure-resourcemanager-artifactsigning/ + exclude: + - sdk/artifactsigning/pom.xml + - sdk/artifactsigning/azure-resourcemanager-artifactsigning/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/artifactsigning/ci.yml + - sdk/artifactsigning/azure-resourcemanager-artifactsigning/ + exclude: + - sdk/artifactsigning/pom.xml + - sdk/artifactsigning/azure-resourcemanager-artifactsigning/pom.xml + +parameters: + - name: release_azureresourcemanagerartifactsigning + displayName: azure-resourcemanager-artifactsigning + type: boolean + default: false + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: artifactsigning + Artifacts: + - name: azure-resourcemanager-artifactsigning + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerartifactsigning + releaseInBatch: ${{ parameters.release_azureresourcemanagerartifactsigning }} diff --git a/sdk/artifactsigning/pom.xml b/sdk/artifactsigning/pom.xml new file mode 100644 index 000000000000..207474df083b --- /dev/null +++ b/sdk/artifactsigning/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + com.azure + azure-artifactsigning-service + pom + 1.0.0 + + + azure-resourcemanager-artifactsigning + +