From e70117425bd6e46ba5c9543ea5b34ee260b6ce4d Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 29 Jul 2021 00:07:06 +0000 Subject: [PATCH] CodeGen from PR 14409 in Azure/azure-rest-api-specs add cname path and create new api version (#14409) * add cname path and create new api version * fix PR comment * remove storage account * use common types for Check Name Availability * Fix PR comment --- eng/versioning/version_client.txt | 1 + .../CHANGELOG.md | 5 + .../README.md | 101 ++ .../pom.xml | 86 + .../ConfidentialLedgerManager.java | 254 +++ .../ConfidentialLedgerManagementClient.java | 67 + .../fluent/LedgersClient.java | 271 +++ .../fluent/OperationsClient.java | 36 + .../fluent/ResourceProvidersClient.java | 41 + .../CheckNameAvailabilityResponseInner.java | 103 ++ .../models/ConfidentialLedgerInner.java | 124 ++ ...ourceProviderOperationDefinitionInner.java | 106 ++ .../fluent/models/package-info.java | 9 + .../fluent/package-info.java | 9 + .../CheckNameAvailabilityResponseImpl.java | 42 + .../ConfidentialLedgerImpl.java | 175 ++ ...identialLedgerManagementClientBuilder.java | 147 ++ ...onfidentialLedgerManagementClientImpl.java | 322 ++++ .../implementation/LedgersClientImpl.java | 1603 +++++++++++++++++ .../implementation/LedgersImpl.java | 173 ++ .../implementation/OperationsClientImpl.java | 270 +++ .../implementation/OperationsImpl.java | 47 + ...sourceProviderOperationDefinitionImpl.java | 42 + .../ResourceProvidersClientImpl.java | 215 +++ .../implementation/ResourceProvidersImpl.java | 63 + .../implementation/Utils.java | 204 +++ .../implementation/package-info.java | 9 + .../models/AadBasedSecurityPrincipal.java | 102 ++ .../models/CertBasedSecurityPrincipal.java | 76 + .../models/CheckNameAvailabilityReason.java | 34 + .../models/CheckNameAvailabilityRequest.java | 76 + .../models/CheckNameAvailabilityResponse.java | 39 + .../models/ConfidentialLedger.java | 225 +++ .../models/ConfidentialLedgerList.java | 82 + .../models/LedgerProperties.java | 185 ++ .../models/LedgerRoleName.java | 37 + .../confidentialledger/models/LedgerType.java | 37 + .../confidentialledger/models/Ledgers.java | 158 ++ .../confidentialledger/models/Location.java | 50 + .../confidentialledger/models/Operations.java | 31 + .../models/ProvisioningState.java | 49 + .../ResourceProviderOperationDefinition.java | 39 + .../ResourceProviderOperationDisplay.java | 128 ++ .../models/ResourceProviderOperationList.java | 60 + .../models/ResourceProviders.java | 35 + .../confidentialledger/models/Tags.java | 51 + .../models/package-info.java | 9 + .../confidentialledger/package-info.java | 9 + .../src/main/java/module-info.java | 19 + sdk/confidentialledger/ci.yml | 4 + sdk/confidentialledger/pom.xml | 1 + 51 files changed, 6061 insertions(+) create mode 100644 sdk/confidentialledger/azure-resourcemanager-confidentialledger/CHANGELOG.md create mode 100644 sdk/confidentialledger/azure-resourcemanager-confidentialledger/README.md create mode 100644 sdk/confidentialledger/azure-resourcemanager-confidentialledger/pom.xml create mode 100644 sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/ConfidentialLedgerManager.java create mode 100644 sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/fluent/ConfidentialLedgerManagementClient.java create mode 100644 sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/fluent/LedgersClient.java create mode 100644 sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/fluent/OperationsClient.java create mode 100644 sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/fluent/ResourceProvidersClient.java create mode 100644 sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/fluent/models/CheckNameAvailabilityResponseInner.java create mode 100644 sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/fluent/models/ConfidentialLedgerInner.java create mode 100644 sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/fluent/models/ResourceProviderOperationDefinitionInner.java create mode 100644 sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/fluent/models/package-info.java create mode 100644 sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/fluent/package-info.java create mode 100644 sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/implementation/CheckNameAvailabilityResponseImpl.java create mode 100644 sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/implementation/ConfidentialLedgerImpl.java create mode 100644 sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/implementation/ConfidentialLedgerManagementClientBuilder.java create mode 100644 sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/implementation/ConfidentialLedgerManagementClientImpl.java create mode 100644 sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/implementation/LedgersClientImpl.java create mode 100644 sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/implementation/LedgersImpl.java create mode 100644 sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/implementation/OperationsClientImpl.java create mode 100644 sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/implementation/OperationsImpl.java create mode 100644 sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/implementation/ResourceProviderOperationDefinitionImpl.java create mode 100644 sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/implementation/ResourceProvidersClientImpl.java create mode 100644 sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/implementation/ResourceProvidersImpl.java create mode 100644 sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/implementation/Utils.java create mode 100644 sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/implementation/package-info.java create mode 100644 sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/AadBasedSecurityPrincipal.java create mode 100644 sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/CertBasedSecurityPrincipal.java create mode 100644 sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/CheckNameAvailabilityReason.java create mode 100644 sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/CheckNameAvailabilityRequest.java create mode 100644 sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/CheckNameAvailabilityResponse.java create mode 100644 sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/ConfidentialLedger.java create mode 100644 sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/ConfidentialLedgerList.java create mode 100644 sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/LedgerProperties.java create mode 100644 sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/LedgerRoleName.java create mode 100644 sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/LedgerType.java create mode 100644 sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/Ledgers.java create mode 100644 sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/Location.java create mode 100644 sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/Operations.java create mode 100644 sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/ProvisioningState.java create mode 100644 sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/ResourceProviderOperationDefinition.java create mode 100644 sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/ResourceProviderOperationDisplay.java create mode 100644 sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/ResourceProviderOperationList.java create mode 100644 sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/ResourceProviders.java create mode 100644 sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/Tags.java create mode 100644 sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/package-info.java create mode 100644 sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/package-info.java create mode 100644 sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/module-info.java diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index b7d60864e4e24..75d4d00c1c84e 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -308,6 +308,7 @@ com.azure.resourcemanager:azure-resourcemanager-elastic;1.0.0-beta.1;1.0.0-beta. com.azure.resourcemanager:azure-resourcemanager-webpubsub;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-security;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-azurearcdata;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-confidentialledger;1.0.0-beta.1;1.0.0-beta.1 # Unreleased dependencies: Copy the entry from above, prepend "unreleased_" and remove the current # version. Unreleased dependencies are only valid for dependency versions. diff --git a/sdk/confidentialledger/azure-resourcemanager-confidentialledger/CHANGELOG.md b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/CHANGELOG.md new file mode 100644 index 0000000000000..7ff35e92041d5 --- /dev/null +++ b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2021-07-29) + +- Azure Resource Manager ConfidentialLedger client library for Java. This package contains Microsoft Azure SDK for ConfidentialLedger Management SDK. Microsoft Azure Confidential Compute Ledger Control Plane REST API version 2020-12-01-preview. Package tag package-2021-05-13-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). diff --git a/sdk/confidentialledger/azure-resourcemanager-confidentialledger/README.md b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/README.md new file mode 100644 index 0000000000000..d73a3ecf32767 --- /dev/null +++ b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/README.md @@ -0,0 +1,101 @@ +# Azure Resource Manager ConfidentialLedger client library for Java + +Azure Resource Manager ConfidentialLedger client library for Java. + +This package contains Microsoft Azure SDK for ConfidentialLedger Management SDK. Microsoft Azure Confidential Compute Ledger Control Plane REST API version 2020-12-01-preview. Package tag package-2021-05-13-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-confidentialledger;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-confidentialledger + 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] package and [Azure Core Netty HTTP][azure_core_http_netty] package provide the default implementation. + +### Authentication + +By default, Azure Active Directory token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, `azure` client can be authenticated by following code: + +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +ConfidentialLedgerManager manager = ConfidentialLedgerManager + .authenticate(credential, profile); +``` + +The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise. + +See [Authentication][authenticate] for more options. + +## Key concepts + +See [API design][design] for general introduction on design and key concepts on Azure Management Libraries. + +## Examples + + + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md). + +1. Fork it +1. Create your feature branch (`git checkout -b my-new-feature`) +1. Commit your changes (`git commit -am 'Add some feature'`) +1. Push to the branch (`git push origin my-new-feature`) +1. Create new Pull Request + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://docs.microsoft.com/java/azure/jdk/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity +[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 diff --git a/sdk/confidentialledger/azure-resourcemanager-confidentialledger/pom.xml b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/pom.xml new file mode 100644 index 0000000000000..7d34a25bb90a4 --- /dev/null +++ b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/pom.xml @@ -0,0 +1,86 @@ + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-confidentialledger + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for ConfidentialLedger Management + This package contains Microsoft Azure SDK for ConfidentialLedger Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Microsoft Azure Confidential Compute Ledger Control Plane REST API version 2020-12-01-preview. Package tag package-2021-05-13-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 + + + + + com.azure + azure-core + 1.18.0 + + + com.azure + azure-core-management + 1.3.1 + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + true + + + + org.revapi + revapi-maven-plugin + 0.11.2 + + + + + java.method.addedToInterface + + + true + .* + com\.azure\.resourcemanager(\.[^.]+)+\.fluent(\.[^.]+)* + + + + + + + + diff --git a/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/ConfidentialLedgerManager.java b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/ConfidentialLedgerManager.java new file mode 100644 index 0000000000000..5aa1edf766b4f --- /dev/null +++ b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/ConfidentialLedgerManager.java @@ -0,0 +1,254 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.confidentialledger; + +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.policy.AddDatePolicy; +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.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.http.policy.ArmChallengeAuthenticationPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.confidentialledger.fluent.ConfidentialLedgerManagementClient; +import com.azure.resourcemanager.confidentialledger.implementation.ConfidentialLedgerManagementClientBuilder; +import com.azure.resourcemanager.confidentialledger.implementation.LedgersImpl; +import com.azure.resourcemanager.confidentialledger.implementation.OperationsImpl; +import com.azure.resourcemanager.confidentialledger.implementation.ResourceProvidersImpl; +import com.azure.resourcemanager.confidentialledger.models.Ledgers; +import com.azure.resourcemanager.confidentialledger.models.Operations; +import com.azure.resourcemanager.confidentialledger.models.ResourceProviders; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** + * Entry point to ConfidentialLedgerManager. Microsoft Azure Confidential Compute Ledger Control Plane REST API version + * 2020-12-01-preview. + */ +public final class ConfidentialLedgerManager { + private Operations operations; + + private ResourceProviders resourceProviders; + + private Ledgers ledgers; + + private final ConfidentialLedgerManagementClient clientObject; + + private ConfidentialLedgerManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new ConfidentialLedgerManagementClientBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of ConfidentialLedger service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the ConfidentialLedger service API instance. + */ + public static ConfidentialLedgerManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return configure().authenticate(credential, profile); + } + + /** + * Gets a Configurable instance that can be used to create ConfidentialLedgerManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new ConfidentialLedgerManager.Configurable(); + } + + /** The Configurable allowing configurations to be set. */ + public static final class Configurable { + private final ClientLogger logger = new ClientLogger(Configurable.class); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); + private RetryPolicy retryPolicy; + private 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 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, "'retryPolicy' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw logger.logExceptionAsError(new IllegalArgumentException("'httpPipeline' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of ConfidentialLedger service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the ConfidentialLedger service API instance. + */ + public ConfidentialLedgerManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder + .append("azsdk-java") + .append("-") + .append("com.azure.resourcemanager.confidentialledger") + .append("/") + .append("1.0.0-beta.1"); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder + .append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } + if (retryPolicy == null) { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new RequestIdPolicy()); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies.addAll(this.policies); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new ConfidentialLedgerManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** @return Resource collection API of Operations. */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** @return Resource collection API of ResourceProviders. */ + public ResourceProviders resourceProviders() { + if (this.resourceProviders == null) { + this.resourceProviders = new ResourceProvidersImpl(clientObject.getResourceProviders(), this); + } + return resourceProviders; + } + + /** @return Resource collection API of Ledgers. */ + public Ledgers ledgers() { + if (this.ledgers == null) { + this.ledgers = new LedgersImpl(clientObject.getLedgers(), this); + } + return ledgers; + } + + /** + * @return Wrapped service client ConfidentialLedgerManagementClient providing direct access to the underlying + * auto-generated API implementation, based on Azure REST API. + */ + public ConfidentialLedgerManagementClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/fluent/ConfidentialLedgerManagementClient.java b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/fluent/ConfidentialLedgerManagementClient.java new file mode 100644 index 0000000000000..1a63936f81bb4 --- /dev/null +++ b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/fluent/ConfidentialLedgerManagementClient.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.confidentialledger.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for ConfidentialLedgerManagementClient class. */ +public interface ConfidentialLedgerManagementClient { + /** + * Gets The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the ResourceProvidersClient object to access its operations. + * + * @return the ResourceProvidersClient object. + */ + ResourceProvidersClient getResourceProviders(); + + /** + * Gets the LedgersClient object to access its operations. + * + * @return the LedgersClient object. + */ + LedgersClient getLedgers(); +} diff --git a/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/fluent/LedgersClient.java b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/fluent/LedgersClient.java new file mode 100644 index 0000000000000..d8a4d1ebff524 --- /dev/null +++ b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/fluent/LedgersClient.java @@ -0,0 +1,271 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.confidentialledger.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.confidentialledger.fluent.models.ConfidentialLedgerInner; + +/** An instance of this class provides access to all the operations defined in LedgersClient. */ +public interface LedgersClient { + /** + * Retrieves the properties of a Confidential Ledger. + * + * @param resourceGroupName The name of the resource group. + * @param ledgerName Name of the Confidential Ledger. + * @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 confidential Ledger. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ConfidentialLedgerInner getByResourceGroup(String resourceGroupName, String ledgerName); + + /** + * Retrieves the properties of a Confidential Ledger. + * + * @param resourceGroupName The name of the resource group. + * @param ledgerName Name of the Confidential Ledger. + * @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 confidential Ledger. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String ledgerName, Context context); + + /** + * Deletes an existing Confidential Ledger. + * + * @param resourceGroupName The name of the resource group. + * @param ledgerName Name of the Confidential Ledger. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete(String resourceGroupName, String ledgerName); + + /** + * Deletes an existing Confidential Ledger. + * + * @param resourceGroupName The name of the resource group. + * @param ledgerName Name of the Confidential Ledger. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete(String resourceGroupName, String ledgerName, Context context); + + /** + * Deletes an existing Confidential Ledger. + * + * @param resourceGroupName The name of the resource group. + * @param ledgerName Name of the Confidential Ledger. + * @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 ledgerName); + + /** + * Deletes an existing Confidential Ledger. + * + * @param resourceGroupName The name of the resource group. + * @param ledgerName Name of the Confidential Ledger. + * @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 ledgerName, Context context); + + /** + * Creates a Confidential Ledger with the specified ledger parameters. + * + * @param resourceGroupName The name of the resource group. + * @param ledgerName Name of the Confidential Ledger. + * @param confidentialLedger Confidential Ledger Create Request Body. + * @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 confidential Ledger. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ConfidentialLedgerInner> beginCreate( + String resourceGroupName, String ledgerName, ConfidentialLedgerInner confidentialLedger); + + /** + * Creates a Confidential Ledger with the specified ledger parameters. + * + * @param resourceGroupName The name of the resource group. + * @param ledgerName Name of the Confidential Ledger. + * @param confidentialLedger Confidential Ledger Create Request Body. + * @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 confidential Ledger. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ConfidentialLedgerInner> beginCreate( + String resourceGroupName, String ledgerName, ConfidentialLedgerInner confidentialLedger, Context context); + + /** + * Creates a Confidential Ledger with the specified ledger parameters. + * + * @param resourceGroupName The name of the resource group. + * @param ledgerName Name of the Confidential Ledger. + * @param confidentialLedger Confidential Ledger Create Request Body. + * @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 confidential Ledger. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ConfidentialLedgerInner create( + String resourceGroupName, String ledgerName, ConfidentialLedgerInner confidentialLedger); + + /** + * Creates a Confidential Ledger with the specified ledger parameters. + * + * @param resourceGroupName The name of the resource group. + * @param ledgerName Name of the Confidential Ledger. + * @param confidentialLedger Confidential Ledger Create Request Body. + * @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 confidential Ledger. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ConfidentialLedgerInner create( + String resourceGroupName, String ledgerName, ConfidentialLedgerInner confidentialLedger, Context context); + + /** + * Updates properties of Confidential Ledger. + * + * @param resourceGroupName The name of the resource group. + * @param ledgerName Name of the Confidential Ledger. + * @param confidentialLedger Confidential Ledger request body for Updating Ledger. + * @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 confidential Ledger. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ConfidentialLedgerInner> beginUpdate( + String resourceGroupName, String ledgerName, ConfidentialLedgerInner confidentialLedger); + + /** + * Updates properties of Confidential Ledger. + * + * @param resourceGroupName The name of the resource group. + * @param ledgerName Name of the Confidential Ledger. + * @param confidentialLedger Confidential Ledger request body for Updating Ledger. + * @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 confidential Ledger. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ConfidentialLedgerInner> beginUpdate( + String resourceGroupName, String ledgerName, ConfidentialLedgerInner confidentialLedger, Context context); + + /** + * Updates properties of Confidential Ledger. + * + * @param resourceGroupName The name of the resource group. + * @param ledgerName Name of the Confidential Ledger. + * @param confidentialLedger Confidential Ledger request body for Updating Ledger. + * @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 confidential Ledger. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ConfidentialLedgerInner update( + String resourceGroupName, String ledgerName, ConfidentialLedgerInner confidentialLedger); + + /** + * Updates properties of Confidential Ledger. + * + * @param resourceGroupName The name of the resource group. + * @param ledgerName Name of the Confidential Ledger. + * @param confidentialLedger Confidential Ledger request body for Updating Ledger. + * @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 confidential Ledger. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ConfidentialLedgerInner update( + String resourceGroupName, String ledgerName, ConfidentialLedgerInner confidentialLedger, Context context); + + /** + * Retrieves the properties of all Confidential Ledgers. + * + * @param resourceGroupName The name of the resource group. + * @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 object that includes an array of Confidential Ledgers and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Retrieves the properties of all Confidential Ledgers. + * + * @param resourceGroupName The name of the resource group. + * @param filter The filter to apply on the list operation. eg. $filter=ledgerType eq 'Public'. + * @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 object that includes an array of Confidential Ledgers and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup( + String resourceGroupName, String filter, Context context); + + /** + * Retrieves the properties of all Confidential Ledgers. + * + * @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 object that includes an array of Confidential Ledgers and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Retrieves the properties of all Confidential Ledgers. + * + * @param filter The filter to apply on the list operation. eg. $filter=ledgerType eq 'Public'. + * @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 object that includes an array of Confidential Ledgers and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String filter, Context context); +} diff --git a/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/fluent/OperationsClient.java b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/fluent/OperationsClient.java new file mode 100644 index 0000000000000..d30f09f861ac9 --- /dev/null +++ b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/fluent/OperationsClient.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.confidentialledger.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.confidentialledger.fluent.models.ResourceProviderOperationDefinitionInner; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public interface OperationsClient { + /** + * Retrieves a list of available API operations. + * + * @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 list containing this Resource Provider's available operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Retrieves a list of available API operations. + * + * @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 list containing this Resource Provider's available operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/fluent/ResourceProvidersClient.java b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/fluent/ResourceProvidersClient.java new file mode 100644 index 0000000000000..4c3e325a21807 --- /dev/null +++ b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/fluent/ResourceProvidersClient.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.confidentialledger.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.confidentialledger.fluent.models.CheckNameAvailabilityResponseInner; +import com.azure.resourcemanager.confidentialledger.models.CheckNameAvailabilityRequest; + +/** An instance of this class provides access to all the operations defined in ResourceProvidersClient. */ +public interface ResourceProvidersClient { + /** + * To check whether a resource name is available. + * + * @param nameAvailabilityRequest Name availability request payload. + * @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 check availability result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CheckNameAvailabilityResponseInner checkNameAvailability(CheckNameAvailabilityRequest nameAvailabilityRequest); + + /** + * To check whether a resource name is available. + * + * @param nameAvailabilityRequest Name availability request payload. + * @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 check availability result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response checkNameAvailabilityWithResponse( + CheckNameAvailabilityRequest nameAvailabilityRequest, Context context); +} diff --git a/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/fluent/models/CheckNameAvailabilityResponseInner.java b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/fluent/models/CheckNameAvailabilityResponseInner.java new file mode 100644 index 0000000000000..2cdcb30f0a724 --- /dev/null +++ b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/fluent/models/CheckNameAvailabilityResponseInner.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.confidentialledger.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.confidentialledger.models.CheckNameAvailabilityReason; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The check availability result. */ +@Fluent +public final class CheckNameAvailabilityResponseInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CheckNameAvailabilityResponseInner.class); + + /* + * Indicates if the resource name is available. + */ + @JsonProperty(value = "nameAvailable") + private Boolean nameAvailable; + + /* + * The reason why the given name is not available. + */ + @JsonProperty(value = "reason") + private CheckNameAvailabilityReason reason; + + /* + * Detailed reason why the given name is available. + */ + @JsonProperty(value = "message") + private String message; + + /** + * Get the nameAvailable property: Indicates if the resource name is available. + * + * @return the nameAvailable value. + */ + public Boolean nameAvailable() { + return this.nameAvailable; + } + + /** + * Set the nameAvailable property: Indicates if the resource name is available. + * + * @param nameAvailable the nameAvailable value to set. + * @return the CheckNameAvailabilityResponseInner object itself. + */ + public CheckNameAvailabilityResponseInner withNameAvailable(Boolean nameAvailable) { + this.nameAvailable = nameAvailable; + return this; + } + + /** + * Get the reason property: The reason why the given name is not available. + * + * @return the reason value. + */ + public CheckNameAvailabilityReason reason() { + return this.reason; + } + + /** + * Set the reason property: The reason why the given name is not available. + * + * @param reason the reason value to set. + * @return the CheckNameAvailabilityResponseInner object itself. + */ + public CheckNameAvailabilityResponseInner withReason(CheckNameAvailabilityReason reason) { + this.reason = reason; + return this; + } + + /** + * Get the message property: Detailed reason why the given name is available. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: Detailed reason why the given name is available. + * + * @param message the message value to set. + * @return the CheckNameAvailabilityResponseInner object itself. + */ + public CheckNameAvailabilityResponseInner withMessage(String message) { + this.message = message; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/fluent/models/ConfidentialLedgerInner.java b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/fluent/models/ConfidentialLedgerInner.java new file mode 100644 index 0000000000000..f8dbeffcbed8f --- /dev/null +++ b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/fluent/models/ConfidentialLedgerInner.java @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.confidentialledger.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.confidentialledger.models.LedgerProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Confidential Ledger. Contains the properties of Confidential Ledger Resource. */ +@Fluent +public final class ConfidentialLedgerInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ConfidentialLedgerInner.class); + + /* + * Properties of Confidential Ledger Resource. + */ + @JsonProperty(value = "properties") + private LedgerProperties properties; + + /* + * Metadata pertaining to creation and last modification of the resource + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /* + * The Azure location where the Confidential Ledger is running. + */ + @JsonProperty(value = "location") + private String location; + + /* + * Additional tags for Confidential Ledger + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get the properties property: Properties of Confidential Ledger Resource. + * + * @return the properties value. + */ + public LedgerProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Properties of Confidential Ledger Resource. + * + * @param properties the properties value to set. + * @return the ConfidentialLedgerInner object itself. + */ + public ConfidentialLedgerInner withProperties(LedgerProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the location property: The Azure location where the Confidential Ledger is running. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The Azure location where the Confidential Ledger is running. + * + * @param location the location value to set. + * @return the ConfidentialLedgerInner object itself. + */ + public ConfidentialLedgerInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the tags property: Additional tags for Confidential Ledger. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Additional tags for Confidential Ledger. + * + * @param tags the tags value to set. + * @return the ConfidentialLedgerInner object itself. + */ + public ConfidentialLedgerInner withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/fluent/models/ResourceProviderOperationDefinitionInner.java b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/fluent/models/ResourceProviderOperationDefinitionInner.java new file mode 100644 index 0000000000000..023e48f61b460 --- /dev/null +++ b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/fluent/models/ResourceProviderOperationDefinitionInner.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.confidentialledger.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.confidentialledger.models.ResourceProviderOperationDisplay; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes the Resource Provider Operation. */ +@Fluent +public final class ResourceProviderOperationDefinitionInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceProviderOperationDefinitionInner.class); + + /* + * Resource provider operation name. + */ + @JsonProperty(value = "name") + private String name; + + /* + * Indicates whether the operation is data action or not. + */ + @JsonProperty(value = "isDataAction") + private Boolean isDataAction; + + /* + * Details about the operations + */ + @JsonProperty(value = "display") + private ResourceProviderOperationDisplay display; + + /** + * Get the name property: Resource provider operation name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Resource provider operation name. + * + * @param name the name value to set. + * @return the ResourceProviderOperationDefinitionInner object itself. + */ + public ResourceProviderOperationDefinitionInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the isDataAction property: Indicates whether the operation is data action or not. + * + * @return the isDataAction value. + */ + public Boolean isDataAction() { + return this.isDataAction; + } + + /** + * Set the isDataAction property: Indicates whether the operation is data action or not. + * + * @param isDataAction the isDataAction value to set. + * @return the ResourceProviderOperationDefinitionInner object itself. + */ + public ResourceProviderOperationDefinitionInner withIsDataAction(Boolean isDataAction) { + this.isDataAction = isDataAction; + return this; + } + + /** + * Get the display property: Details about the operations. + * + * @return the display value. + */ + public ResourceProviderOperationDisplay display() { + return this.display; + } + + /** + * Set the display property: Details about the operations. + * + * @param display the display value to set. + * @return the ResourceProviderOperationDefinitionInner object itself. + */ + public ResourceProviderOperationDefinitionInner withDisplay(ResourceProviderOperationDisplay display) { + this.display = display; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } +} diff --git a/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/fluent/models/package-info.java b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/fluent/models/package-info.java new file mode 100644 index 0000000000000..b3b77ca549da3 --- /dev/null +++ b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/fluent/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the inner data models for ConfidentialLedgerManagementClient. Microsoft Azure Confidential Compute + * Ledger Control Plane REST API version 2020-12-01-preview. + */ +package com.azure.resourcemanager.confidentialledger.fluent.models; diff --git a/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/fluent/package-info.java b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/fluent/package-info.java new file mode 100644 index 0000000000000..d5062e2caf4ed --- /dev/null +++ b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/fluent/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the service clients for ConfidentialLedgerManagementClient. Microsoft Azure Confidential Compute + * Ledger Control Plane REST API version 2020-12-01-preview. + */ +package com.azure.resourcemanager.confidentialledger.fluent; diff --git a/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/implementation/CheckNameAvailabilityResponseImpl.java b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/implementation/CheckNameAvailabilityResponseImpl.java new file mode 100644 index 0000000000000..0b0bff6b7cfcb --- /dev/null +++ b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/implementation/CheckNameAvailabilityResponseImpl.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.confidentialledger.implementation; + +import com.azure.resourcemanager.confidentialledger.fluent.models.CheckNameAvailabilityResponseInner; +import com.azure.resourcemanager.confidentialledger.models.CheckNameAvailabilityReason; +import com.azure.resourcemanager.confidentialledger.models.CheckNameAvailabilityResponse; + +public final class CheckNameAvailabilityResponseImpl implements CheckNameAvailabilityResponse { + private CheckNameAvailabilityResponseInner innerObject; + + private final com.azure.resourcemanager.confidentialledger.ConfidentialLedgerManager serviceManager; + + CheckNameAvailabilityResponseImpl( + CheckNameAvailabilityResponseInner innerObject, + com.azure.resourcemanager.confidentialledger.ConfidentialLedgerManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public Boolean nameAvailable() { + return this.innerModel().nameAvailable(); + } + + public CheckNameAvailabilityReason reason() { + return this.innerModel().reason(); + } + + public String message() { + return this.innerModel().message(); + } + + public CheckNameAvailabilityResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.confidentialledger.ConfidentialLedgerManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/implementation/ConfidentialLedgerImpl.java b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/implementation/ConfidentialLedgerImpl.java new file mode 100644 index 0000000000000..0c5fdadae5b31 --- /dev/null +++ b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/implementation/ConfidentialLedgerImpl.java @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.confidentialledger.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.confidentialledger.fluent.models.ConfidentialLedgerInner; +import com.azure.resourcemanager.confidentialledger.models.ConfidentialLedger; +import com.azure.resourcemanager.confidentialledger.models.LedgerProperties; +import java.util.Collections; +import java.util.Map; + +public final class ConfidentialLedgerImpl + implements ConfidentialLedger, ConfidentialLedger.Definition, ConfidentialLedger.Update { + private ConfidentialLedgerInner innerObject; + + private final com.azure.resourcemanager.confidentialledger.ConfidentialLedgerManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public LedgerProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + 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 Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public ConfidentialLedgerInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.confidentialledger.ConfidentialLedgerManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String ledgerName; + + public ConfidentialLedgerImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public ConfidentialLedger create() { + this.innerObject = + serviceManager + .serviceClient() + .getLedgers() + .create(resourceGroupName, ledgerName, this.innerModel(), Context.NONE); + return this; + } + + public ConfidentialLedger create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getLedgers() + .create(resourceGroupName, ledgerName, this.innerModel(), context); + return this; + } + + ConfidentialLedgerImpl( + String name, com.azure.resourcemanager.confidentialledger.ConfidentialLedgerManager serviceManager) { + this.innerObject = new ConfidentialLedgerInner(); + this.serviceManager = serviceManager; + this.ledgerName = name; + } + + public ConfidentialLedgerImpl update() { + return this; + } + + public ConfidentialLedger apply() { + this.innerObject = + serviceManager + .serviceClient() + .getLedgers() + .update(resourceGroupName, ledgerName, this.innerModel(), Context.NONE); + return this; + } + + public ConfidentialLedger apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getLedgers() + .update(resourceGroupName, ledgerName, this.innerModel(), context); + return this; + } + + ConfidentialLedgerImpl( + ConfidentialLedgerInner innerObject, + com.azure.resourcemanager.confidentialledger.ConfidentialLedgerManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.ledgerName = Utils.getValueFromIdByName(innerObject.id(), "ledgers"); + } + + public ConfidentialLedger refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getLedgers() + .getByResourceGroupWithResponse(resourceGroupName, ledgerName, Context.NONE) + .getValue(); + return this; + } + + public ConfidentialLedger refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getLedgers() + .getByResourceGroupWithResponse(resourceGroupName, ledgerName, context) + .getValue(); + return this; + } + + public ConfidentialLedgerImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public ConfidentialLedgerImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public ConfidentialLedgerImpl withTags(Map tags) { + this.innerModel().withTags(tags); + return this; + } + + public ConfidentialLedgerImpl withProperties(LedgerProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/implementation/ConfidentialLedgerManagementClientBuilder.java b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/implementation/ConfidentialLedgerManagementClientBuilder.java new file mode 100644 index 0000000000000..23e30e6151cab --- /dev/null +++ b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/implementation/ConfidentialLedgerManagementClientBuilder.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.confidentialledger.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.CookiePolicy; +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 ConfidentialLedgerManagementClientImpl type. */ +@ServiceClientBuilder(serviceClients = {ConfidentialLedgerManagementClientImpl.class}) +public final class ConfidentialLedgerManagementClientBuilder { + /* + * The Azure subscription ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000) + */ + private String subscriptionId; + + /** + * Sets The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + * + * @param subscriptionId the subscriptionId value. + * @return the ConfidentialLedgerManagementClientBuilder. + */ + public ConfidentialLedgerManagementClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the ConfidentialLedgerManagementClientBuilder. + */ + public ConfidentialLedgerManagementClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The environment to connect to + */ + private AzureEnvironment environment; + + /** + * Sets The environment to connect to. + * + * @param environment the environment value. + * @return the ConfidentialLedgerManagementClientBuilder. + */ + public ConfidentialLedgerManagementClientBuilder environment(AzureEnvironment environment) { + this.environment = environment; + 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 ConfidentialLedgerManagementClientBuilder. + */ + public ConfidentialLedgerManagementClientBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + 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 ConfidentialLedgerManagementClientBuilder. + */ + public ConfidentialLedgerManagementClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + 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 ConfidentialLedgerManagementClientBuilder. + */ + public ConfidentialLedgerManagementClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of ConfidentialLedgerManagementClientImpl with the provided parameters. + * + * @return an instance of ConfidentialLedgerManagementClientImpl. + */ + public ConfidentialLedgerManagementClientImpl buildClient() { + if (endpoint == null) { + this.endpoint = "https://management.azure.com"; + } + if (environment == null) { + this.environment = AzureEnvironment.AZURE; + } + if (defaultPollInterval == null) { + this.defaultPollInterval = Duration.ofSeconds(30); + } + if (pipeline == null) { + this.pipeline = + new HttpPipelineBuilder() + .policies(new UserAgentPolicy(), new RetryPolicy(), new CookiePolicy()) + .build(); + } + if (serializerAdapter == null) { + this.serializerAdapter = SerializerFactory.createDefaultManagementSerializerAdapter(); + } + ConfidentialLedgerManagementClientImpl client = + new ConfidentialLedgerManagementClientImpl( + pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + return client; + } +} diff --git a/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/implementation/ConfidentialLedgerManagementClientImpl.java b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/implementation/ConfidentialLedgerManagementClientImpl.java new file mode 100644 index 0000000000000..29140c80e7e8e --- /dev/null +++ b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/implementation/ConfidentialLedgerManagementClientImpl.java @@ -0,0 +1,322 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.confidentialledger.implementation; + +import com.azure.core.annotation.ServiceClient; +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.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.confidentialledger.fluent.ConfidentialLedgerManagementClient; +import com.azure.resourcemanager.confidentialledger.fluent.LedgersClient; +import com.azure.resourcemanager.confidentialledger.fluent.OperationsClient; +import com.azure.resourcemanager.confidentialledger.fluent.ResourceProvidersClient; +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 java.util.Map; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** Initializes a new instance of the ConfidentialLedgerManagementClientImpl type. */ +@ServiceClient(builder = ConfidentialLedgerManagementClientBuilder.class) +public final class ConfidentialLedgerManagementClientImpl implements ConfidentialLedgerManagementClient { + private final ClientLogger logger = new ClientLogger(ConfidentialLedgerManagementClientImpl.class); + + /** The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). */ + private final String subscriptionId; + + /** + * Gets The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** server parameter. */ + private final String endpoint; + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** Api Version. */ + private final String apiVersion; + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** The HTTP pipeline to send requests through. */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** The serializer to serialize an object into a string. */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** The default poll interval for long-running operation. */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** The OperationsClient object to access its operations. */ + private final OperationsClient operations; + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + public OperationsClient getOperations() { + return this.operations; + } + + /** The ResourceProvidersClient object to access its operations. */ + private final ResourceProvidersClient resourceProviders; + + /** + * Gets the ResourceProvidersClient object to access its operations. + * + * @return the ResourceProvidersClient object. + */ + public ResourceProvidersClient getResourceProviders() { + return this.resourceProviders; + } + + /** The LedgersClient object to access its operations. */ + private final LedgersClient ledgers; + + /** + * Gets the LedgersClient object to access its operations. + * + * @return the LedgersClient object. + */ + public LedgersClient getLedgers() { + return this.ledgers; + } + + /** + * Initializes an instance of ConfidentialLedgerManagementClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param subscriptionId The Azure subscription ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * @param endpoint server parameter. + */ + ConfidentialLedgerManagementClientImpl( + HttpPipeline httpPipeline, + SerializerAdapter serializerAdapter, + Duration defaultPollInterval, + AzureEnvironment environment, + String subscriptionId, + String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + this.apiVersion = "2021-05-13-preview"; + this.operations = new OperationsClientImpl(this); + this.resourceProviders = new ResourceProvidersClientImpl(this); + this.ledgers = new LedgersClientImpl(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) { + for (Map.Entry entry : this.getContext().getValues().entrySet()) { + context = context.addData(entry.getKey(), entry.getValue()); + } + return context; + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult( + Mono>> activationResponse, + HttpPipeline httpPipeline, + Type pollResultType, + Type finalResultType, + Context context) { + return PollerFactory + .create( + serializerAdapter, + httpPipeline, + pollResultType, + finalResultType, + defaultPollInterval, + activationResponse, + context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = + new HttpResponseImpl( + lroError.getResponseStatusCode(), lroError.getResponseHeaders(), lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = + this + .getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + logger.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(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)); + } + } +} diff --git a/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/implementation/LedgersClientImpl.java b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/implementation/LedgersClientImpl.java new file mode 100644 index 0000000000000..a3f0d9ef74309 --- /dev/null +++ b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/implementation/LedgersClientImpl.java @@ -0,0 +1,1603 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.confidentialledger.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.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.confidentialledger.fluent.LedgersClient; +import com.azure.resourcemanager.confidentialledger.fluent.models.ConfidentialLedgerInner; +import com.azure.resourcemanager.confidentialledger.models.ConfidentialLedgerList; +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 LedgersClient. */ +public final class LedgersClientImpl implements LedgersClient { + private final ClientLogger logger = new ClientLogger(LedgersClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final LedgersService service; + + /** The service client containing this operation class. */ + private final ConfidentialLedgerManagementClientImpl client; + + /** + * Initializes an instance of LedgersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + LedgersClientImpl(ConfidentialLedgerManagementClientImpl client) { + this.service = RestProxy.create(LedgersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ConfidentialLedgerManagementClientLedgers to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ConfidentialLedgerMa") + private interface LedgersService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConfidentialLedger" + + "/ledgers/{ledgerName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("ledgerName") String ledgerName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConfidentialLedger" + + "/ledgers/{ledgerName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("ledgerName") String ledgerName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConfidentialLedger" + + "/ledgers/{ledgerName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> create( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("ledgerName") String ledgerName, + @BodyParam("application/json") ConfidentialLedgerInner confidentialLedger, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConfidentialLedger" + + "/ledgers/{ledgerName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("ledgerName") String ledgerName, + @BodyParam("application/json") ConfidentialLedgerInner confidentialLedger, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConfidentialLedger" + + "/ledgers") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.ConfidentialLedger/ledgers/") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Retrieves the properties of a Confidential Ledger. + * + * @param resourceGroupName The name of the resource group. + * @param ledgerName Name of the Confidential Ledger. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return confidential Ledger. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String ledgerName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ledgerName == null) { + return Mono.error(new IllegalArgumentException("Parameter ledgerName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + ledgerName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves the properties of a Confidential Ledger. + * + * @param resourceGroupName The name of the resource group. + * @param ledgerName Name of the Confidential Ledger. + * @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 confidential Ledger. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String ledgerName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ledgerName == null) { + return Mono.error(new IllegalArgumentException("Parameter ledgerName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + ledgerName, + accept, + context); + } + + /** + * Retrieves the properties of a Confidential Ledger. + * + * @param resourceGroupName The name of the resource group. + * @param ledgerName Name of the Confidential Ledger. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return confidential Ledger. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String ledgerName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, ledgerName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Retrieves the properties of a Confidential Ledger. + * + * @param resourceGroupName The name of the resource group. + * @param ledgerName Name of the Confidential Ledger. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return confidential Ledger. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ConfidentialLedgerInner getByResourceGroup(String resourceGroupName, String ledgerName) { + return getByResourceGroupAsync(resourceGroupName, ledgerName).block(); + } + + /** + * Retrieves the properties of a Confidential Ledger. + * + * @param resourceGroupName The name of the resource group. + * @param ledgerName Name of the Confidential Ledger. + * @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 confidential Ledger. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String ledgerName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, ledgerName, context).block(); + } + + /** + * Deletes an existing Confidential Ledger. + * + * @param resourceGroupName The name of the resource group. + * @param ledgerName Name of the Confidential Ledger. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, String ledgerName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ledgerName == null) { + return Mono.error(new IllegalArgumentException("Parameter ledgerName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + ledgerName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes an existing Confidential Ledger. + * + * @param resourceGroupName The name of the resource group. + * @param ledgerName Name of the Confidential Ledger. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String ledgerName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ledgerName == null) { + return Mono.error(new IllegalArgumentException("Parameter ledgerName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + ledgerName, + accept, + context); + } + + /** + * Deletes an existing Confidential Ledger. + * + * @param resourceGroupName The name of the resource group. + * @param ledgerName Name of the Confidential Ledger. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String ledgerName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, ledgerName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes an existing Confidential Ledger. + * + * @param resourceGroupName The name of the resource group. + * @param ledgerName Name of the Confidential Ledger. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String ledgerName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, ledgerName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes an existing Confidential Ledger. + * + * @param resourceGroupName The name of the resource group. + * @param ledgerName Name of the Confidential Ledger. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete(String resourceGroupName, String ledgerName) { + return beginDeleteAsync(resourceGroupName, ledgerName).getSyncPoller(); + } + + /** + * Deletes an existing Confidential Ledger. + * + * @param resourceGroupName The name of the resource group. + * @param ledgerName Name of the Confidential Ledger. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String ledgerName, Context context) { + return beginDeleteAsync(resourceGroupName, ledgerName, context).getSyncPoller(); + } + + /** + * Deletes an existing Confidential Ledger. + * + * @param resourceGroupName The name of the resource group. + * @param ledgerName Name of the Confidential Ledger. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String ledgerName) { + return beginDeleteAsync(resourceGroupName, ledgerName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an existing Confidential Ledger. + * + * @param resourceGroupName The name of the resource group. + * @param ledgerName Name of the Confidential Ledger. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String ledgerName, Context context) { + return beginDeleteAsync(resourceGroupName, ledgerName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an existing Confidential Ledger. + * + * @param resourceGroupName The name of the resource group. + * @param ledgerName Name of the Confidential Ledger. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 ledgerName) { + deleteAsync(resourceGroupName, ledgerName).block(); + } + + /** + * Deletes an existing Confidential Ledger. + * + * @param resourceGroupName The name of the resource group. + * @param ledgerName Name of the Confidential Ledger. + * @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 ledgerName, Context context) { + deleteAsync(resourceGroupName, ledgerName, context).block(); + } + + /** + * Creates a Confidential Ledger with the specified ledger parameters. + * + * @param resourceGroupName The name of the resource group. + * @param ledgerName Name of the Confidential Ledger. + * @param confidentialLedger Confidential Ledger Create Request Body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return confidential Ledger. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, String ledgerName, ConfidentialLedgerInner confidentialLedger) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ledgerName == null) { + return Mono.error(new IllegalArgumentException("Parameter ledgerName is required and cannot be null.")); + } + if (confidentialLedger == null) { + return Mono + .error(new IllegalArgumentException("Parameter confidentialLedger is required and cannot be null.")); + } else { + confidentialLedger.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .create( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + ledgerName, + confidentialLedger, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates a Confidential Ledger with the specified ledger parameters. + * + * @param resourceGroupName The name of the resource group. + * @param ledgerName Name of the Confidential Ledger. + * @param confidentialLedger Confidential Ledger Create Request Body. + * @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 confidential Ledger. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, String ledgerName, ConfidentialLedgerInner confidentialLedger, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ledgerName == null) { + return Mono.error(new IllegalArgumentException("Parameter ledgerName is required and cannot be null.")); + } + if (confidentialLedger == null) { + return Mono + .error(new IllegalArgumentException("Parameter confidentialLedger is required and cannot be null.")); + } else { + confidentialLedger.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .create( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + ledgerName, + confidentialLedger, + accept, + context); + } + + /** + * Creates a Confidential Ledger with the specified ledger parameters. + * + * @param resourceGroupName The name of the resource group. + * @param ledgerName Name of the Confidential Ledger. + * @param confidentialLedger Confidential Ledger Create Request Body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return confidential Ledger. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ConfidentialLedgerInner> beginCreateAsync( + String resourceGroupName, String ledgerName, ConfidentialLedgerInner confidentialLedger) { + Mono>> mono = + createWithResponseAsync(resourceGroupName, ledgerName, confidentialLedger); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ConfidentialLedgerInner.class, + ConfidentialLedgerInner.class, + Context.NONE); + } + + /** + * Creates a Confidential Ledger with the specified ledger parameters. + * + * @param resourceGroupName The name of the resource group. + * @param ledgerName Name of the Confidential Ledger. + * @param confidentialLedger Confidential Ledger Create Request Body. + * @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 confidential Ledger. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ConfidentialLedgerInner> beginCreateAsync( + String resourceGroupName, String ledgerName, ConfidentialLedgerInner confidentialLedger, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createWithResponseAsync(resourceGroupName, ledgerName, confidentialLedger, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ConfidentialLedgerInner.class, + ConfidentialLedgerInner.class, + context); + } + + /** + * Creates a Confidential Ledger with the specified ledger parameters. + * + * @param resourceGroupName The name of the resource group. + * @param ledgerName Name of the Confidential Ledger. + * @param confidentialLedger Confidential Ledger Create Request Body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return confidential Ledger. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ConfidentialLedgerInner> beginCreate( + String resourceGroupName, String ledgerName, ConfidentialLedgerInner confidentialLedger) { + return beginCreateAsync(resourceGroupName, ledgerName, confidentialLedger).getSyncPoller(); + } + + /** + * Creates a Confidential Ledger with the specified ledger parameters. + * + * @param resourceGroupName The name of the resource group. + * @param ledgerName Name of the Confidential Ledger. + * @param confidentialLedger Confidential Ledger Create Request Body. + * @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 confidential Ledger. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ConfidentialLedgerInner> beginCreate( + String resourceGroupName, String ledgerName, ConfidentialLedgerInner confidentialLedger, Context context) { + return beginCreateAsync(resourceGroupName, ledgerName, confidentialLedger, context).getSyncPoller(); + } + + /** + * Creates a Confidential Ledger with the specified ledger parameters. + * + * @param resourceGroupName The name of the resource group. + * @param ledgerName Name of the Confidential Ledger. + * @param confidentialLedger Confidential Ledger Create Request Body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return confidential Ledger. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String ledgerName, ConfidentialLedgerInner confidentialLedger) { + return beginCreateAsync(resourceGroupName, ledgerName, confidentialLedger) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a Confidential Ledger with the specified ledger parameters. + * + * @param resourceGroupName The name of the resource group. + * @param ledgerName Name of the Confidential Ledger. + * @param confidentialLedger Confidential Ledger Create Request Body. + * @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 confidential Ledger. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String ledgerName, ConfidentialLedgerInner confidentialLedger, Context context) { + return beginCreateAsync(resourceGroupName, ledgerName, confidentialLedger, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a Confidential Ledger with the specified ledger parameters. + * + * @param resourceGroupName The name of the resource group. + * @param ledgerName Name of the Confidential Ledger. + * @param confidentialLedger Confidential Ledger Create Request Body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return confidential Ledger. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ConfidentialLedgerInner create( + String resourceGroupName, String ledgerName, ConfidentialLedgerInner confidentialLedger) { + return createAsync(resourceGroupName, ledgerName, confidentialLedger).block(); + } + + /** + * Creates a Confidential Ledger with the specified ledger parameters. + * + * @param resourceGroupName The name of the resource group. + * @param ledgerName Name of the Confidential Ledger. + * @param confidentialLedger Confidential Ledger Create Request Body. + * @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 confidential Ledger. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ConfidentialLedgerInner create( + String resourceGroupName, String ledgerName, ConfidentialLedgerInner confidentialLedger, Context context) { + return createAsync(resourceGroupName, ledgerName, confidentialLedger, context).block(); + } + + /** + * Updates properties of Confidential Ledger. + * + * @param resourceGroupName The name of the resource group. + * @param ledgerName Name of the Confidential Ledger. + * @param confidentialLedger Confidential Ledger request body for Updating Ledger. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return confidential Ledger. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String ledgerName, ConfidentialLedgerInner confidentialLedger) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ledgerName == null) { + return Mono.error(new IllegalArgumentException("Parameter ledgerName is required and cannot be null.")); + } + if (confidentialLedger == null) { + return Mono + .error(new IllegalArgumentException("Parameter confidentialLedger is required and cannot be null.")); + } else { + confidentialLedger.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + ledgerName, + confidentialLedger, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates properties of Confidential Ledger. + * + * @param resourceGroupName The name of the resource group. + * @param ledgerName Name of the Confidential Ledger. + * @param confidentialLedger Confidential Ledger request body for Updating Ledger. + * @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 confidential Ledger. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String ledgerName, ConfidentialLedgerInner confidentialLedger, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ledgerName == null) { + return Mono.error(new IllegalArgumentException("Parameter ledgerName is required and cannot be null.")); + } + if (confidentialLedger == null) { + return Mono + .error(new IllegalArgumentException("Parameter confidentialLedger is required and cannot be null.")); + } else { + confidentialLedger.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + ledgerName, + confidentialLedger, + accept, + context); + } + + /** + * Updates properties of Confidential Ledger. + * + * @param resourceGroupName The name of the resource group. + * @param ledgerName Name of the Confidential Ledger. + * @param confidentialLedger Confidential Ledger request body for Updating Ledger. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return confidential Ledger. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ConfidentialLedgerInner> beginUpdateAsync( + String resourceGroupName, String ledgerName, ConfidentialLedgerInner confidentialLedger) { + Mono>> mono = + updateWithResponseAsync(resourceGroupName, ledgerName, confidentialLedger); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ConfidentialLedgerInner.class, + ConfidentialLedgerInner.class, + Context.NONE); + } + + /** + * Updates properties of Confidential Ledger. + * + * @param resourceGroupName The name of the resource group. + * @param ledgerName Name of the Confidential Ledger. + * @param confidentialLedger Confidential Ledger request body for Updating Ledger. + * @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 confidential Ledger. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ConfidentialLedgerInner> beginUpdateAsync( + String resourceGroupName, String ledgerName, ConfidentialLedgerInner confidentialLedger, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, ledgerName, confidentialLedger, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ConfidentialLedgerInner.class, + ConfidentialLedgerInner.class, + context); + } + + /** + * Updates properties of Confidential Ledger. + * + * @param resourceGroupName The name of the resource group. + * @param ledgerName Name of the Confidential Ledger. + * @param confidentialLedger Confidential Ledger request body for Updating Ledger. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return confidential Ledger. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ConfidentialLedgerInner> beginUpdate( + String resourceGroupName, String ledgerName, ConfidentialLedgerInner confidentialLedger) { + return beginUpdateAsync(resourceGroupName, ledgerName, confidentialLedger).getSyncPoller(); + } + + /** + * Updates properties of Confidential Ledger. + * + * @param resourceGroupName The name of the resource group. + * @param ledgerName Name of the Confidential Ledger. + * @param confidentialLedger Confidential Ledger request body for Updating Ledger. + * @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 confidential Ledger. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ConfidentialLedgerInner> beginUpdate( + String resourceGroupName, String ledgerName, ConfidentialLedgerInner confidentialLedger, Context context) { + return beginUpdateAsync(resourceGroupName, ledgerName, confidentialLedger, context).getSyncPoller(); + } + + /** + * Updates properties of Confidential Ledger. + * + * @param resourceGroupName The name of the resource group. + * @param ledgerName Name of the Confidential Ledger. + * @param confidentialLedger Confidential Ledger request body for Updating Ledger. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return confidential Ledger. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String ledgerName, ConfidentialLedgerInner confidentialLedger) { + return beginUpdateAsync(resourceGroupName, ledgerName, confidentialLedger) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates properties of Confidential Ledger. + * + * @param resourceGroupName The name of the resource group. + * @param ledgerName Name of the Confidential Ledger. + * @param confidentialLedger Confidential Ledger request body for Updating Ledger. + * @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 confidential Ledger. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String ledgerName, ConfidentialLedgerInner confidentialLedger, Context context) { + return beginUpdateAsync(resourceGroupName, ledgerName, confidentialLedger, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates properties of Confidential Ledger. + * + * @param resourceGroupName The name of the resource group. + * @param ledgerName Name of the Confidential Ledger. + * @param confidentialLedger Confidential Ledger request body for Updating Ledger. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return confidential Ledger. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ConfidentialLedgerInner update( + String resourceGroupName, String ledgerName, ConfidentialLedgerInner confidentialLedger) { + return updateAsync(resourceGroupName, ledgerName, confidentialLedger).block(); + } + + /** + * Updates properties of Confidential Ledger. + * + * @param resourceGroupName The name of the resource group. + * @param ledgerName Name of the Confidential Ledger. + * @param confidentialLedger Confidential Ledger request body for Updating Ledger. + * @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 confidential Ledger. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ConfidentialLedgerInner update( + String resourceGroupName, String ledgerName, ConfidentialLedgerInner confidentialLedger, Context context) { + return updateAsync(resourceGroupName, ledgerName, confidentialLedger, context).block(); + } + + /** + * Retrieves the properties of all Confidential Ledgers. + * + * @param resourceGroupName The name of the resource group. + * @param filter The filter to apply on the list operation. eg. $filter=ledgerType eq 'Public'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return object that includes an array of Confidential Ledgers and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + filter, + 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())); + } + + /** + * Retrieves the properties of all Confidential Ledgers. + * + * @param resourceGroupName The name of the resource group. + * @param filter The filter to apply on the list operation. eg. $filter=ledgerType eq 'Public'. + * @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 object that includes an array of Confidential Ledgers and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, String filter, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + filter, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Retrieves the properties of all Confidential Ledgers. + * + * @param resourceGroupName The name of the resource group. + * @param filter The filter to apply on the list operation. eg. $filter=ledgerType eq 'Public'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return object that includes an array of Confidential Ledgers and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, String filter) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, filter), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Retrieves the properties of all Confidential Ledgers. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return object that includes an array of Confidential Ledgers and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + final String filter = null; + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, filter), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Retrieves the properties of all Confidential Ledgers. + * + * @param resourceGroupName The name of the resource group. + * @param filter The filter to apply on the list operation. eg. $filter=ledgerType eq 'Public'. + * @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 object that includes an array of Confidential Ledgers and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync( + String resourceGroupName, String filter, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, filter, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Retrieves the properties of all Confidential Ledgers. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return object that includes an array of Confidential Ledgers and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + final String filter = null; + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, filter)); + } + + /** + * Retrieves the properties of all Confidential Ledgers. + * + * @param resourceGroupName The name of the resource group. + * @param filter The filter to apply on the list operation. eg. $filter=ledgerType eq 'Public'. + * @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 object that includes an array of Confidential Ledgers and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup( + String resourceGroupName, String filter, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, filter, context)); + } + + /** + * Retrieves the properties of all Confidential Ledgers. + * + * @param filter The filter to apply on the list operation. eg. $filter=ledgerType eq 'Public'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return object that includes an array of Confidential Ledgers and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + filter, + 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())); + } + + /** + * Retrieves the properties of all Confidential Ledgers. + * + * @param filter The filter to apply on the list operation. eg. $filter=ledgerType eq 'Public'. + * @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 object that includes an array of Confidential Ledgers and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String filter, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + filter, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Retrieves the properties of all Confidential Ledgers. + * + * @param filter The filter to apply on the list operation. eg. $filter=ledgerType eq 'Public'. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return object that includes an array of Confidential Ledgers and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String filter) { + return new PagedFlux<>( + () -> listSinglePageAsync(filter), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Retrieves the properties of all Confidential Ledgers. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return object that includes an array of Confidential Ledgers and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + final String filter = null; + return new PagedFlux<>( + () -> listSinglePageAsync(filter), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Retrieves the properties of all Confidential Ledgers. + * + * @param filter The filter to apply on the list operation. eg. $filter=ledgerType eq 'Public'. + * @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 object that includes an array of Confidential Ledgers and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String filter, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(filter, context), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * Retrieves the properties of all Confidential Ledgers. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return object that includes an array of Confidential Ledgers and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + final String filter = null; + return new PagedIterable<>(listAsync(filter)); + } + + /** + * Retrieves the properties of all Confidential Ledgers. + * + * @param filter The filter to apply on the list operation. eg. $filter=ledgerType eq 'Public'. + * @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 object that includes an array of Confidential Ledgers and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String filter, Context context) { + return new PagedIterable<>(listAsync(filter, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return object that includes an array of Confidential Ledgers and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @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 object that includes an array of Confidential Ledgers and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return object that includes an array of Confidential Ledgers and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @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 object that includes an array of Confidential Ledgers and a possible link for next set. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/implementation/LedgersImpl.java b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/implementation/LedgersImpl.java new file mode 100644 index 0000000000000..4a8ee5dbae745 --- /dev/null +++ b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/implementation/LedgersImpl.java @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.confidentialledger.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.confidentialledger.fluent.LedgersClient; +import com.azure.resourcemanager.confidentialledger.fluent.models.ConfidentialLedgerInner; +import com.azure.resourcemanager.confidentialledger.models.ConfidentialLedger; +import com.azure.resourcemanager.confidentialledger.models.Ledgers; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class LedgersImpl implements Ledgers { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LedgersImpl.class); + + private final LedgersClient innerClient; + + private final com.azure.resourcemanager.confidentialledger.ConfidentialLedgerManager serviceManager; + + public LedgersImpl( + LedgersClient innerClient, + com.azure.resourcemanager.confidentialledger.ConfidentialLedgerManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ConfidentialLedger getByResourceGroup(String resourceGroupName, String ledgerName) { + ConfidentialLedgerInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, ledgerName); + if (inner != null) { + return new ConfidentialLedgerImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String ledgerName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, ledgerName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ConfidentialLedgerImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String ledgerName) { + this.serviceClient().delete(resourceGroupName, ledgerName); + } + + public void delete(String resourceGroupName, String ledgerName, Context context) { + this.serviceClient().delete(resourceGroupName, ledgerName, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new ConfidentialLedgerImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup( + String resourceGroupName, String filter, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, filter, context); + return Utils.mapPage(inner, inner1 -> new ConfidentialLedgerImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new ConfidentialLedgerImpl(inner1, this.manager())); + } + + public PagedIterable list(String filter, Context context) { + PagedIterable inner = this.serviceClient().list(filter, context); + return Utils.mapPage(inner, inner1 -> new ConfidentialLedgerImpl(inner1, this.manager())); + } + + public ConfidentialLedger getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String ledgerName = Utils.getValueFromIdByName(id, "ledgers"); + if (ledgerName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'ledgers'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, ledgerName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String ledgerName = Utils.getValueFromIdByName(id, "ledgers"); + if (ledgerName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'ledgers'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, ledgerName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String ledgerName = Utils.getValueFromIdByName(id, "ledgers"); + if (ledgerName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'ledgers'.", id))); + } + this.delete(resourceGroupName, ledgerName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String ledgerName = Utils.getValueFromIdByName(id, "ledgers"); + if (ledgerName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'ledgers'.", id))); + } + this.delete(resourceGroupName, ledgerName, context); + } + + private LedgersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.confidentialledger.ConfidentialLedgerManager manager() { + return this.serviceManager; + } + + public ConfidentialLedgerImpl define(String name) { + return new ConfidentialLedgerImpl(name, this.manager()); + } +} diff --git a/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/implementation/OperationsClientImpl.java b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/implementation/OperationsClientImpl.java new file mode 100644 index 0000000000000..7352d247bf71c --- /dev/null +++ b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/implementation/OperationsClientImpl.java @@ -0,0 +1,270 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.confidentialledger.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.core.util.logging.ClientLogger; +import com.azure.resourcemanager.confidentialledger.fluent.OperationsClient; +import com.azure.resourcemanager.confidentialledger.fluent.models.ResourceProviderOperationDefinitionInner; +import com.azure.resourcemanager.confidentialledger.models.ResourceProviderOperationList; +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 { + private final ClientLogger logger = new ClientLogger(OperationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final OperationsService service; + + /** The service client containing this operation class. */ + private final ConfidentialLedgerManagementClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(ConfidentialLedgerManagementClientImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ConfidentialLedgerManagementClientOperations to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ConfidentialLedgerMa") + private interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.ConfidentialLedger/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Retrieves a list of available API operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list containing this Resource Provider's available operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves a list of available API operations. + * + * @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 list containing this Resource Provider's available operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Retrieves a list of available API operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list containing this Resource Provider's available operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Retrieves a list of available API operations. + * + * @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 list containing this Resource Provider's available operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Retrieves a list of available API operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list containing this Resource Provider's available operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Retrieves a list of available API operations. + * + * @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 list containing this Resource Provider's available operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list containing this Resource Provider's available operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @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 list containing this Resource Provider's available operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/implementation/OperationsImpl.java b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..566af554b12d1 --- /dev/null +++ b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/implementation/OperationsImpl.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.confidentialledger.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.confidentialledger.fluent.OperationsClient; +import com.azure.resourcemanager.confidentialledger.fluent.models.ResourceProviderOperationDefinitionInner; +import com.azure.resourcemanager.confidentialledger.models.Operations; +import com.azure.resourcemanager.confidentialledger.models.ResourceProviderOperationDefinition; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class OperationsImpl implements Operations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationsImpl.class); + + private final OperationsClient innerClient; + + private final com.azure.resourcemanager.confidentialledger.ConfidentialLedgerManager serviceManager; + + public OperationsImpl( + OperationsClient innerClient, + com.azure.resourcemanager.confidentialledger.ConfidentialLedgerManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new ResourceProviderOperationDefinitionImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new ResourceProviderOperationDefinitionImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.confidentialledger.ConfidentialLedgerManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/implementation/ResourceProviderOperationDefinitionImpl.java b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/implementation/ResourceProviderOperationDefinitionImpl.java new file mode 100644 index 0000000000000..d690d36e1e5df --- /dev/null +++ b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/implementation/ResourceProviderOperationDefinitionImpl.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.confidentialledger.implementation; + +import com.azure.resourcemanager.confidentialledger.fluent.models.ResourceProviderOperationDefinitionInner; +import com.azure.resourcemanager.confidentialledger.models.ResourceProviderOperationDefinition; +import com.azure.resourcemanager.confidentialledger.models.ResourceProviderOperationDisplay; + +public final class ResourceProviderOperationDefinitionImpl implements ResourceProviderOperationDefinition { + private ResourceProviderOperationDefinitionInner innerObject; + + private final com.azure.resourcemanager.confidentialledger.ConfidentialLedgerManager serviceManager; + + ResourceProviderOperationDefinitionImpl( + ResourceProviderOperationDefinitionInner innerObject, + com.azure.resourcemanager.confidentialledger.ConfidentialLedgerManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public Boolean isDataAction() { + return this.innerModel().isDataAction(); + } + + public ResourceProviderOperationDisplay display() { + return this.innerModel().display(); + } + + public ResourceProviderOperationDefinitionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.confidentialledger.ConfidentialLedgerManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/implementation/ResourceProvidersClientImpl.java b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/implementation/ResourceProvidersClientImpl.java new file mode 100644 index 0000000000000..570c8acf64fd4 --- /dev/null +++ b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/implementation/ResourceProvidersClientImpl.java @@ -0,0 +1,215 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.confidentialledger.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.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.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.core.util.logging.ClientLogger; +import com.azure.resourcemanager.confidentialledger.fluent.ResourceProvidersClient; +import com.azure.resourcemanager.confidentialledger.fluent.models.CheckNameAvailabilityResponseInner; +import com.azure.resourcemanager.confidentialledger.models.CheckNameAvailabilityRequest; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ResourceProvidersClient. */ +public final class ResourceProvidersClientImpl implements ResourceProvidersClient { + private final ClientLogger logger = new ClientLogger(ResourceProvidersClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ResourceProvidersService service; + + /** The service client containing this operation class. */ + private final ConfidentialLedgerManagementClientImpl client; + + /** + * Initializes an instance of ResourceProvidersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ResourceProvidersClientImpl(ConfidentialLedgerManagementClientImpl client) { + this.service = + RestProxy.create(ResourceProvidersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ConfidentialLedgerManagementClientResourceProviders to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ConfidentialLedgerMa") + private interface ResourceProvidersService { + @Headers({"Content-Type: application/json"}) + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.ConfidentialLedger/checkNameAvailability") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> checkNameAvailability( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") CheckNameAvailabilityRequest nameAvailabilityRequest, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * To check whether a resource name is available. + * + * @param nameAvailabilityRequest Name availability request payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 check availability result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkNameAvailabilityWithResponseAsync( + CheckNameAvailabilityRequest nameAvailabilityRequest) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (nameAvailabilityRequest == null) { + return Mono + .error( + new IllegalArgumentException("Parameter nameAvailabilityRequest is required and cannot be null.")); + } else { + nameAvailabilityRequest.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .checkNameAvailability( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + nameAvailabilityRequest, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * To check whether a resource name is available. + * + * @param nameAvailabilityRequest Name availability request payload. + * @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 check availability result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkNameAvailabilityWithResponseAsync( + CheckNameAvailabilityRequest nameAvailabilityRequest, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (nameAvailabilityRequest == null) { + return Mono + .error( + new IllegalArgumentException("Parameter nameAvailabilityRequest is required and cannot be null.")); + } else { + nameAvailabilityRequest.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .checkNameAvailability( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + nameAvailabilityRequest, + accept, + context); + } + + /** + * To check whether a resource name is available. + * + * @param nameAvailabilityRequest Name availability request payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 check availability result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono checkNameAvailabilityAsync( + CheckNameAvailabilityRequest nameAvailabilityRequest) { + return checkNameAvailabilityWithResponseAsync(nameAvailabilityRequest) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * To check whether a resource name is available. + * + * @param nameAvailabilityRequest Name availability request payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 check availability result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CheckNameAvailabilityResponseInner checkNameAvailability( + CheckNameAvailabilityRequest nameAvailabilityRequest) { + return checkNameAvailabilityAsync(nameAvailabilityRequest).block(); + } + + /** + * To check whether a resource name is available. + * + * @param nameAvailabilityRequest Name availability request payload. + * @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 check availability result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response checkNameAvailabilityWithResponse( + CheckNameAvailabilityRequest nameAvailabilityRequest, Context context) { + return checkNameAvailabilityWithResponseAsync(nameAvailabilityRequest, context).block(); + } +} diff --git a/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/implementation/ResourceProvidersImpl.java b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/implementation/ResourceProvidersImpl.java new file mode 100644 index 0000000000000..ed9735090cdd9 --- /dev/null +++ b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/implementation/ResourceProvidersImpl.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.confidentialledger.implementation; + +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.confidentialledger.fluent.ResourceProvidersClient; +import com.azure.resourcemanager.confidentialledger.fluent.models.CheckNameAvailabilityResponseInner; +import com.azure.resourcemanager.confidentialledger.models.CheckNameAvailabilityRequest; +import com.azure.resourcemanager.confidentialledger.models.CheckNameAvailabilityResponse; +import com.azure.resourcemanager.confidentialledger.models.ResourceProviders; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ResourceProvidersImpl implements ResourceProviders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceProvidersImpl.class); + + private final ResourceProvidersClient innerClient; + + private final com.azure.resourcemanager.confidentialledger.ConfidentialLedgerManager serviceManager; + + public ResourceProvidersImpl( + ResourceProvidersClient innerClient, + com.azure.resourcemanager.confidentialledger.ConfidentialLedgerManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public CheckNameAvailabilityResponse checkNameAvailability(CheckNameAvailabilityRequest nameAvailabilityRequest) { + CheckNameAvailabilityResponseInner inner = this.serviceClient().checkNameAvailability(nameAvailabilityRequest); + if (inner != null) { + return new CheckNameAvailabilityResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response checkNameAvailabilityWithResponse( + CheckNameAvailabilityRequest nameAvailabilityRequest, Context context) { + Response inner = + this.serviceClient().checkNameAvailabilityWithResponse(nameAvailabilityRequest, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CheckNameAvailabilityResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private ResourceProvidersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.confidentialledger.ConfidentialLedgerManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/implementation/Utils.java b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/implementation/Utils.java new file mode 100644 index 0000000000000..5785128f3ad3a --- /dev/null +++ b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/implementation/Utils.java @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.confidentialledger.implementation; + +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.util.CoreUtils; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import reactor.core.publisher.Flux; + +final class Utils { + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterator itr = Arrays.stream(id.split("/")).iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && !part.trim().isEmpty()) { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { + if (id == null || pathTemplate == null) { + return null; + } + String parameterNameParentheses = "{" + parameterName + "}"; + List idSegmentsReverted = Arrays.asList(id.split("/")); + List pathSegments = Arrays.asList(pathTemplate.split("/")); + Collections.reverse(idSegmentsReverted); + Iterator idItrReverted = idSegmentsReverted.iterator(); + int pathIndex = pathSegments.size(); + while (idItrReverted.hasNext() && pathIndex > 0) { + String idSegment = idItrReverted.next(); + String pathSegment = pathSegments.get(--pathIndex); + if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { + if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { + if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { + List segments = new ArrayList<>(); + segments.add(idSegment); + idItrReverted.forEachRemaining(segments::add); + Collections.reverse(segments); + if (segments.size() > 0 && segments.get(0).isEmpty()) { + segments.remove(0); + } + return String.join("/", segments); + } else { + return idSegment; + } + } + } + } + return null; + } + + static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { + return new PagedIterableImpl(pageIterable, mapper); + } + + private static final class PagedIterableImpl extends PagedIterable { + + private final PagedIterable pagedIterable; + private final Function mapper; + private final Function, PagedResponse> pageMapper; + + private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { + super( + PagedFlux + .create( + () -> + (continuationToken, pageSize) -> + Flux.fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); + this.pagedIterable = pagedIterable; + this.mapper = mapper; + this.pageMapper = getPageMapper(mapper); + } + + private static Function, PagedResponse> getPageMapper(Function mapper) { + return page -> + new PagedResponseBase( + page.getRequest(), + page.getStatusCode(), + page.getHeaders(), + page.getElements().stream().map(mapper).collect(Collectors.toList()), + page.getContinuationToken(), + null); + } + + @Override + public Stream stream() { + return pagedIterable.stream().map(mapper); + } + + @Override + public Stream> streamByPage() { + return pagedIterable.streamByPage().map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken) { + return pagedIterable.streamByPage(continuationToken).map(pageMapper); + } + + @Override + public Stream> streamByPage(int preferredPageSize) { + return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken, int preferredPageSize) { + return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + } + + @Override + public Iterator iterator() { + return new IteratorImpl(pagedIterable.iterator(), mapper); + } + + @Override + public Iterable> iterableByPage() { + return new IterableImpl, PagedResponse>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl, PagedResponse>( + 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/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/implementation/package-info.java b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/implementation/package-info.java new file mode 100644 index 0000000000000..c2b3113495f25 --- /dev/null +++ b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/implementation/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the implementations for ConfidentialLedgerManagementClient. Microsoft Azure Confidential Compute + * Ledger Control Plane REST API version 2020-12-01-preview. + */ +package com.azure.resourcemanager.confidentialledger.implementation; diff --git a/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/AadBasedSecurityPrincipal.java b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/AadBasedSecurityPrincipal.java new file mode 100644 index 0000000000000..0c99d9daa957f --- /dev/null +++ b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/AadBasedSecurityPrincipal.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.confidentialledger.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** AAD based security principal with associated Ledger RoleName. */ +@Fluent +public final class AadBasedSecurityPrincipal { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AadBasedSecurityPrincipal.class); + + /* + * UUID/GUID based Principal Id of the Security Principal + */ + @JsonProperty(value = "principalId") + private String principalId; + + /* + * UUID/GUID based Tenant Id of the Security Principal + */ + @JsonProperty(value = "tenantId") + private String tenantId; + + /* + * LedgerRole associated with the Security Principal of Ledger + */ + @JsonProperty(value = "ledgerRoleName") + private LedgerRoleName ledgerRoleName; + + /** + * Get the principalId property: UUID/GUID based Principal Id of the Security Principal. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Set the principalId property: UUID/GUID based Principal Id of the Security Principal. + * + * @param principalId the principalId value to set. + * @return the AadBasedSecurityPrincipal object itself. + */ + public AadBasedSecurityPrincipal withPrincipalId(String principalId) { + this.principalId = principalId; + return this; + } + + /** + * Get the tenantId property: UUID/GUID based Tenant Id of the Security Principal. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Set the tenantId property: UUID/GUID based Tenant Id of the Security Principal. + * + * @param tenantId the tenantId value to set. + * @return the AadBasedSecurityPrincipal object itself. + */ + public AadBasedSecurityPrincipal withTenantId(String tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Get the ledgerRoleName property: LedgerRole associated with the Security Principal of Ledger. + * + * @return the ledgerRoleName value. + */ + public LedgerRoleName ledgerRoleName() { + return this.ledgerRoleName; + } + + /** + * Set the ledgerRoleName property: LedgerRole associated with the Security Principal of Ledger. + * + * @param ledgerRoleName the ledgerRoleName value to set. + * @return the AadBasedSecurityPrincipal object itself. + */ + public AadBasedSecurityPrincipal withLedgerRoleName(LedgerRoleName ledgerRoleName) { + this.ledgerRoleName = ledgerRoleName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/CertBasedSecurityPrincipal.java b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/CertBasedSecurityPrincipal.java new file mode 100644 index 0000000000000..b23ca0c59d614 --- /dev/null +++ b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/CertBasedSecurityPrincipal.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.confidentialledger.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Cert based security principal with Ledger RoleName. */ +@Fluent +public final class CertBasedSecurityPrincipal { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CertBasedSecurityPrincipal.class); + + /* + * Base64 encoded public key of the user cert (.pem or .cer) + */ + @JsonProperty(value = "cert") + private String cert; + + /* + * LedgerRole associated with the Security Principal of Ledger + */ + @JsonProperty(value = "ledgerRoleName") + private LedgerRoleName ledgerRoleName; + + /** + * Get the cert property: Base64 encoded public key of the user cert (.pem or .cer). + * + * @return the cert value. + */ + public String cert() { + return this.cert; + } + + /** + * Set the cert property: Base64 encoded public key of the user cert (.pem or .cer). + * + * @param cert the cert value to set. + * @return the CertBasedSecurityPrincipal object itself. + */ + public CertBasedSecurityPrincipal withCert(String cert) { + this.cert = cert; + return this; + } + + /** + * Get the ledgerRoleName property: LedgerRole associated with the Security Principal of Ledger. + * + * @return the ledgerRoleName value. + */ + public LedgerRoleName ledgerRoleName() { + return this.ledgerRoleName; + } + + /** + * Set the ledgerRoleName property: LedgerRole associated with the Security Principal of Ledger. + * + * @param ledgerRoleName the ledgerRoleName value to set. + * @return the CertBasedSecurityPrincipal object itself. + */ + public CertBasedSecurityPrincipal withLedgerRoleName(LedgerRoleName ledgerRoleName) { + this.ledgerRoleName = ledgerRoleName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/CheckNameAvailabilityReason.java b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/CheckNameAvailabilityReason.java new file mode 100644 index 0000000000000..2e66c90a8c895 --- /dev/null +++ b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/CheckNameAvailabilityReason.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.confidentialledger.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for CheckNameAvailabilityReason. */ +public final class CheckNameAvailabilityReason extends ExpandableStringEnum { + /** Static value Invalid for CheckNameAvailabilityReason. */ + public static final CheckNameAvailabilityReason INVALID = fromString("Invalid"); + + /** Static value AlreadyExists for CheckNameAvailabilityReason. */ + public static final CheckNameAvailabilityReason ALREADY_EXISTS = fromString("AlreadyExists"); + + /** + * Creates or finds a CheckNameAvailabilityReason from its string representation. + * + * @param name a name to look for. + * @return the corresponding CheckNameAvailabilityReason. + */ + @JsonCreator + public static CheckNameAvailabilityReason fromString(String name) { + return fromString(name, CheckNameAvailabilityReason.class); + } + + /** @return known CheckNameAvailabilityReason values. */ + public static Collection values() { + return values(CheckNameAvailabilityReason.class); + } +} diff --git a/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/CheckNameAvailabilityRequest.java b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/CheckNameAvailabilityRequest.java new file mode 100644 index 0000000000000..e6c4d23fe3adb --- /dev/null +++ b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/CheckNameAvailabilityRequest.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.confidentialledger.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The check availability request body. */ +@Fluent +public final class CheckNameAvailabilityRequest { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CheckNameAvailabilityRequest.class); + + /* + * The name of the resource for which availability needs to be checked. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The resource type. + */ + @JsonProperty(value = "type") + private String type; + + /** + * Get the name property: The name of the resource for which availability needs to be checked. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the resource for which availability needs to be checked. + * + * @param name the name value to set. + * @return the CheckNameAvailabilityRequest object itself. + */ + public CheckNameAvailabilityRequest withName(String name) { + this.name = name; + return this; + } + + /** + * Get the type property: The resource type. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: The resource type. + * + * @param type the type value to set. + * @return the CheckNameAvailabilityRequest object itself. + */ + public CheckNameAvailabilityRequest withType(String type) { + this.type = type; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/CheckNameAvailabilityResponse.java b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/CheckNameAvailabilityResponse.java new file mode 100644 index 0000000000000..651c1702faba6 --- /dev/null +++ b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/CheckNameAvailabilityResponse.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.confidentialledger.models; + +import com.azure.resourcemanager.confidentialledger.fluent.models.CheckNameAvailabilityResponseInner; + +/** An immutable client-side representation of CheckNameAvailabilityResponse. */ +public interface CheckNameAvailabilityResponse { + /** + * Gets the nameAvailable property: Indicates if the resource name is available. + * + * @return the nameAvailable value. + */ + Boolean nameAvailable(); + + /** + * Gets the reason property: The reason why the given name is not available. + * + * @return the reason value. + */ + CheckNameAvailabilityReason reason(); + + /** + * Gets the message property: Detailed reason why the given name is available. + * + * @return the message value. + */ + String message(); + + /** + * Gets the inner com.azure.resourcemanager.confidentialledger.fluent.models.CheckNameAvailabilityResponseInner + * object. + * + * @return the inner object. + */ + CheckNameAvailabilityResponseInner innerModel(); +} diff --git a/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/ConfidentialLedger.java b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/ConfidentialLedger.java new file mode 100644 index 0000000000000..107d1c074c9e4 --- /dev/null +++ b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/ConfidentialLedger.java @@ -0,0 +1,225 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.confidentialledger.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.confidentialledger.fluent.models.ConfidentialLedgerInner; +import java.util.Map; + +/** An immutable client-side representation of ConfidentialLedger. */ +public interface ConfidentialLedger { + /** + * 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 properties property: Properties of Confidential Ledger Resource. + * + * @return the properties value. + */ + LedgerProperties properties(); + + /** + * Gets the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the location property: The Azure location where the Confidential Ledger is running. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Additional tags for Confidential Ledger. + * + * @return the tags value. + */ + Map tags(); + + /** + * 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 inner com.azure.resourcemanager.confidentialledger.fluent.models.ConfidentialLedgerInner object. + * + * @return the inner object. + */ + ConfidentialLedgerInner innerModel(); + + /** The entirety of the ConfidentialLedger definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { + } + /** The ConfidentialLedger definition stages. */ + interface DefinitionStages { + /** The first stage of the ConfidentialLedger definition. */ + interface Blank extends WithResourceGroup { + } + /** The stage of the ConfidentialLedger definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the ConfidentialLedger 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.WithLocation, DefinitionStages.WithTags, DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + ConfidentialLedger create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ConfidentialLedger create(Context context); + } + /** The stage of the ConfidentialLedger definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The Azure location where the Confidential Ledger is running. + * @return the next definition stage. + */ + WithCreate withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The Azure location where the Confidential Ledger is running. + * @return the next definition stage. + */ + WithCreate withRegion(String location); + } + /** The stage of the ConfidentialLedger definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Additional tags for Confidential Ledger. + * + * @param tags Additional tags for Confidential Ledger. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the ConfidentialLedger definition allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: Properties of Confidential Ledger Resource.. + * + * @param properties Properties of Confidential Ledger Resource. + * @return the next definition stage. + */ + WithCreate withProperties(LedgerProperties properties); + } + } + /** + * Begins update for the ConfidentialLedger resource. + * + * @return the stage of resource update. + */ + ConfidentialLedger.Update update(); + + /** The template for ConfidentialLedger update. */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ConfidentialLedger apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ConfidentialLedger apply(Context context); + } + /** The ConfidentialLedger update stages. */ + interface UpdateStages { + /** The stage of the ConfidentialLedger update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Additional tags for Confidential Ledger. + * + * @param tags Additional tags for Confidential Ledger. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the ConfidentialLedger update allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: Properties of Confidential Ledger Resource.. + * + * @param properties Properties of Confidential Ledger Resource. + * @return the next definition stage. + */ + Update withProperties(LedgerProperties properties); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ConfidentialLedger refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ConfidentialLedger refresh(Context context); +} diff --git a/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/ConfidentialLedgerList.java b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/ConfidentialLedgerList.java new file mode 100644 index 0000000000000..213f9a9dada0a --- /dev/null +++ b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/ConfidentialLedgerList.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.confidentialledger.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.confidentialledger.fluent.models.ConfidentialLedgerInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Object that includes an array of Confidential Ledgers and a possible link for next set. */ +@Fluent +public final class ConfidentialLedgerList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ConfidentialLedgerList.class); + + /* + * List of Confidential Ledgers + */ + @JsonProperty(value = "value") + private List value; + + /* + * The URL the client should use to fetch the next page (per server side + * paging). + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: List of Confidential Ledgers. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of Confidential Ledgers. + * + * @param value the value value to set. + * @return the ConfidentialLedgerList object itself. + */ + public ConfidentialLedgerList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URL the client should use to fetch the next page (per server side paging). + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The URL the client should use to fetch the next page (per server side paging). + * + * @param nextLink the nextLink value to set. + * @return the ConfidentialLedgerList object itself. + */ + public ConfidentialLedgerList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/LedgerProperties.java b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/LedgerProperties.java new file mode 100644 index 0000000000000..3a23b60a9666b --- /dev/null +++ b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/LedgerProperties.java @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.confidentialledger.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Additional Confidential Ledger properties. */ +@Fluent +public final class LedgerProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LedgerProperties.class); + + /* + * Unique name for the Confidential Ledger. + */ + @JsonProperty(value = "ledgerName", access = JsonProperty.Access.WRITE_ONLY) + private String ledgerName; + + /* + * Endpoint for calling Ledger Service. + */ + @JsonProperty(value = "ledgerUri", access = JsonProperty.Access.WRITE_ONLY) + private String ledgerUri; + + /* + * Endpoint for accessing network identity. + */ + @JsonProperty(value = "identityServiceUri", access = JsonProperty.Access.WRITE_ONLY) + private String identityServiceUri; + + /* + * Internal namespace for the Ledger + */ + @JsonProperty(value = "ledgerInternalNamespace", access = JsonProperty.Access.WRITE_ONLY) + private String ledgerInternalNamespace; + + /* + * Type of Confidential Ledger + */ + @JsonProperty(value = "ledgerType") + private LedgerType ledgerType; + + /* + * Provisioning state of Ledger Resource + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /* + * Array of all AAD based Security Principals. + */ + @JsonProperty(value = "aadBasedSecurityPrincipals") + private List aadBasedSecurityPrincipals; + + /* + * Array of all cert based Security Principals. + */ + @JsonProperty(value = "certBasedSecurityPrincipals") + private List certBasedSecurityPrincipals; + + /** + * Get the ledgerName property: Unique name for the Confidential Ledger. + * + * @return the ledgerName value. + */ + public String ledgerName() { + return this.ledgerName; + } + + /** + * Get the ledgerUri property: Endpoint for calling Ledger Service. + * + * @return the ledgerUri value. + */ + public String ledgerUri() { + return this.ledgerUri; + } + + /** + * Get the identityServiceUri property: Endpoint for accessing network identity. + * + * @return the identityServiceUri value. + */ + public String identityServiceUri() { + return this.identityServiceUri; + } + + /** + * Get the ledgerInternalNamespace property: Internal namespace for the Ledger. + * + * @return the ledgerInternalNamespace value. + */ + public String ledgerInternalNamespace() { + return this.ledgerInternalNamespace; + } + + /** + * Get the ledgerType property: Type of Confidential Ledger. + * + * @return the ledgerType value. + */ + public LedgerType ledgerType() { + return this.ledgerType; + } + + /** + * Set the ledgerType property: Type of Confidential Ledger. + * + * @param ledgerType the ledgerType value to set. + * @return the LedgerProperties object itself. + */ + public LedgerProperties withLedgerType(LedgerType ledgerType) { + this.ledgerType = ledgerType; + return this; + } + + /** + * Get the provisioningState property: Provisioning state of Ledger Resource. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the aadBasedSecurityPrincipals property: Array of all AAD based Security Principals. + * + * @return the aadBasedSecurityPrincipals value. + */ + public List aadBasedSecurityPrincipals() { + return this.aadBasedSecurityPrincipals; + } + + /** + * Set the aadBasedSecurityPrincipals property: Array of all AAD based Security Principals. + * + * @param aadBasedSecurityPrincipals the aadBasedSecurityPrincipals value to set. + * @return the LedgerProperties object itself. + */ + public LedgerProperties withAadBasedSecurityPrincipals(List aadBasedSecurityPrincipals) { + this.aadBasedSecurityPrincipals = aadBasedSecurityPrincipals; + return this; + } + + /** + * Get the certBasedSecurityPrincipals property: Array of all cert based Security Principals. + * + * @return the certBasedSecurityPrincipals value. + */ + public List certBasedSecurityPrincipals() { + return this.certBasedSecurityPrincipals; + } + + /** + * Set the certBasedSecurityPrincipals property: Array of all cert based Security Principals. + * + * @param certBasedSecurityPrincipals the certBasedSecurityPrincipals value to set. + * @return the LedgerProperties object itself. + */ + public LedgerProperties withCertBasedSecurityPrincipals( + List certBasedSecurityPrincipals) { + this.certBasedSecurityPrincipals = certBasedSecurityPrincipals; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (aadBasedSecurityPrincipals() != null) { + aadBasedSecurityPrincipals().forEach(e -> e.validate()); + } + if (certBasedSecurityPrincipals() != null) { + certBasedSecurityPrincipals().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/LedgerRoleName.java b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/LedgerRoleName.java new file mode 100644 index 0000000000000..1f61cc6982151 --- /dev/null +++ b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/LedgerRoleName.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.confidentialledger.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for LedgerRoleName. */ +public final class LedgerRoleName extends ExpandableStringEnum { + /** Static value Reader for LedgerRoleName. */ + public static final LedgerRoleName READER = fromString("Reader"); + + /** Static value Contributor for LedgerRoleName. */ + public static final LedgerRoleName CONTRIBUTOR = fromString("Contributor"); + + /** Static value Administrator for LedgerRoleName. */ + public static final LedgerRoleName ADMINISTRATOR = fromString("Administrator"); + + /** + * Creates or finds a LedgerRoleName from its string representation. + * + * @param name a name to look for. + * @return the corresponding LedgerRoleName. + */ + @JsonCreator + public static LedgerRoleName fromString(String name) { + return fromString(name, LedgerRoleName.class); + } + + /** @return known LedgerRoleName values. */ + public static Collection values() { + return values(LedgerRoleName.class); + } +} diff --git a/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/LedgerType.java b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/LedgerType.java new file mode 100644 index 0000000000000..63a00f59d8507 --- /dev/null +++ b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/LedgerType.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.confidentialledger.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for LedgerType. */ +public final class LedgerType extends ExpandableStringEnum { + /** Static value Unknown for LedgerType. */ + public static final LedgerType UNKNOWN = fromString("Unknown"); + + /** Static value Public for LedgerType. */ + public static final LedgerType PUBLIC = fromString("Public"); + + /** Static value Private for LedgerType. */ + public static final LedgerType PRIVATE = fromString("Private"); + + /** + * Creates or finds a LedgerType from its string representation. + * + * @param name a name to look for. + * @return the corresponding LedgerType. + */ + @JsonCreator + public static LedgerType fromString(String name) { + return fromString(name, LedgerType.class); + } + + /** @return known LedgerType values. */ + public static Collection values() { + return values(LedgerType.class); + } +} diff --git a/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/Ledgers.java b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/Ledgers.java new file mode 100644 index 0000000000000..3b0385984af67 --- /dev/null +++ b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/Ledgers.java @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.confidentialledger.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 Ledgers. */ +public interface Ledgers { + /** + * Retrieves the properties of a Confidential Ledger. + * + * @param resourceGroupName The name of the resource group. + * @param ledgerName Name of the Confidential Ledger. + * @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 confidential Ledger. + */ + ConfidentialLedger getByResourceGroup(String resourceGroupName, String ledgerName); + + /** + * Retrieves the properties of a Confidential Ledger. + * + * @param resourceGroupName The name of the resource group. + * @param ledgerName Name of the Confidential Ledger. + * @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 confidential Ledger. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String ledgerName, Context context); + + /** + * Deletes an existing Confidential Ledger. + * + * @param resourceGroupName The name of the resource group. + * @param ledgerName Name of the Confidential Ledger. + * @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 ledgerName); + + /** + * Deletes an existing Confidential Ledger. + * + * @param resourceGroupName The name of the resource group. + * @param ledgerName Name of the Confidential Ledger. + * @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 ledgerName, Context context); + + /** + * Retrieves the properties of all Confidential Ledgers. + * + * @param resourceGroupName The name of the resource group. + * @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 object that includes an array of Confidential Ledgers and a possible link for next set. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Retrieves the properties of all Confidential Ledgers. + * + * @param resourceGroupName The name of the resource group. + * @param filter The filter to apply on the list operation. eg. $filter=ledgerType eq 'Public'. + * @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 object that includes an array of Confidential Ledgers and a possible link for next set. + */ + PagedIterable listByResourceGroup(String resourceGroupName, String filter, Context context); + + /** + * Retrieves the properties of all Confidential Ledgers. + * + * @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 object that includes an array of Confidential Ledgers and a possible link for next set. + */ + PagedIterable list(); + + /** + * Retrieves the properties of all Confidential Ledgers. + * + * @param filter The filter to apply on the list operation. eg. $filter=ledgerType eq 'Public'. + * @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 object that includes an array of Confidential Ledgers and a possible link for next set. + */ + PagedIterable list(String filter, Context context); + + /** + * Retrieves the properties of a Confidential Ledger. + * + * @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 confidential Ledger. + */ + ConfidentialLedger getById(String id); + + /** + * Retrieves the properties of a Confidential Ledger. + * + * @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 confidential Ledger. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes an existing Confidential Ledger. + * + * @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); + + /** + * Deletes an existing Confidential Ledger. + * + * @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 ConfidentialLedger resource. + * + * @param name resource name. + * @return the first stage of the new ConfidentialLedger definition. + */ + ConfidentialLedger.DefinitionStages.Blank define(String name); +} diff --git a/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/Location.java b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/Location.java new file mode 100644 index 0000000000000..97abfa2efead3 --- /dev/null +++ b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/Location.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.confidentialledger.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Location of the ARM Resource. */ +@Fluent +public class Location { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Location.class); + + /* + * The Azure location where the Confidential Ledger is running. + */ + @JsonProperty(value = "location") + private String location; + + /** + * Get the location property: The Azure location where the Confidential Ledger is running. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The Azure location where the Confidential Ledger is running. + * + * @param location the location value to set. + * @return the Location object itself. + */ + public Location withLocation(String location) { + this.location = location; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/Operations.java b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/Operations.java new file mode 100644 index 0000000000000..e0f3e6bb01ca1 --- /dev/null +++ b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/Operations.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.confidentialledger.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Operations. */ +public interface Operations { + /** + * Retrieves a list of available API operations. + * + * @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 list containing this Resource Provider's available operations. + */ + PagedIterable list(); + + /** + * Retrieves a list of available API operations. + * + * @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 list containing this Resource Provider's available operations. + */ + PagedIterable list(Context context); +} diff --git a/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/ProvisioningState.java b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/ProvisioningState.java new file mode 100644 index 0000000000000..1ff69fb13e629 --- /dev/null +++ b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/ProvisioningState.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.confidentialledger.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ProvisioningState. */ +public final class ProvisioningState extends ExpandableStringEnum { + /** Static value Unknown for ProvisioningState. */ + public static final ProvisioningState UNKNOWN = fromString("Unknown"); + + /** Static value Succeeded for ProvisioningState. */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** Static value Failed for ProvisioningState. */ + public static final ProvisioningState FAILED = fromString("Failed"); + + /** Static value Canceled for ProvisioningState. */ + public static final ProvisioningState CANCELED = fromString("Canceled"); + + /** Static value Creating for ProvisioningState. */ + public static final ProvisioningState CREATING = fromString("Creating"); + + /** Static value Deleting for ProvisioningState. */ + public static final ProvisioningState DELETING = fromString("Deleting"); + + /** Static value Updating for ProvisioningState. */ + public static final ProvisioningState UPDATING = fromString("Updating"); + + /** + * Creates or finds a ProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProvisioningState. + */ + @JsonCreator + public static ProvisioningState fromString(String name) { + return fromString(name, ProvisioningState.class); + } + + /** @return known ProvisioningState values. */ + public static Collection values() { + return values(ProvisioningState.class); + } +} diff --git a/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/ResourceProviderOperationDefinition.java b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/ResourceProviderOperationDefinition.java new file mode 100644 index 0000000000000..1c9ace1cf67e4 --- /dev/null +++ b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/ResourceProviderOperationDefinition.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.confidentialledger.models; + +import com.azure.resourcemanager.confidentialledger.fluent.models.ResourceProviderOperationDefinitionInner; + +/** An immutable client-side representation of ResourceProviderOperationDefinition. */ +public interface ResourceProviderOperationDefinition { + /** + * Gets the name property: Resource provider operation name. + * + * @return the name value. + */ + String name(); + + /** + * Gets the isDataAction property: Indicates whether the operation is data action or not. + * + * @return the isDataAction value. + */ + Boolean isDataAction(); + + /** + * Gets the display property: Details about the operations. + * + * @return the display value. + */ + ResourceProviderOperationDisplay display(); + + /** + * Gets the inner + * com.azure.resourcemanager.confidentialledger.fluent.models.ResourceProviderOperationDefinitionInner object. + * + * @return the inner object. + */ + ResourceProviderOperationDefinitionInner innerModel(); +} diff --git a/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/ResourceProviderOperationDisplay.java b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/ResourceProviderOperationDisplay.java new file mode 100644 index 0000000000000..0a4197d78503e --- /dev/null +++ b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/ResourceProviderOperationDisplay.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.confidentialledger.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes the properties of the Operation. */ +@Fluent +public final class ResourceProviderOperationDisplay { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceProviderOperationDisplay.class); + + /* + * Name of the resource provider. + */ + @JsonProperty(value = "provider") + private String provider; + + /* + * Name of the resource type. + */ + @JsonProperty(value = "resource") + private String resource; + + /* + * Name of the resource provider operation. + */ + @JsonProperty(value = "operation") + private String operation; + + /* + * Description of the resource provider operation. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get the provider property: Name of the resource provider. + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Set the provider property: Name of the resource provider. + * + * @param provider the provider value to set. + * @return the ResourceProviderOperationDisplay object itself. + */ + public ResourceProviderOperationDisplay withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get the resource property: Name of the resource type. + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Set the resource property: Name of the resource type. + * + * @param resource the resource value to set. + * @return the ResourceProviderOperationDisplay object itself. + */ + public ResourceProviderOperationDisplay withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get the operation property: Name of the resource provider operation. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Set the operation property: Name of the resource provider operation. + * + * @param operation the operation value to set. + * @return the ResourceProviderOperationDisplay object itself. + */ + public ResourceProviderOperationDisplay withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get the description property: Description of the resource provider operation. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Description of the resource provider operation. + * + * @param description the description value to set. + * @return the ResourceProviderOperationDisplay object itself. + */ + public ResourceProviderOperationDisplay withDescription(String description) { + this.description = description; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/ResourceProviderOperationList.java b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/ResourceProviderOperationList.java new file mode 100644 index 0000000000000..a520ed36cfeb3 --- /dev/null +++ b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/ResourceProviderOperationList.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.confidentialledger.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.confidentialledger.fluent.models.ResourceProviderOperationDefinitionInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List containing this Resource Provider's available operations. */ +@Immutable +public final class ResourceProviderOperationList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceProviderOperationList.class); + + /* + * Resource provider operations list. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * The URI that can be used to request the next page for list of Azure + * operations. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: Resource provider operations list. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The URI that can be used to request the next page for list of Azure operations. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/ResourceProviders.java b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/ResourceProviders.java new file mode 100644 index 0000000000000..81782cee01d0d --- /dev/null +++ b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/ResourceProviders.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.confidentialledger.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ResourceProviders. */ +public interface ResourceProviders { + /** + * To check whether a resource name is available. + * + * @param nameAvailabilityRequest Name availability request payload. + * @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 check availability result. + */ + CheckNameAvailabilityResponse checkNameAvailability(CheckNameAvailabilityRequest nameAvailabilityRequest); + + /** + * To check whether a resource name is available. + * + * @param nameAvailabilityRequest Name availability request payload. + * @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 check availability result. + */ + Response checkNameAvailabilityWithResponse( + CheckNameAvailabilityRequest nameAvailabilityRequest, Context context); +} diff --git a/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/Tags.java b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/Tags.java new file mode 100644 index 0000000000000..5a12bab13d0e7 --- /dev/null +++ b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/Tags.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.confidentialledger.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Tags for Confidential Ledger Resource. */ +@Fluent +public class Tags { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Tags.class); + + /* + * Additional tags for Confidential Ledger + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get the tags property: Additional tags for Confidential Ledger. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Additional tags for Confidential Ledger. + * + * @param tags the tags value to set. + * @return the Tags object itself. + */ + public Tags withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/package-info.java b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/package-info.java new file mode 100644 index 0000000000000..6174d0311fe46 --- /dev/null +++ b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the data models for ConfidentialLedgerManagementClient. Microsoft Azure Confidential Compute + * Ledger Control Plane REST API version 2020-12-01-preview. + */ +package com.azure.resourcemanager.confidentialledger.models; diff --git a/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/package-info.java b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/package-info.java new file mode 100644 index 0000000000000..31daf1621a12d --- /dev/null +++ b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/com/azure/resourcemanager/confidentialledger/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the classes for ConfidentialLedgerManagementClient. Microsoft Azure Confidential Compute Ledger + * Control Plane REST API version 2020-12-01-preview. + */ +package com.azure.resourcemanager.confidentialledger; diff --git a/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/module-info.java b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/module-info.java new file mode 100644 index 0000000000000..72e4b07e86520 --- /dev/null +++ b/sdk/confidentialledger/azure-resourcemanager-confidentialledger/src/main/java/module-info.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +module com.azure.resourcemanager.confidentialledger { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.confidentialledger; + exports com.azure.resourcemanager.confidentialledger.fluent; + exports com.azure.resourcemanager.confidentialledger.fluent.models; + exports com.azure.resourcemanager.confidentialledger.models; + + opens com.azure.resourcemanager.confidentialledger.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.confidentialledger.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/confidentialledger/ci.yml b/sdk/confidentialledger/ci.yml index 2ad90cefb874d..413cd7d6cc31a 100644 --- a/sdk/confidentialledger/ci.yml +++ b/sdk/confidentialledger/ci.yml @@ -1,4 +1,5 @@ # NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + trigger: branches: include: @@ -28,3 +29,6 @@ extends: - name: azure-security-confidentialledger groupId: com.azure safeName: azuresecurityconfidentialledger + - name: azure-resourcemanager-confidentialledger + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerconfidentialledger diff --git a/sdk/confidentialledger/pom.xml b/sdk/confidentialledger/pom.xml index 41b1a89d0bc36..dc821c53645bf 100644 --- a/sdk/confidentialledger/pom.xml +++ b/sdk/confidentialledger/pom.xml @@ -51,6 +51,7 @@ true + azure-resourcemanager-confidentialledger azure-security-confidentialledger