diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index f64b70065d1d..277df38c0675 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -530,6 +530,7 @@ com.azure.resourcemanager:azure-resourcemanager-datatransfer;1.0.0-beta.1;1.0.0- com.azure.resourcemanager:azure-resourcemanager-sovereign;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-aiinfraoptimization;1.0.0-beta.2;1.0.0-beta.3 com.azure.resourcemanager:azure-resourcemanager-networksecurity;1.0.0-beta.2;1.0.0-beta.3 +com.azure.resourcemanager:azure-resourcemanager-digitalassets;1.0.0-beta.1;1.0.0-beta.1 com.azure.tools:api-review-maven-plugin;1.0.0-beta.1;1.0.0-beta.1 com.azure.tools:apiview-java-processor;1.34.0;1.34.0 com.azure.tools:azure-sdk-archetype;1.0.0;1.2.0-beta.1 diff --git a/pom.xml b/pom.xml index 67bf3b498d89..1d19ef56f0e8 100644 --- a/pom.xml +++ b/pom.xml @@ -102,6 +102,7 @@ sdk/deviceupdate sdk/devopsinfrastructure sdk/devtestlabs + sdk/digitalassets sdk/digitaltwins sdk/disconnectedoperations sdk/discovery diff --git a/sdk/digitalassets/azure-resourcemanager-digitalassets/CHANGELOG.md b/sdk/digitalassets/azure-resourcemanager-digitalassets/CHANGELOG.md new file mode 100644 index 000000000000..ecc930ca3672 --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 1.0.0-beta.1 (2026-11-24) + +- Azure Resource Manager DigitalAssets client library for Java. This package contains Microsoft Azure SDK for DigitalAssets Management SDK. Package api-version 2025-09-01-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). +### Features Added + +- Initial release for the azure-resourcemanager-digitalassets Java SDK. diff --git a/sdk/digitalassets/azure-resourcemanager-digitalassets/README.md b/sdk/digitalassets/azure-resourcemanager-digitalassets/README.md new file mode 100644 index 000000000000..6dd56a994c85 --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/README.md @@ -0,0 +1,102 @@ +# Azure Resource Manager DigitalAssets client library for Java + +Azure Resource Manager DigitalAssets client library for Java. + +This package contains Microsoft Azure SDK for DigitalAssets Management SDK. Package api-version 2025-09-01-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +## We'd love to hear your feedback + +We're always working on improving our products and the way we communicate with our users. So we'd love to learn what's working and how we can do better. + +If you haven't already, please take a few minutes to [complete this short survey][survey] we have put together. + +Thank you in advance for your collaboration. We really appreciate your time! + +## Documentation + +Various documentation is available to help you get started + +- [API reference documentation][docs] + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-digitalassets;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-digitalassets + 1.0.0-beta.1 + +``` +[//]: # ({x-version-update-end}) + +### Include the recommended packages + +Azure Management Libraries require a `TokenCredential` implementation for authentication and an `HttpClient` implementation for HTTP client. + +[Azure Identity][azure_identity] and [Azure Core Netty HTTP][azure_core_http_netty] packages provide the default implementation. + +### Authentication + +Microsoft Entra ID token authentication relies on the [credential class][azure_identity_credentials] from [Azure Identity][azure_identity] package. + +Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment variable. + +Assuming the use of the `DefaultAzureCredential` credential class, the client can be authenticated using the following code: + +```java +AzureProfile profile = new AzureProfile(AzureCloud.AZURE_PUBLIC_CLOUD); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +DigitalAssetsManager manager = DigitalAssetsManager + .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/digitalassets/azure-resourcemanager-digitalassets/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/digitalassets/azure-resourcemanager-digitalassets/SAMPLE.md b/sdk/digitalassets/azure-resourcemanager-digitalassets/SAMPLE.md new file mode 100644 index 000000000000..b8d55f07602b --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/SAMPLE.md @@ -0,0 +1,391 @@ +# Code snippets and samples + + +## Operations + +- [List](#operations_list) + +## Partitions + +- [CreateOrUpdate](#partitions_createorupdate) +- [Delete](#partitions_delete) +- [Get](#partitions_get) +- [ListByParent](#partitions_listbyparent) +- [Update](#partitions_update) + +## ZkpRollups + +- [CreateOrUpdate](#zkprollups_createorupdate) +- [Delete](#zkprollups_delete) +- [GetByResourceGroup](#zkprollups_getbyresourcegroup) +- [List](#zkprollups_list) +- [ListByResourceGroup](#zkprollups_listbyresourcegroup) +- [Update](#zkprollups_update) +### Operations_List + +```java +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: 2025-09-01-preview/Operations_List.json + */ + /** + * Sample code: ListOperations. + * + * @param manager Entry point to DigitalAssetsManager. + */ + public static void listOperations(com.azure.resourcemanager.digitalassets.DigitalAssetsManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} +``` + +### Partitions_CreateOrUpdate + +```java +/** + * Samples for Partitions CreateOrUpdate. + */ +public final class PartitionsCreateOrUpdateSamples { + /* + * x-ms-original-file: 2025-09-01-preview/Partitions_CreateOrUpdate.json + */ + /** + * Sample code: CreatePartition. + * + * @param manager Entry point to DigitalAssetsManager. + */ + public static void createPartition(com.azure.resourcemanager.digitalassets.DigitalAssetsManager manager) { + manager.partitions().define("Partition1").withRegion("eastus").withExistingZkpRollup("testrg", "Jack").create(); + } +} +``` + +### Partitions_Delete + +```java +/** + * Samples for Partitions Delete. + */ +public final class PartitionsDeleteSamples { + /* + * x-ms-original-file: 2025-09-01-preview/Partitions_Delete.json + */ + /** + * Sample code: DeletePartition. + * + * @param manager Entry point to DigitalAssetsManager. + */ + public static void deletePartition(com.azure.resourcemanager.digitalassets.DigitalAssetsManager manager) { + manager.partitions().delete("testrg", "Jack", "Partition1", com.azure.core.util.Context.NONE); + } +} +``` + +### Partitions_Get + +```java +/** + * Samples for Partitions Get. + */ +public final class PartitionsGetSamples { + /* + * x-ms-original-file: 2025-09-01-preview/Partitions_Get.json + */ + /** + * Sample code: GetPartition. + * + * @param manager Entry point to DigitalAssetsManager. + */ + public static void getPartition(com.azure.resourcemanager.digitalassets.DigitalAssetsManager manager) { + manager.partitions().getWithResponse("testrg", "Jack", "Partition1", com.azure.core.util.Context.NONE); + } +} +``` + +### Partitions_ListByParent + +```java +/** + * Samples for Partitions ListByParent. + */ +public final class PartitionsListByParentSamples { + /* + * x-ms-original-file: 2025-09-01-preview/Partitions_ListByParent.json + */ + /** + * Sample code: ListPartitionsByParent. + * + * @param manager Entry point to DigitalAssetsManager. + */ + public static void listPartitionsByParent(com.azure.resourcemanager.digitalassets.DigitalAssetsManager manager) { + manager.partitions().listByParent("testrg", "Jack", com.azure.core.util.Context.NONE); + } +} +``` + +### Partitions_Update + +```java +import com.azure.resourcemanager.digitalassets.models.Partition; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Partitions Update. + */ +public final class PartitionsUpdateSamples { + /* + * x-ms-original-file: 2025-09-01-preview/Partitions_Update.json + */ + /** + * Sample code: UpdatePartition. + * + * @param manager Entry point to DigitalAssetsManager. + */ + public static void updatePartition(com.azure.resourcemanager.digitalassets.DigitalAssetsManager manager) { + Partition resource = manager.partitions() + .getWithResponse("testrg", "Jack", "Partition1", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("env", "test")).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; + } +} +``` + +### ZkpRollups_CreateOrUpdate + +```java +import com.azure.resourcemanager.digitalassets.models.ManagedServiceIdentity; +import com.azure.resourcemanager.digitalassets.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.digitalassets.models.UserAssignedIdentity; +import com.azure.resourcemanager.digitalassets.models.ZkpRollupProperties; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for ZkpRollups CreateOrUpdate. + */ +public final class ZkpRollupsCreateOrUpdateSamples { + /* + * x-ms-original-file: 2025-09-01-preview/ZkpRollups_CreateOrUpdate.json + */ + /** + * Sample code: CreateZkpRollup. + * + * @param manager Entry point to DigitalAssetsManager. + */ + public static void createZkpRollup(com.azure.resourcemanager.digitalassets.DigitalAssetsManager manager) { + manager.zkpRollups() + .define("Jack") + .withRegion("eastus") + .withExistingResourceGroup("testrg") + .withProperties(new ZkpRollupProperties() + .withTokenOwnerAccounts(Arrays.asList("0x1111111111111111111111111111111111111111", + "0x2222222222222222222222222222222222222222")) + .withKeyVaultId("fakeTokenPlaceholder") + .withKeyVaultUserAssignedIdentityResourceId("fakeTokenPlaceholder") + .withCustomerVpnPublicIp("203.0.113.10") + .withCustomerOnPremAddressPrefixes(Arrays.asList("192.168.100.0/24")) + .withBootNodeId( + "79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8") + .withBootNodeIp("10.0.0.4") + .withBootNodeP2pPort(30303) + .withBootNodeRpcPort(8545) + .withServiceBusEndpoint("https://sb-da-customer.servicebus.windows.net") + .withServiceBusQueueName("proofs-output")) + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities(mapOf( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/kvReader", + new UserAssignedIdentity()))) + .create(); + } + + // 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; + } +} +``` + +### ZkpRollups_Delete + +```java +/** + * Samples for ZkpRollups Delete. + */ +public final class ZkpRollupsDeleteSamples { + /* + * x-ms-original-file: 2025-09-01-preview/ZkpRollups_Delete.json + */ + /** + * Sample code: DeleteZkpRollup. + * + * @param manager Entry point to DigitalAssetsManager. + */ + public static void deleteZkpRollup(com.azure.resourcemanager.digitalassets.DigitalAssetsManager manager) { + manager.zkpRollups().delete("testrg", "Jack", com.azure.core.util.Context.NONE); + } +} +``` + +### ZkpRollups_GetByResourceGroup + +```java +/** + * Samples for ZkpRollups GetByResourceGroup. + */ +public final class ZkpRollupsGetByResourceGroupSamples { + /* + * x-ms-original-file: 2025-09-01-preview/ZkpRollups_Get.json + */ + /** + * Sample code: GetZkpRollup. + * + * @param manager Entry point to DigitalAssetsManager. + */ + public static void getZkpRollup(com.azure.resourcemanager.digitalassets.DigitalAssetsManager manager) { + manager.zkpRollups().getByResourceGroupWithResponse("testrg", "Jack", com.azure.core.util.Context.NONE); + } +} +``` + +### ZkpRollups_List + +```java +/** + * Samples for ZkpRollups List. + */ +public final class ZkpRollupsListSamples { + /* + * x-ms-original-file: 2025-09-01-preview/ZkpRollups_ListBySubscription.json + */ + /** + * Sample code: ListZkpRollupsBySubscription. + * + * @param manager Entry point to DigitalAssetsManager. + */ + public static void + listZkpRollupsBySubscription(com.azure.resourcemanager.digitalassets.DigitalAssetsManager manager) { + manager.zkpRollups().list(com.azure.core.util.Context.NONE); + } +} +``` + +### ZkpRollups_ListByResourceGroup + +```java +/** + * Samples for ZkpRollups ListByResourceGroup. + */ +public final class ZkpRollupsListByResourceGroupSamples { + /* + * x-ms-original-file: 2025-09-01-preview/ZkpRollups_ListByResourceGroup.json + */ + /** + * Sample code: ListZkpRollupsByResourceGroup. + * + * @param manager Entry point to DigitalAssetsManager. + */ + public static void + listZkpRollupsByResourceGroup(com.azure.resourcemanager.digitalassets.DigitalAssetsManager manager) { + manager.zkpRollups().listByResourceGroup("testrg", com.azure.core.util.Context.NONE); + } +} +``` + +### ZkpRollups_Update + +```java +import com.azure.resourcemanager.digitalassets.models.ZkpRollup; +import com.azure.resourcemanager.digitalassets.models.ZkpRollupIdentityUpdate; +import com.azure.resourcemanager.digitalassets.models.ZkpRollupPatchProperties; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for ZkpRollups Update. + */ +public final class ZkpRollupsUpdateSamples { + /* + * x-ms-original-file: 2025-09-01-preview/ZkpRollups_Update.json + */ + /** + * Sample code: UpdateZkpRollupTagsIdentityAndBootNode. + * + * @param manager Entry point to DigitalAssetsManager. + */ + public static void + updateZkpRollupTagsIdentityAndBootNode(com.azure.resourcemanager.digitalassets.DigitalAssetsManager manager) { + ZkpRollup resource = manager.zkpRollups() + .getByResourceGroupWithResponse("testrg", "Jack", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("env", "test")) + .withIdentity(new ZkpRollupIdentityUpdate().withUserAssignedIdentities(mapOf( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/additionalReader", + null))) + .withProperties(new ZkpRollupPatchProperties().withBootNodeIp("10.0.0.4")) + .apply(); + } + + /* + * x-ms-original-file: 2025-09-01-preview/ZkpRollups_UpdateConfiguration.json + */ + /** + * Sample code: UpdateZkpRollupConfiguration. + * + * @param manager Entry point to DigitalAssetsManager. + */ + public static void + updateZkpRollupConfiguration(com.azure.resourcemanager.digitalassets.DigitalAssetsManager manager) { + ZkpRollup resource = manager.zkpRollups() + .getByResourceGroupWithResponse("testrg", "Jack", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withProperties(new ZkpRollupPatchProperties() + .withTokenOwnerAccounts(Arrays.asList("0x2222222222222222222222222222222222222222")) + .withBootNodeId( + "79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8") + .withBootNodeIp("10.0.0.5") + .withBootNodeP2pPort(30304) + .withBootNodeRpcPort(8546)) + .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/digitalassets/azure-resourcemanager-digitalassets/pom.xml b/sdk/digitalassets/azure-resourcemanager-digitalassets/pom.xml new file mode 100644 index 000000000000..b353a5b2c427 --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/pom.xml @@ -0,0 +1,74 @@ + + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-digitalassets + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for DigitalAssets Management + This package contains Microsoft Azure SDK for DigitalAssets Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Package api-version 2025-09-01-preview. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + 0 + 0 + true + + + + com.azure + azure-core + 1.61.0 + + + com.azure + azure-core-management + 1.20.0 + + + com.azure + azure-core-test + 1.27.0-beta.20 + test + + + com.azure + azure-identity + 1.19.0 + test + + + diff --git a/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/DigitalAssetsManager.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/DigitalAssetsManager.java new file mode 100644 index 000000000000..88e067a5fc77 --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/DigitalAssetsManager.java @@ -0,0 +1,313 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.digitalassets; + +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.digitalassets.fluent.DigitalAssetsManagementClient; +import com.azure.resourcemanager.digitalassets.implementation.DigitalAssetsManagementClientBuilder; +import com.azure.resourcemanager.digitalassets.implementation.OperationsImpl; +import com.azure.resourcemanager.digitalassets.implementation.PartitionsImpl; +import com.azure.resourcemanager.digitalassets.implementation.ZkpRollupsImpl; +import com.azure.resourcemanager.digitalassets.models.Operations; +import com.azure.resourcemanager.digitalassets.models.Partitions; +import com.azure.resourcemanager.digitalassets.models.ZkpRollups; +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 DigitalAssetsManager. + */ +public final class DigitalAssetsManager { + private Operations operations; + + private ZkpRollups zkpRollups; + + private Partitions partitions; + + private final DigitalAssetsManagementClient clientObject; + + private DigitalAssetsManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = new DigitalAssetsManagementClientBuilder().pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of DigitalAssets service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the DigitalAssets service API instance. + */ + public static DigitalAssetsManager 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 DigitalAssets service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the DigitalAssets service API instance. + */ + public static DigitalAssetsManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new DigitalAssetsManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create DigitalAssetsManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new DigitalAssetsManager.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-digitalassets.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 DigitalAssets service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the DigitalAssets service API instance. + */ + public DigitalAssetsManager 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.digitalassets") + .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 DigitalAssetsManager(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 ZkpRollups. It manages ZkpRollup. + * + * @return Resource collection API of ZkpRollups. + */ + public ZkpRollups zkpRollups() { + if (this.zkpRollups == null) { + this.zkpRollups = new ZkpRollupsImpl(clientObject.getZkpRollups(), this); + } + return zkpRollups; + } + + /** + * Gets the resource collection API of Partitions. It manages Partition. + * + * @return Resource collection API of Partitions. + */ + public Partitions partitions() { + if (this.partitions == null) { + this.partitions = new PartitionsImpl(clientObject.getPartitions(), this); + } + return partitions; + } + + /** + * Gets wrapped service client DigitalAssetsManagementClient providing direct access to the underlying + * auto-generated API implementation, based on Azure REST API. + * + * @return Wrapped service client DigitalAssetsManagementClient. + */ + public DigitalAssetsManagementClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/fluent/DigitalAssetsManagementClient.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/fluent/DigitalAssetsManagementClient.java new file mode 100644 index 000000000000..59b3ce3427fe --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/fluent/DigitalAssetsManagementClient.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.digitalassets.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** + * The interface for DigitalAssetsManagementClient class. + */ +public interface DigitalAssetsManagementClient { + /** + * 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 ZkpRollupsClient object to access its operations. + * + * @return the ZkpRollupsClient object. + */ + ZkpRollupsClient getZkpRollups(); + + /** + * Gets the PartitionsClient object to access its operations. + * + * @return the PartitionsClient object. + */ + PartitionsClient getPartitions(); +} diff --git a/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/fluent/OperationsClient.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/fluent/OperationsClient.java new file mode 100644 index 000000000000..6cd4706ddf02 --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/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.digitalassets.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.digitalassets.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/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/fluent/PartitionsClient.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/fluent/PartitionsClient.java new file mode 100644 index 000000000000..8f4d51cd00e3 --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/fluent/PartitionsClient.java @@ -0,0 +1,234 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.digitalassets.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.digitalassets.fluent.models.PartitionInner; +import com.azure.resourcemanager.digitalassets.models.PartitionTagsUpdate; + +/** + * An instance of this class provides access to all the operations defined in PartitionsClient. + */ +public interface PartitionsClient { + /** + * Get a Partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @param partitionName The name of the partition. + * @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 Partition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String zkpRollupName, String partitionName, + Context context); + + /** + * Get a Partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @param partitionName The name of the partition. + * @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 Partition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PartitionInner get(String resourceGroupName, String zkpRollupName, String partitionName); + + /** + * Creates or replaces a partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @param partitionName The name of the partition. + * @param resource Resource create parameters. + * @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 a deployable partition of a ZkpRollup. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, PartitionInner> beginCreateOrUpdate(String resourceGroupName, + String zkpRollupName, String partitionName, PartitionInner resource); + + /** + * Creates or replaces a partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @param partitionName The name of the partition. + * @param resource Resource create parameters. + * @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 a deployable partition of a ZkpRollup. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, PartitionInner> beginCreateOrUpdate(String resourceGroupName, + String zkpRollupName, String partitionName, PartitionInner resource, Context context); + + /** + * Creates or replaces a partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @param partitionName The name of the partition. + * @param resource Resource create parameters. + * @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 deployable partition of a ZkpRollup. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PartitionInner createOrUpdate(String resourceGroupName, String zkpRollupName, String partitionName, + PartitionInner resource); + + /** + * Creates or replaces a partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @param partitionName The name of the partition. + * @param resource Resource create parameters. + * @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 deployable partition of a ZkpRollup. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PartitionInner createOrUpdate(String resourceGroupName, String zkpRollupName, String partitionName, + PartitionInner resource, Context context); + + /** + * Update a Partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @param partitionName The name of the partition. + * @param properties The resource properties to be updated. + * @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 deployable partition of a ZkpRollup along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse(String resourceGroupName, String zkpRollupName, String partitionName, + PartitionTagsUpdate properties, Context context); + + /** + * Update a Partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @param partitionName The name of the partition. + * @param properties The resource properties to be updated. + * @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 deployable partition of a ZkpRollup. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PartitionInner update(String resourceGroupName, String zkpRollupName, String partitionName, + PartitionTagsUpdate properties); + + /** + * Delete a Partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @param partitionName The name of the partition. + * @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 zkpRollupName, + String partitionName); + + /** + * Delete a Partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @param partitionName The name of the partition. + * @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 zkpRollupName, String partitionName, + Context context); + + /** + * Delete a Partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @param partitionName The name of the partition. + * @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 zkpRollupName, String partitionName); + + /** + * Delete a Partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @param partitionName The name of the partition. + * @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 zkpRollupName, String partitionName, Context context); + + /** + * List Partition resources by ZkpRollup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @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 Partition list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByParent(String resourceGroupName, String zkpRollupName); + + /** + * List Partition resources by ZkpRollup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @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 Partition list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByParent(String resourceGroupName, String zkpRollupName, Context context); +} diff --git a/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/fluent/ZkpRollupsClient.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/fluent/ZkpRollupsClient.java new file mode 100644 index 000000000000..54e18c62f440 --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/fluent/ZkpRollupsClient.java @@ -0,0 +1,276 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.digitalassets.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.digitalassets.fluent.models.ZkpRollupInner; +import com.azure.resourcemanager.digitalassets.models.ZkpRollupUpdate; + +/** + * An instance of this class provides access to all the operations defined in ZkpRollupsClient. + */ +public interface ZkpRollupsClient { + /** + * Get a ZkpRollup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @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 ZkpRollup along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, String zkpRollupName, + Context context); + + /** + * Get a ZkpRollup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @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 ZkpRollup. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ZkpRollupInner getByResourceGroup(String resourceGroupName, String zkpRollupName); + + /** + * Creates or replaces a ZKP rollup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @param resource Resource create parameters. + * @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 a DigitalAssets ZKP rollup resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ZkpRollupInner> beginCreateOrUpdate(String resourceGroupName, + String zkpRollupName, ZkpRollupInner resource); + + /** + * Creates or replaces a ZKP rollup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @param resource Resource create parameters. + * @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 a DigitalAssets ZKP rollup resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ZkpRollupInner> beginCreateOrUpdate(String resourceGroupName, + String zkpRollupName, ZkpRollupInner resource, Context context); + + /** + * Creates or replaces a ZKP rollup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @param resource Resource create parameters. + * @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 DigitalAssets ZKP rollup resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ZkpRollupInner createOrUpdate(String resourceGroupName, String zkpRollupName, ZkpRollupInner resource); + + /** + * Creates or replaces a ZKP rollup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @param resource Resource create parameters. + * @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 DigitalAssets ZKP rollup resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ZkpRollupInner createOrUpdate(String resourceGroupName, String zkpRollupName, ZkpRollupInner resource, + Context context); + + /** + * Updates rollup tags, identity attachments or configuration. Metadata-only updates complete synchronously. + * Configuration changes reconcile the rollup and existing partition asynchronously, preserving checkpoints and + * discovered contracts. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @param properties The resource properties to be updated. + * @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 a DigitalAssets ZKP rollup resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ZkpRollupInner> beginUpdate(String resourceGroupName, String zkpRollupName, + ZkpRollupUpdate properties); + + /** + * Updates rollup tags, identity attachments or configuration. Metadata-only updates complete synchronously. + * Configuration changes reconcile the rollup and existing partition asynchronously, preserving checkpoints and + * discovered contracts. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @param properties The resource properties to be updated. + * @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 a DigitalAssets ZKP rollup resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ZkpRollupInner> beginUpdate(String resourceGroupName, String zkpRollupName, + ZkpRollupUpdate properties, Context context); + + /** + * Updates rollup tags, identity attachments or configuration. Metadata-only updates complete synchronously. + * Configuration changes reconcile the rollup and existing partition asynchronously, preserving checkpoints and + * discovered contracts. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @param properties The resource properties to be updated. + * @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 DigitalAssets ZKP rollup resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ZkpRollupInner update(String resourceGroupName, String zkpRollupName, ZkpRollupUpdate properties); + + /** + * Updates rollup tags, identity attachments or configuration. Metadata-only updates complete synchronously. + * Configuration changes reconcile the rollup and existing partition asynchronously, preserving checkpoints and + * discovered contracts. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @param properties The resource properties to be updated. + * @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 DigitalAssets ZKP rollup resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ZkpRollupInner update(String resourceGroupName, String zkpRollupName, ZkpRollupUpdate properties, Context context); + + /** + * Delete a ZkpRollup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @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 zkpRollupName); + + /** + * Delete a ZkpRollup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @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 zkpRollupName, Context context); + + /** + * Delete a ZkpRollup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @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 zkpRollupName); + + /** + * Delete a ZkpRollup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @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 zkpRollupName, Context context); + + /** + * List ZkpRollup resources by 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 ZkpRollup list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List ZkpRollup resources by 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 ZkpRollup list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List ZkpRollup resources by subscription ID. + * + * @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 ZkpRollup list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List ZkpRollup resources by subscription 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 the response of a ZkpRollup list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/fluent/models/OperationInner.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/fluent/models/OperationInner.java new file mode 100644 index 000000000000..51eb06c566cd --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/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.digitalassets.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.digitalassets.models.ActionType; +import com.azure.resourcemanager.digitalassets.models.OperationDisplay; +import com.azure.resourcemanager.digitalassets.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/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/fluent/models/PartitionInner.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/fluent/models/PartitionInner.java new file mode 100644 index 000000000000..9161ca99cf67 --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/fluent/models/PartitionInner.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.digitalassets.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.digitalassets.models.PartitionProperties; +import java.io.IOException; +import java.util.Map; + +/** + * A deployable partition of a ZkpRollup. + */ +@Fluent +public final class PartitionInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + private PartitionProperties properties; + + /* + * 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 PartitionInner class. + */ + public PartitionInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public PartitionProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the PartitionInner object itself. + */ + public PartitionInner withProperties(PartitionProperties properties) { + this.properties = properties; + return this; + } + + /** + * 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 PartitionInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public PartitionInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * {@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.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PartitionInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PartitionInner 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 PartitionInner. + */ + public static PartitionInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PartitionInner deserializedPartitionInner = new PartitionInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedPartitionInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedPartitionInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedPartitionInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedPartitionInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedPartitionInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedPartitionInner.properties = PartitionProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedPartitionInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedPartitionInner; + }); + } +} diff --git a/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/fluent/models/ZkpRollupInner.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/fluent/models/ZkpRollupInner.java new file mode 100644 index 000000000000..ccf8022d1fcc --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/fluent/models/ZkpRollupInner.java @@ -0,0 +1,210 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.digitalassets.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.digitalassets.models.ManagedServiceIdentity; +import com.azure.resourcemanager.digitalassets.models.ZkpRollupProperties; +import java.io.IOException; +import java.util.Map; + +/** + * A DigitalAssets ZKP rollup resource. + */ +@Fluent +public final class ZkpRollupInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + private ZkpRollupProperties properties; + + /* + * The managed service identities assigned to this resource. + */ + private ManagedServiceIdentity identity; + + /* + * 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 ZkpRollupInner class. + */ + public ZkpRollupInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public ZkpRollupProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the ZkpRollupInner object itself. + */ + public ZkpRollupInner withProperties(ZkpRollupProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the identity property: The managed service identities assigned to this resource. + * + * @return the identity value. + */ + public ManagedServiceIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: The managed service identities assigned to this resource. + * + * @param identity the identity value to set. + * @return the ZkpRollupInner object itself. + */ + public ZkpRollupInner withIdentity(ManagedServiceIdentity identity) { + this.identity = identity; + return this; + } + + /** + * 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 ZkpRollupInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ZkpRollupInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * {@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.properties); + jsonWriter.writeJsonField("identity", this.identity); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ZkpRollupInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ZkpRollupInner 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 ZkpRollupInner. + */ + public static ZkpRollupInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ZkpRollupInner deserializedZkpRollupInner = new ZkpRollupInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedZkpRollupInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedZkpRollupInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedZkpRollupInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedZkpRollupInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedZkpRollupInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedZkpRollupInner.properties = ZkpRollupProperties.fromJson(reader); + } else if ("identity".equals(fieldName)) { + deserializedZkpRollupInner.identity = ManagedServiceIdentity.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedZkpRollupInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedZkpRollupInner; + }); + } +} diff --git a/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/fluent/models/package-info.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/fluent/models/package-info.java new file mode 100644 index 000000000000..24110977eab0 --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/fluent/models/package-info.java @@ -0,0 +1,8 @@ +// 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 DigitalAssets. + */ +package com.azure.resourcemanager.digitalassets.fluent.models; diff --git a/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/fluent/package-info.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/fluent/package-info.java new file mode 100644 index 000000000000..920f5d880415 --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/fluent/package-info.java @@ -0,0 +1,8 @@ +// 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 DigitalAssets. + */ +package com.azure.resourcemanager.digitalassets.fluent; diff --git a/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/implementation/DigitalAssetsManagementClientBuilder.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/implementation/DigitalAssetsManagementClientBuilder.java new file mode 100644 index 000000000000..435a78d813ea --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/implementation/DigitalAssetsManagementClientBuilder.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.digitalassets.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 DigitalAssetsManagementClientImpl type. + */ +@ServiceClientBuilder(serviceClients = { DigitalAssetsManagementClientImpl.class }) +public final class DigitalAssetsManagementClientBuilder { + /* + * Service host + */ + private String endpoint; + + /** + * Sets Service host. + * + * @param endpoint the endpoint value. + * @return the DigitalAssetsManagementClientBuilder. + */ + public DigitalAssetsManagementClientBuilder 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 DigitalAssetsManagementClientBuilder. + */ + public DigitalAssetsManagementClientBuilder 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 DigitalAssetsManagementClientBuilder. + */ + public DigitalAssetsManagementClientBuilder 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 DigitalAssetsManagementClientBuilder. + */ + public DigitalAssetsManagementClientBuilder 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 DigitalAssetsManagementClientBuilder. + */ + public DigitalAssetsManagementClientBuilder 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 DigitalAssetsManagementClientBuilder. + */ + public DigitalAssetsManagementClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of DigitalAssetsManagementClientImpl with the provided parameters. + * + * @return an instance of DigitalAssetsManagementClientImpl. + */ + public DigitalAssetsManagementClientImpl 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(); + DigitalAssetsManagementClientImpl client = new DigitalAssetsManagementClientImpl(localPipeline, + localSerializerAdapter, localDefaultPollInterval, localEnvironment, localEndpoint, this.subscriptionId); + return client; + } +} diff --git a/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/implementation/DigitalAssetsManagementClientImpl.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/implementation/DigitalAssetsManagementClientImpl.java new file mode 100644 index 000000000000..340e5c522ee3 --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/implementation/DigitalAssetsManagementClientImpl.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.digitalassets.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.digitalassets.fluent.DigitalAssetsManagementClient; +import com.azure.resourcemanager.digitalassets.fluent.OperationsClient; +import com.azure.resourcemanager.digitalassets.fluent.PartitionsClient; +import com.azure.resourcemanager.digitalassets.fluent.ZkpRollupsClient; +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 DigitalAssetsManagementClientImpl type. + */ +@ServiceClient(builder = DigitalAssetsManagementClientBuilder.class) +public final class DigitalAssetsManagementClientImpl implements DigitalAssetsManagementClient { + /** + * 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 ZkpRollupsClient object to access its operations. + */ + private final ZkpRollupsClient zkpRollups; + + /** + * Gets the ZkpRollupsClient object to access its operations. + * + * @return the ZkpRollupsClient object. + */ + public ZkpRollupsClient getZkpRollups() { + return this.zkpRollups; + } + + /** + * The PartitionsClient object to access its operations. + */ + private final PartitionsClient partitions; + + /** + * Gets the PartitionsClient object to access its operations. + * + * @return the PartitionsClient object. + */ + public PartitionsClient getPartitions() { + return this.partitions; + } + + /** + * Initializes an instance of DigitalAssetsManagementClient 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. + */ + DigitalAssetsManagementClientImpl(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-09-01-preview"; + this.operations = new OperationsClientImpl(this); + this.zkpRollups = new ZkpRollupsClientImpl(this); + this.partitions = new PartitionsClientImpl(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 ? new byte[0] : 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(DigitalAssetsManagementClientImpl.class); +} diff --git a/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/implementation/OperationImpl.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/implementation/OperationImpl.java new file mode 100644 index 000000000000..dcbff86ed3cb --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/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.digitalassets.implementation; + +import com.azure.resourcemanager.digitalassets.fluent.models.OperationInner; +import com.azure.resourcemanager.digitalassets.models.ActionType; +import com.azure.resourcemanager.digitalassets.models.Operation; +import com.azure.resourcemanager.digitalassets.models.OperationDisplay; +import com.azure.resourcemanager.digitalassets.models.Origin; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.digitalassets.DigitalAssetsManager serviceManager; + + OperationImpl(OperationInner innerObject, + com.azure.resourcemanager.digitalassets.DigitalAssetsManager 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.digitalassets.DigitalAssetsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/implementation/OperationsClientImpl.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/implementation/OperationsClientImpl.java new file mode 100644 index 000000000000..e440198ba634 --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/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.digitalassets.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.digitalassets.fluent.OperationsClient; +import com.azure.resourcemanager.digitalassets.fluent.models.OperationInner; +import com.azure.resourcemanager.digitalassets.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 DigitalAssetsManagementClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(DigitalAssetsManagementClientImpl client) { + this.service + = RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DigitalAssetsManagementClientOperations to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "DigitalAssetsManagementClientOperations") + public interface OperationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.DigitalAssets/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.DigitalAssets/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/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/implementation/OperationsImpl.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/implementation/OperationsImpl.java new file mode 100644 index 000000000000..face08d3c591 --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/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.digitalassets.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.digitalassets.fluent.OperationsClient; +import com.azure.resourcemanager.digitalassets.fluent.models.OperationInner; +import com.azure.resourcemanager.digitalassets.models.Operation; +import com.azure.resourcemanager.digitalassets.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.digitalassets.DigitalAssetsManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, + com.azure.resourcemanager.digitalassets.DigitalAssetsManager 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.digitalassets.DigitalAssetsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/implementation/PartitionImpl.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/implementation/PartitionImpl.java new file mode 100644 index 000000000000..026af92f4fe8 --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/implementation/PartitionImpl.java @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.digitalassets.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.digitalassets.fluent.models.PartitionInner; +import com.azure.resourcemanager.digitalassets.models.Partition; +import com.azure.resourcemanager.digitalassets.models.PartitionProperties; +import com.azure.resourcemanager.digitalassets.models.PartitionTagsUpdate; +import java.util.Collections; +import java.util.Map; + +public final class PartitionImpl implements Partition, Partition.Definition, Partition.Update { + private PartitionInner innerObject; + + private final com.azure.resourcemanager.digitalassets.DigitalAssetsManager 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 PartitionProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public PartitionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.digitalassets.DigitalAssetsManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String zkpRollupName; + + private String partitionName; + + private PartitionTagsUpdate updateProperties; + + public PartitionImpl withExistingZkpRollup(String resourceGroupName, String zkpRollupName) { + this.resourceGroupName = resourceGroupName; + this.zkpRollupName = zkpRollupName; + return this; + } + + public Partition create() { + this.innerObject = serviceManager.serviceClient() + .getPartitions() + .createOrUpdate(resourceGroupName, zkpRollupName, partitionName, this.innerModel(), Context.NONE); + return this; + } + + public Partition create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getPartitions() + .createOrUpdate(resourceGroupName, zkpRollupName, partitionName, this.innerModel(), context); + return this; + } + + PartitionImpl(String name, com.azure.resourcemanager.digitalassets.DigitalAssetsManager serviceManager) { + this.innerObject = new PartitionInner(); + this.serviceManager = serviceManager; + this.partitionName = name; + } + + public PartitionImpl update() { + this.updateProperties = new PartitionTagsUpdate(); + return this; + } + + public Partition apply() { + this.innerObject = serviceManager.serviceClient() + .getPartitions() + .updateWithResponse(resourceGroupName, zkpRollupName, partitionName, updateProperties, Context.NONE) + .getValue(); + return this; + } + + public Partition apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getPartitions() + .updateWithResponse(resourceGroupName, zkpRollupName, partitionName, updateProperties, context) + .getValue(); + return this; + } + + PartitionImpl(PartitionInner innerObject, + com.azure.resourcemanager.digitalassets.DigitalAssetsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByParameterName(innerObject.id(), + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalAssets/zkpRollups/{zkpRollupName}/partitions/{partitionName}", + "resourceGroupName"); + this.zkpRollupName = ResourceManagerUtils.getValueFromIdByParameterName(innerObject.id(), + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalAssets/zkpRollups/{zkpRollupName}/partitions/{partitionName}", + "zkpRollupName"); + this.partitionName = ResourceManagerUtils.getValueFromIdByParameterName(innerObject.id(), + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalAssets/zkpRollups/{zkpRollupName}/partitions/{partitionName}", + "partitionName"); + } + + public Partition refresh() { + this.innerObject = serviceManager.serviceClient() + .getPartitions() + .getWithResponse(resourceGroupName, zkpRollupName, partitionName, Context.NONE) + .getValue(); + return this; + } + + public Partition refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getPartitions() + .getWithResponse(resourceGroupName, zkpRollupName, partitionName, context) + .getValue(); + return this; + } + + public PartitionImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public PartitionImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public PartitionImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateProperties.withTags(tags); + return this; + } + } + + public PartitionImpl withProperties(PartitionProperties properties) { + this.innerModel().withProperties(properties); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel() == null || this.innerModel().id() == null; + } +} diff --git a/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/implementation/PartitionsClientImpl.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/implementation/PartitionsClientImpl.java new file mode 100644 index 000000000000..bb14287e68c6 --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/implementation/PartitionsClientImpl.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.digitalassets.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.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.digitalassets.fluent.PartitionsClient; +import com.azure.resourcemanager.digitalassets.fluent.models.PartitionInner; +import com.azure.resourcemanager.digitalassets.implementation.models.PartitionListResult; +import com.azure.resourcemanager.digitalassets.models.PartitionTagsUpdate; +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 PartitionsClient. + */ +public final class PartitionsClientImpl implements PartitionsClient { + /** + * The proxy service used to perform REST calls. + */ + private final PartitionsService service; + + /** + * The service client containing this operation class. + */ + private final DigitalAssetsManagementClientImpl client; + + /** + * Initializes an instance of PartitionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PartitionsClientImpl(DigitalAssetsManagementClientImpl client) { + this.service + = RestProxy.create(PartitionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DigitalAssetsManagementClientPartitions to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "DigitalAssetsManagementClientPartitions") + public interface PartitionsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalAssets/zkpRollups/{zkpRollupName}/partitions/{partitionName}") + @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("zkpRollupName") String zkpRollupName, + @PathParam("partitionName") String partitionName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalAssets/zkpRollups/{zkpRollupName}/partitions/{partitionName}") + @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("zkpRollupName") String zkpRollupName, + @PathParam("partitionName") String partitionName, @HeaderParam("Accept") String accept, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalAssets/zkpRollups/{zkpRollupName}/partitions/{partitionName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("zkpRollupName") String zkpRollupName, + @PathParam("partitionName") String partitionName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") PartitionInner resource, + Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalAssets/zkpRollups/{zkpRollupName}/partitions/{partitionName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("zkpRollupName") String zkpRollupName, + @PathParam("partitionName") String partitionName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") PartitionInner resource, + Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalAssets/zkpRollups/{zkpRollupName}/partitions/{partitionName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("zkpRollupName") String zkpRollupName, + @PathParam("partitionName") String partitionName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") PartitionTagsUpdate properties, + Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalAssets/zkpRollups/{zkpRollupName}/partitions/{partitionName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("zkpRollupName") String zkpRollupName, + @PathParam("partitionName") String partitionName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") PartitionTagsUpdate properties, + Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalAssets/zkpRollups/{zkpRollupName}/partitions/{partitionName}") + @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("zkpRollupName") String zkpRollupName, + @PathParam("partitionName") String partitionName, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalAssets/zkpRollups/{zkpRollupName}/partitions/{partitionName}") + @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("zkpRollupName") String zkpRollupName, + @PathParam("partitionName") String partitionName, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalAssets/zkpRollups/{zkpRollupName}/partitions") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByParent(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("zkpRollupName") String zkpRollupName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalAssets/zkpRollups/{zkpRollupName}/partitions") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByParentSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("zkpRollupName") String zkpRollupName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByParentNext( + @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 listByParentNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get a Partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @param partitionName The name of the partition. + * @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 Partition along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String zkpRollupName, + String partitionName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, zkpRollupName, partitionName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a Partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @param partitionName The name of the partition. + * @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 Partition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String zkpRollupName, String partitionName) { + return getWithResponseAsync(resourceGroupName, zkpRollupName, partitionName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a Partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @param partitionName The name of the partition. + * @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 Partition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String zkpRollupName, + String partitionName, Context context) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, zkpRollupName, partitionName, accept, context); + } + + /** + * Get a Partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @param partitionName The name of the partition. + * @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 Partition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PartitionInner get(String resourceGroupName, String zkpRollupName, String partitionName) { + return getWithResponse(resourceGroupName, zkpRollupName, partitionName, Context.NONE).getValue(); + } + + /** + * Creates or replaces a partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @param partitionName The name of the partition. + * @param resource Resource create parameters. + * @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 deployable partition of a ZkpRollup along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String zkpRollupName, String partitionName, PartitionInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, zkpRollupName, partitionName, contentType, accept, + resource, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or replaces a partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @param partitionName The name of the partition. + * @param resource Resource create parameters. + * @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 deployable partition of a ZkpRollup along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String zkpRollupName, + String partitionName, PartitionInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, zkpRollupName, partitionName, contentType, accept, + resource, Context.NONE); + } + + /** + * Creates or replaces a partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @param partitionName The name of the partition. + * @param resource Resource create parameters. + * @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 deployable partition of a ZkpRollup along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String zkpRollupName, + String partitionName, PartitionInner resource, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, zkpRollupName, partitionName, contentType, accept, + resource, context); + } + + /** + * Creates or replaces a partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @param partitionName The name of the partition. + * @param resource Resource create parameters. + * @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 a deployable partition of a ZkpRollup. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, PartitionInner> beginCreateOrUpdateAsync(String resourceGroupName, + String zkpRollupName, String partitionName, PartitionInner resource) { + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, zkpRollupName, partitionName, resource); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + PartitionInner.class, PartitionInner.class, this.client.getContext()); + } + + /** + * Creates or replaces a partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @param partitionName The name of the partition. + * @param resource Resource create parameters. + * @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 a deployable partition of a ZkpRollup. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, PartitionInner> beginCreateOrUpdate(String resourceGroupName, + String zkpRollupName, String partitionName, PartitionInner resource) { + Response response + = createOrUpdateWithResponse(resourceGroupName, zkpRollupName, partitionName, resource); + return this.client.getLroResult(response, PartitionInner.class, + PartitionInner.class, Context.NONE); + } + + /** + * Creates or replaces a partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @param partitionName The name of the partition. + * @param resource Resource create parameters. + * @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 a deployable partition of a ZkpRollup. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, PartitionInner> beginCreateOrUpdate(String resourceGroupName, + String zkpRollupName, String partitionName, PartitionInner resource, Context context) { + Response response + = createOrUpdateWithResponse(resourceGroupName, zkpRollupName, partitionName, resource, context); + return this.client.getLroResult(response, PartitionInner.class, + PartitionInner.class, context); + } + + /** + * Creates or replaces a partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @param partitionName The name of the partition. + * @param resource Resource create parameters. + * @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 deployable partition of a ZkpRollup on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String zkpRollupName, + String partitionName, PartitionInner resource) { + return beginCreateOrUpdateAsync(resourceGroupName, zkpRollupName, partitionName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or replaces a partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @param partitionName The name of the partition. + * @param resource Resource create parameters. + * @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 deployable partition of a ZkpRollup. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PartitionInner createOrUpdate(String resourceGroupName, String zkpRollupName, String partitionName, + PartitionInner resource) { + return beginCreateOrUpdate(resourceGroupName, zkpRollupName, partitionName, resource).getFinalResult(); + } + + /** + * Creates or replaces a partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @param partitionName The name of the partition. + * @param resource Resource create parameters. + * @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 deployable partition of a ZkpRollup. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PartitionInner createOrUpdate(String resourceGroupName, String zkpRollupName, String partitionName, + PartitionInner resource, Context context) { + return beginCreateOrUpdate(resourceGroupName, zkpRollupName, partitionName, resource, context).getFinalResult(); + } + + /** + * Update a Partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @param partitionName The name of the partition. + * @param properties The resource properties to be updated. + * @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 deployable partition of a ZkpRollup along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync(String resourceGroupName, String zkpRollupName, + String partitionName, PartitionTagsUpdate 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, zkpRollupName, partitionName, contentType, accept, + properties, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a Partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @param partitionName The name of the partition. + * @param properties The resource properties to be updated. + * @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 deployable partition of a ZkpRollup on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String zkpRollupName, String partitionName, + PartitionTagsUpdate properties) { + return updateWithResponseAsync(resourceGroupName, zkpRollupName, partitionName, properties) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Update a Partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @param partitionName The name of the partition. + * @param properties The resource properties to be updated. + * @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 deployable partition of a ZkpRollup along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse(String resourceGroupName, String zkpRollupName, + String partitionName, PartitionTagsUpdate 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, zkpRollupName, partitionName, contentType, accept, + properties, context); + } + + /** + * Update a Partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @param partitionName The name of the partition. + * @param properties The resource properties to be updated. + * @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 deployable partition of a ZkpRollup. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PartitionInner update(String resourceGroupName, String zkpRollupName, String partitionName, + PartitionTagsUpdate properties) { + return updateWithResponse(resourceGroupName, zkpRollupName, partitionName, properties, Context.NONE).getValue(); + } + + /** + * Delete a Partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @param partitionName The name of the partition. + * @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 zkpRollupName, + String partitionName) { + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, zkpRollupName, partitionName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a Partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @param partitionName The name of the partition. + * @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 zkpRollupName, + String partitionName) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, zkpRollupName, partitionName, Context.NONE); + } + + /** + * Delete a Partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @param partitionName The name of the partition. + * @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 zkpRollupName, + String partitionName, Context context) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, zkpRollupName, partitionName, context); + } + + /** + * Delete a Partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @param partitionName The name of the partition. + * @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 zkpRollupName, + String partitionName) { + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, zkpRollupName, partitionName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Delete a Partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @param partitionName The name of the partition. + * @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 zkpRollupName, + String partitionName) { + Response response = deleteWithResponse(resourceGroupName, zkpRollupName, partitionName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * Delete a Partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @param partitionName The name of the partition. + * @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 zkpRollupName, + String partitionName, Context context) { + Response response = deleteWithResponse(resourceGroupName, zkpRollupName, partitionName, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * Delete a Partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @param partitionName The name of the partition. + * @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 zkpRollupName, String partitionName) { + return beginDeleteAsync(resourceGroupName, zkpRollupName, partitionName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a Partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @param partitionName The name of the partition. + * @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 zkpRollupName, String partitionName) { + beginDelete(resourceGroupName, zkpRollupName, partitionName).getFinalResult(); + } + + /** + * Delete a Partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @param partitionName The name of the partition. + * @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 zkpRollupName, String partitionName, Context context) { + beginDelete(resourceGroupName, zkpRollupName, partitionName, context).getFinalResult(); + } + + /** + * List Partition resources by ZkpRollup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @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 Partition list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByParentSinglePageAsync(String resourceGroupName, + String zkpRollupName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByParent(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, zkpRollupName, 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 Partition resources by ZkpRollup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @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 Partition list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByParentAsync(String resourceGroupName, String zkpRollupName) { + return new PagedFlux<>(() -> listByParentSinglePageAsync(resourceGroupName, zkpRollupName), + nextLink -> listByParentNextSinglePageAsync(nextLink)); + } + + /** + * List Partition resources by ZkpRollup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @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 Partition list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByParentSinglePage(String resourceGroupName, String zkpRollupName) { + final String accept = "application/json"; + Response res + = service.listByParentSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, zkpRollupName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List Partition resources by ZkpRollup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @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 Partition list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByParentSinglePage(String resourceGroupName, String zkpRollupName, + Context context) { + final String accept = "application/json"; + Response res + = service.listByParentSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, zkpRollupName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List Partition resources by ZkpRollup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @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 Partition list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByParent(String resourceGroupName, String zkpRollupName) { + return new PagedIterable<>(() -> listByParentSinglePage(resourceGroupName, zkpRollupName), + nextLink -> listByParentNextSinglePage(nextLink)); + } + + /** + * List Partition resources by ZkpRollup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @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 Partition list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByParent(String resourceGroupName, String zkpRollupName, Context context) { + return new PagedIterable<>(() -> listByParentSinglePage(resourceGroupName, zkpRollupName, context), + nextLink -> listByParentNextSinglePage(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 the response of a Partition list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByParentNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByParentNext(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 Partition list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByParentNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listByParentNextSync(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 Partition list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByParentNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res + = service.listByParentNextSync(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/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/implementation/PartitionsImpl.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/implementation/PartitionsImpl.java new file mode 100644 index 000000000000..a17eb426dfaf --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/implementation/PartitionsImpl.java @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.digitalassets.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.digitalassets.fluent.PartitionsClient; +import com.azure.resourcemanager.digitalassets.fluent.models.PartitionInner; +import com.azure.resourcemanager.digitalassets.models.Partition; +import com.azure.resourcemanager.digitalassets.models.Partitions; + +public final class PartitionsImpl implements Partitions { + private static final ClientLogger LOGGER = new ClientLogger(PartitionsImpl.class); + + private final PartitionsClient innerClient; + + private final com.azure.resourcemanager.digitalassets.DigitalAssetsManager serviceManager; + + public PartitionsImpl(PartitionsClient innerClient, + com.azure.resourcemanager.digitalassets.DigitalAssetsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceGroupName, String zkpRollupName, String partitionName, + Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, zkpRollupName, partitionName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new PartitionImpl(inner.getValue(), this.manager())); + } + + public Partition get(String resourceGroupName, String zkpRollupName, String partitionName) { + PartitionInner inner = this.serviceClient().get(resourceGroupName, zkpRollupName, partitionName); + if (inner != null) { + return new PartitionImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String zkpRollupName, String partitionName) { + this.serviceClient().delete(resourceGroupName, zkpRollupName, partitionName); + } + + public void delete(String resourceGroupName, String zkpRollupName, String partitionName, Context context) { + this.serviceClient().delete(resourceGroupName, zkpRollupName, partitionName, context); + } + + public PagedIterable listByParent(String resourceGroupName, String zkpRollupName) { + PagedIterable inner = this.serviceClient().listByParent(resourceGroupName, zkpRollupName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new PartitionImpl(inner1, this.manager())); + } + + public PagedIterable listByParent(String resourceGroupName, String zkpRollupName, Context context) { + PagedIterable inner + = this.serviceClient().listByParent(resourceGroupName, zkpRollupName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new PartitionImpl(inner1, this.manager())); + } + + public Partition getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalAssets/zkpRollups/{zkpRollupName}/partitions/{partitionName}", + "resourceGroupName"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String zkpRollupName = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalAssets/zkpRollups/{zkpRollupName}/partitions/{partitionName}", + "zkpRollupName"); + if (zkpRollupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'zkpRollups'.", id))); + } + String partitionName = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalAssets/zkpRollups/{zkpRollupName}/partitions/{partitionName}", + "partitionName"); + if (partitionName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'partitions'.", id))); + } + return this.getWithResponse(resourceGroupName, zkpRollupName, partitionName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalAssets/zkpRollups/{zkpRollupName}/partitions/{partitionName}", + "resourceGroupName"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String zkpRollupName = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalAssets/zkpRollups/{zkpRollupName}/partitions/{partitionName}", + "zkpRollupName"); + if (zkpRollupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'zkpRollups'.", id))); + } + String partitionName = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalAssets/zkpRollups/{zkpRollupName}/partitions/{partitionName}", + "partitionName"); + if (partitionName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'partitions'.", id))); + } + return this.getWithResponse(resourceGroupName, zkpRollupName, partitionName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalAssets/zkpRollups/{zkpRollupName}/partitions/{partitionName}", + "resourceGroupName"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String zkpRollupName = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalAssets/zkpRollups/{zkpRollupName}/partitions/{partitionName}", + "zkpRollupName"); + if (zkpRollupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'zkpRollups'.", id))); + } + String partitionName = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalAssets/zkpRollups/{zkpRollupName}/partitions/{partitionName}", + "partitionName"); + if (partitionName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'partitions'.", id))); + } + this.delete(resourceGroupName, zkpRollupName, partitionName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalAssets/zkpRollups/{zkpRollupName}/partitions/{partitionName}", + "resourceGroupName"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String zkpRollupName = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalAssets/zkpRollups/{zkpRollupName}/partitions/{partitionName}", + "zkpRollupName"); + if (zkpRollupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'zkpRollups'.", id))); + } + String partitionName = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalAssets/zkpRollups/{zkpRollupName}/partitions/{partitionName}", + "partitionName"); + if (partitionName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'partitions'.", id))); + } + this.delete(resourceGroupName, zkpRollupName, partitionName, context); + } + + private PartitionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.digitalassets.DigitalAssetsManager manager() { + return this.serviceManager; + } + + public PartitionImpl define(String name) { + return new PartitionImpl(name, this.manager()); + } +} diff --git a/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/implementation/ResourceManagerUtils.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/implementation/ResourceManagerUtils.java new file mode 100644 index 000000000000..c669b13bdbbd --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/implementation/ResourceManagerUtils.java @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.digitalassets.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 java.util.Arrays; +import java.util.Iterator; +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 getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { + if (id == null || pathTemplate == null || parameterName == null) { + return null; + } + String[] idSegments = id.split("/", -1); + String[] pathSegments = pathTemplate.split("/", -1); + int idStart = idSegments[0].isEmpty() ? 1 : 0; + int pathStart = pathSegments[0].isEmpty() ? 1 : 0; + if (idStart == idSegments.length || pathStart == pathSegments.length) { + return null; + } + for (int i = idStart; i < idSegments.length; ++i) { + if (idSegments[i].isEmpty()) { + return null; + } + } + String parameterPlaceholder = "{" + parameterName + "}"; + String value = null; + int idIndex = idSegments.length - 1; + for (int pathIndex = pathSegments.length - 1; pathIndex >= pathStart; --pathIndex, --idIndex) { + String pathSegment = pathSegments[pathIndex]; + boolean isParameter = pathSegment.startsWith("{") && pathSegment.endsWith("}"); + if (pathIndex == pathStart && isParameter) { + // A leading scope can span multiple segments, or be empty for tenant resources. + if (pathSegment.equalsIgnoreCase(parameterPlaceholder)) { + value = String.join("/", Arrays.copyOfRange(idSegments, idStart, idIndex + 1)); + } + idIndex = idStart; + } else if (idIndex < idStart) { + return null; + } else if (!isParameter && !pathSegment.equalsIgnoreCase(idSegments[idIndex])) { + return null; + } else if (pathSegment.equalsIgnoreCase(parameterPlaceholder)) { + value = idSegments[idIndex]; + } + } + return idIndex < idStart ? value : 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/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/implementation/ZkpRollupImpl.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/implementation/ZkpRollupImpl.java new file mode 100644 index 000000000000..5c00d0f98e48 --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/implementation/ZkpRollupImpl.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.digitalassets.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.digitalassets.fluent.models.ZkpRollupInner; +import com.azure.resourcemanager.digitalassets.models.ManagedServiceIdentity; +import com.azure.resourcemanager.digitalassets.models.ZkpRollup; +import com.azure.resourcemanager.digitalassets.models.ZkpRollupIdentityUpdate; +import com.azure.resourcemanager.digitalassets.models.ZkpRollupPatchProperties; +import com.azure.resourcemanager.digitalassets.models.ZkpRollupProperties; +import com.azure.resourcemanager.digitalassets.models.ZkpRollupUpdate; +import java.util.Collections; +import java.util.Map; + +public final class ZkpRollupImpl implements ZkpRollup, ZkpRollup.Definition, ZkpRollup.Update { + private ZkpRollupInner innerObject; + + private final com.azure.resourcemanager.digitalassets.DigitalAssetsManager 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 ZkpRollupProperties properties() { + return this.innerModel().properties(); + } + + public ManagedServiceIdentity identity() { + return this.innerModel().identity(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public ZkpRollupInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.digitalassets.DigitalAssetsManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String zkpRollupName; + + private ZkpRollupUpdate updateProperties; + + public ZkpRollupImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public ZkpRollup create() { + this.innerObject = serviceManager.serviceClient() + .getZkpRollups() + .createOrUpdate(resourceGroupName, zkpRollupName, this.innerModel(), Context.NONE); + return this; + } + + public ZkpRollup create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getZkpRollups() + .createOrUpdate(resourceGroupName, zkpRollupName, this.innerModel(), context); + return this; + } + + ZkpRollupImpl(String name, com.azure.resourcemanager.digitalassets.DigitalAssetsManager serviceManager) { + this.innerObject = new ZkpRollupInner(); + this.serviceManager = serviceManager; + this.zkpRollupName = name; + } + + public ZkpRollupImpl update() { + this.updateProperties = new ZkpRollupUpdate(); + return this; + } + + public ZkpRollup apply() { + this.innerObject = serviceManager.serviceClient() + .getZkpRollups() + .update(resourceGroupName, zkpRollupName, updateProperties, Context.NONE); + return this; + } + + public ZkpRollup apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getZkpRollups() + .update(resourceGroupName, zkpRollupName, updateProperties, context); + return this; + } + + ZkpRollupImpl(ZkpRollupInner innerObject, + com.azure.resourcemanager.digitalassets.DigitalAssetsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByParameterName(innerObject.id(), + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalAssets/zkpRollups/{zkpRollupName}", + "resourceGroupName"); + this.zkpRollupName = ResourceManagerUtils.getValueFromIdByParameterName(innerObject.id(), + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalAssets/zkpRollups/{zkpRollupName}", + "zkpRollupName"); + } + + public ZkpRollup refresh() { + this.innerObject = serviceManager.serviceClient() + .getZkpRollups() + .getByResourceGroupWithResponse(resourceGroupName, zkpRollupName, Context.NONE) + .getValue(); + return this; + } + + public ZkpRollup refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getZkpRollups() + .getByResourceGroupWithResponse(resourceGroupName, zkpRollupName, context) + .getValue(); + return this; + } + + public ZkpRollupImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public ZkpRollupImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public ZkpRollupImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateProperties.withTags(tags); + return this; + } + } + + public ZkpRollupImpl withProperties(ZkpRollupProperties properties) { + this.innerModel().withProperties(properties); + return this; + } + + public ZkpRollupImpl withIdentity(ManagedServiceIdentity identity) { + this.innerModel().withIdentity(identity); + return this; + } + + public ZkpRollupImpl withIdentity(ZkpRollupIdentityUpdate identity) { + this.updateProperties.withIdentity(identity); + return this; + } + + public ZkpRollupImpl withProperties(ZkpRollupPatchProperties properties) { + this.updateProperties.withProperties(properties); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel() == null || this.innerModel().id() == null; + } +} diff --git a/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/implementation/ZkpRollupsClientImpl.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/implementation/ZkpRollupsClientImpl.java new file mode 100644 index 000000000000..25d5535d2cfe --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/implementation/ZkpRollupsClientImpl.java @@ -0,0 +1,1113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.digitalassets.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.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.digitalassets.fluent.ZkpRollupsClient; +import com.azure.resourcemanager.digitalassets.fluent.models.ZkpRollupInner; +import com.azure.resourcemanager.digitalassets.implementation.models.ZkpRollupListResult; +import com.azure.resourcemanager.digitalassets.models.ZkpRollupUpdate; +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 ZkpRollupsClient. + */ +public final class ZkpRollupsClientImpl implements ZkpRollupsClient { + /** + * The proxy service used to perform REST calls. + */ + private final ZkpRollupsService service; + + /** + * The service client containing this operation class. + */ + private final DigitalAssetsManagementClientImpl client; + + /** + * Initializes an instance of ZkpRollupsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ZkpRollupsClientImpl(DigitalAssetsManagementClientImpl client) { + this.service + = RestProxy.create(ZkpRollupsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DigitalAssetsManagementClientZkpRollups to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "DigitalAssetsManagementClientZkpRollups") + public interface ZkpRollupsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalAssets/zkpRollups/{zkpRollupName}") + @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("zkpRollupName") String zkpRollupName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalAssets/zkpRollups/{zkpRollupName}") + @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("zkpRollupName") String zkpRollupName, + @HeaderParam("Accept") String accept, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalAssets/zkpRollups/{zkpRollupName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("zkpRollupName") String zkpRollupName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") ZkpRollupInner resource, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalAssets/zkpRollups/{zkpRollupName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("zkpRollupName") String zkpRollupName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") ZkpRollupInner resource, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalAssets/zkpRollups/{zkpRollupName}") + @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("zkpRollupName") String zkpRollupName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") ZkpRollupUpdate properties, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalAssets/zkpRollups/{zkpRollupName}") + @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("zkpRollupName") String zkpRollupName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") ZkpRollupUpdate properties, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalAssets/zkpRollups/{zkpRollupName}") + @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("zkpRollupName") String zkpRollupName, + Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalAssets/zkpRollups/{zkpRollupName}") + @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("zkpRollupName") String zkpRollupName, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalAssets/zkpRollups") + @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.DigitalAssets/zkpRollups") + @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.DigitalAssets/zkpRollups") + @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.DigitalAssets/zkpRollups") + @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); + + @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 a ZkpRollup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @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 ZkpRollup along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String zkpRollupName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, zkpRollupName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a ZkpRollup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @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 ZkpRollup on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String zkpRollupName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, zkpRollupName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a ZkpRollup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @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 ZkpRollup along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, String zkpRollupName, + Context context) { + final String accept = "application/json"; + return service.getByResourceGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, zkpRollupName, accept, context); + } + + /** + * Get a ZkpRollup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @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 ZkpRollup. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ZkpRollupInner getByResourceGroup(String resourceGroupName, String zkpRollupName) { + return getByResourceGroupWithResponse(resourceGroupName, zkpRollupName, Context.NONE).getValue(); + } + + /** + * Creates or replaces a ZKP rollup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @param resource Resource create parameters. + * @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 DigitalAssets ZKP rollup resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String zkpRollupName, ZkpRollupInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, zkpRollupName, contentType, accept, resource, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or replaces a ZKP rollup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @param resource Resource create parameters. + * @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 DigitalAssets ZKP rollup resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String zkpRollupName, + ZkpRollupInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, zkpRollupName, contentType, accept, resource, + Context.NONE); + } + + /** + * Creates or replaces a ZKP rollup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @param resource Resource create parameters. + * @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 DigitalAssets ZKP rollup resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String zkpRollupName, + ZkpRollupInner resource, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, zkpRollupName, contentType, accept, resource, context); + } + + /** + * Creates or replaces a ZKP rollup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @param resource Resource create parameters. + * @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 a DigitalAssets ZKP rollup resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ZkpRollupInner> beginCreateOrUpdateAsync(String resourceGroupName, + String zkpRollupName, ZkpRollupInner resource) { + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, zkpRollupName, resource); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + ZkpRollupInner.class, ZkpRollupInner.class, this.client.getContext()); + } + + /** + * Creates or replaces a ZKP rollup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @param resource Resource create parameters. + * @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 a DigitalAssets ZKP rollup resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ZkpRollupInner> beginCreateOrUpdate(String resourceGroupName, + String zkpRollupName, ZkpRollupInner resource) { + Response response = createOrUpdateWithResponse(resourceGroupName, zkpRollupName, resource); + return this.client.getLroResult(response, ZkpRollupInner.class, + ZkpRollupInner.class, Context.NONE); + } + + /** + * Creates or replaces a ZKP rollup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @param resource Resource create parameters. + * @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 a DigitalAssets ZKP rollup resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ZkpRollupInner> beginCreateOrUpdate(String resourceGroupName, + String zkpRollupName, ZkpRollupInner resource, Context context) { + Response response = createOrUpdateWithResponse(resourceGroupName, zkpRollupName, resource, context); + return this.client.getLroResult(response, ZkpRollupInner.class, + ZkpRollupInner.class, context); + } + + /** + * Creates or replaces a ZKP rollup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @param resource Resource create parameters. + * @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 DigitalAssets ZKP rollup resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String zkpRollupName, + ZkpRollupInner resource) { + return beginCreateOrUpdateAsync(resourceGroupName, zkpRollupName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or replaces a ZKP rollup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @param resource Resource create parameters. + * @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 DigitalAssets ZKP rollup resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ZkpRollupInner createOrUpdate(String resourceGroupName, String zkpRollupName, ZkpRollupInner resource) { + return beginCreateOrUpdate(resourceGroupName, zkpRollupName, resource).getFinalResult(); + } + + /** + * Creates or replaces a ZKP rollup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @param resource Resource create parameters. + * @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 DigitalAssets ZKP rollup resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ZkpRollupInner createOrUpdate(String resourceGroupName, String zkpRollupName, ZkpRollupInner resource, + Context context) { + return beginCreateOrUpdate(resourceGroupName, zkpRollupName, resource, context).getFinalResult(); + } + + /** + * Updates rollup tags, identity attachments or configuration. Metadata-only updates complete synchronously. + * Configuration changes reconcile the rollup and existing partition asynchronously, preserving checkpoints and + * discovered contracts. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @param properties The resource properties to be updated. + * @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 DigitalAssets ZKP rollup resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, String zkpRollupName, + ZkpRollupUpdate 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, zkpRollupName, contentType, accept, properties, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates rollup tags, identity attachments or configuration. Metadata-only updates complete synchronously. + * Configuration changes reconcile the rollup and existing partition asynchronously, preserving checkpoints and + * discovered contracts. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @param properties The resource properties to be updated. + * @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 DigitalAssets ZKP rollup resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String zkpRollupName, + ZkpRollupUpdate properties) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, zkpRollupName, contentType, accept, properties, + Context.NONE); + } + + /** + * Updates rollup tags, identity attachments or configuration. Metadata-only updates complete synchronously. + * Configuration changes reconcile the rollup and existing partition asynchronously, preserving checkpoints and + * discovered contracts. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @param properties The resource properties to be updated. + * @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 DigitalAssets ZKP rollup resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String zkpRollupName, + ZkpRollupUpdate 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, zkpRollupName, contentType, accept, properties, + context); + } + + /** + * Updates rollup tags, identity attachments or configuration. Metadata-only updates complete synchronously. + * Configuration changes reconcile the rollup and existing partition asynchronously, preserving checkpoints and + * discovered contracts. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @param properties The resource properties to be updated. + * @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 a DigitalAssets ZKP rollup resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ZkpRollupInner> beginUpdateAsync(String resourceGroupName, + String zkpRollupName, ZkpRollupUpdate properties) { + Mono>> mono = updateWithResponseAsync(resourceGroupName, zkpRollupName, properties); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + ZkpRollupInner.class, ZkpRollupInner.class, this.client.getContext()); + } + + /** + * Updates rollup tags, identity attachments or configuration. Metadata-only updates complete synchronously. + * Configuration changes reconcile the rollup and existing partition asynchronously, preserving checkpoints and + * discovered contracts. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @param properties The resource properties to be updated. + * @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 a DigitalAssets ZKP rollup resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ZkpRollupInner> beginUpdate(String resourceGroupName, + String zkpRollupName, ZkpRollupUpdate properties) { + Response response = updateWithResponse(resourceGroupName, zkpRollupName, properties); + return this.client.getLroResult(response, ZkpRollupInner.class, + ZkpRollupInner.class, Context.NONE); + } + + /** + * Updates rollup tags, identity attachments or configuration. Metadata-only updates complete synchronously. + * Configuration changes reconcile the rollup and existing partition asynchronously, preserving checkpoints and + * discovered contracts. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @param properties The resource properties to be updated. + * @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 a DigitalAssets ZKP rollup resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ZkpRollupInner> beginUpdate(String resourceGroupName, + String zkpRollupName, ZkpRollupUpdate properties, Context context) { + Response response = updateWithResponse(resourceGroupName, zkpRollupName, properties, context); + return this.client.getLroResult(response, ZkpRollupInner.class, + ZkpRollupInner.class, context); + } + + /** + * Updates rollup tags, identity attachments or configuration. Metadata-only updates complete synchronously. + * Configuration changes reconcile the rollup and existing partition asynchronously, preserving checkpoints and + * discovered contracts. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @param properties The resource properties to be updated. + * @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 DigitalAssets ZKP rollup resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String zkpRollupName, + ZkpRollupUpdate properties) { + return beginUpdateAsync(resourceGroupName, zkpRollupName, properties).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates rollup tags, identity attachments or configuration. Metadata-only updates complete synchronously. + * Configuration changes reconcile the rollup and existing partition asynchronously, preserving checkpoints and + * discovered contracts. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @param properties The resource properties to be updated. + * @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 DigitalAssets ZKP rollup resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ZkpRollupInner update(String resourceGroupName, String zkpRollupName, ZkpRollupUpdate properties) { + return beginUpdate(resourceGroupName, zkpRollupName, properties).getFinalResult(); + } + + /** + * Updates rollup tags, identity attachments or configuration. Metadata-only updates complete synchronously. + * Configuration changes reconcile the rollup and existing partition asynchronously, preserving checkpoints and + * discovered contracts. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @param properties The resource properties to be updated. + * @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 DigitalAssets ZKP rollup resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ZkpRollupInner update(String resourceGroupName, String zkpRollupName, ZkpRollupUpdate properties, + Context context) { + return beginUpdate(resourceGroupName, zkpRollupName, properties, context).getFinalResult(); + } + + /** + * Delete a ZkpRollup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @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 zkpRollupName) { + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, zkpRollupName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a ZkpRollup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @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 zkpRollupName) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, zkpRollupName, Context.NONE); + } + + /** + * Delete a ZkpRollup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @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 zkpRollupName, Context context) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, zkpRollupName, context); + } + + /** + * Delete a ZkpRollup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @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 zkpRollupName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, zkpRollupName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Delete a ZkpRollup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @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 zkpRollupName) { + Response response = deleteWithResponse(resourceGroupName, zkpRollupName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * Delete a ZkpRollup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @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 zkpRollupName, + Context context) { + Response response = deleteWithResponse(resourceGroupName, zkpRollupName, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * Delete a ZkpRollup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @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 zkpRollupName) { + return beginDeleteAsync(resourceGroupName, zkpRollupName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a ZkpRollup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @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 zkpRollupName) { + beginDelete(resourceGroupName, zkpRollupName).getFinalResult(); + } + + /** + * Delete a ZkpRollup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @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 zkpRollupName, Context context) { + beginDelete(resourceGroupName, zkpRollupName, context).getFinalResult(); + } + + /** + * List ZkpRollup resources by 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 ZkpRollup 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())); + } + + /** + * List ZkpRollup resources by 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 ZkpRollup 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)); + } + + /** + * List ZkpRollup resources by 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 ZkpRollup 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); + } + + /** + * List ZkpRollup resources by 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 ZkpRollup 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); + } + + /** + * List ZkpRollup resources by 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 ZkpRollup 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)); + } + + /** + * List ZkpRollup resources by 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 ZkpRollup 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)); + } + + /** + * List ZkpRollup resources by subscription ID. + * + * @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 ZkpRollup 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())); + } + + /** + * List ZkpRollup resources by subscription ID. + * + * @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 ZkpRollup list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List ZkpRollup resources by subscription ID. + * + * @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 ZkpRollup 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); + } + + /** + * List ZkpRollup resources by subscription ID. + * + * @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 ZkpRollup 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); + } + + /** + * List ZkpRollup resources by subscription ID. + * + * @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 ZkpRollup list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listBySubscriptionNextSinglePage(nextLink)); + } + + /** + * List ZkpRollup resources by subscription ID. + * + * @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 ZkpRollup 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)); + } + + /** + * 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 ZkpRollup 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 ZkpRollup 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 ZkpRollup 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 ZkpRollup 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 ZkpRollup 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 ZkpRollup 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/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/implementation/ZkpRollupsImpl.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/implementation/ZkpRollupsImpl.java new file mode 100644 index 000000000000..f3b7ebfb25db --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/implementation/ZkpRollupsImpl.java @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.digitalassets.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.digitalassets.fluent.ZkpRollupsClient; +import com.azure.resourcemanager.digitalassets.fluent.models.ZkpRollupInner; +import com.azure.resourcemanager.digitalassets.models.ZkpRollup; +import com.azure.resourcemanager.digitalassets.models.ZkpRollups; + +public final class ZkpRollupsImpl implements ZkpRollups { + private static final ClientLogger LOGGER = new ClientLogger(ZkpRollupsImpl.class); + + private final ZkpRollupsClient innerClient; + + private final com.azure.resourcemanager.digitalassets.DigitalAssetsManager serviceManager; + + public ZkpRollupsImpl(ZkpRollupsClient innerClient, + com.azure.resourcemanager.digitalassets.DigitalAssetsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, String zkpRollupName, + Context context) { + Response inner + = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, zkpRollupName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ZkpRollupImpl(inner.getValue(), this.manager())); + } + + public ZkpRollup getByResourceGroup(String resourceGroupName, String zkpRollupName) { + ZkpRollupInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, zkpRollupName); + if (inner != null) { + return new ZkpRollupImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String zkpRollupName) { + this.serviceClient().delete(resourceGroupName, zkpRollupName); + } + + public void delete(String resourceGroupName, String zkpRollupName, Context context) { + this.serviceClient().delete(resourceGroupName, zkpRollupName, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ZkpRollupImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ZkpRollupImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ZkpRollupImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ZkpRollupImpl(inner1, this.manager())); + } + + public ZkpRollup getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalAssets/zkpRollups/{zkpRollupName}", + "resourceGroupName"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String zkpRollupName = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalAssets/zkpRollups/{zkpRollupName}", + "zkpRollupName"); + if (zkpRollupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'zkpRollups'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, zkpRollupName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalAssets/zkpRollups/{zkpRollupName}", + "resourceGroupName"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String zkpRollupName = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalAssets/zkpRollups/{zkpRollupName}", + "zkpRollupName"); + if (zkpRollupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'zkpRollups'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, zkpRollupName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalAssets/zkpRollups/{zkpRollupName}", + "resourceGroupName"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String zkpRollupName = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalAssets/zkpRollups/{zkpRollupName}", + "zkpRollupName"); + if (zkpRollupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'zkpRollups'.", id))); + } + this.delete(resourceGroupName, zkpRollupName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalAssets/zkpRollups/{zkpRollupName}", + "resourceGroupName"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String zkpRollupName = ResourceManagerUtils.getValueFromIdByParameterName(id, + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DigitalAssets/zkpRollups/{zkpRollupName}", + "zkpRollupName"); + if (zkpRollupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'zkpRollups'.", id))); + } + this.delete(resourceGroupName, zkpRollupName, context); + } + + private ZkpRollupsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.digitalassets.DigitalAssetsManager manager() { + return this.serviceManager; + } + + public ZkpRollupImpl define(String name) { + return new ZkpRollupImpl(name, this.manager()); + } +} diff --git a/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/implementation/models/OperationListResult.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/implementation/models/OperationListResult.java new file mode 100644 index 000000000000..4f2753395c7c --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/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.digitalassets.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.digitalassets.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/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/implementation/models/PartitionListResult.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/implementation/models/PartitionListResult.java new file mode 100644 index 000000000000..93553924bd3b --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/implementation/models/PartitionListResult.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.digitalassets.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.digitalassets.fluent.models.PartitionInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a Partition list operation. + */ +@Immutable +public final class PartitionListResult implements JsonSerializable { + /* + * The Partition items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of PartitionListResult class. + */ + private PartitionListResult() { + } + + /** + * Get the value property: The Partition 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 PartitionListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PartitionListResult 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 PartitionListResult. + */ + public static PartitionListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PartitionListResult deserializedPartitionListResult = new PartitionListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> PartitionInner.fromJson(reader1)); + deserializedPartitionListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedPartitionListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedPartitionListResult; + }); + } +} diff --git a/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/implementation/models/ZkpRollupListResult.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/implementation/models/ZkpRollupListResult.java new file mode 100644 index 000000000000..ddc8f2b854d9 --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/implementation/models/ZkpRollupListResult.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.digitalassets.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.digitalassets.fluent.models.ZkpRollupInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a ZkpRollup list operation. + */ +@Immutable +public final class ZkpRollupListResult implements JsonSerializable { + /* + * The ZkpRollup items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of ZkpRollupListResult class. + */ + private ZkpRollupListResult() { + } + + /** + * Get the value property: The ZkpRollup 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 ZkpRollupListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ZkpRollupListResult 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 ZkpRollupListResult. + */ + public static ZkpRollupListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ZkpRollupListResult deserializedZkpRollupListResult = new ZkpRollupListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> ZkpRollupInner.fromJson(reader1)); + deserializedZkpRollupListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedZkpRollupListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedZkpRollupListResult; + }); + } +} diff --git a/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/implementation/package-info.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/implementation/package-info.java new file mode 100644 index 000000000000..e28b405d81bb --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/implementation/package-info.java @@ -0,0 +1,8 @@ +// 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 DigitalAssets. + */ +package com.azure.resourcemanager.digitalassets.implementation; diff --git a/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/models/ActionType.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/models/ActionType.java new file mode 100644 index 000000000000..088c12417aa6 --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/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.digitalassets.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/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/models/ManagedServiceIdentity.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/models/ManagedServiceIdentity.java new file mode 100644 index 000000000000..271d12ba1700 --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/models/ManagedServiceIdentity.java @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.digitalassets.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * Managed service identity (system assigned and/or user assigned identities). + */ +@Fluent +public final class ManagedServiceIdentity implements JsonSerializable { + /* + * The service principal ID of the system assigned identity. This property will only be provided for a system + * assigned identity. + */ + private String principalId; + + /* + * The tenant ID of the system assigned identity. This property will only be provided for a system assigned + * identity. + */ + private String tenantId; + + /* + * The type of managed identity assigned to this resource. + */ + private ManagedServiceIdentityType type; + + /* + * The identities assigned to this resource by the user. + */ + private Map userAssignedIdentities; + + /** + * Creates an instance of ManagedServiceIdentity class. + */ + public ManagedServiceIdentity() { + } + + /** + * Get the principalId property: The service principal ID of the system assigned identity. This property will only + * be provided for a system assigned identity. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the tenantId property: The tenant ID of the system assigned identity. This property will only be provided for + * a system assigned identity. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Get the type property: The type of managed identity assigned to this resource. + * + * @return the type value. + */ + public ManagedServiceIdentityType type() { + return this.type; + } + + /** + * Set the type property: The type of managed identity assigned to this resource. + * + * @param type the type value to set. + * @return the ManagedServiceIdentity object itself. + */ + public ManagedServiceIdentity withType(ManagedServiceIdentityType type) { + this.type = type; + return this; + } + + /** + * Get the userAssignedIdentities property: The identities assigned to this resource by the user. + * + * @return the userAssignedIdentities value. + */ + public Map userAssignedIdentities() { + return this.userAssignedIdentities; + } + + /** + * Set the userAssignedIdentities property: The identities assigned to this resource by the user. + * + * @param userAssignedIdentities the userAssignedIdentities value to set. + * @return the ManagedServiceIdentity object itself. + */ + public ManagedServiceIdentity withUserAssignedIdentities(Map userAssignedIdentities) { + this.userAssignedIdentities = userAssignedIdentities; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeMapField("userAssignedIdentities", this.userAssignedIdentities, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ManagedServiceIdentity from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ManagedServiceIdentity 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 ManagedServiceIdentity. + */ + public static ManagedServiceIdentity fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ManagedServiceIdentity deserializedManagedServiceIdentity = new ManagedServiceIdentity(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedManagedServiceIdentity.type = ManagedServiceIdentityType.fromString(reader.getString()); + } else if ("principalId".equals(fieldName)) { + deserializedManagedServiceIdentity.principalId = reader.getString(); + } else if ("tenantId".equals(fieldName)) { + deserializedManagedServiceIdentity.tenantId = reader.getString(); + } else if ("userAssignedIdentities".equals(fieldName)) { + Map userAssignedIdentities + = reader.readMap(reader1 -> UserAssignedIdentity.fromJson(reader1)); + deserializedManagedServiceIdentity.userAssignedIdentities = userAssignedIdentities; + } else { + reader.skipChildren(); + } + } + + return deserializedManagedServiceIdentity; + }); + } +} diff --git a/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/models/ManagedServiceIdentityType.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/models/ManagedServiceIdentityType.java new file mode 100644 index 000000000000..2e00fcca4cd6 --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/models/ManagedServiceIdentityType.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.digitalassets.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). + */ +public final class ManagedServiceIdentityType extends ExpandableStringEnum { + /** + * No managed identity. + */ + public static final ManagedServiceIdentityType NONE = fromString("None"); + + /** + * System assigned managed identity. + */ + public static final ManagedServiceIdentityType SYSTEM_ASSIGNED = fromString("SystemAssigned"); + + /** + * User assigned managed identity. + */ + public static final ManagedServiceIdentityType USER_ASSIGNED = fromString("UserAssigned"); + + /** + * System and user assigned managed identity. + */ + public static final ManagedServiceIdentityType SYSTEM_ASSIGNED_USER_ASSIGNED + = fromString("SystemAssigned,UserAssigned"); + + /** + * Creates a new instance of ManagedServiceIdentityType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ManagedServiceIdentityType() { + } + + /** + * Creates or finds a ManagedServiceIdentityType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ManagedServiceIdentityType. + */ + public static ManagedServiceIdentityType fromString(String name) { + return fromString(name, ManagedServiceIdentityType.class); + } + + /** + * Gets known ManagedServiceIdentityType values. + * + * @return known ManagedServiceIdentityType values. + */ + public static Collection values() { + return values(ManagedServiceIdentityType.class); + } +} diff --git a/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/models/Operation.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/models/Operation.java new file mode 100644 index 000000000000..dea179c9701e --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/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.digitalassets.models; + +import com.azure.resourcemanager.digitalassets.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.digitalassets.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/models/OperationDisplay.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/models/OperationDisplay.java new file mode 100644 index 000000000000..104e6ff03f0c --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/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.digitalassets.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/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/models/OperationalStatus.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/models/OperationalStatus.java new file mode 100644 index 000000000000..a638ac536904 --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/models/OperationalStatus.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.digitalassets.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 java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * Represents the operational status of the resource. + */ +@Immutable +public final class OperationalStatus implements JsonSerializable { + /* + * The current state of the operational status. + */ + private String status; + + /* + * The timestamp of the last status evaluation. + */ + private OffsetDateTime evaluatedAt; + + /* + * The timestamp until which the current status is considered valid. + */ + private OffsetDateTime validUntil; + + /** + * Creates an instance of OperationalStatus class. + */ + private OperationalStatus() { + } + + /** + * Get the status property: The current state of the operational status. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Get the evaluatedAt property: The timestamp of the last status evaluation. + * + * @return the evaluatedAt value. + */ + public OffsetDateTime evaluatedAt() { + return this.evaluatedAt; + } + + /** + * Get the validUntil property: The timestamp until which the current status is considered valid. + * + * @return the validUntil value. + */ + public OffsetDateTime validUntil() { + return this.validUntil; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("status", this.status); + jsonWriter.writeStringField("evaluatedAt", + this.evaluatedAt == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.evaluatedAt)); + jsonWriter.writeStringField("validUntil", + this.validUntil == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.validUntil)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationalStatus from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationalStatus 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 OperationalStatus. + */ + public static OperationalStatus fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationalStatus deserializedOperationalStatus = new OperationalStatus(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("status".equals(fieldName)) { + deserializedOperationalStatus.status = reader.getString(); + } else if ("evaluatedAt".equals(fieldName)) { + deserializedOperationalStatus.evaluatedAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("validUntil".equals(fieldName)) { + deserializedOperationalStatus.validUntil = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationalStatus; + }); + } +} diff --git a/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/models/Operations.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/models/Operations.java new file mode 100644 index 000000000000..ddbe6a994cda --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/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.digitalassets.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/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/models/Origin.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/models/Origin.java new file mode 100644 index 000000000000..4c51be6f8b6d --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/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.digitalassets.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/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/models/Partition.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/models/Partition.java new file mode 100644 index 000000000000..edf2f0c4e9de --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/models/Partition.java @@ -0,0 +1,253 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.digitalassets.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.digitalassets.fluent.models.PartitionInner; +import java.util.Map; + +/** + * An immutable client-side representation of Partition. + */ +public interface Partition { + /** + * 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 properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + PartitionProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * 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.digitalassets.fluent.models.PartitionInner object. + * + * @return the inner object. + */ + PartitionInner innerModel(); + + /** + * The entirety of the Partition definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The Partition definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the Partition definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the Partition 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. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + + /** + * The stage of the Partition definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, zkpRollupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @return the next definition stage. + */ + WithCreate withExistingZkpRollup(String resourceGroupName, String zkpRollupName); + } + + /** + * The stage of the Partition 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.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + Partition create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Partition create(Context context); + } + + /** + * The stage of the Partition 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 Partition definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(PartitionProperties properties); + } + } + + /** + * Begins update for the Partition resource. + * + * @return the stage of resource update. + */ + Partition.Update update(); + + /** + * The template for Partition update. + */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Partition apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Partition apply(Context context); + } + + /** + * The Partition update stages. + */ + interface UpdateStages { + /** + * The stage of the Partition 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); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Partition refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Partition refresh(Context context); +} diff --git a/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/models/PartitionProperties.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/models/PartitionProperties.java new file mode 100644 index 000000000000..df1c4f4fef9c --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/models/PartitionProperties.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.digitalassets.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; + +/** + * Read-only status properties of a ZkpRollup partition. In Public Preview, shared service configuration comes from the + * parent rollup. The partition name and location select the deployment, so no writable service-specific properties are + * needed. PATCH updates tags only. + */ +@Immutable +public final class PartitionProperties implements JsonSerializable { + /* + * The status of the last operation. + */ + private ProvisioningState provisioningState; + + /* + * Operational status of the partition. + */ + private OperationalStatus operationalStatus; + + /** + * Creates an instance of PartitionProperties class. + */ + public PartitionProperties() { + } + + /** + * Get the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the operationalStatus property: Operational status of the partition. + * + * @return the operationalStatus value. + */ + public OperationalStatus operationalStatus() { + return this.operationalStatus; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PartitionProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PartitionProperties 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 PartitionProperties. + */ + public static PartitionProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PartitionProperties deserializedPartitionProperties = new PartitionProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provisioningState".equals(fieldName)) { + deserializedPartitionProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else if ("operationalStatus".equals(fieldName)) { + deserializedPartitionProperties.operationalStatus = OperationalStatus.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedPartitionProperties; + }); + } +} diff --git a/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/models/PartitionTagsUpdate.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/models/PartitionTagsUpdate.java new file mode 100644 index 000000000000..f5f3cd994bd2 --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/models/PartitionTagsUpdate.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.digitalassets.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * The type used for updating tags in Partition resources. + */ +@Fluent +public final class PartitionTagsUpdate implements JsonSerializable { + /* + * Resource tags. + */ + private Map tags; + + /** + * Creates an instance of PartitionTagsUpdate class. + */ + public PartitionTagsUpdate() { + } + + /** + * 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 PartitionTagsUpdate object itself. + */ + public PartitionTagsUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PartitionTagsUpdate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PartitionTagsUpdate 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 PartitionTagsUpdate. + */ + public static PartitionTagsUpdate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PartitionTagsUpdate deserializedPartitionTagsUpdate = new PartitionTagsUpdate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedPartitionTagsUpdate.tags = tags; + } else { + reader.skipChildren(); + } + } + + return deserializedPartitionTagsUpdate; + }); + } +} diff --git a/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/models/Partitions.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/models/Partitions.java new file mode 100644 index 000000000000..2289ca3d6ce2 --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/models/Partitions.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.digitalassets.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 Partitions. + */ +public interface Partitions { + /** + * Get a Partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @param partitionName The name of the partition. + * @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 Partition along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String zkpRollupName, String partitionName, + Context context); + + /** + * Get a Partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @param partitionName The name of the partition. + * @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 Partition. + */ + Partition get(String resourceGroupName, String zkpRollupName, String partitionName); + + /** + * Delete a Partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @param partitionName The name of the partition. + * @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 zkpRollupName, String partitionName); + + /** + * Delete a Partition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @param partitionName The name of the partition. + * @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 zkpRollupName, String partitionName, Context context); + + /** + * List Partition resources by ZkpRollup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @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 Partition list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByParent(String resourceGroupName, String zkpRollupName); + + /** + * List Partition resources by ZkpRollup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @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 Partition list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByParent(String resourceGroupName, String zkpRollupName, Context context); + + /** + * Get a Partition. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Partition along with {@link Response}. + */ + Partition getById(String id); + + /** + * Get a Partition. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Partition along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a Partition. + * + * @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 Partition. + * + * @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 Partition resource. + * + * @param name resource name. + * @return the first stage of the new Partition definition. + */ + Partition.DefinitionStages.Blank define(String name); +} diff --git a/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/models/ProvisioningState.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/models/ProvisioningState.java new file mode 100644 index 000000000000..5f376567743b --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/models/ProvisioningState.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.digitalassets.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"); + + /** + * Initial provisioning in progress. + */ + public static final ProvisioningState PROVISIONING = fromString("Provisioning"); + + /** + * Update in progress. + */ + public static final ProvisioningState UPDATING = fromString("Updating"); + + /** + * Deletion in progress. + */ + public static final ProvisioningState DELETING = fromString("Deleting"); + + /** + * Change accepted for processing. + */ + 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/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/models/UserAssignedIdentity.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/models/UserAssignedIdentity.java new file mode 100644 index 000000000000..f9df68088d66 --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/models/UserAssignedIdentity.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.digitalassets.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; + +/** + * User assigned identity properties. + */ +@Immutable +public final class UserAssignedIdentity implements JsonSerializable { + /* + * The principal ID of the assigned identity. + */ + private String principalId; + + /* + * The client ID of the assigned identity. + */ + private String clientId; + + /** + * Creates an instance of UserAssignedIdentity class. + */ + public UserAssignedIdentity() { + } + + /** + * Get the principalId property: The principal ID of the assigned identity. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the clientId property: The client ID of the assigned identity. + * + * @return the clientId value. + */ + public String clientId() { + return this.clientId; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UserAssignedIdentity from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UserAssignedIdentity 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 UserAssignedIdentity. + */ + public static UserAssignedIdentity fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UserAssignedIdentity deserializedUserAssignedIdentity = new UserAssignedIdentity(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("principalId".equals(fieldName)) { + deserializedUserAssignedIdentity.principalId = reader.getString(); + } else if ("clientId".equals(fieldName)) { + deserializedUserAssignedIdentity.clientId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedUserAssignedIdentity; + }); + } +} diff --git a/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/models/ZkpRollup.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/models/ZkpRollup.java new file mode 100644 index 000000000000..af5f2ca7bc43 --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/models/ZkpRollup.java @@ -0,0 +1,299 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.digitalassets.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.digitalassets.fluent.models.ZkpRollupInner; +import java.util.Map; + +/** + * An immutable client-side representation of ZkpRollup. + */ +public interface ZkpRollup { + /** + * 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 properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + ZkpRollupProperties properties(); + + /** + * Gets the identity property: The managed service identities assigned to this resource. + * + * @return the identity value. + */ + ManagedServiceIdentity identity(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * 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.digitalassets.fluent.models.ZkpRollupInner object. + * + * @return the inner object. + */ + ZkpRollupInner innerModel(); + + /** + * The entirety of the ZkpRollup definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { + } + + /** + * The ZkpRollup definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the ZkpRollup definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the ZkpRollup 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 ZkpRollup 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 ZkpRollup 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.WithProperties, DefinitionStages.WithIdentity { + /** + * Executes the create request. + * + * @return the created resource. + */ + ZkpRollup create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ZkpRollup create(Context context); + } + + /** + * The stage of the ZkpRollup 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 ZkpRollup definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(ZkpRollupProperties properties); + } + + /** + * The stage of the ZkpRollup definition allowing to specify identity. + */ + interface WithIdentity { + /** + * Specifies the identity property: The managed service identities assigned to this resource.. + * + * @param identity The managed service identities assigned to this resource. + * @return the next definition stage. + */ + WithCreate withIdentity(ManagedServiceIdentity identity); + } + } + + /** + * Begins update for the ZkpRollup resource. + * + * @return the stage of resource update. + */ + ZkpRollup.Update update(); + + /** + * The template for ZkpRollup update. + */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithIdentity, UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ZkpRollup apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ZkpRollup apply(Context context); + } + + /** + * The ZkpRollup update stages. + */ + interface UpdateStages { + /** + * The stage of the ZkpRollup 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 ZkpRollup update allowing to specify identity. + */ + interface WithIdentity { + /** + * Specifies the identity property: Managed-identity attachment changes.. + * + * @param identity Managed-identity attachment changes. + * @return the next definition stage. + */ + Update withIdentity(ZkpRollupIdentityUpdate identity); + } + + /** + * The stage of the ZkpRollup update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: Mutable rollup configuration fields.. + * + * @param properties Mutable rollup configuration fields. + * @return the next definition stage. + */ + Update withProperties(ZkpRollupPatchProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ZkpRollup refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ZkpRollup refresh(Context context); +} diff --git a/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/models/ZkpRollupIdentityUpdate.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/models/ZkpRollupIdentityUpdate.java new file mode 100644 index 000000000000..810dfef28105 --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/models/ZkpRollupIdentityUpdate.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.digitalassets.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * Partial managed-identity update. Omitted attachments remain; object entries add or retain an identity and null + * entries remove it. The selected Key Vault identity must remain attached. + */ +@Fluent +public final class ZkpRollupIdentityUpdate implements JsonSerializable { + /* + * The type of managed identity assigned to this resource. + */ + private ManagedServiceIdentityType type; + + /* + * The identities assigned to this resource by the user. + */ + private Map userAssignedIdentities; + + /** + * Creates an instance of ZkpRollupIdentityUpdate class. + */ + public ZkpRollupIdentityUpdate() { + } + + /** + * Get the type property: The type of managed identity assigned to this resource. + * + * @return the type value. + */ + public ManagedServiceIdentityType type() { + return this.type; + } + + /** + * Set the type property: The type of managed identity assigned to this resource. + * + * @param type the type value to set. + * @return the ZkpRollupIdentityUpdate object itself. + */ + public ZkpRollupIdentityUpdate withType(ManagedServiceIdentityType type) { + this.type = type; + return this; + } + + /** + * Get the userAssignedIdentities property: The identities assigned to this resource by the user. + * + * @return the userAssignedIdentities value. + */ + public Map userAssignedIdentities() { + return this.userAssignedIdentities; + } + + /** + * Set the userAssignedIdentities property: The identities assigned to this resource by the user. + * + * @param userAssignedIdentities the userAssignedIdentities value to set. + * @return the ZkpRollupIdentityUpdate object itself. + */ + public ZkpRollupIdentityUpdate + withUserAssignedIdentities(Map userAssignedIdentities) { + this.userAssignedIdentities = userAssignedIdentities; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeMapField("userAssignedIdentities", this.userAssignedIdentities, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ZkpRollupIdentityUpdate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ZkpRollupIdentityUpdate 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 ZkpRollupIdentityUpdate. + */ + public static ZkpRollupIdentityUpdate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ZkpRollupIdentityUpdate deserializedZkpRollupIdentityUpdate = new ZkpRollupIdentityUpdate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedZkpRollupIdentityUpdate.type + = ManagedServiceIdentityType.fromString(reader.getString()); + } else if ("userAssignedIdentities".equals(fieldName)) { + Map userAssignedIdentities + = reader.readMap(reader1 -> UserAssignedIdentity.fromJson(reader1)); + deserializedZkpRollupIdentityUpdate.userAssignedIdentities = userAssignedIdentities; + } else { + reader.skipChildren(); + } + } + + return deserializedZkpRollupIdentityUpdate; + }); + } +} diff --git a/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/models/ZkpRollupPatchProperties.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/models/ZkpRollupPatchProperties.java new file mode 100644 index 000000000000..ea8cbd48b3a9 --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/models/ZkpRollupPatchProperties.java @@ -0,0 +1,205 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.digitalassets.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Properties that may be updated via PATCH on a ZkpRollup. + */ +@Fluent +public final class ZkpRollupPatchProperties implements JsonSerializable { + /* + * Replacement list of owner accounts for future contract discovery. Omission preserves the current list; existing + * checkpoints and discovered contracts are retained. + */ + private List tokenOwnerAccounts; + + /* + * Replacement boot-node public key on the same ledger. Omission preserves the current value. + */ + private String bootNodeId; + + /* + * Replacement boot-node IPv4 address. Omission preserves the current value. + */ + private String bootNodeIp; + + /* + * Replacement boot-node P2P port. Omission preserves the current value. + */ + private Integer bootNodeP2pPort; + + /* + * Replacement boot-node JSON-RPC port. Omission preserves the current value. + */ + private Integer bootNodeRpcPort; + + /** + * Creates an instance of ZkpRollupPatchProperties class. + */ + public ZkpRollupPatchProperties() { + } + + /** + * Get the tokenOwnerAccounts property: Replacement list of owner accounts for future contract discovery. Omission + * preserves the current list; existing checkpoints and discovered contracts are retained. + * + * @return the tokenOwnerAccounts value. + */ + public List tokenOwnerAccounts() { + return this.tokenOwnerAccounts; + } + + /** + * Set the tokenOwnerAccounts property: Replacement list of owner accounts for future contract discovery. Omission + * preserves the current list; existing checkpoints and discovered contracts are retained. + * + * @param tokenOwnerAccounts the tokenOwnerAccounts value to set. + * @return the ZkpRollupPatchProperties object itself. + */ + public ZkpRollupPatchProperties withTokenOwnerAccounts(List tokenOwnerAccounts) { + this.tokenOwnerAccounts = tokenOwnerAccounts; + return this; + } + + /** + * Get the bootNodeId property: Replacement boot-node public key on the same ledger. Omission preserves the current + * value. + * + * @return the bootNodeId value. + */ + public String bootNodeId() { + return this.bootNodeId; + } + + /** + * Set the bootNodeId property: Replacement boot-node public key on the same ledger. Omission preserves the current + * value. + * + * @param bootNodeId the bootNodeId value to set. + * @return the ZkpRollupPatchProperties object itself. + */ + public ZkpRollupPatchProperties withBootNodeId(String bootNodeId) { + this.bootNodeId = bootNodeId; + return this; + } + + /** + * Get the bootNodeIp property: Replacement boot-node IPv4 address. Omission preserves the current value. + * + * @return the bootNodeIp value. + */ + public String bootNodeIp() { + return this.bootNodeIp; + } + + /** + * Set the bootNodeIp property: Replacement boot-node IPv4 address. Omission preserves the current value. + * + * @param bootNodeIp the bootNodeIp value to set. + * @return the ZkpRollupPatchProperties object itself. + */ + public ZkpRollupPatchProperties withBootNodeIp(String bootNodeIp) { + this.bootNodeIp = bootNodeIp; + return this; + } + + /** + * Get the bootNodeP2pPort property: Replacement boot-node P2P port. Omission preserves the current value. + * + * @return the bootNodeP2pPort value. + */ + public Integer bootNodeP2pPort() { + return this.bootNodeP2pPort; + } + + /** + * Set the bootNodeP2pPort property: Replacement boot-node P2P port. Omission preserves the current value. + * + * @param bootNodeP2pPort the bootNodeP2pPort value to set. + * @return the ZkpRollupPatchProperties object itself. + */ + public ZkpRollupPatchProperties withBootNodeP2pPort(Integer bootNodeP2pPort) { + this.bootNodeP2pPort = bootNodeP2pPort; + return this; + } + + /** + * Get the bootNodeRpcPort property: Replacement boot-node JSON-RPC port. Omission preserves the current value. + * + * @return the bootNodeRpcPort value. + */ + public Integer bootNodeRpcPort() { + return this.bootNodeRpcPort; + } + + /** + * Set the bootNodeRpcPort property: Replacement boot-node JSON-RPC port. Omission preserves the current value. + * + * @param bootNodeRpcPort the bootNodeRpcPort value to set. + * @return the ZkpRollupPatchProperties object itself. + */ + public ZkpRollupPatchProperties withBootNodeRpcPort(Integer bootNodeRpcPort) { + this.bootNodeRpcPort = bootNodeRpcPort; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("tokenOwnerAccounts", this.tokenOwnerAccounts, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("bootNodeId", this.bootNodeId); + jsonWriter.writeStringField("bootNodeIp", this.bootNodeIp); + jsonWriter.writeNumberField("bootNodeP2pPort", this.bootNodeP2pPort); + jsonWriter.writeNumberField("bootNodeRpcPort", this.bootNodeRpcPort); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ZkpRollupPatchProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ZkpRollupPatchProperties 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 ZkpRollupPatchProperties. + */ + public static ZkpRollupPatchProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ZkpRollupPatchProperties deserializedZkpRollupPatchProperties = new ZkpRollupPatchProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tokenOwnerAccounts".equals(fieldName)) { + List tokenOwnerAccounts = reader.readArray(reader1 -> reader1.getString()); + deserializedZkpRollupPatchProperties.tokenOwnerAccounts = tokenOwnerAccounts; + } else if ("bootNodeId".equals(fieldName)) { + deserializedZkpRollupPatchProperties.bootNodeId = reader.getString(); + } else if ("bootNodeIp".equals(fieldName)) { + deserializedZkpRollupPatchProperties.bootNodeIp = reader.getString(); + } else if ("bootNodeP2pPort".equals(fieldName)) { + deserializedZkpRollupPatchProperties.bootNodeP2pPort = reader.getNullable(JsonReader::getInt); + } else if ("bootNodeRpcPort".equals(fieldName)) { + deserializedZkpRollupPatchProperties.bootNodeRpcPort = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedZkpRollupPatchProperties; + }); + } +} diff --git a/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/models/ZkpRollupProperties.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/models/ZkpRollupProperties.java new file mode 100644 index 000000000000..f651c97166c0 --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/models/ZkpRollupProperties.java @@ -0,0 +1,510 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.digitalassets.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Details of the DigitalAssets ZkpRollup. + */ +@Fluent +public final class ZkpRollupProperties implements JsonSerializable { + /* + * Rollup-level owner accounts used for contract discovery. Updates affect future discovery after configuration is + * applied; existing checkpoints and discovered contracts are preserved. + */ + private List tokenOwnerAccounts; + + /* + * The fully qualified resource ID of the customer Key Vault used to resolve Besu node private keys. Required on PUT + * and immutable after creation. + */ + private String keyVaultId; + + /* + * User-assigned managed identity resource ID used for customer Key Vault reads. Immutable after creation; this + * identity must remain attached to the rollup. + */ + private String keyVaultUserAssignedIdentityResourceId; + + /* + * Number of L2 blocks batched into a single proof. Must be a power of 2 (runtime-enforced). Immutable after create; + * changing it requires deleting and recreating the rollup. Default is 2 when omitted on create. + */ + private Integer blocksPerProof; + + /* + * Public IPv4 address of the customer's VPN device. Set on create and immutable afterward. + */ + private String customerVpnPublicIp; + + /* + * Customer on-premises address prefixes reachable across the VPN tunnel (the Local Network Gateway address space). + * Must not overlap the RP-reserved 10.128.0.0/10 block. Set on create and immutable afterward. + */ + private List customerOnPremAddressPrefixes; + + /* + * Read-only public IP address of this service's VPN Gateway. This is the far-end address the customer configures on + * their Local Network Gateway and Site-to-Site VPN connection. Populated once the service's VPN tunnel is + * provisioned. + */ + private String serviceVpnPublicIp; + + /* + * Read-only address space (a /21 CIDR, e.g. 10.160.0.0/21) assigned to this service's end of the VPN tunnel. + * Populated once the service's VPN tunnel is provisioned. + */ + private String serviceVpnAddressSpace; + + /* + * Enode id (public key) of the customer's L2 Besu boot node. Required on PUT. Updates reconcile the existing + * partition and must remain on the same ledger. + */ + private String bootNodeId; + + /* + * Private IPv4 address of the customer's L2 Besu boot node. Required on PUT. Updates reconcile the existing + * partition. + */ + private String bootNodeIp; + + /* + * P2P (devp2p) port of the customer's L2 Besu boot node. Required on PUT. Updates reconcile the existing partition. + */ + private int bootNodeP2pPort; + + /* + * JSON-RPC (HTTP) port of the customer's L2 Besu boot node. Required on PUT. Updates reconcile the existing + * partition. + */ + private int bootNodeRpcPort; + + /* + * URL of the customer-provided Service Bus namespace to which proofs are published. Required on PUT. Set only on + * initial creation; cannot be changed by PUT or PATCH. + */ + private String serviceBusEndpoint; + + /* + * Name of the customer-provided Service Bus queue to which proofs are published. Required on PUT. Set only on + * initial creation; cannot be changed by PUT or PATCH. + */ + private String serviceBusQueueName; + + /* + * The status of the last operation. + */ + private ProvisioningState provisioningState; + + /* + * Operational status of the rollup. + */ + private OperationalStatus operationalStatus; + + /** + * Creates an instance of ZkpRollupProperties class. + */ + public ZkpRollupProperties() { + } + + /** + * Get the tokenOwnerAccounts property: Rollup-level owner accounts used for contract discovery. Updates affect + * future discovery after configuration is applied; existing checkpoints and discovered contracts are preserved. + * + * @return the tokenOwnerAccounts value. + */ + public List tokenOwnerAccounts() { + return this.tokenOwnerAccounts; + } + + /** + * Set the tokenOwnerAccounts property: Rollup-level owner accounts used for contract discovery. Updates affect + * future discovery after configuration is applied; existing checkpoints and discovered contracts are preserved. + * + * @param tokenOwnerAccounts the tokenOwnerAccounts value to set. + * @return the ZkpRollupProperties object itself. + */ + public ZkpRollupProperties withTokenOwnerAccounts(List tokenOwnerAccounts) { + this.tokenOwnerAccounts = tokenOwnerAccounts; + return this; + } + + /** + * Get the keyVaultId property: The fully qualified resource ID of the customer Key Vault used to resolve Besu node + * private keys. Required on PUT and immutable after creation. + * + * @return the keyVaultId value. + */ + public String keyVaultId() { + return this.keyVaultId; + } + + /** + * Set the keyVaultId property: The fully qualified resource ID of the customer Key Vault used to resolve Besu node + * private keys. Required on PUT and immutable after creation. + * + * @param keyVaultId the keyVaultId value to set. + * @return the ZkpRollupProperties object itself. + */ + public ZkpRollupProperties withKeyVaultId(String keyVaultId) { + this.keyVaultId = keyVaultId; + return this; + } + + /** + * Get the keyVaultUserAssignedIdentityResourceId property: User-assigned managed identity resource ID used for + * customer Key Vault reads. Immutable after creation; this identity must remain attached to the rollup. + * + * @return the keyVaultUserAssignedIdentityResourceId value. + */ + public String keyVaultUserAssignedIdentityResourceId() { + return this.keyVaultUserAssignedIdentityResourceId; + } + + /** + * Set the keyVaultUserAssignedIdentityResourceId property: User-assigned managed identity resource ID used for + * customer Key Vault reads. Immutable after creation; this identity must remain attached to the rollup. + * + * @param keyVaultUserAssignedIdentityResourceId the keyVaultUserAssignedIdentityResourceId value to set. + * @return the ZkpRollupProperties object itself. + */ + public ZkpRollupProperties + withKeyVaultUserAssignedIdentityResourceId(String keyVaultUserAssignedIdentityResourceId) { + this.keyVaultUserAssignedIdentityResourceId = keyVaultUserAssignedIdentityResourceId; + return this; + } + + /** + * Get the blocksPerProof property: Number of L2 blocks batched into a single proof. Must be a power of 2 + * (runtime-enforced). Immutable after create; changing it requires deleting and recreating the rollup. Default is 2 + * when omitted on create. + * + * @return the blocksPerProof value. + */ + public Integer blocksPerProof() { + return this.blocksPerProof; + } + + /** + * Set the blocksPerProof property: Number of L2 blocks batched into a single proof. Must be a power of 2 + * (runtime-enforced). Immutable after create; changing it requires deleting and recreating the rollup. Default is 2 + * when omitted on create. + * + * @param blocksPerProof the blocksPerProof value to set. + * @return the ZkpRollupProperties object itself. + */ + public ZkpRollupProperties withBlocksPerProof(Integer blocksPerProof) { + this.blocksPerProof = blocksPerProof; + return this; + } + + /** + * Get the customerVpnPublicIp property: Public IPv4 address of the customer's VPN device. Set on create and + * immutable afterward. + * + * @return the customerVpnPublicIp value. + */ + public String customerVpnPublicIp() { + return this.customerVpnPublicIp; + } + + /** + * Set the customerVpnPublicIp property: Public IPv4 address of the customer's VPN device. Set on create and + * immutable afterward. + * + * @param customerVpnPublicIp the customerVpnPublicIp value to set. + * @return the ZkpRollupProperties object itself. + */ + public ZkpRollupProperties withCustomerVpnPublicIp(String customerVpnPublicIp) { + this.customerVpnPublicIp = customerVpnPublicIp; + return this; + } + + /** + * Get the customerOnPremAddressPrefixes property: Customer on-premises address prefixes reachable across the VPN + * tunnel (the Local Network Gateway address space). Must not overlap the RP-reserved 10.128.0.0/10 block. Set on + * create and immutable afterward. + * + * @return the customerOnPremAddressPrefixes value. + */ + public List customerOnPremAddressPrefixes() { + return this.customerOnPremAddressPrefixes; + } + + /** + * Set the customerOnPremAddressPrefixes property: Customer on-premises address prefixes reachable across the VPN + * tunnel (the Local Network Gateway address space). Must not overlap the RP-reserved 10.128.0.0/10 block. Set on + * create and immutable afterward. + * + * @param customerOnPremAddressPrefixes the customerOnPremAddressPrefixes value to set. + * @return the ZkpRollupProperties object itself. + */ + public ZkpRollupProperties withCustomerOnPremAddressPrefixes(List customerOnPremAddressPrefixes) { + this.customerOnPremAddressPrefixes = customerOnPremAddressPrefixes; + return this; + } + + /** + * Get the serviceVpnPublicIp property: Read-only public IP address of this service's VPN Gateway. This is the + * far-end address the customer configures on their Local Network Gateway and Site-to-Site VPN connection. Populated + * once the service's VPN tunnel is provisioned. + * + * @return the serviceVpnPublicIp value. + */ + public String serviceVpnPublicIp() { + return this.serviceVpnPublicIp; + } + + /** + * Get the serviceVpnAddressSpace property: Read-only address space (a /21 CIDR, e.g. 10.160.0.0/21) assigned to + * this service's end of the VPN tunnel. Populated once the service's VPN tunnel is provisioned. + * + * @return the serviceVpnAddressSpace value. + */ + public String serviceVpnAddressSpace() { + return this.serviceVpnAddressSpace; + } + + /** + * Get the bootNodeId property: Enode id (public key) of the customer's L2 Besu boot node. Required on PUT. Updates + * reconcile the existing partition and must remain on the same ledger. + * + * @return the bootNodeId value. + */ + public String bootNodeId() { + return this.bootNodeId; + } + + /** + * Set the bootNodeId property: Enode id (public key) of the customer's L2 Besu boot node. Required on PUT. Updates + * reconcile the existing partition and must remain on the same ledger. + * + * @param bootNodeId the bootNodeId value to set. + * @return the ZkpRollupProperties object itself. + */ + public ZkpRollupProperties withBootNodeId(String bootNodeId) { + this.bootNodeId = bootNodeId; + return this; + } + + /** + * Get the bootNodeIp property: Private IPv4 address of the customer's L2 Besu boot node. Required on PUT. Updates + * reconcile the existing partition. + * + * @return the bootNodeIp value. + */ + public String bootNodeIp() { + return this.bootNodeIp; + } + + /** + * Set the bootNodeIp property: Private IPv4 address of the customer's L2 Besu boot node. Required on PUT. Updates + * reconcile the existing partition. + * + * @param bootNodeIp the bootNodeIp value to set. + * @return the ZkpRollupProperties object itself. + */ + public ZkpRollupProperties withBootNodeIp(String bootNodeIp) { + this.bootNodeIp = bootNodeIp; + return this; + } + + /** + * Get the bootNodeP2pPort property: P2P (devp2p) port of the customer's L2 Besu boot node. Required on PUT. Updates + * reconcile the existing partition. + * + * @return the bootNodeP2pPort value. + */ + public int bootNodeP2pPort() { + return this.bootNodeP2pPort; + } + + /** + * Set the bootNodeP2pPort property: P2P (devp2p) port of the customer's L2 Besu boot node. Required on PUT. Updates + * reconcile the existing partition. + * + * @param bootNodeP2pPort the bootNodeP2pPort value to set. + * @return the ZkpRollupProperties object itself. + */ + public ZkpRollupProperties withBootNodeP2pPort(int bootNodeP2pPort) { + this.bootNodeP2pPort = bootNodeP2pPort; + return this; + } + + /** + * Get the bootNodeRpcPort property: JSON-RPC (HTTP) port of the customer's L2 Besu boot node. Required on PUT. + * Updates reconcile the existing partition. + * + * @return the bootNodeRpcPort value. + */ + public int bootNodeRpcPort() { + return this.bootNodeRpcPort; + } + + /** + * Set the bootNodeRpcPort property: JSON-RPC (HTTP) port of the customer's L2 Besu boot node. Required on PUT. + * Updates reconcile the existing partition. + * + * @param bootNodeRpcPort the bootNodeRpcPort value to set. + * @return the ZkpRollupProperties object itself. + */ + public ZkpRollupProperties withBootNodeRpcPort(int bootNodeRpcPort) { + this.bootNodeRpcPort = bootNodeRpcPort; + return this; + } + + /** + * Get the serviceBusEndpoint property: URL of the customer-provided Service Bus namespace to which proofs are + * published. Required on PUT. Set only on initial creation; cannot be changed by PUT or PATCH. + * + * @return the serviceBusEndpoint value. + */ + public String serviceBusEndpoint() { + return this.serviceBusEndpoint; + } + + /** + * Set the serviceBusEndpoint property: URL of the customer-provided Service Bus namespace to which proofs are + * published. Required on PUT. Set only on initial creation; cannot be changed by PUT or PATCH. + * + * @param serviceBusEndpoint the serviceBusEndpoint value to set. + * @return the ZkpRollupProperties object itself. + */ + public ZkpRollupProperties withServiceBusEndpoint(String serviceBusEndpoint) { + this.serviceBusEndpoint = serviceBusEndpoint; + return this; + } + + /** + * Get the serviceBusQueueName property: Name of the customer-provided Service Bus queue to which proofs are + * published. Required on PUT. Set only on initial creation; cannot be changed by PUT or PATCH. + * + * @return the serviceBusQueueName value. + */ + public String serviceBusQueueName() { + return this.serviceBusQueueName; + } + + /** + * Set the serviceBusQueueName property: Name of the customer-provided Service Bus queue to which proofs are + * published. Required on PUT. Set only on initial creation; cannot be changed by PUT or PATCH. + * + * @param serviceBusQueueName the serviceBusQueueName value to set. + * @return the ZkpRollupProperties object itself. + */ + public ZkpRollupProperties withServiceBusQueueName(String serviceBusQueueName) { + this.serviceBusQueueName = serviceBusQueueName; + return this; + } + + /** + * Get the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the operationalStatus property: Operational status of the rollup. + * + * @return the operationalStatus value. + */ + public OperationalStatus operationalStatus() { + return this.operationalStatus; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("tokenOwnerAccounts", this.tokenOwnerAccounts, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("keyVaultId", this.keyVaultId); + jsonWriter.writeStringField("keyVaultUserAssignedIdentityResourceId", + this.keyVaultUserAssignedIdentityResourceId); + jsonWriter.writeStringField("bootNodeId", this.bootNodeId); + jsonWriter.writeStringField("bootNodeIp", this.bootNodeIp); + jsonWriter.writeIntField("bootNodeP2pPort", this.bootNodeP2pPort); + jsonWriter.writeIntField("bootNodeRpcPort", this.bootNodeRpcPort); + jsonWriter.writeStringField("serviceBusEndpoint", this.serviceBusEndpoint); + jsonWriter.writeStringField("serviceBusQueueName", this.serviceBusQueueName); + jsonWriter.writeNumberField("blocksPerProof", this.blocksPerProof); + jsonWriter.writeStringField("customerVpnPublicIp", this.customerVpnPublicIp); + jsonWriter.writeArrayField("customerOnPremAddressPrefixes", this.customerOnPremAddressPrefixes, + (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ZkpRollupProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ZkpRollupProperties 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 ZkpRollupProperties. + */ + public static ZkpRollupProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ZkpRollupProperties deserializedZkpRollupProperties = new ZkpRollupProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tokenOwnerAccounts".equals(fieldName)) { + List tokenOwnerAccounts = reader.readArray(reader1 -> reader1.getString()); + deserializedZkpRollupProperties.tokenOwnerAccounts = tokenOwnerAccounts; + } else if ("keyVaultId".equals(fieldName)) { + deserializedZkpRollupProperties.keyVaultId = reader.getString(); + } else if ("keyVaultUserAssignedIdentityResourceId".equals(fieldName)) { + deserializedZkpRollupProperties.keyVaultUserAssignedIdentityResourceId = reader.getString(); + } else if ("bootNodeId".equals(fieldName)) { + deserializedZkpRollupProperties.bootNodeId = reader.getString(); + } else if ("bootNodeIp".equals(fieldName)) { + deserializedZkpRollupProperties.bootNodeIp = reader.getString(); + } else if ("bootNodeP2pPort".equals(fieldName)) { + deserializedZkpRollupProperties.bootNodeP2pPort = reader.getInt(); + } else if ("bootNodeRpcPort".equals(fieldName)) { + deserializedZkpRollupProperties.bootNodeRpcPort = reader.getInt(); + } else if ("serviceBusEndpoint".equals(fieldName)) { + deserializedZkpRollupProperties.serviceBusEndpoint = reader.getString(); + } else if ("serviceBusQueueName".equals(fieldName)) { + deserializedZkpRollupProperties.serviceBusQueueName = reader.getString(); + } else if ("blocksPerProof".equals(fieldName)) { + deserializedZkpRollupProperties.blocksPerProof = reader.getNullable(JsonReader::getInt); + } else if ("customerVpnPublicIp".equals(fieldName)) { + deserializedZkpRollupProperties.customerVpnPublicIp = reader.getString(); + } else if ("customerOnPremAddressPrefixes".equals(fieldName)) { + List customerOnPremAddressPrefixes = reader.readArray(reader1 -> reader1.getString()); + deserializedZkpRollupProperties.customerOnPremAddressPrefixes = customerOnPremAddressPrefixes; + } else if ("serviceVpnPublicIp".equals(fieldName)) { + deserializedZkpRollupProperties.serviceVpnPublicIp = reader.getString(); + } else if ("serviceVpnAddressSpace".equals(fieldName)) { + deserializedZkpRollupProperties.serviceVpnAddressSpace = reader.getString(); + } else if ("provisioningState".equals(fieldName)) { + deserializedZkpRollupProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else if ("operationalStatus".equals(fieldName)) { + deserializedZkpRollupProperties.operationalStatus = OperationalStatus.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedZkpRollupProperties; + }); + } +} diff --git a/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/models/ZkpRollupUpdate.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/models/ZkpRollupUpdate.java new file mode 100644 index 000000000000..614fff3028ea --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/models/ZkpRollupUpdate.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.digitalassets.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * Rollup update payload. Omitted fields are preserved. Configuration changes may restart partition containers; tags and + * identity-only changes complete synchronously. + */ +@Fluent +public final class ZkpRollupUpdate implements JsonSerializable { + /* + * Resource tags. + */ + private Map tags; + + /* + * Managed-identity attachment changes. + */ + private ZkpRollupIdentityUpdate identity; + + /* + * Mutable rollup configuration fields. + */ + private ZkpRollupPatchProperties properties; + + /** + * Creates an instance of ZkpRollupUpdate class. + */ + public ZkpRollupUpdate() { + } + + /** + * 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 ZkpRollupUpdate object itself. + */ + public ZkpRollupUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the identity property: Managed-identity attachment changes. + * + * @return the identity value. + */ + public ZkpRollupIdentityUpdate identity() { + return this.identity; + } + + /** + * Set the identity property: Managed-identity attachment changes. + * + * @param identity the identity value to set. + * @return the ZkpRollupUpdate object itself. + */ + public ZkpRollupUpdate withIdentity(ZkpRollupIdentityUpdate identity) { + this.identity = identity; + return this; + } + + /** + * Get the properties property: Mutable rollup configuration fields. + * + * @return the properties value. + */ + public ZkpRollupPatchProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Mutable rollup configuration fields. + * + * @param properties the properties value to set. + * @return the ZkpRollupUpdate object itself. + */ + public ZkpRollupUpdate withProperties(ZkpRollupPatchProperties properties) { + this.properties = properties; + 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("identity", this.identity); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ZkpRollupUpdate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ZkpRollupUpdate 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 ZkpRollupUpdate. + */ + public static ZkpRollupUpdate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ZkpRollupUpdate deserializedZkpRollupUpdate = new ZkpRollupUpdate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedZkpRollupUpdate.tags = tags; + } else if ("identity".equals(fieldName)) { + deserializedZkpRollupUpdate.identity = ZkpRollupIdentityUpdate.fromJson(reader); + } else if ("properties".equals(fieldName)) { + deserializedZkpRollupUpdate.properties = ZkpRollupPatchProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedZkpRollupUpdate; + }); + } +} diff --git a/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/models/ZkpRollups.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/models/ZkpRollups.java new file mode 100644 index 000000000000..bc379fa6c597 --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/models/ZkpRollups.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.digitalassets.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 ZkpRollups. + */ +public interface ZkpRollups { + /** + * Get a ZkpRollup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @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 ZkpRollup along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String zkpRollupName, Context context); + + /** + * Get a ZkpRollup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @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 ZkpRollup. + */ + ZkpRollup getByResourceGroup(String resourceGroupName, String zkpRollupName); + + /** + * Delete a ZkpRollup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @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 zkpRollupName); + + /** + * Delete a ZkpRollup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param zkpRollupName The name of the ZKP rollup resource. + * @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 zkpRollupName, Context context); + + /** + * List ZkpRollup resources by 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 ZkpRollup list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List ZkpRollup resources by 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 ZkpRollup list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List ZkpRollup resources by subscription ID. + * + * @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 ZkpRollup list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List ZkpRollup resources by subscription 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 the response of a ZkpRollup list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Get a ZkpRollup. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ZkpRollup along with {@link Response}. + */ + ZkpRollup getById(String id); + + /** + * Get a ZkpRollup. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ZkpRollup along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a ZkpRollup. + * + * @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 ZkpRollup. + * + * @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 ZkpRollup resource. + * + * @param name resource name. + * @return the first stage of the new ZkpRollup definition. + */ + ZkpRollup.DefinitionStages.Blank define(String name); +} diff --git a/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/models/package-info.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/models/package-info.java new file mode 100644 index 000000000000..ea457337cd4d --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/models/package-info.java @@ -0,0 +1,8 @@ +// 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 DigitalAssets. + */ +package com.azure.resourcemanager.digitalassets.models; diff --git a/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/package-info.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/package-info.java new file mode 100644 index 000000000000..7830868fa610 --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/com/azure/resourcemanager/digitalassets/package-info.java @@ -0,0 +1,8 @@ +// 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 DigitalAssets. + */ +package com.azure.resourcemanager.digitalassets; diff --git a/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/module-info.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/java/module-info.java new file mode 100644 index 000000000000..80c1c942531e --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/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.digitalassets { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.digitalassets; + exports com.azure.resourcemanager.digitalassets.fluent; + exports com.azure.resourcemanager.digitalassets.fluent.models; + exports com.azure.resourcemanager.digitalassets.models; + + opens com.azure.resourcemanager.digitalassets.fluent.models to com.azure.core; + opens com.azure.resourcemanager.digitalassets.models to com.azure.core; + opens com.azure.resourcemanager.digitalassets.implementation.models to com.azure.core; +} diff --git a/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/resources/META-INF/azure-resourcemanager-digitalassets_metadata.json b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/resources/META-INF/azure-resourcemanager-digitalassets_metadata.json new file mode 100644 index 000000000000..9bbe531cc080 --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/resources/META-INF/azure-resourcemanager-digitalassets_metadata.json @@ -0,0 +1 @@ +{"flavor":"azure","apiVersions":{"Microsoft.DigitalAssets":"2025-09-01-preview"},"crossLanguagePackageId":"Microsoft.DigitalAssets","crossLanguageVersion":"0844375f6b65","crossLanguageDefinitions":{"com.azure.resourcemanager.digitalassets.fluent.DigitalAssetsManagementClient":"Microsoft.DigitalAssets","com.azure.resourcemanager.digitalassets.fluent.OperationsClient":"Microsoft.DigitalAssets.Operations","com.azure.resourcemanager.digitalassets.fluent.OperationsClient.list":"Azure.ResourceManager.Operations.list","com.azure.resourcemanager.digitalassets.fluent.PartitionsClient":"Microsoft.DigitalAssets.Partitions","com.azure.resourcemanager.digitalassets.fluent.PartitionsClient.beginCreateOrUpdate":"Microsoft.DigitalAssets.Partitions.createOrUpdate","com.azure.resourcemanager.digitalassets.fluent.PartitionsClient.beginDelete":"Microsoft.DigitalAssets.Partitions.delete","com.azure.resourcemanager.digitalassets.fluent.PartitionsClient.createOrUpdate":"Microsoft.DigitalAssets.Partitions.createOrUpdate","com.azure.resourcemanager.digitalassets.fluent.PartitionsClient.delete":"Microsoft.DigitalAssets.Partitions.delete","com.azure.resourcemanager.digitalassets.fluent.PartitionsClient.get":"Microsoft.DigitalAssets.Partitions.get","com.azure.resourcemanager.digitalassets.fluent.PartitionsClient.getWithResponse":"Microsoft.DigitalAssets.Partitions.get","com.azure.resourcemanager.digitalassets.fluent.PartitionsClient.listByParent":"Microsoft.DigitalAssets.Partitions.listByParent","com.azure.resourcemanager.digitalassets.fluent.PartitionsClient.update":"Microsoft.DigitalAssets.Partitions.update","com.azure.resourcemanager.digitalassets.fluent.PartitionsClient.updateWithResponse":"Microsoft.DigitalAssets.Partitions.update","com.azure.resourcemanager.digitalassets.fluent.ZkpRollupsClient":"Microsoft.DigitalAssets.ZkpRollups","com.azure.resourcemanager.digitalassets.fluent.ZkpRollupsClient.beginCreateOrUpdate":"Microsoft.DigitalAssets.ZkpRollups.createOrUpdate","com.azure.resourcemanager.digitalassets.fluent.ZkpRollupsClient.beginDelete":"Microsoft.DigitalAssets.ZkpRollups.delete","com.azure.resourcemanager.digitalassets.fluent.ZkpRollupsClient.beginUpdate":"Microsoft.DigitalAssets.ZkpRollups.update","com.azure.resourcemanager.digitalassets.fluent.ZkpRollupsClient.createOrUpdate":"Microsoft.DigitalAssets.ZkpRollups.createOrUpdate","com.azure.resourcemanager.digitalassets.fluent.ZkpRollupsClient.delete":"Microsoft.DigitalAssets.ZkpRollups.delete","com.azure.resourcemanager.digitalassets.fluent.ZkpRollupsClient.getByResourceGroup":"Microsoft.DigitalAssets.ZkpRollups.get","com.azure.resourcemanager.digitalassets.fluent.ZkpRollupsClient.getByResourceGroupWithResponse":"Microsoft.DigitalAssets.ZkpRollups.get","com.azure.resourcemanager.digitalassets.fluent.ZkpRollupsClient.list":"Microsoft.DigitalAssets.ZkpRollups.listBySubscription","com.azure.resourcemanager.digitalassets.fluent.ZkpRollupsClient.listByResourceGroup":"Microsoft.DigitalAssets.ZkpRollups.listByResourceGroup","com.azure.resourcemanager.digitalassets.fluent.ZkpRollupsClient.update":"Microsoft.DigitalAssets.ZkpRollups.update","com.azure.resourcemanager.digitalassets.fluent.models.OperationInner":"Azure.ResourceManager.CommonTypes.Operation","com.azure.resourcemanager.digitalassets.fluent.models.PartitionInner":"Microsoft.DigitalAssets.Partition","com.azure.resourcemanager.digitalassets.fluent.models.ZkpRollupInner":"Microsoft.DigitalAssets.ZkpRollup","com.azure.resourcemanager.digitalassets.implementation.DigitalAssetsManagementClientBuilder":"Microsoft.DigitalAssets","com.azure.resourcemanager.digitalassets.implementation.models.OperationListResult":"Azure.ResourceManager.CommonTypes.OperationListResult","com.azure.resourcemanager.digitalassets.implementation.models.PartitionListResult":"Azure.ResourceManager.ResourceListResult","com.azure.resourcemanager.digitalassets.implementation.models.ZkpRollupListResult":"Azure.ResourceManager.ResourceListResult","com.azure.resourcemanager.digitalassets.models.ActionType":"Azure.ResourceManager.CommonTypes.ActionType","com.azure.resourcemanager.digitalassets.models.ManagedServiceIdentity":"Azure.ResourceManager.CommonTypes.ManagedServiceIdentity","com.azure.resourcemanager.digitalassets.models.ManagedServiceIdentityType":"Azure.ResourceManager.CommonTypes.ManagedServiceIdentityType","com.azure.resourcemanager.digitalassets.models.OperationDisplay":"Azure.ResourceManager.CommonTypes.OperationDisplay","com.azure.resourcemanager.digitalassets.models.OperationalStatus":"Microsoft.DigitalAssets.OperationalStatus","com.azure.resourcemanager.digitalassets.models.Origin":"Azure.ResourceManager.CommonTypes.Origin","com.azure.resourcemanager.digitalassets.models.PartitionProperties":"Microsoft.DigitalAssets.PartitionProperties","com.azure.resourcemanager.digitalassets.models.PartitionTagsUpdate":"Azure.ResourceManager.Foundations.TagsUpdateModel","com.azure.resourcemanager.digitalassets.models.ProvisioningState":"Microsoft.DigitalAssets.ProvisioningState","com.azure.resourcemanager.digitalassets.models.UserAssignedIdentity":"Azure.ResourceManager.CommonTypes.UserAssignedIdentity","com.azure.resourcemanager.digitalassets.models.ZkpRollupIdentityUpdate":"Microsoft.DigitalAssets.ZkpRollupIdentityUpdate","com.azure.resourcemanager.digitalassets.models.ZkpRollupPatchProperties":"Microsoft.DigitalAssets.ZkpRollupPatchProperties","com.azure.resourcemanager.digitalassets.models.ZkpRollupProperties":"Microsoft.DigitalAssets.ZkpRollupProperties","com.azure.resourcemanager.digitalassets.models.ZkpRollupUpdate":"Microsoft.DigitalAssets.ZkpRollupUpdate"},"generatedFiles":["src/main/java/com/azure/resourcemanager/digitalassets/DigitalAssetsManager.java","src/main/java/com/azure/resourcemanager/digitalassets/fluent/DigitalAssetsManagementClient.java","src/main/java/com/azure/resourcemanager/digitalassets/fluent/OperationsClient.java","src/main/java/com/azure/resourcemanager/digitalassets/fluent/PartitionsClient.java","src/main/java/com/azure/resourcemanager/digitalassets/fluent/ZkpRollupsClient.java","src/main/java/com/azure/resourcemanager/digitalassets/fluent/models/OperationInner.java","src/main/java/com/azure/resourcemanager/digitalassets/fluent/models/PartitionInner.java","src/main/java/com/azure/resourcemanager/digitalassets/fluent/models/ZkpRollupInner.java","src/main/java/com/azure/resourcemanager/digitalassets/fluent/models/package-info.java","src/main/java/com/azure/resourcemanager/digitalassets/fluent/package-info.java","src/main/java/com/azure/resourcemanager/digitalassets/implementation/DigitalAssetsManagementClientBuilder.java","src/main/java/com/azure/resourcemanager/digitalassets/implementation/DigitalAssetsManagementClientImpl.java","src/main/java/com/azure/resourcemanager/digitalassets/implementation/OperationImpl.java","src/main/java/com/azure/resourcemanager/digitalassets/implementation/OperationsClientImpl.java","src/main/java/com/azure/resourcemanager/digitalassets/implementation/OperationsImpl.java","src/main/java/com/azure/resourcemanager/digitalassets/implementation/PartitionImpl.java","src/main/java/com/azure/resourcemanager/digitalassets/implementation/PartitionsClientImpl.java","src/main/java/com/azure/resourcemanager/digitalassets/implementation/PartitionsImpl.java","src/main/java/com/azure/resourcemanager/digitalassets/implementation/ResourceManagerUtils.java","src/main/java/com/azure/resourcemanager/digitalassets/implementation/ZkpRollupImpl.java","src/main/java/com/azure/resourcemanager/digitalassets/implementation/ZkpRollupsClientImpl.java","src/main/java/com/azure/resourcemanager/digitalassets/implementation/ZkpRollupsImpl.java","src/main/java/com/azure/resourcemanager/digitalassets/implementation/models/OperationListResult.java","src/main/java/com/azure/resourcemanager/digitalassets/implementation/models/PartitionListResult.java","src/main/java/com/azure/resourcemanager/digitalassets/implementation/models/ZkpRollupListResult.java","src/main/java/com/azure/resourcemanager/digitalassets/implementation/package-info.java","src/main/java/com/azure/resourcemanager/digitalassets/models/ActionType.java","src/main/java/com/azure/resourcemanager/digitalassets/models/ManagedServiceIdentity.java","src/main/java/com/azure/resourcemanager/digitalassets/models/ManagedServiceIdentityType.java","src/main/java/com/azure/resourcemanager/digitalassets/models/Operation.java","src/main/java/com/azure/resourcemanager/digitalassets/models/OperationDisplay.java","src/main/java/com/azure/resourcemanager/digitalassets/models/OperationalStatus.java","src/main/java/com/azure/resourcemanager/digitalassets/models/Operations.java","src/main/java/com/azure/resourcemanager/digitalassets/models/Origin.java","src/main/java/com/azure/resourcemanager/digitalassets/models/Partition.java","src/main/java/com/azure/resourcemanager/digitalassets/models/PartitionProperties.java","src/main/java/com/azure/resourcemanager/digitalassets/models/PartitionTagsUpdate.java","src/main/java/com/azure/resourcemanager/digitalassets/models/Partitions.java","src/main/java/com/azure/resourcemanager/digitalassets/models/ProvisioningState.java","src/main/java/com/azure/resourcemanager/digitalassets/models/UserAssignedIdentity.java","src/main/java/com/azure/resourcemanager/digitalassets/models/ZkpRollup.java","src/main/java/com/azure/resourcemanager/digitalassets/models/ZkpRollupIdentityUpdate.java","src/main/java/com/azure/resourcemanager/digitalassets/models/ZkpRollupPatchProperties.java","src/main/java/com/azure/resourcemanager/digitalassets/models/ZkpRollupProperties.java","src/main/java/com/azure/resourcemanager/digitalassets/models/ZkpRollupUpdate.java","src/main/java/com/azure/resourcemanager/digitalassets/models/ZkpRollups.java","src/main/java/com/azure/resourcemanager/digitalassets/models/package-info.java","src/main/java/com/azure/resourcemanager/digitalassets/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-digitalassets/proxy-config.json b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-digitalassets/proxy-config.json new file mode 100644 index 000000000000..9763d153ea68 --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-digitalassets/proxy-config.json @@ -0,0 +1 @@ +[["com.azure.resourcemanager.digitalassets.implementation.OperationsClientImpl$OperationsService"],["com.azure.resourcemanager.digitalassets.implementation.PartitionsClientImpl$PartitionsService"],["com.azure.resourcemanager.digitalassets.implementation.ZkpRollupsClientImpl$ZkpRollupsService"]] \ No newline at end of file diff --git a/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-digitalassets/reflect-config.json b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-digitalassets/reflect-config.json new file mode 100644 index 000000000000..0637a088a01e --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-digitalassets/reflect-config.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/resources/azure-resourcemanager-digitalassets.properties b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/resources/azure-resourcemanager-digitalassets.properties new file mode 100644 index 000000000000..defbd48204e4 --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/main/resources/azure-resourcemanager-digitalassets.properties @@ -0,0 +1 @@ +version=${project.version} diff --git a/sdk/digitalassets/azure-resourcemanager-digitalassets/src/samples/java/com/azure/resourcemanager/digitalassets/generated/OperationsListSamples.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/samples/java/com/azure/resourcemanager/digitalassets/generated/OperationsListSamples.java new file mode 100644 index 000000000000..70658e6c52de --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/samples/java/com/azure/resourcemanager/digitalassets/generated/OperationsListSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.digitalassets.generated; + +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: 2025-09-01-preview/Operations_List.json + */ + /** + * Sample code: ListOperations. + * + * @param manager Entry point to DigitalAssetsManager. + */ + public static void listOperations(com.azure.resourcemanager.digitalassets.DigitalAssetsManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/digitalassets/azure-resourcemanager-digitalassets/src/samples/java/com/azure/resourcemanager/digitalassets/generated/PartitionsCreateOrUpdateSamples.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/samples/java/com/azure/resourcemanager/digitalassets/generated/PartitionsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..553caa5d9a1c --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/samples/java/com/azure/resourcemanager/digitalassets/generated/PartitionsCreateOrUpdateSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.digitalassets.generated; + +/** + * Samples for Partitions CreateOrUpdate. + */ +public final class PartitionsCreateOrUpdateSamples { + /* + * x-ms-original-file: 2025-09-01-preview/Partitions_CreateOrUpdate.json + */ + /** + * Sample code: CreatePartition. + * + * @param manager Entry point to DigitalAssetsManager. + */ + public static void createPartition(com.azure.resourcemanager.digitalassets.DigitalAssetsManager manager) { + manager.partitions().define("Partition1").withRegion("eastus").withExistingZkpRollup("testrg", "Jack").create(); + } +} diff --git a/sdk/digitalassets/azure-resourcemanager-digitalassets/src/samples/java/com/azure/resourcemanager/digitalassets/generated/PartitionsDeleteSamples.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/samples/java/com/azure/resourcemanager/digitalassets/generated/PartitionsDeleteSamples.java new file mode 100644 index 000000000000..2a17f734d5fe --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/samples/java/com/azure/resourcemanager/digitalassets/generated/PartitionsDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.digitalassets.generated; + +/** + * Samples for Partitions Delete. + */ +public final class PartitionsDeleteSamples { + /* + * x-ms-original-file: 2025-09-01-preview/Partitions_Delete.json + */ + /** + * Sample code: DeletePartition. + * + * @param manager Entry point to DigitalAssetsManager. + */ + public static void deletePartition(com.azure.resourcemanager.digitalassets.DigitalAssetsManager manager) { + manager.partitions().delete("testrg", "Jack", "Partition1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/digitalassets/azure-resourcemanager-digitalassets/src/samples/java/com/azure/resourcemanager/digitalassets/generated/PartitionsGetSamples.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/samples/java/com/azure/resourcemanager/digitalassets/generated/PartitionsGetSamples.java new file mode 100644 index 000000000000..efc6c44568c5 --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/samples/java/com/azure/resourcemanager/digitalassets/generated/PartitionsGetSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.digitalassets.generated; + +/** + * Samples for Partitions Get. + */ +public final class PartitionsGetSamples { + /* + * x-ms-original-file: 2025-09-01-preview/Partitions_Get.json + */ + /** + * Sample code: GetPartition. + * + * @param manager Entry point to DigitalAssetsManager. + */ + public static void getPartition(com.azure.resourcemanager.digitalassets.DigitalAssetsManager manager) { + manager.partitions().getWithResponse("testrg", "Jack", "Partition1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/digitalassets/azure-resourcemanager-digitalassets/src/samples/java/com/azure/resourcemanager/digitalassets/generated/PartitionsListByParentSamples.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/samples/java/com/azure/resourcemanager/digitalassets/generated/PartitionsListByParentSamples.java new file mode 100644 index 000000000000..ce8953882f42 --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/samples/java/com/azure/resourcemanager/digitalassets/generated/PartitionsListByParentSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.digitalassets.generated; + +/** + * Samples for Partitions ListByParent. + */ +public final class PartitionsListByParentSamples { + /* + * x-ms-original-file: 2025-09-01-preview/Partitions_ListByParent.json + */ + /** + * Sample code: ListPartitionsByParent. + * + * @param manager Entry point to DigitalAssetsManager. + */ + public static void listPartitionsByParent(com.azure.resourcemanager.digitalassets.DigitalAssetsManager manager) { + manager.partitions().listByParent("testrg", "Jack", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/digitalassets/azure-resourcemanager-digitalassets/src/samples/java/com/azure/resourcemanager/digitalassets/generated/PartitionsUpdateSamples.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/samples/java/com/azure/resourcemanager/digitalassets/generated/PartitionsUpdateSamples.java new file mode 100644 index 000000000000..dbc609f3a01a --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/samples/java/com/azure/resourcemanager/digitalassets/generated/PartitionsUpdateSamples.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.digitalassets.generated; + +import com.azure.resourcemanager.digitalassets.models.Partition; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Partitions Update. + */ +public final class PartitionsUpdateSamples { + /* + * x-ms-original-file: 2025-09-01-preview/Partitions_Update.json + */ + /** + * Sample code: UpdatePartition. + * + * @param manager Entry point to DigitalAssetsManager. + */ + public static void updatePartition(com.azure.resourcemanager.digitalassets.DigitalAssetsManager manager) { + Partition resource = manager.partitions() + .getWithResponse("testrg", "Jack", "Partition1", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("env", "test")).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/digitalassets/azure-resourcemanager-digitalassets/src/samples/java/com/azure/resourcemanager/digitalassets/generated/ZkpRollupsCreateOrUpdateSamples.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/samples/java/com/azure/resourcemanager/digitalassets/generated/ZkpRollupsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..064c3097909f --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/samples/java/com/azure/resourcemanager/digitalassets/generated/ZkpRollupsCreateOrUpdateSamples.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.digitalassets.generated; + +import com.azure.resourcemanager.digitalassets.models.ManagedServiceIdentity; +import com.azure.resourcemanager.digitalassets.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.digitalassets.models.UserAssignedIdentity; +import com.azure.resourcemanager.digitalassets.models.ZkpRollupProperties; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for ZkpRollups CreateOrUpdate. + */ +public final class ZkpRollupsCreateOrUpdateSamples { + /* + * x-ms-original-file: 2025-09-01-preview/ZkpRollups_CreateOrUpdate.json + */ + /** + * Sample code: CreateZkpRollup. + * + * @param manager Entry point to DigitalAssetsManager. + */ + public static void createZkpRollup(com.azure.resourcemanager.digitalassets.DigitalAssetsManager manager) { + manager.zkpRollups() + .define("Jack") + .withRegion("eastus") + .withExistingResourceGroup("testrg") + .withProperties(new ZkpRollupProperties() + .withTokenOwnerAccounts(Arrays.asList("0x1111111111111111111111111111111111111111", + "0x2222222222222222222222222222222222222222")) + .withKeyVaultId("fakeTokenPlaceholder") + .withKeyVaultUserAssignedIdentityResourceId("fakeTokenPlaceholder") + .withCustomerVpnPublicIp("203.0.113.10") + .withCustomerOnPremAddressPrefixes(Arrays.asList("192.168.100.0/24")) + .withBootNodeId( + "79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8") + .withBootNodeIp("10.0.0.4") + .withBootNodeP2pPort(30303) + .withBootNodeRpcPort(8545) + .withServiceBusEndpoint("https://sb-da-customer.servicebus.windows.net") + .withServiceBusQueueName("proofs-output")) + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities(mapOf( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/kvReader", + new UserAssignedIdentity()))) + .create(); + } + + // 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/digitalassets/azure-resourcemanager-digitalassets/src/samples/java/com/azure/resourcemanager/digitalassets/generated/ZkpRollupsDeleteSamples.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/samples/java/com/azure/resourcemanager/digitalassets/generated/ZkpRollupsDeleteSamples.java new file mode 100644 index 000000000000..c33c4a00da13 --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/samples/java/com/azure/resourcemanager/digitalassets/generated/ZkpRollupsDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.digitalassets.generated; + +/** + * Samples for ZkpRollups Delete. + */ +public final class ZkpRollupsDeleteSamples { + /* + * x-ms-original-file: 2025-09-01-preview/ZkpRollups_Delete.json + */ + /** + * Sample code: DeleteZkpRollup. + * + * @param manager Entry point to DigitalAssetsManager. + */ + public static void deleteZkpRollup(com.azure.resourcemanager.digitalassets.DigitalAssetsManager manager) { + manager.zkpRollups().delete("testrg", "Jack", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/digitalassets/azure-resourcemanager-digitalassets/src/samples/java/com/azure/resourcemanager/digitalassets/generated/ZkpRollupsGetByResourceGroupSamples.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/samples/java/com/azure/resourcemanager/digitalassets/generated/ZkpRollupsGetByResourceGroupSamples.java new file mode 100644 index 000000000000..ec9de79b0036 --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/samples/java/com/azure/resourcemanager/digitalassets/generated/ZkpRollupsGetByResourceGroupSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.digitalassets.generated; + +/** + * Samples for ZkpRollups GetByResourceGroup. + */ +public final class ZkpRollupsGetByResourceGroupSamples { + /* + * x-ms-original-file: 2025-09-01-preview/ZkpRollups_Get.json + */ + /** + * Sample code: GetZkpRollup. + * + * @param manager Entry point to DigitalAssetsManager. + */ + public static void getZkpRollup(com.azure.resourcemanager.digitalassets.DigitalAssetsManager manager) { + manager.zkpRollups().getByResourceGroupWithResponse("testrg", "Jack", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/digitalassets/azure-resourcemanager-digitalassets/src/samples/java/com/azure/resourcemanager/digitalassets/generated/ZkpRollupsListByResourceGroupSamples.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/samples/java/com/azure/resourcemanager/digitalassets/generated/ZkpRollupsListByResourceGroupSamples.java new file mode 100644 index 000000000000..2fca65c99564 --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/samples/java/com/azure/resourcemanager/digitalassets/generated/ZkpRollupsListByResourceGroupSamples.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.digitalassets.generated; + +/** + * Samples for ZkpRollups ListByResourceGroup. + */ +public final class ZkpRollupsListByResourceGroupSamples { + /* + * x-ms-original-file: 2025-09-01-preview/ZkpRollups_ListByResourceGroup.json + */ + /** + * Sample code: ListZkpRollupsByResourceGroup. + * + * @param manager Entry point to DigitalAssetsManager. + */ + public static void + listZkpRollupsByResourceGroup(com.azure.resourcemanager.digitalassets.DigitalAssetsManager manager) { + manager.zkpRollups().listByResourceGroup("testrg", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/digitalassets/azure-resourcemanager-digitalassets/src/samples/java/com/azure/resourcemanager/digitalassets/generated/ZkpRollupsListSamples.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/samples/java/com/azure/resourcemanager/digitalassets/generated/ZkpRollupsListSamples.java new file mode 100644 index 000000000000..bb0a815bfa2c --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/samples/java/com/azure/resourcemanager/digitalassets/generated/ZkpRollupsListSamples.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.digitalassets.generated; + +/** + * Samples for ZkpRollups List. + */ +public final class ZkpRollupsListSamples { + /* + * x-ms-original-file: 2025-09-01-preview/ZkpRollups_ListBySubscription.json + */ + /** + * Sample code: ListZkpRollupsBySubscription. + * + * @param manager Entry point to DigitalAssetsManager. + */ + public static void + listZkpRollupsBySubscription(com.azure.resourcemanager.digitalassets.DigitalAssetsManager manager) { + manager.zkpRollups().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/digitalassets/azure-resourcemanager-digitalassets/src/samples/java/com/azure/resourcemanager/digitalassets/generated/ZkpRollupsUpdateSamples.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/samples/java/com/azure/resourcemanager/digitalassets/generated/ZkpRollupsUpdateSamples.java new file mode 100644 index 000000000000..32ff574978ca --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/samples/java/com/azure/resourcemanager/digitalassets/generated/ZkpRollupsUpdateSamples.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.digitalassets.generated; + +import com.azure.resourcemanager.digitalassets.models.ZkpRollup; +import com.azure.resourcemanager.digitalassets.models.ZkpRollupIdentityUpdate; +import com.azure.resourcemanager.digitalassets.models.ZkpRollupPatchProperties; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for ZkpRollups Update. + */ +public final class ZkpRollupsUpdateSamples { + /* + * x-ms-original-file: 2025-09-01-preview/ZkpRollups_Update.json + */ + /** + * Sample code: UpdateZkpRollupTagsIdentityAndBootNode. + * + * @param manager Entry point to DigitalAssetsManager. + */ + public static void + updateZkpRollupTagsIdentityAndBootNode(com.azure.resourcemanager.digitalassets.DigitalAssetsManager manager) { + ZkpRollup resource = manager.zkpRollups() + .getByResourceGroupWithResponse("testrg", "Jack", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("env", "test")) + .withIdentity(new ZkpRollupIdentityUpdate().withUserAssignedIdentities(mapOf( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/additionalReader", + null))) + .withProperties(new ZkpRollupPatchProperties().withBootNodeIp("10.0.0.4")) + .apply(); + } + + /* + * x-ms-original-file: 2025-09-01-preview/ZkpRollups_UpdateConfiguration.json + */ + /** + * Sample code: UpdateZkpRollupConfiguration. + * + * @param manager Entry point to DigitalAssetsManager. + */ + public static void + updateZkpRollupConfiguration(com.azure.resourcemanager.digitalassets.DigitalAssetsManager manager) { + ZkpRollup resource = manager.zkpRollups() + .getByResourceGroupWithResponse("testrg", "Jack", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withProperties(new ZkpRollupPatchProperties() + .withTokenOwnerAccounts(Arrays.asList("0x2222222222222222222222222222222222222222")) + .withBootNodeId( + "79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8") + .withBootNodeIp("10.0.0.5") + .withBootNodeP2pPort(30304) + .withBootNodeRpcPort(8546)) + .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/digitalassets/azure-resourcemanager-digitalassets/src/test/java/com/azure/resourcemanager/digitalassets/generated/ManagedServiceIdentityTests.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/test/java/com/azure/resourcemanager/digitalassets/generated/ManagedServiceIdentityTests.java new file mode 100644 index 000000000000..aac6eee6c058 --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/test/java/com/azure/resourcemanager/digitalassets/generated/ManagedServiceIdentityTests.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.digitalassets.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.digitalassets.models.ManagedServiceIdentity; +import com.azure.resourcemanager.digitalassets.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.digitalassets.models.UserAssignedIdentity; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class ManagedServiceIdentityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ManagedServiceIdentity model = BinaryData.fromString( + "{\"principalId\":\"vd\",\"tenantId\":\"jgrtfwvukxga\",\"type\":\"None\",\"userAssignedIdentities\":{\"mkkvnip\":{\"principalId\":\"nhsjcnyej\",\"clientId\":\"ryhtnapczwlokjy\"}}}") + .toObject(ManagedServiceIdentity.class); + Assertions.assertEquals(ManagedServiceIdentityType.NONE, model.type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ManagedServiceIdentity model = new ManagedServiceIdentity().withType(ManagedServiceIdentityType.NONE) + .withUserAssignedIdentities(mapOf("mkkvnip", new UserAssignedIdentity())); + model = BinaryData.fromObject(model).toObject(ManagedServiceIdentity.class); + Assertions.assertEquals(ManagedServiceIdentityType.NONE, model.type()); + } + + // 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/digitalassets/azure-resourcemanager-digitalassets/src/test/java/com/azure/resourcemanager/digitalassets/generated/OperationDisplayTests.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/test/java/com/azure/resourcemanager/digitalassets/generated/OperationDisplayTests.java new file mode 100644 index 000000000000..26818fd977ef --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/test/java/com/azure/resourcemanager/digitalassets/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.digitalassets.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.digitalassets.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/digitalassets/azure-resourcemanager-digitalassets/src/test/java/com/azure/resourcemanager/digitalassets/generated/OperationInnerTests.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/test/java/com/azure/resourcemanager/digitalassets/generated/OperationInnerTests.java new file mode 100644 index 000000000000..542fdee123f3 --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/test/java/com/azure/resourcemanager/digitalassets/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.digitalassets.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.digitalassets.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/digitalassets/azure-resourcemanager-digitalassets/src/test/java/com/azure/resourcemanager/digitalassets/generated/OperationListResultTests.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/test/java/com/azure/resourcemanager/digitalassets/generated/OperationListResultTests.java new file mode 100644 index 000000000000..09fd3c7cce62 --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/test/java/com/azure/resourcemanager/digitalassets/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.digitalassets.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.digitalassets.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/digitalassets/azure-resourcemanager-digitalassets/src/test/java/com/azure/resourcemanager/digitalassets/generated/OperationalStatusTests.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/test/java/com/azure/resourcemanager/digitalassets/generated/OperationalStatusTests.java new file mode 100644 index 000000000000..d70c97de08b2 --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/test/java/com/azure/resourcemanager/digitalassets/generated/OperationalStatusTests.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.digitalassets.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.digitalassets.models.OperationalStatus; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; + +public final class OperationalStatusTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperationalStatus model = BinaryData + .fromString( + "{\"status\":\"wby\",\"evaluatedAt\":\"2021-06-19T13:57:47Z\",\"validUntil\":\"2021-04-19T10:59:49Z\"}") + .toObject(OperationalStatus.class); + Assertions.assertEquals("wby", model.status()); + Assertions.assertEquals(OffsetDateTime.parse("2021-06-19T13:57:47Z"), model.evaluatedAt()); + Assertions.assertEquals(OffsetDateTime.parse("2021-04-19T10:59:49Z"), model.validUntil()); + } +} diff --git a/sdk/digitalassets/azure-resourcemanager-digitalassets/src/test/java/com/azure/resourcemanager/digitalassets/generated/OperationsListMockTests.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/test/java/com/azure/resourcemanager/digitalassets/generated/OperationsListMockTests.java new file mode 100644 index 000000000000..10e11852cbad --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/test/java/com/azure/resourcemanager/digitalassets/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.digitalassets.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.digitalassets.DigitalAssetsManager; +import com.azure.resourcemanager.digitalassets.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\":\"rmnohj\",\"isDataAction\":false,\"display\":{\"provider\":\"dsoifiyipj\",\"resource\":\"qwpgrjbzn\",\"operation\":\"cjxvsnbyxqab\",\"description\":\"ocpcy\"},\"origin\":\"system\",\"actionType\":\"Internal\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DigitalAssetsManager manager = DigitalAssetsManager.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/digitalassets/azure-resourcemanager-digitalassets/src/test/java/com/azure/resourcemanager/digitalassets/generated/PartitionInnerTests.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/test/java/com/azure/resourcemanager/digitalassets/generated/PartitionInnerTests.java new file mode 100644 index 000000000000..c11473f132d5 --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/test/java/com/azure/resourcemanager/digitalassets/generated/PartitionInnerTests.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.digitalassets.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.digitalassets.fluent.models.PartitionInner; +import com.azure.resourcemanager.digitalassets.models.PartitionProperties; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class PartitionInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PartitionInner model = BinaryData.fromString( + "{\"properties\":{\"provisioningState\":\"Succeeded\",\"operationalStatus\":{\"status\":\"inqpjwnzll\",\"evaluatedAt\":\"2021-11-25T19:06:53Z\",\"validUntil\":\"2020-12-23T02:21:43Z\"}},\"location\":\"pee\",\"tags\":{\"uujitcjc\":\"gxsabkyq\",\"d\":\"dzevndhkrw\"},\"id\":\"ppdsbdkvwrwj\",\"name\":\"eusnhutj\",\"type\":\"ltmrldh\"}") + .toObject(PartitionInner.class); + Assertions.assertEquals("pee", model.location()); + Assertions.assertEquals("gxsabkyq", model.tags().get("uujitcjc")); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PartitionInner model = new PartitionInner().withLocation("pee") + .withTags(mapOf("uujitcjc", "gxsabkyq", "d", "dzevndhkrw")) + .withProperties(new PartitionProperties()); + model = BinaryData.fromObject(model).toObject(PartitionInner.class); + Assertions.assertEquals("pee", model.location()); + Assertions.assertEquals("gxsabkyq", model.tags().get("uujitcjc")); + } + + // 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/digitalassets/azure-resourcemanager-digitalassets/src/test/java/com/azure/resourcemanager/digitalassets/generated/PartitionListResultTests.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/test/java/com/azure/resourcemanager/digitalassets/generated/PartitionListResultTests.java new file mode 100644 index 000000000000..ac5c3e81cdc2 --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/test/java/com/azure/resourcemanager/digitalassets/generated/PartitionListResultTests.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.digitalassets.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.digitalassets.implementation.models.PartitionListResult; +import org.junit.jupiter.api.Assertions; + +public final class PartitionListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PartitionListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"provisioningState\":\"Canceled\",\"operationalStatus\":{\"status\":\"hejkotynqgou\",\"evaluatedAt\":\"2021-01-02T21:42:03Z\",\"validUntil\":\"2021-01-30T20:47:53Z\"}},\"location\":\"likwyqkgfgib\",\"tags\":{\"yb\":\"gakeqsr\"},\"id\":\"qqedqytbciqfou\",\"name\":\"lmmnkzsmodmglo\",\"type\":\"gpbkwtmut\"},{\"properties\":{\"provisioningState\":\"Failed\",\"operationalStatus\":{\"status\":\"ap\",\"evaluatedAt\":\"2021-01-27T01:22:28Z\",\"validUntil\":\"2021-10-12T00:21:31Z\"}},\"location\":\"cuertu\",\"tags\":{\"vqwhbmdgbbjfd\":\"o\",\"q\":\"gmbmbexppbh\",\"algbquxigjyjg\":\"rolfpfp\",\"lnerkujysvleju\":\"jaoyfhrtx\"},\"id\":\"fqawrlyxw\",\"name\":\"kcprbnw\",\"type\":\"xgjvtbv\"},{\"properties\":{\"provisioningState\":\"Failed\",\"operationalStatus\":{\"status\":\"dnrujqguhmuouqfp\",\"evaluatedAt\":\"2021-03-08T16:35:29Z\",\"validUntil\":\"2021-01-23T13:08:48Z\"}},\"location\":\"bngui\",\"tags\":{\"x\":\"uizga\"},\"id\":\"fizuckyf\",\"name\":\"hr\",\"type\":\"idf\"},{\"properties\":{\"provisioningState\":\"Accepted\",\"operationalStatus\":{\"status\":\"uht\",\"evaluatedAt\":\"2021-01-09T17:32:36Z\",\"validUntil\":\"2021-10-17T08:51:50Z\"}},\"location\":\"sdkf\",\"tags\":{\"km\":\"xmnteiwaop\",\"mzidnsezcxtb\":\"jcmmxdcufufsrp\",\"dwzjeiach\":\"sgfyccsnew\"},\"id\":\"oosflnr\",\"name\":\"sfqpteehz\",\"type\":\"vypyqrimzinpv\"}],\"nextLink\":\"jdkirsoodqx\"}") + .toObject(PartitionListResult.class); + Assertions.assertEquals("likwyqkgfgib", model.value().get(0).location()); + Assertions.assertEquals("gakeqsr", model.value().get(0).tags().get("yb")); + Assertions.assertEquals("jdkirsoodqx", model.nextLink()); + } +} diff --git a/sdk/digitalassets/azure-resourcemanager-digitalassets/src/test/java/com/azure/resourcemanager/digitalassets/generated/PartitionPropertiesTests.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/test/java/com/azure/resourcemanager/digitalassets/generated/PartitionPropertiesTests.java new file mode 100644 index 000000000000..f2adcac50847 --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/test/java/com/azure/resourcemanager/digitalassets/generated/PartitionPropertiesTests.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.digitalassets.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.digitalassets.models.PartitionProperties; + +public final class PartitionPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PartitionProperties model = BinaryData.fromString( + "{\"provisioningState\":\"Succeeded\",\"operationalStatus\":{\"status\":\"zdatqxhocdg\",\"evaluatedAt\":\"2021-01-21T00:19:14Z\",\"validUntil\":\"2021-05-02T13:31:32Z\"}}") + .toObject(PartitionProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PartitionProperties model = new PartitionProperties(); + model = BinaryData.fromObject(model).toObject(PartitionProperties.class); + } +} diff --git a/sdk/digitalassets/azure-resourcemanager-digitalassets/src/test/java/com/azure/resourcemanager/digitalassets/generated/PartitionTagsUpdateTests.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/test/java/com/azure/resourcemanager/digitalassets/generated/PartitionTagsUpdateTests.java new file mode 100644 index 000000000000..836053bb8308 --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/test/java/com/azure/resourcemanager/digitalassets/generated/PartitionTagsUpdateTests.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.digitalassets.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.digitalassets.models.PartitionTagsUpdate; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class PartitionTagsUpdateTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PartitionTagsUpdate model = BinaryData.fromString( + "{\"tags\":{\"cndvkaozwyiftyhx\":\"phut\",\"xolniwpwcukjfk\":\"urokft\",\"lwckbasyypnddhs\":\"iawxklry\"}}") + .toObject(PartitionTagsUpdate.class); + Assertions.assertEquals("phut", model.tags().get("cndvkaozwyiftyhx")); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PartitionTagsUpdate model = new PartitionTagsUpdate() + .withTags(mapOf("cndvkaozwyiftyhx", "phut", "xolniwpwcukjfk", "urokft", "lwckbasyypnddhs", "iawxklry")); + model = BinaryData.fromObject(model).toObject(PartitionTagsUpdate.class); + Assertions.assertEquals("phut", model.tags().get("cndvkaozwyiftyhx")); + } + + // 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/digitalassets/azure-resourcemanager-digitalassets/src/test/java/com/azure/resourcemanager/digitalassets/generated/PartitionsCreateOrUpdateMockTests.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/test/java/com/azure/resourcemanager/digitalassets/generated/PartitionsCreateOrUpdateMockTests.java new file mode 100644 index 000000000000..771195b281a4 --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/test/java/com/azure/resourcemanager/digitalassets/generated/PartitionsCreateOrUpdateMockTests.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.digitalassets.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.digitalassets.DigitalAssetsManager; +import com.azure.resourcemanager.digitalassets.models.Partition; +import com.azure.resourcemanager.digitalassets.models.PartitionProperties; +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 PartitionsCreateOrUpdateMockTests { + @Test + public void testCreateOrUpdate() throws Exception { + String responseStr + = "{\"properties\":{\"provisioningState\":\"Succeeded\",\"operationalStatus\":{\"status\":\"lnwsubisn\",\"evaluatedAt\":\"2021-07-23T14:25:25Z\",\"validUntil\":\"2021-08-17T16:47:22Z\"}},\"location\":\"mngnzscxaqw\",\"tags\":{\"njeaseipheofloke\":\"hcbonqvpkvlr\",\"enjbdlwtgrhp\":\"y\",\"umasxazjpq\":\"jp\",\"ualhbxxhejj\":\"e\"},\"id\":\"zvdudgwdslfhotwm\",\"name\":\"ynpwlbj\",\"type\":\"pgacftadehxnlty\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DigitalAssetsManager manager = DigitalAssetsManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + Partition response = manager.partitions() + .define("tthzrvqd") + .withRegion("oqfbowskanyk") + .withExistingZkpRollup("gxlefgugnxkrxd", "mi") + .withTags(mapOf("ndrvynhzg", "cuiywgqyw", "ecfvmm", "phrcgyncoc", "sxlzevgbmqj", "oo", "lzu", "abcypmivk")) + .withProperties(new PartitionProperties()) + .create(); + + Assertions.assertEquals("mngnzscxaqw", response.location()); + Assertions.assertEquals("hcbonqvpkvlr", response.tags().get("njeaseipheofloke")); + } + + // 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/digitalassets/azure-resourcemanager-digitalassets/src/test/java/com/azure/resourcemanager/digitalassets/generated/PartitionsGetWithResponseMockTests.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/test/java/com/azure/resourcemanager/digitalassets/generated/PartitionsGetWithResponseMockTests.java new file mode 100644 index 000000000000..f79be1e4af77 --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/test/java/com/azure/resourcemanager/digitalassets/generated/PartitionsGetWithResponseMockTests.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.digitalassets.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.digitalassets.DigitalAssetsManager; +import com.azure.resourcemanager.digitalassets.models.Partition; +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 PartitionsGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"provisioningState\":\"Failed\",\"operationalStatus\":{\"status\":\"ijcoejctb\",\"evaluatedAt\":\"2021-04-06T12:53:23Z\",\"validUntil\":\"2021-07-24T11:38:54Z\"}},\"location\":\"qsycbkbfkgu\",\"tags\":{\"ddtocjjxhvp\":\"exxppofmxaxcfjp\",\"exhd\":\"o\"},\"id\":\"xibqeojnx\",\"name\":\"bzv\",\"type\":\"dntwndeicbtw\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DigitalAssetsManager manager = DigitalAssetsManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + Partition response = manager.partitions() + .getWithResponse("po", "gmaajrm", "djwzrlov", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("qsycbkbfkgu", response.location()); + Assertions.assertEquals("exxppofmxaxcfjp", response.tags().get("ddtocjjxhvp")); + } +} diff --git a/sdk/digitalassets/azure-resourcemanager-digitalassets/src/test/java/com/azure/resourcemanager/digitalassets/generated/PartitionsListByParentMockTests.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/test/java/com/azure/resourcemanager/digitalassets/generated/PartitionsListByParentMockTests.java new file mode 100644 index 000000000000..bd97e26be1ae --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/test/java/com/azure/resourcemanager/digitalassets/generated/PartitionsListByParentMockTests.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.digitalassets.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.digitalassets.DigitalAssetsManager; +import com.azure.resourcemanager.digitalassets.models.Partition; +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 PartitionsListByParentMockTests { + @Test + public void testListByParent() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"provisioningState\":\"Succeeded\",\"operationalStatus\":{\"status\":\"wpyeicxmqciwqvh\",\"evaluatedAt\":\"2021-01-23T19:42:32Z\",\"validUntil\":\"2021-03-25T23:46:11Z\"}},\"location\":\"uigdtopbobjog\",\"tags\":{\"a\":\"w\"},\"id\":\"a\",\"name\":\"hrzayvvtpgvdf\",\"type\":\"iotkftutqxl\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DigitalAssetsManager manager = DigitalAssetsManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response + = manager.partitions().listByParent("pzaoqvuhr", "cffcyddglmj", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("uigdtopbobjog", response.iterator().next().location()); + Assertions.assertEquals("w", response.iterator().next().tags().get("a")); + } +} diff --git a/sdk/digitalassets/azure-resourcemanager-digitalassets/src/test/java/com/azure/resourcemanager/digitalassets/generated/UserAssignedIdentityTests.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/test/java/com/azure/resourcemanager/digitalassets/generated/UserAssignedIdentityTests.java new file mode 100644 index 000000000000..3db3c8605d8c --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/test/java/com/azure/resourcemanager/digitalassets/generated/UserAssignedIdentityTests.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.digitalassets.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.digitalassets.models.UserAssignedIdentity; + +public final class UserAssignedIdentityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + UserAssignedIdentity model + = BinaryData.fromString("{\"principalId\":\"xzjnchgejs\",\"clientId\":\"dmailzydehojw\"}") + .toObject(UserAssignedIdentity.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + UserAssignedIdentity model = new UserAssignedIdentity(); + model = BinaryData.fromObject(model).toObject(UserAssignedIdentity.class); + } +} diff --git a/sdk/digitalassets/azure-resourcemanager-digitalassets/src/test/java/com/azure/resourcemanager/digitalassets/generated/ZkpRollupIdentityUpdateTests.java b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/test/java/com/azure/resourcemanager/digitalassets/generated/ZkpRollupIdentityUpdateTests.java new file mode 100644 index 000000000000..f0ef4f29da91 --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/src/test/java/com/azure/resourcemanager/digitalassets/generated/ZkpRollupIdentityUpdateTests.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.digitalassets.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.digitalassets.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.digitalassets.models.UserAssignedIdentity; +import com.azure.resourcemanager.digitalassets.models.ZkpRollupIdentityUpdate; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class ZkpRollupIdentityUpdateTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ZkpRollupIdentityUpdate model = BinaryData.fromString( + "{\"type\":\"SystemAssigned,UserAssigned\",\"userAssignedIdentities\":{\"i\":{\"principalId\":\"zitonpeqfpjkjl\",\"clientId\":\"fpdvhpfxxypi\"},\"ooginuvamih\":{\"principalId\":\"ayhuy\",\"clientId\":\"kpode\"},\"yevc\":{\"principalId\":\"gnarxzxtheo\",\"clientId\":\"si\"},\"gxg\":{\"principalId\":\"qi\",\"clientId\":\"hungbwjzrnf\"}}}") + .toObject(ZkpRollupIdentityUpdate.class); + Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED, model.type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ZkpRollupIdentityUpdate model + = new ZkpRollupIdentityUpdate().withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED) + .withUserAssignedIdentities(mapOf("i", new UserAssignedIdentity(), "ooginuvamih", + new UserAssignedIdentity(), "yevc", new UserAssignedIdentity(), "gxg", new UserAssignedIdentity())); + model = BinaryData.fromObject(model).toObject(ZkpRollupIdentityUpdate.class); + Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED, model.type()); + } + + // 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/digitalassets/azure-resourcemanager-digitalassets/tsp-location.yaml b/sdk/digitalassets/azure-resourcemanager-digitalassets/tsp-location.yaml new file mode 100644 index 000000000000..12768ea81b85 --- /dev/null +++ b/sdk/digitalassets/azure-resourcemanager-digitalassets/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/digitalassets/resource-manager/Microsoft.DigitalAssets/DigitalAssets +commit: 1112474efdc9ffe891994f177b1cc4fcf171e17b +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/digitalassets/ci.yml b/sdk/digitalassets/ci.yml new file mode 100644 index 000000000000..558568cae53c --- /dev/null +++ b/sdk/digitalassets/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/digitalassets/ci.yml + - sdk/digitalassets/azure-resourcemanager-digitalassets/ + exclude: + - sdk/digitalassets/pom.xml + - sdk/digitalassets/azure-resourcemanager-digitalassets/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/digitalassets/ci.yml + - sdk/digitalassets/azure-resourcemanager-digitalassets/ + exclude: + - sdk/digitalassets/pom.xml + - sdk/digitalassets/azure-resourcemanager-digitalassets/pom.xml + +parameters: + - name: release_azureresourcemanagerdigitalassets + displayName: azure-resourcemanager-digitalassets + type: boolean + default: false + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: digitalassets + Artifacts: + - name: azure-resourcemanager-digitalassets + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerdigitalassets + releaseInBatch: ${{ parameters.release_azureresourcemanagerdigitalassets }} diff --git a/sdk/digitalassets/pom.xml b/sdk/digitalassets/pom.xml new file mode 100644 index 000000000000..c2f7c18ed8ce --- /dev/null +++ b/sdk/digitalassets/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + com.azure + azure-digitalassets-service + pom + 1.0.0 + + + azure-resourcemanager-digitalassets + +