diff --git a/eng/versioning/external_dependencies.txt b/eng/versioning/external_dependencies.txt index 89f9243f9a00..1502121e62df 100644 --- a/eng/versioning/external_dependencies.txt +++ b/eng/versioning/external_dependencies.txt @@ -132,6 +132,7 @@ org.springframework:spring-messaging;5.2.10.RELEASE org.springframework:spring-tx;5.2.10.RELEASE org.springframework:spring-web;5.2.10.RELEASE org.springframework:spring-webmvc;5.2.10.RELEASE +org.springframework:spring-webflux;5.2.10.RELEASE # spring-boot-starter-parent is not managed by spring-boot-dependencies or spring-cloud-dependencies. org.springframework.boot:spring-boot-starter-parent;2.3.7.RELEASE diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index a4f5ca22cbe7..e084adcfa332 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -206,6 +206,7 @@ com.azure.resourcemanager:azure-resourcemanager-digitaltwins;1.0.0-beta.1;1.0.0- com.azure.resourcemanager:azure-resourcemanager-netapp;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-storagecache;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-redisenterprise;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-blockchain;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/pom.xml b/pom.xml index 8069fdfba48a..1beb9b0176d8 100644 --- a/pom.xml +++ b/pom.xml @@ -579,6 +579,7 @@ sdk/attestation sdk/authorization sdk/batch + sdk/blockchain sdk/boms sdk/cognitiveservices sdk/communication diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/CHANGELOG.md b/sdk/blockchain/azure-resourcemanager-blockchain/CHANGELOG.md new file mode 100644 index 000000000000..6e03d14d08c5 --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2021-02-26) + +- Azure Resource Manager Blockchain client library for Java. This package contains Microsoft Azure SDK for Blockchain Management SDK. REST API for Azure Blockchain Service. Package tag package-2018-06-01-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/blockchain/azure-resourcemanager-blockchain/README.md b/sdk/blockchain/azure-resourcemanager-blockchain/README.md new file mode 100644 index 000000000000..ed50bb17567a --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/README.md @@ -0,0 +1,99 @@ +# Azure Resource Manager Blockchain client library for Java + +Azure Resource Manager Blockchain client library for Java. + +This package contains Microsoft Azure SDK for Blockchain Management SDK. REST API for Azure Blockchain Service. Package tag package-2018-06-01-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +## We'd love to hear your feedback + +We're always working on improving our products and the way we communicate with our users. So we'd love to learn what's working and how we can do better. + +If you haven't already, please take a few minutes to [complete this short survey][survey] we have put together. + +Thank you in advance for your collaboration. We really appreciate your time! + +## Documentation + +Various documentation is available to help you get started + +- [API reference documentation][docs] + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-blockchain;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-blockchain + 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(); +BlockchainManager manager = BlockchainManager + .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/master/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/master/sdk/identity/azure-identity +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/resourcemanager/docs/DESIGN.md diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/pom.xml b/sdk/blockchain/azure-resourcemanager-blockchain/pom.xml new file mode 100644 index 000000000000..834e25f9e164 --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/pom.xml @@ -0,0 +1,67 @@ + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-blockchain + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for Blockchain Management + This package contains Microsoft Azure SDK for Blockchain Management SDK. REST API for Azure Blockchain Service. Package tag package-2018-06-01-preview. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt + 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.13.0 + + + com.azure + azure-core-management + 1.1.1 + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + true + + + + + diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/BlockchainManager.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/BlockchainManager.java new file mode 100644 index 000000000000..daf5fe96af97 --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/BlockchainManager.java @@ -0,0 +1,275 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.blockchain; + +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.BearerTokenAuthenticationPolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.blockchain.fluent.BlockchainManagementClient; +import com.azure.resourcemanager.blockchain.implementation.BlockchainManagementClientBuilder; +import com.azure.resourcemanager.blockchain.implementation.BlockchainMemberOperationResultsImpl; +import com.azure.resourcemanager.blockchain.implementation.BlockchainMembersImpl; +import com.azure.resourcemanager.blockchain.implementation.LocationsImpl; +import com.azure.resourcemanager.blockchain.implementation.OperationsImpl; +import com.azure.resourcemanager.blockchain.implementation.SkusImpl; +import com.azure.resourcemanager.blockchain.implementation.TransactionNodesImpl; +import com.azure.resourcemanager.blockchain.models.BlockchainMemberOperationResults; +import com.azure.resourcemanager.blockchain.models.BlockchainMembers; +import com.azure.resourcemanager.blockchain.models.Locations; +import com.azure.resourcemanager.blockchain.models.Operations; +import com.azure.resourcemanager.blockchain.models.Skus; +import com.azure.resourcemanager.blockchain.models.TransactionNodes; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** Entry point to BlockchainManager. REST API for Azure Blockchain Service. */ +public final class BlockchainManager { + private BlockchainMembers blockchainMembers; + + private BlockchainMemberOperationResults blockchainMemberOperationResults; + + private Locations locations; + + private Operations operations; + + private Skus skus; + + private TransactionNodes transactionNodes; + + private final BlockchainManagementClient clientObject; + + private BlockchainManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new BlockchainManagementClientBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of Blockchain service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Blockchain service API instance. + */ + public static BlockchainManager 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 BlockchainManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new BlockchainManager.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 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; + } + + /** + * 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 Blockchain service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Blockchain service API instance. + */ + public BlockchainManager 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.blockchain") + .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 (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 BearerTokenAuthenticationPolicy( + credential, profile.getEnvironment().getManagementEndpoint() + "/.default")); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new BlockchainManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** @return Resource collection API of BlockchainMembers. */ + public BlockchainMembers blockchainMembers() { + if (this.blockchainMembers == null) { + this.blockchainMembers = new BlockchainMembersImpl(clientObject.getBlockchainMembers(), this); + } + return blockchainMembers; + } + + /** @return Resource collection API of BlockchainMemberOperationResults. */ + public BlockchainMemberOperationResults blockchainMemberOperationResults() { + if (this.blockchainMemberOperationResults == null) { + this.blockchainMemberOperationResults = + new BlockchainMemberOperationResultsImpl(clientObject.getBlockchainMemberOperationResults(), this); + } + return blockchainMemberOperationResults; + } + + /** @return Resource collection API of Locations. */ + public Locations locations() { + if (this.locations == null) { + this.locations = new LocationsImpl(clientObject.getLocations(), this); + } + return locations; + } + + /** @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 Skus. */ + public Skus skus() { + if (this.skus == null) { + this.skus = new SkusImpl(clientObject.getSkus(), this); + } + return skus; + } + + /** @return Resource collection API of TransactionNodes. */ + public TransactionNodes transactionNodes() { + if (this.transactionNodes == null) { + this.transactionNodes = new TransactionNodesImpl(clientObject.getTransactionNodes(), this); + } + return transactionNodes; + } + + /** + * @return Wrapped service client BlockchainManagementClient providing direct access to the underlying + * auto-generated API implementation, based on Azure REST API. + */ + public BlockchainManagementClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/fluent/BlockchainManagementClient.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/fluent/BlockchainManagementClient.java new file mode 100644 index 000000000000..059778ff39ac --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/fluent/BlockchainManagementClient.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.blockchain.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for BlockchainManagementClient class. */ +public interface BlockchainManagementClient { + /** + * Gets Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is + * part of the URI for every service call. + * + * @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 BlockchainMembersClient object to access its operations. + * + * @return the BlockchainMembersClient object. + */ + BlockchainMembersClient getBlockchainMembers(); + + /** + * Gets the BlockchainMemberOperationResultsClient object to access its operations. + * + * @return the BlockchainMemberOperationResultsClient object. + */ + BlockchainMemberOperationResultsClient getBlockchainMemberOperationResults(); + + /** + * Gets the LocationsClient object to access its operations. + * + * @return the LocationsClient object. + */ + LocationsClient getLocations(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the SkusClient object to access its operations. + * + * @return the SkusClient object. + */ + SkusClient getSkus(); + + /** + * Gets the TransactionNodesClient object to access its operations. + * + * @return the TransactionNodesClient object. + */ + TransactionNodesClient getTransactionNodes(); +} diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/fluent/BlockchainMemberOperationResultsClient.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/fluent/BlockchainMemberOperationResultsClient.java new file mode 100644 index 000000000000..a9c4f848c13c --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/fluent/BlockchainMemberOperationResultsClient.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.blockchain.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.blockchain.fluent.models.OperationResultInner; + +/** + * An instance of this class provides access to all the operations defined in BlockchainMemberOperationResultsClient. + */ +public interface BlockchainMemberOperationResultsClient { + /** + * Get Async operation result. + * + * @param locationName Location name. + * @param operationId Operation 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 async operation result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OperationResultInner get(String locationName, String operationId); + + /** + * Get Async operation result. + * + * @param locationName Location name. + * @param operationId Operation 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 async operation result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String locationName, String operationId, Context context); +} diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/fluent/BlockchainMembersClient.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/fluent/BlockchainMembersClient.java new file mode 100644 index 000000000000..4ee93f63fed3 --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/fluent/BlockchainMembersClient.java @@ -0,0 +1,366 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.blockchain.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.blockchain.fluent.models.ApiKeyCollectionInner; +import com.azure.resourcemanager.blockchain.fluent.models.BlockchainMemberInner; +import com.azure.resourcemanager.blockchain.fluent.models.ConsortiumMemberInner; +import com.azure.resourcemanager.blockchain.models.ApiKey; +import com.azure.resourcemanager.blockchain.models.BlockchainMemberUpdate; + +/** An instance of this class provides access to all the operations defined in BlockchainMembersClient. */ +public interface BlockchainMembersClient { + /** + * Get details about a blockchain member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param blockchainMemberName Blockchain member name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return details about a blockchain member. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BlockchainMemberInner getByResourceGroup(String resourceGroupName, String blockchainMemberName); + + /** + * Get details about a blockchain member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param blockchainMemberName Blockchain member name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return details about a blockchain member. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String blockchainMemberName, Context context); + + /** + * Create a blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param blockchainMember Payload to create a blockchain member. + * @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 payload of the blockchain member which is exposed in the request/response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, BlockchainMemberInner> beginCreate( + String blockchainMemberName, String resourceGroupName, BlockchainMemberInner blockchainMember); + + /** + * Create a blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param blockchainMember Payload to create a blockchain member. + * @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 payload of the blockchain member which is exposed in the request/response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, BlockchainMemberInner> beginCreate( + String blockchainMemberName, String resourceGroupName, BlockchainMemberInner blockchainMember, Context context); + + /** + * Create a blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param blockchainMember Payload to create a blockchain member. + * @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 payload of the blockchain member which is exposed in the request/response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BlockchainMemberInner create( + String blockchainMemberName, String resourceGroupName, BlockchainMemberInner blockchainMember); + + /** + * Create a blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @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 payload of the blockchain member which is exposed in the request/response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BlockchainMemberInner create(String blockchainMemberName, String resourceGroupName); + + /** + * Create a blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param blockchainMember Payload to create a blockchain member. + * @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 payload of the blockchain member which is exposed in the request/response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BlockchainMemberInner create( + String blockchainMemberName, String resourceGroupName, BlockchainMemberInner blockchainMember, Context context); + + /** + * Delete a blockchain member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param blockchainMemberName Blockchain member name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete(String resourceGroupName, String blockchainMemberName); + + /** + * Delete a blockchain member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param blockchainMemberName Blockchain member name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String blockchainMemberName, Context context); + + /** + * Delete a blockchain member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param blockchainMemberName Blockchain member name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String blockchainMemberName); + + /** + * Delete a blockchain member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param blockchainMemberName Blockchain member name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String blockchainMemberName, Context context); + + /** + * Update a blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @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 payload of the blockchain member which is exposed in the request/response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BlockchainMemberInner update(String blockchainMemberName, String resourceGroupName); + + /** + * Update a blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param blockchainMember Payload to update the blockchain member. + * @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 payload of the blockchain member which is exposed in the request/response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String blockchainMemberName, + String resourceGroupName, + BlockchainMemberUpdate blockchainMember, + Context context); + + /** + * Lists the blockchain members for a resource group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @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 collection of the blockchain member payload which is exposed in the request/response of the resource + * provider. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists the blockchain members for a resource group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @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 collection of the blockchain member payload which is exposed in the request/response of the resource + * provider. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Lists the blockchain members for a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return collection of the blockchain member payload which is exposed in the request/response of the resource + * provider. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists the blockchain members for a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return collection of the blockchain member payload which is exposed in the request/response of the resource + * provider. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Lists the consortium members for a blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @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 collection of consortium payload. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listConsortiumMembers(String blockchainMemberName, String resourceGroupName); + + /** + * Lists the consortium members for a blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @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 collection of consortium payload. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listConsortiumMembers( + String blockchainMemberName, String resourceGroupName, Context context); + + /** + * Lists the API keys for a blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @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 collection of the API key payload which is exposed in the response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApiKeyCollectionInner listApiKeys(String blockchainMemberName, String resourceGroupName); + + /** + * Lists the API keys for a blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @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 collection of the API key payload which is exposed in the response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listApiKeysWithResponse( + String blockchainMemberName, String resourceGroupName, Context context); + + /** + * Regenerate the API keys for a blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @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 collection of the API key payload which is exposed in the response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApiKeyCollectionInner listRegenerateApiKeys(String blockchainMemberName, String resourceGroupName); + + /** + * Regenerate the API keys for a blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param apiKey api key to be regenerate. + * @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 collection of the API key payload which is exposed in the response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listRegenerateApiKeysWithResponse( + String blockchainMemberName, String resourceGroupName, ApiKey apiKey, Context context); +} diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/fluent/LocationsClient.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/fluent/LocationsClient.java new file mode 100644 index 000000000000..08398ad85ff5 --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/fluent/LocationsClient.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.blockchain.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.blockchain.fluent.models.ConsortiumCollectionInner; +import com.azure.resourcemanager.blockchain.fluent.models.NameAvailabilityInner; +import com.azure.resourcemanager.blockchain.models.NameAvailabilityRequest; + +/** An instance of this class provides access to all the operations defined in LocationsClient. */ +public interface LocationsClient { + /** + * To check whether a resource name is available. + * + * @param locationName Location Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return name availability payload which is exposed in the response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NameAvailabilityInner checkNameAvailability(String locationName); + + /** + * To check whether a resource name is available. + * + * @param locationName Location Name. + * @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 name availability payload which is exposed in the response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response checkNameAvailabilityWithResponse( + String locationName, NameAvailabilityRequest nameAvailabilityRequest, Context context); + + /** + * Lists the available consortiums for a subscription. + * + * @param locationName Location Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return collection of the consortium payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ConsortiumCollectionInner listConsortiums(String locationName); + + /** + * Lists the available consortiums for a subscription. + * + * @param locationName Location Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return collection of the consortium payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listConsortiumsWithResponse(String locationName, Context context); +} diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/fluent/OperationsClient.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/fluent/OperationsClient.java new file mode 100644 index 000000000000..b1365180f118 --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/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.blockchain.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.blockchain.fluent.models.ResourceProviderOperationInner; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public interface OperationsClient { + /** + * Lists the available operations of Microsoft.Blockchain resource provider. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return collection of operation payload which is exposed in the response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists the available operations of Microsoft.Blockchain resource provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return collection of operation payload which is exposed in the response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/fluent/SkusClient.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/fluent/SkusClient.java new file mode 100644 index 000000000000..3350f14411d6 --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/fluent/SkusClient.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.blockchain.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.blockchain.fluent.models.ResourceTypeSkuCollectionInner; + +/** An instance of this class provides access to all the operations defined in SkusClient. */ +public interface SkusClient { + /** + * Lists the Skus of the resource type. + * + * @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 collection of the resource type Sku. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ResourceTypeSkuCollectionInner list(); + + /** + * Lists the Skus of the resource type. + * + * @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 collection of the resource type Sku. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listWithResponse(Context context); +} diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/fluent/TransactionNodesClient.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/fluent/TransactionNodesClient.java new file mode 100644 index 000000000000..176ddc8b4674 --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/fluent/TransactionNodesClient.java @@ -0,0 +1,350 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.blockchain.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.blockchain.fluent.models.ApiKeyCollectionInner; +import com.azure.resourcemanager.blockchain.fluent.models.TransactionNodeInner; +import com.azure.resourcemanager.blockchain.models.ApiKey; +import com.azure.resourcemanager.blockchain.models.TransactionNodeUpdate; + +/** An instance of this class provides access to all the operations defined in TransactionNodesClient. */ +public interface TransactionNodesClient { + /** + * Get the details of the transaction node. + * + * @param blockchainMemberName Blockchain member name. + * @param transactionNodeName Transaction node name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @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 details of the transaction node. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TransactionNodeInner get(String blockchainMemberName, String transactionNodeName, String resourceGroupName); + + /** + * Get the details of the transaction node. + * + * @param blockchainMemberName Blockchain member name. + * @param transactionNodeName Transaction node name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @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 details of the transaction node. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String blockchainMemberName, String transactionNodeName, String resourceGroupName, Context context); + + /** + * Create or update the transaction node. + * + * @param blockchainMemberName Blockchain member name. + * @param transactionNodeName Transaction node name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param transactionNode Payload to create the transaction node. + * @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 payload of the transaction node which is the request/response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, TransactionNodeInner> beginCreate( + String blockchainMemberName, + String transactionNodeName, + String resourceGroupName, + TransactionNodeInner transactionNode); + + /** + * Create or update the transaction node. + * + * @param blockchainMemberName Blockchain member name. + * @param transactionNodeName Transaction node name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param transactionNode Payload to create the transaction node. + * @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 payload of the transaction node which is the request/response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, TransactionNodeInner> beginCreate( + String blockchainMemberName, + String transactionNodeName, + String resourceGroupName, + TransactionNodeInner transactionNode, + Context context); + + /** + * Create or update the transaction node. + * + * @param blockchainMemberName Blockchain member name. + * @param transactionNodeName Transaction node name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param transactionNode Payload to create the transaction node. + * @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 payload of the transaction node which is the request/response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TransactionNodeInner create( + String blockchainMemberName, + String transactionNodeName, + String resourceGroupName, + TransactionNodeInner transactionNode); + + /** + * Create or update the transaction node. + * + * @param blockchainMemberName Blockchain member name. + * @param transactionNodeName Transaction node name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @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 payload of the transaction node which is the request/response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TransactionNodeInner create(String blockchainMemberName, String transactionNodeName, String resourceGroupName); + + /** + * Create or update the transaction node. + * + * @param blockchainMemberName Blockchain member name. + * @param transactionNodeName Transaction node name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param transactionNode Payload to create the transaction node. + * @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 payload of the transaction node which is the request/response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TransactionNodeInner create( + String blockchainMemberName, + String transactionNodeName, + String resourceGroupName, + TransactionNodeInner transactionNode, + Context context); + + /** + * Delete the transaction node. + * + * @param blockchainMemberName Blockchain member name. + * @param transactionNodeName Transaction node name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @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 blockchainMemberName, String transactionNodeName, String resourceGroupName); + + /** + * Delete the transaction node. + * + * @param blockchainMemberName Blockchain member name. + * @param transactionNodeName Transaction node name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @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 blockchainMemberName, String transactionNodeName, String resourceGroupName, Context context); + + /** + * Delete the transaction node. + * + * @param blockchainMemberName Blockchain member name. + * @param transactionNodeName Transaction node name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @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 blockchainMemberName, String transactionNodeName, String resourceGroupName); + + /** + * Delete the transaction node. + * + * @param blockchainMemberName Blockchain member name. + * @param transactionNodeName Transaction node name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @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 blockchainMemberName, String transactionNodeName, String resourceGroupName, Context context); + + /** + * Update the transaction node. + * + * @param blockchainMemberName Blockchain member name. + * @param transactionNodeName Transaction node name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @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 payload of the transaction node which is the request/response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TransactionNodeInner update(String blockchainMemberName, String transactionNodeName, String resourceGroupName); + + /** + * Update the transaction node. + * + * @param blockchainMemberName Blockchain member name. + * @param transactionNodeName Transaction node name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param transactionNode Payload to create the transaction node. + * @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 payload of the transaction node which is the request/response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String blockchainMemberName, + String transactionNodeName, + String resourceGroupName, + TransactionNodeUpdate transactionNode, + Context context); + + /** + * Lists the transaction nodes for a blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @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 collection of transaction node payload which is exposed in the request/response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String blockchainMemberName, String resourceGroupName); + + /** + * Lists the transaction nodes for a blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @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 collection of transaction node payload which is exposed in the request/response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String blockchainMemberName, String resourceGroupName, Context context); + + /** + * List the API keys for the transaction node. + * + * @param blockchainMemberName Blockchain member name. + * @param transactionNodeName Transaction node name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @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 collection of the API key payload which is exposed in the response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApiKeyCollectionInner listApiKeys( + String blockchainMemberName, String transactionNodeName, String resourceGroupName); + + /** + * List the API keys for the transaction node. + * + * @param blockchainMemberName Blockchain member name. + * @param transactionNodeName Transaction node name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @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 collection of the API key payload which is exposed in the response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listApiKeysWithResponse( + String blockchainMemberName, String transactionNodeName, String resourceGroupName, Context context); + + /** + * Regenerate the API keys for the blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param transactionNodeName Transaction node name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @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 collection of the API key payload which is exposed in the response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApiKeyCollectionInner listRegenerateApiKeys( + String blockchainMemberName, String transactionNodeName, String resourceGroupName); + + /** + * Regenerate the API keys for the blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param transactionNodeName Transaction node name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param apiKey api key to be regenerated. + * @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 collection of the API key payload which is exposed in the response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listRegenerateApiKeysWithResponse( + String blockchainMemberName, + String transactionNodeName, + String resourceGroupName, + ApiKey apiKey, + Context context); +} diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/fluent/models/ApiKeyCollectionInner.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/fluent/models/ApiKeyCollectionInner.java new file mode 100644 index 000000000000..e35a5a6cf228 --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/fluent/models/ApiKeyCollectionInner.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.blockchain.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.blockchain.models.ApiKey; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Collection of the API key payload which is exposed in the response of the resource provider. */ +@Fluent +public final class ApiKeyCollectionInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ApiKeyCollectionInner.class); + + /* + * Gets or sets the collection of API key. + */ + @JsonProperty(value = "keys") + private List keys; + + /** + * Get the keys property: Gets or sets the collection of API key. + * + * @return the keys value. + */ + public List keys() { + return this.keys; + } + + /** + * Set the keys property: Gets or sets the collection of API key. + * + * @param keys the keys value to set. + * @return the ApiKeyCollectionInner object itself. + */ + public ApiKeyCollectionInner withKeys(List keys) { + this.keys = keys; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (keys() != null) { + keys().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/fluent/models/BlockchainMemberInner.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/fluent/models/BlockchainMemberInner.java new file mode 100644 index 000000000000..657968ee10ba --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/fluent/models/BlockchainMemberInner.java @@ -0,0 +1,381 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.blockchain.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.blockchain.models.BlockchainMemberNodesSku; +import com.azure.resourcemanager.blockchain.models.BlockchainMemberProvisioningState; +import com.azure.resourcemanager.blockchain.models.BlockchainProtocol; +import com.azure.resourcemanager.blockchain.models.FirewallRule; +import com.azure.resourcemanager.blockchain.models.Sku; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** Payload of the blockchain member which is exposed in the request/response of the resource provider. */ +@JsonFlatten +@Fluent +public class BlockchainMemberInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BlockchainMemberInner.class); + + /* + * Gets or sets the blockchain member Sku. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /* + * Gets or sets the blockchain protocol. + */ + @JsonProperty(value = "properties.protocol") + private BlockchainProtocol protocol; + + /* + * Gets or sets the blockchain validator nodes Sku. + */ + @JsonProperty(value = "properties.validatorNodesSku") + private BlockchainMemberNodesSku validatorNodesSku; + + /* + * Gets or sets the blockchain member provision state. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private BlockchainMemberProvisioningState provisioningState; + + /* + * Gets the dns endpoint of the blockchain member. + */ + @JsonProperty(value = "properties.dns", access = JsonProperty.Access.WRITE_ONLY) + private String dns; + + /* + * Gets the auth user name of the blockchain member. + */ + @JsonProperty(value = "properties.userName", access = JsonProperty.Access.WRITE_ONLY) + private String username; + + /* + * Sets the basic auth password of the blockchain member. + */ + @JsonProperty(value = "properties.password") + private String password; + + /* + * Gets or sets the consortium for the blockchain member. + */ + @JsonProperty(value = "properties.consortium") + private String consortium; + + /* + * Gets the managed consortium management account address. + */ + @JsonProperty(value = "properties.consortiumManagementAccountAddress", access = JsonProperty.Access.WRITE_ONLY) + private String consortiumManagementAccountAddress; + + /* + * Sets the managed consortium management account password. + */ + @JsonProperty(value = "properties.consortiumManagementAccountPassword") + private String consortiumManagementAccountPassword; + + /* + * Gets the role of the member in the consortium. + */ + @JsonProperty(value = "properties.consortiumRole") + private String consortiumRole; + + /* + * Gets the display name of the member in the consortium. + */ + @JsonProperty(value = "properties.consortiumMemberDisplayName") + private String consortiumMemberDisplayName; + + /* + * Gets the Ethereum root contract address of the blockchain. + */ + @JsonProperty(value = "properties.rootContractAddress", access = JsonProperty.Access.WRITE_ONLY) + private String rootContractAddress; + + /* + * Gets the public key of the blockchain member (default transaction node). + */ + @JsonProperty(value = "properties.publicKey", access = JsonProperty.Access.WRITE_ONLY) + private String publicKey; + + /* + * Gets or sets firewall rules + */ + @JsonProperty(value = "properties.firewallRules") + private List firewallRules; + + /** + * Get the sku property: Gets or sets the blockchain member Sku. + * + * @return the sku value. + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku property: Gets or sets the blockchain member Sku. + * + * @param sku the sku value to set. + * @return the BlockchainMemberInner object itself. + */ + public BlockchainMemberInner withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get the protocol property: Gets or sets the blockchain protocol. + * + * @return the protocol value. + */ + public BlockchainProtocol protocol() { + return this.protocol; + } + + /** + * Set the protocol property: Gets or sets the blockchain protocol. + * + * @param protocol the protocol value to set. + * @return the BlockchainMemberInner object itself. + */ + public BlockchainMemberInner withProtocol(BlockchainProtocol protocol) { + this.protocol = protocol; + return this; + } + + /** + * Get the validatorNodesSku property: Gets or sets the blockchain validator nodes Sku. + * + * @return the validatorNodesSku value. + */ + public BlockchainMemberNodesSku validatorNodesSku() { + return this.validatorNodesSku; + } + + /** + * Set the validatorNodesSku property: Gets or sets the blockchain validator nodes Sku. + * + * @param validatorNodesSku the validatorNodesSku value to set. + * @return the BlockchainMemberInner object itself. + */ + public BlockchainMemberInner withValidatorNodesSku(BlockchainMemberNodesSku validatorNodesSku) { + this.validatorNodesSku = validatorNodesSku; + return this; + } + + /** + * Get the provisioningState property: Gets or sets the blockchain member provision state. + * + * @return the provisioningState value. + */ + public BlockchainMemberProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the dns property: Gets the dns endpoint of the blockchain member. + * + * @return the dns value. + */ + public String dns() { + return this.dns; + } + + /** + * Get the username property: Gets the auth user name of the blockchain member. + * + * @return the username value. + */ + public String username() { + return this.username; + } + + /** + * Get the password property: Sets the basic auth password of the blockchain member. + * + * @return the password value. + */ + public String password() { + return this.password; + } + + /** + * Set the password property: Sets the basic auth password of the blockchain member. + * + * @param password the password value to set. + * @return the BlockchainMemberInner object itself. + */ + public BlockchainMemberInner withPassword(String password) { + this.password = password; + return this; + } + + /** + * Get the consortium property: Gets or sets the consortium for the blockchain member. + * + * @return the consortium value. + */ + public String consortium() { + return this.consortium; + } + + /** + * Set the consortium property: Gets or sets the consortium for the blockchain member. + * + * @param consortium the consortium value to set. + * @return the BlockchainMemberInner object itself. + */ + public BlockchainMemberInner withConsortium(String consortium) { + this.consortium = consortium; + return this; + } + + /** + * Get the consortiumManagementAccountAddress property: Gets the managed consortium management account address. + * + * @return the consortiumManagementAccountAddress value. + */ + public String consortiumManagementAccountAddress() { + return this.consortiumManagementAccountAddress; + } + + /** + * Get the consortiumManagementAccountPassword property: Sets the managed consortium management account password. + * + * @return the consortiumManagementAccountPassword value. + */ + public String consortiumManagementAccountPassword() { + return this.consortiumManagementAccountPassword; + } + + /** + * Set the consortiumManagementAccountPassword property: Sets the managed consortium management account password. + * + * @param consortiumManagementAccountPassword the consortiumManagementAccountPassword value to set. + * @return the BlockchainMemberInner object itself. + */ + public BlockchainMemberInner withConsortiumManagementAccountPassword(String consortiumManagementAccountPassword) { + this.consortiumManagementAccountPassword = consortiumManagementAccountPassword; + return this; + } + + /** + * Get the consortiumRole property: Gets the role of the member in the consortium. + * + * @return the consortiumRole value. + */ + public String consortiumRole() { + return this.consortiumRole; + } + + /** + * Set the consortiumRole property: Gets the role of the member in the consortium. + * + * @param consortiumRole the consortiumRole value to set. + * @return the BlockchainMemberInner object itself. + */ + public BlockchainMemberInner withConsortiumRole(String consortiumRole) { + this.consortiumRole = consortiumRole; + return this; + } + + /** + * Get the consortiumMemberDisplayName property: Gets the display name of the member in the consortium. + * + * @return the consortiumMemberDisplayName value. + */ + public String consortiumMemberDisplayName() { + return this.consortiumMemberDisplayName; + } + + /** + * Set the consortiumMemberDisplayName property: Gets the display name of the member in the consortium. + * + * @param consortiumMemberDisplayName the consortiumMemberDisplayName value to set. + * @return the BlockchainMemberInner object itself. + */ + public BlockchainMemberInner withConsortiumMemberDisplayName(String consortiumMemberDisplayName) { + this.consortiumMemberDisplayName = consortiumMemberDisplayName; + return this; + } + + /** + * Get the rootContractAddress property: Gets the Ethereum root contract address of the blockchain. + * + * @return the rootContractAddress value. + */ + public String rootContractAddress() { + return this.rootContractAddress; + } + + /** + * Get the publicKey property: Gets the public key of the blockchain member (default transaction node). + * + * @return the publicKey value. + */ + public String publicKey() { + return this.publicKey; + } + + /** + * Get the firewallRules property: Gets or sets firewall rules. + * + * @return the firewallRules value. + */ + public List firewallRules() { + return this.firewallRules; + } + + /** + * Set the firewallRules property: Gets or sets firewall rules. + * + * @param firewallRules the firewallRules value to set. + * @return the BlockchainMemberInner object itself. + */ + public BlockchainMemberInner withFirewallRules(List firewallRules) { + this.firewallRules = firewallRules; + return this; + } + + /** {@inheritDoc} */ + @Override + public BlockchainMemberInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public BlockchainMemberInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sku() != null) { + sku().validate(); + } + if (validatorNodesSku() != null) { + validatorNodesSku().validate(); + } + if (firewallRules() != null) { + firewallRules().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/fluent/models/ConsortiumCollectionInner.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/fluent/models/ConsortiumCollectionInner.java new file mode 100644 index 000000000000..f014c9703b96 --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/fluent/models/ConsortiumCollectionInner.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.blockchain.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.blockchain.models.Consortium; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Collection of the consortium payload. */ +@Fluent +public final class ConsortiumCollectionInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ConsortiumCollectionInner.class); + + /* + * Gets or sets the collection of consortiums. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: Gets or sets the collection of consortiums. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Gets or sets the collection of consortiums. + * + * @param value the value value to set. + * @return the ConsortiumCollectionInner object itself. + */ + public ConsortiumCollectionInner withValue(List value) { + this.value = value; + 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/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/fluent/models/ConsortiumMemberInner.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/fluent/models/ConsortiumMemberInner.java new file mode 100644 index 000000000000..10c5f1c5cd27 --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/fluent/models/ConsortiumMemberInner.java @@ -0,0 +1,207 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.blockchain.fluent.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.time.OffsetDateTime; + +/** Consortium approval. */ +@Fluent +public final class ConsortiumMemberInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ConsortiumMemberInner.class); + + /* + * Gets the consortium member name. + */ + @JsonProperty(value = "name") + private String name; + + /* + * Gets the consortium member display name. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /* + * Gets the consortium member subscription id. + */ + @JsonProperty(value = "subscriptionId") + private String subscriptionId; + + /* + * Gets the consortium member role. + */ + @JsonProperty(value = "role") + private String role; + + /* + * Gets the consortium member status. + */ + @JsonProperty(value = "status") + private String status; + + /* + * Gets the consortium member join date. + */ + @JsonProperty(value = "joinDate") + private OffsetDateTime joinDate; + + /* + * Gets the consortium member modified date. + */ + @JsonProperty(value = "dateModified") + private OffsetDateTime dateModified; + + /** + * Get the name property: Gets the consortium member name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Gets the consortium member name. + * + * @param name the name value to set. + * @return the ConsortiumMemberInner object itself. + */ + public ConsortiumMemberInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the displayName property: Gets the consortium member display name. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: Gets the consortium member display name. + * + * @param displayName the displayName value to set. + * @return the ConsortiumMemberInner object itself. + */ + public ConsortiumMemberInner withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the subscriptionId property: Gets the consortium member subscription id. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Set the subscriptionId property: Gets the consortium member subscription id. + * + * @param subscriptionId the subscriptionId value to set. + * @return the ConsortiumMemberInner object itself. + */ + public ConsortiumMemberInner withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** + * Get the role property: Gets the consortium member role. + * + * @return the role value. + */ + public String role() { + return this.role; + } + + /** + * Set the role property: Gets the consortium member role. + * + * @param role the role value to set. + * @return the ConsortiumMemberInner object itself. + */ + public ConsortiumMemberInner withRole(String role) { + this.role = role; + return this; + } + + /** + * Get the status property: Gets the consortium member status. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Set the status property: Gets the consortium member status. + * + * @param status the status value to set. + * @return the ConsortiumMemberInner object itself. + */ + public ConsortiumMemberInner withStatus(String status) { + this.status = status; + return this; + } + + /** + * Get the joinDate property: Gets the consortium member join date. + * + * @return the joinDate value. + */ + public OffsetDateTime joinDate() { + return this.joinDate; + } + + /** + * Set the joinDate property: Gets the consortium member join date. + * + * @param joinDate the joinDate value to set. + * @return the ConsortiumMemberInner object itself. + */ + public ConsortiumMemberInner withJoinDate(OffsetDateTime joinDate) { + this.joinDate = joinDate; + return this; + } + + /** + * Get the dateModified property: Gets the consortium member modified date. + * + * @return the dateModified value. + */ + public OffsetDateTime dateModified() { + return this.dateModified; + } + + /** + * Set the dateModified property: Gets the consortium member modified date. + * + * @param dateModified the dateModified value to set. + * @return the ConsortiumMemberInner object itself. + */ + public ConsortiumMemberInner withDateModified(OffsetDateTime dateModified) { + this.dateModified = dateModified; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/fluent/models/NameAvailabilityInner.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/fluent/models/NameAvailabilityInner.java new file mode 100644 index 000000000000..ac7a1b684058 --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/fluent/models/NameAvailabilityInner.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.blockchain.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.blockchain.models.NameAvailabilityReason; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Name availability payload which is exposed in the response of the resource provider. */ +@Fluent +public final class NameAvailabilityInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(NameAvailabilityInner.class); + + /* + * Gets or sets the value indicating whether the name is available. + */ + @JsonProperty(value = "nameAvailable") + private Boolean nameAvailable; + + /* + * Gets or sets the message. + */ + @JsonProperty(value = "message") + private String message; + + /* + * Gets or sets the name availability reason. + */ + @JsonProperty(value = "reason") + private NameAvailabilityReason reason; + + /** + * Get the nameAvailable property: Gets or sets the value indicating whether the name is available. + * + * @return the nameAvailable value. + */ + public Boolean nameAvailable() { + return this.nameAvailable; + } + + /** + * Set the nameAvailable property: Gets or sets the value indicating whether the name is available. + * + * @param nameAvailable the nameAvailable value to set. + * @return the NameAvailabilityInner object itself. + */ + public NameAvailabilityInner withNameAvailable(Boolean nameAvailable) { + this.nameAvailable = nameAvailable; + return this; + } + + /** + * Get the message property: Gets or sets the message. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: Gets or sets the message. + * + * @param message the message value to set. + * @return the NameAvailabilityInner object itself. + */ + public NameAvailabilityInner withMessage(String message) { + this.message = message; + return this; + } + + /** + * Get the reason property: Gets or sets the name availability reason. + * + * @return the reason value. + */ + public NameAvailabilityReason reason() { + return this.reason; + } + + /** + * Set the reason property: Gets or sets the name availability reason. + * + * @param reason the reason value to set. + * @return the NameAvailabilityInner object itself. + */ + public NameAvailabilityInner withReason(NameAvailabilityReason reason) { + this.reason = reason; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/fluent/models/OperationResultInner.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/fluent/models/OperationResultInner.java new file mode 100644 index 000000000000..e27d51147e27 --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/fluent/models/OperationResultInner.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.blockchain.fluent.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.time.OffsetDateTime; + +/** Operation result payload which is exposed in the response of the resource provider. */ +@Fluent +public final class OperationResultInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationResultInner.class); + + /* + * Gets or sets the operation name. + */ + @JsonProperty(value = "name") + private String name; + + /* + * Gets or sets the operation start time. + */ + @JsonProperty(value = "startTime") + private OffsetDateTime startTime; + + /* + * Gets or sets the operation end time. + */ + @JsonProperty(value = "endTime") + private OffsetDateTime endTime; + + /** + * Get the name property: Gets or sets the operation name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Gets or sets the operation name. + * + * @param name the name value to set. + * @return the OperationResultInner object itself. + */ + public OperationResultInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the startTime property: Gets or sets the operation start time. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Set the startTime property: Gets or sets the operation start time. + * + * @param startTime the startTime value to set. + * @return the OperationResultInner object itself. + */ + public OperationResultInner withStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get the endTime property: Gets or sets the operation end time. + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.endTime; + } + + /** + * Set the endTime property: Gets or sets the operation end time. + * + * @param endTime the endTime value to set. + * @return the OperationResultInner object itself. + */ + public OperationResultInner withEndTime(OffsetDateTime endTime) { + this.endTime = endTime; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/fluent/models/ResourceProviderOperationInner.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/fluent/models/ResourceProviderOperationInner.java new file mode 100644 index 000000000000..6e2434e09e81 --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/fluent/models/ResourceProviderOperationInner.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.blockchain.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.blockchain.models.ResourceProviderOperationDisplay; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Operation payload which is exposed in the response of the resource provider. */ +@Fluent +public final class ResourceProviderOperationInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceProviderOperationInner.class); + + /* + * Gets or sets the origin. + */ + @JsonProperty(value = "origin") + private String origin; + + /* + * Gets or sets the operation name. + */ + @JsonProperty(value = "name") + private String name; + + /* + * Gets or sets a value indicating whether the operation is a data action + * or not. + */ + @JsonProperty(value = "isDataAction") + private Boolean isDataAction; + + /* + * Gets or sets operation display + */ + @JsonProperty(value = "display") + private ResourceProviderOperationDisplay display; + + /** + * Get the origin property: Gets or sets the origin. + * + * @return the origin value. + */ + public String origin() { + return this.origin; + } + + /** + * Set the origin property: Gets or sets the origin. + * + * @param origin the origin value to set. + * @return the ResourceProviderOperationInner object itself. + */ + public ResourceProviderOperationInner withOrigin(String origin) { + this.origin = origin; + return this; + } + + /** + * Get the name property: Gets or sets the operation name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Gets or sets the operation name. + * + * @param name the name value to set. + * @return the ResourceProviderOperationInner object itself. + */ + public ResourceProviderOperationInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the isDataAction property: Gets or sets a value indicating whether the operation is a data action or not. + * + * @return the isDataAction value. + */ + public Boolean isDataAction() { + return this.isDataAction; + } + + /** + * Set the isDataAction property: Gets or sets a value indicating whether the operation is a data action or not. + * + * @param isDataAction the isDataAction value to set. + * @return the ResourceProviderOperationInner object itself. + */ + public ResourceProviderOperationInner withIsDataAction(Boolean isDataAction) { + this.isDataAction = isDataAction; + return this; + } + + /** + * Get the display property: Gets or sets operation display. + * + * @return the display value. + */ + public ResourceProviderOperationDisplay display() { + return this.display; + } + + /** + * Set the display property: Gets or sets operation display. + * + * @param display the display value to set. + * @return the ResourceProviderOperationInner object itself. + */ + public ResourceProviderOperationInner 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/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/fluent/models/ResourceTypeSkuCollectionInner.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/fluent/models/ResourceTypeSkuCollectionInner.java new file mode 100644 index 000000000000..3fc0005a8a30 --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/fluent/models/ResourceTypeSkuCollectionInner.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.blockchain.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.blockchain.models.ResourceTypeSku; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Collection of the resource type Sku. */ +@Fluent +public final class ResourceTypeSkuCollectionInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceTypeSkuCollectionInner.class); + + /* + * Gets or sets the collection of resource type Sku. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: Gets or sets the collection of resource type Sku. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Gets or sets the collection of resource type Sku. + * + * @param value the value value to set. + * @return the ResourceTypeSkuCollectionInner object itself. + */ + public ResourceTypeSkuCollectionInner withValue(List value) { + this.value = value; + 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/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/fluent/models/TransactionNodeInner.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/fluent/models/TransactionNodeInner.java new file mode 100644 index 000000000000..c8ded751ab48 --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/fluent/models/TransactionNodeInner.java @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.blockchain.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.blockchain.models.FirewallRule; +import com.azure.resourcemanager.blockchain.models.NodeProvisioningState; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Payload of the transaction node which is the request/response of the resource provider. */ +@JsonFlatten +@Fluent +public class TransactionNodeInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TransactionNodeInner.class); + + /* + * Gets or sets the transaction node location. + */ + @JsonProperty(value = "location") + private String location; + + /* + * Gets or sets the blockchain member provision state. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private NodeProvisioningState provisioningState; + + /* + * Gets or sets the transaction node dns endpoint. + */ + @JsonProperty(value = "properties.dns", access = JsonProperty.Access.WRITE_ONLY) + private String dns; + + /* + * Gets or sets the transaction node public key. + */ + @JsonProperty(value = "properties.publicKey", access = JsonProperty.Access.WRITE_ONLY) + private String publicKey; + + /* + * Gets or sets the transaction node dns endpoint basic auth user name. + */ + @JsonProperty(value = "properties.userName", access = JsonProperty.Access.WRITE_ONLY) + private String username; + + /* + * Sets the transaction node dns endpoint basic auth password. + */ + @JsonProperty(value = "properties.password") + private String password; + + /* + * Gets or sets the firewall rules. + */ + @JsonProperty(value = "properties.firewallRules") + private List firewallRules; + + /** + * Get the location property: Gets or sets the transaction node location. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: Gets or sets the transaction node location. + * + * @param location the location value to set. + * @return the TransactionNodeInner object itself. + */ + public TransactionNodeInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the provisioningState property: Gets or sets the blockchain member provision state. + * + * @return the provisioningState value. + */ + public NodeProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the dns property: Gets or sets the transaction node dns endpoint. + * + * @return the dns value. + */ + public String dns() { + return this.dns; + } + + /** + * Get the publicKey property: Gets or sets the transaction node public key. + * + * @return the publicKey value. + */ + public String publicKey() { + return this.publicKey; + } + + /** + * Get the username property: Gets or sets the transaction node dns endpoint basic auth user name. + * + * @return the username value. + */ + public String username() { + return this.username; + } + + /** + * Get the password property: Sets the transaction node dns endpoint basic auth password. + * + * @return the password value. + */ + public String password() { + return this.password; + } + + /** + * Set the password property: Sets the transaction node dns endpoint basic auth password. + * + * @param password the password value to set. + * @return the TransactionNodeInner object itself. + */ + public TransactionNodeInner withPassword(String password) { + this.password = password; + return this; + } + + /** + * Get the firewallRules property: Gets or sets the firewall rules. + * + * @return the firewallRules value. + */ + public List firewallRules() { + return this.firewallRules; + } + + /** + * Set the firewallRules property: Gets or sets the firewall rules. + * + * @param firewallRules the firewallRules value to set. + * @return the TransactionNodeInner object itself. + */ + public TransactionNodeInner withFirewallRules(List firewallRules) { + this.firewallRules = firewallRules; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (firewallRules() != null) { + firewallRules().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/fluent/models/package-info.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/fluent/models/package-info.java new file mode 100644 index 000000000000..06451f36ccb8 --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/fluent/models/package-info.java @@ -0,0 +1,6 @@ +// 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 BlockchainManagementClient. REST API for Azure Blockchain Service. */ +package com.azure.resourcemanager.blockchain.fluent.models; diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/fluent/package-info.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/fluent/package-info.java new file mode 100644 index 000000000000..fe5535b55fb4 --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/fluent/package-info.java @@ -0,0 +1,6 @@ +// 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 BlockchainManagementClient. REST API for Azure Blockchain Service. */ +package com.azure.resourcemanager.blockchain.fluent; diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/ApiKeyCollectionImpl.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/ApiKeyCollectionImpl.java new file mode 100644 index 000000000000..79cf1e389a0e --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/ApiKeyCollectionImpl.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.blockchain.implementation; + +import com.azure.resourcemanager.blockchain.BlockchainManager; +import com.azure.resourcemanager.blockchain.fluent.models.ApiKeyCollectionInner; +import com.azure.resourcemanager.blockchain.models.ApiKey; +import com.azure.resourcemanager.blockchain.models.ApiKeyCollection; +import java.util.Collections; +import java.util.List; + +public final class ApiKeyCollectionImpl implements ApiKeyCollection { + private ApiKeyCollectionInner innerObject; + + private final BlockchainManager serviceManager; + + ApiKeyCollectionImpl(ApiKeyCollectionInner innerObject, BlockchainManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List keys() { + List inner = this.innerModel().keys(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public ApiKeyCollectionInner innerModel() { + return this.innerObject; + } + + private BlockchainManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/BlockchainManagementClientBuilder.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/BlockchainManagementClientBuilder.java new file mode 100644 index 000000000000..7e1a6dae58d5 --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/BlockchainManagementClientBuilder.java @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.blockchain.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 BlockchainManagementClientImpl type. */ +@ServiceClientBuilder(serviceClients = {BlockchainManagementClientImpl.class}) +public final class BlockchainManagementClientBuilder { + /* + * Gets the subscription Id which uniquely identifies the Microsoft Azure + * subscription. The subscription ID is part of the URI for every service + * call. + */ + private String subscriptionId; + + /** + * Sets Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is + * part of the URI for every service call. + * + * @param subscriptionId the subscriptionId value. + * @return the BlockchainManagementClientBuilder. + */ + public BlockchainManagementClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the BlockchainManagementClientBuilder. + */ + public BlockchainManagementClientBuilder 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 BlockchainManagementClientBuilder. + */ + public BlockchainManagementClientBuilder 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 BlockchainManagementClientBuilder. + */ + public BlockchainManagementClientBuilder 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 BlockchainManagementClientBuilder. + */ + public BlockchainManagementClientBuilder 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 BlockchainManagementClientBuilder. + */ + public BlockchainManagementClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of BlockchainManagementClientImpl with the provided parameters. + * + * @return an instance of BlockchainManagementClientImpl. + */ + public BlockchainManagementClientImpl 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(); + } + BlockchainManagementClientImpl client = + new BlockchainManagementClientImpl( + pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + return client; + } +} diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/BlockchainManagementClientImpl.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/BlockchainManagementClientImpl.java new file mode 100644 index 000000000000..2d01b35ba182 --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/BlockchainManagementClientImpl.java @@ -0,0 +1,368 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.blockchain.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.blockchain.fluent.BlockchainManagementClient; +import com.azure.resourcemanager.blockchain.fluent.BlockchainMemberOperationResultsClient; +import com.azure.resourcemanager.blockchain.fluent.BlockchainMembersClient; +import com.azure.resourcemanager.blockchain.fluent.LocationsClient; +import com.azure.resourcemanager.blockchain.fluent.OperationsClient; +import com.azure.resourcemanager.blockchain.fluent.SkusClient; +import com.azure.resourcemanager.blockchain.fluent.TransactionNodesClient; +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 BlockchainManagementClientImpl type. */ +@ServiceClient(builder = BlockchainManagementClientBuilder.class) +public final class BlockchainManagementClientImpl implements BlockchainManagementClient { + private final ClientLogger logger = new ClientLogger(BlockchainManagementClientImpl.class); + + /** + * Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is part + * of the URI for every service call. + */ + private final String subscriptionId; + + /** + * Gets Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The subscription ID is + * part of the URI for every service call. + * + * @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 BlockchainMembersClient object to access its operations. */ + private final BlockchainMembersClient blockchainMembers; + + /** + * Gets the BlockchainMembersClient object to access its operations. + * + * @return the BlockchainMembersClient object. + */ + public BlockchainMembersClient getBlockchainMembers() { + return this.blockchainMembers; + } + + /** The BlockchainMemberOperationResultsClient object to access its operations. */ + private final BlockchainMemberOperationResultsClient blockchainMemberOperationResults; + + /** + * Gets the BlockchainMemberOperationResultsClient object to access its operations. + * + * @return the BlockchainMemberOperationResultsClient object. + */ + public BlockchainMemberOperationResultsClient getBlockchainMemberOperationResults() { + return this.blockchainMemberOperationResults; + } + + /** The LocationsClient object to access its operations. */ + private final LocationsClient locations; + + /** + * Gets the LocationsClient object to access its operations. + * + * @return the LocationsClient object. + */ + public LocationsClient getLocations() { + return this.locations; + } + + /** 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 SkusClient object to access its operations. */ + private final SkusClient skus; + + /** + * Gets the SkusClient object to access its operations. + * + * @return the SkusClient object. + */ + public SkusClient getSkus() { + return this.skus; + } + + /** The TransactionNodesClient object to access its operations. */ + private final TransactionNodesClient transactionNodes; + + /** + * Gets the TransactionNodesClient object to access its operations. + * + * @return the TransactionNodesClient object. + */ + public TransactionNodesClient getTransactionNodes() { + return this.transactionNodes; + } + + /** + * Initializes an instance of BlockchainManagementClient 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 Gets the subscription Id which uniquely identifies the Microsoft Azure subscription. The + * subscription ID is part of the URI for every service call. + * @param endpoint server parameter. + */ + BlockchainManagementClientImpl( + 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 = "2018-06-01-preview"; + this.blockchainMembers = new BlockchainMembersClientImpl(this); + this.blockchainMemberOperationResults = new BlockchainMemberOperationResultsClientImpl(this); + this.locations = new LocationsClientImpl(this); + this.operations = new OperationsClientImpl(this); + this.skus = new SkusClientImpl(this); + this.transactionNodes = new TransactionNodesClientImpl(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/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/BlockchainMemberImpl.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/BlockchainMemberImpl.java new file mode 100644 index 000000000000..cd6b873bbe8a --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/BlockchainMemberImpl.java @@ -0,0 +1,327 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.blockchain.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.blockchain.BlockchainManager; +import com.azure.resourcemanager.blockchain.fluent.models.BlockchainMemberInner; +import com.azure.resourcemanager.blockchain.models.ApiKey; +import com.azure.resourcemanager.blockchain.models.ApiKeyCollection; +import com.azure.resourcemanager.blockchain.models.BlockchainMember; +import com.azure.resourcemanager.blockchain.models.BlockchainMemberNodesSku; +import com.azure.resourcemanager.blockchain.models.BlockchainMemberProvisioningState; +import com.azure.resourcemanager.blockchain.models.BlockchainMemberUpdate; +import com.azure.resourcemanager.blockchain.models.BlockchainProtocol; +import com.azure.resourcemanager.blockchain.models.FirewallRule; +import com.azure.resourcemanager.blockchain.models.Sku; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class BlockchainMemberImpl + implements BlockchainMember, BlockchainMember.Definition, BlockchainMember.Update { + private BlockchainMemberInner innerObject; + + private final BlockchainManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public Sku sku() { + return this.innerModel().sku(); + } + + public BlockchainProtocol protocol() { + return this.innerModel().protocol(); + } + + public BlockchainMemberNodesSku validatorNodesSku() { + return this.innerModel().validatorNodesSku(); + } + + public BlockchainMemberProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public String dns() { + return this.innerModel().dns(); + } + + public String username() { + return this.innerModel().username(); + } + + public String password() { + return this.innerModel().password(); + } + + public String consortium() { + return this.innerModel().consortium(); + } + + public String consortiumManagementAccountAddress() { + return this.innerModel().consortiumManagementAccountAddress(); + } + + public String consortiumManagementAccountPassword() { + return this.innerModel().consortiumManagementAccountPassword(); + } + + public String consortiumRole() { + return this.innerModel().consortiumRole(); + } + + public String consortiumMemberDisplayName() { + return this.innerModel().consortiumMemberDisplayName(); + } + + public String rootContractAddress() { + return this.innerModel().rootContractAddress(); + } + + public String publicKey() { + return this.innerModel().publicKey(); + } + + public List firewallRules() { + List inner = this.innerModel().firewallRules(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public BlockchainMemberInner innerModel() { + return this.innerObject; + } + + private BlockchainManager manager() { + return this.serviceManager; + } + + private String blockchainMemberName; + + private String resourceGroupName; + + private BlockchainMemberUpdate updateBlockchainMember; + + public BlockchainMemberImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public BlockchainMember create() { + this.innerObject = + serviceManager + .serviceClient() + .getBlockchainMembers() + .create(blockchainMemberName, resourceGroupName, this.innerModel(), Context.NONE); + return this; + } + + public BlockchainMember create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getBlockchainMembers() + .create(blockchainMemberName, resourceGroupName, this.innerModel(), context); + return this; + } + + BlockchainMemberImpl(String name, BlockchainManager serviceManager) { + this.innerObject = new BlockchainMemberInner(); + this.serviceManager = serviceManager; + this.blockchainMemberName = name; + } + + public BlockchainMemberImpl update() { + this.updateBlockchainMember = new BlockchainMemberUpdate(); + return this; + } + + public BlockchainMember apply() { + this.innerObject = + serviceManager + .serviceClient() + .getBlockchainMembers() + .updateWithResponse(blockchainMemberName, resourceGroupName, updateBlockchainMember, Context.NONE) + .getValue(); + return this; + } + + public BlockchainMember apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getBlockchainMembers() + .updateWithResponse(blockchainMemberName, resourceGroupName, updateBlockchainMember, context) + .getValue(); + return this; + } + + BlockchainMemberImpl(BlockchainMemberInner innerObject, BlockchainManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.blockchainMemberName = Utils.getValueFromIdByName(innerObject.id(), "blockchainMembers"); + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + } + + public BlockchainMember refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getBlockchainMembers() + .getByResourceGroupWithResponse(resourceGroupName, blockchainMemberName, Context.NONE) + .getValue(); + return this; + } + + public BlockchainMember refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getBlockchainMembers() + .getByResourceGroupWithResponse(resourceGroupName, blockchainMemberName, context) + .getValue(); + return this; + } + + public ApiKeyCollection listApiKeys() { + return serviceManager.blockchainMembers().listApiKeys(blockchainMemberName, resourceGroupName); + } + + public Response listApiKeysWithResponse(Context context) { + return serviceManager + .blockchainMembers() + .listApiKeysWithResponse(blockchainMemberName, resourceGroupName, context); + } + + public ApiKeyCollection listRegenerateApiKeys() { + return serviceManager.blockchainMembers().listRegenerateApiKeys(blockchainMemberName, resourceGroupName); + } + + public Response listRegenerateApiKeysWithResponse(ApiKey apiKey, Context context) { + return serviceManager + .blockchainMembers() + .listRegenerateApiKeysWithResponse(blockchainMemberName, resourceGroupName, apiKey, context); + } + + public BlockchainMemberImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public BlockchainMemberImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public BlockchainMemberImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateBlockchainMember.withTags(tags); + return this; + } + } + + public BlockchainMemberImpl withSku(Sku sku) { + this.innerModel().withSku(sku); + return this; + } + + public BlockchainMemberImpl withProtocol(BlockchainProtocol protocol) { + this.innerModel().withProtocol(protocol); + return this; + } + + public BlockchainMemberImpl withValidatorNodesSku(BlockchainMemberNodesSku validatorNodesSku) { + this.innerModel().withValidatorNodesSku(validatorNodesSku); + return this; + } + + public BlockchainMemberImpl withPassword(String password) { + if (isInCreateMode()) { + this.innerModel().withPassword(password); + return this; + } else { + this.updateBlockchainMember.withPassword(password); + return this; + } + } + + public BlockchainMemberImpl withConsortium(String consortium) { + this.innerModel().withConsortium(consortium); + return this; + } + + public BlockchainMemberImpl withConsortiumManagementAccountPassword(String consortiumManagementAccountPassword) { + if (isInCreateMode()) { + this.innerModel().withConsortiumManagementAccountPassword(consortiumManagementAccountPassword); + return this; + } else { + this.updateBlockchainMember.withConsortiumManagementAccountPassword(consortiumManagementAccountPassword); + return this; + } + } + + public BlockchainMemberImpl withConsortiumRole(String consortiumRole) { + this.innerModel().withConsortiumRole(consortiumRole); + return this; + } + + public BlockchainMemberImpl withConsortiumMemberDisplayName(String consortiumMemberDisplayName) { + this.innerModel().withConsortiumMemberDisplayName(consortiumMemberDisplayName); + return this; + } + + public BlockchainMemberImpl withFirewallRules(List firewallRules) { + if (isInCreateMode()) { + this.innerModel().withFirewallRules(firewallRules); + return this; + } else { + this.updateBlockchainMember.withFirewallRules(firewallRules); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/BlockchainMemberOperationResultsClientImpl.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/BlockchainMemberOperationResultsClientImpl.java new file mode 100644 index 000000000000..2214972756d5 --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/BlockchainMemberOperationResultsClientImpl.java @@ -0,0 +1,223 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.blockchain.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.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.blockchain.fluent.BlockchainMemberOperationResultsClient; +import com.azure.resourcemanager.blockchain.fluent.models.OperationResultInner; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in BlockchainMemberOperationResultsClient. + */ +public final class BlockchainMemberOperationResultsClientImpl implements BlockchainMemberOperationResultsClient { + private final ClientLogger logger = new ClientLogger(BlockchainMemberOperationResultsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final BlockchainMemberOperationResultsService service; + + /** The service client containing this operation class. */ + private final BlockchainManagementClientImpl client; + + /** + * Initializes an instance of BlockchainMemberOperationResultsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + BlockchainMemberOperationResultsClientImpl(BlockchainManagementClientImpl client) { + this.service = + RestProxy + .create( + BlockchainMemberOperationResultsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for BlockchainManagementClientBlockchainMemberOperationResults to be used + * by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "BlockchainManagement") + private interface BlockchainMemberOperationResultsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.Blockchain/locations/{locationName}" + + "/blockchainMemberOperationResults/{operationId}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("locationName") String locationName, + @PathParam("operationId") String operationId, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get Async operation result. + * + * @param locationName Location name. + * @param operationId Operation Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return async operation result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String locationName, String operationId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (operationId == null) { + return Mono.error(new IllegalArgumentException("Parameter operationId 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 + .get( + this.client.getEndpoint(), + locationName, + operationId, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get Async operation result. + * + * @param locationName Location name. + * @param operationId Operation Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return async operation result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String locationName, String operationId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (operationId == null) { + return Mono.error(new IllegalArgumentException("Parameter operationId 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 + .get( + this.client.getEndpoint(), + locationName, + operationId, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Get Async operation result. + * + * @param locationName Location name. + * @param operationId Operation Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return async operation result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String locationName, String operationId) { + return getWithResponseAsync(locationName, operationId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get Async operation result. + * + * @param locationName Location name. + * @param operationId Operation Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return async operation result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OperationResultInner get(String locationName, String operationId) { + return getAsync(locationName, operationId).block(); + } + + /** + * Get Async operation result. + * + * @param locationName Location name. + * @param operationId Operation Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return async operation result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String locationName, String operationId, Context context) { + return getWithResponseAsync(locationName, operationId, context).block(); + } +} diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/BlockchainMemberOperationResultsImpl.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/BlockchainMemberOperationResultsImpl.java new file mode 100644 index 000000000000..3b5b361df80c --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/BlockchainMemberOperationResultsImpl.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.blockchain.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.blockchain.BlockchainManager; +import com.azure.resourcemanager.blockchain.fluent.BlockchainMemberOperationResultsClient; +import com.azure.resourcemanager.blockchain.fluent.models.OperationResultInner; +import com.azure.resourcemanager.blockchain.models.BlockchainMemberOperationResults; +import com.azure.resourcemanager.blockchain.models.OperationResult; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class BlockchainMemberOperationResultsImpl implements BlockchainMemberOperationResults { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BlockchainMemberOperationResultsImpl.class); + + private final BlockchainMemberOperationResultsClient innerClient; + + private final BlockchainManager serviceManager; + + public BlockchainMemberOperationResultsImpl( + BlockchainMemberOperationResultsClient innerClient, BlockchainManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public OperationResult get(String locationName, String operationId) { + OperationResultInner inner = this.serviceClient().get(locationName, operationId); + if (inner != null) { + return new OperationResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse(String locationName, String operationId, Context context) { + Response inner = this.serviceClient().getWithResponse(locationName, operationId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new OperationResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private BlockchainMemberOperationResultsClient serviceClient() { + return this.innerClient; + } + + private BlockchainManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/BlockchainMembersClientImpl.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/BlockchainMembersClientImpl.java new file mode 100644 index 000000000000..7e5b29755d83 --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/BlockchainMembersClientImpl.java @@ -0,0 +1,2241 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.blockchain.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.blockchain.fluent.BlockchainMembersClient; +import com.azure.resourcemanager.blockchain.fluent.models.ApiKeyCollectionInner; +import com.azure.resourcemanager.blockchain.fluent.models.BlockchainMemberInner; +import com.azure.resourcemanager.blockchain.fluent.models.ConsortiumMemberInner; +import com.azure.resourcemanager.blockchain.models.ApiKey; +import com.azure.resourcemanager.blockchain.models.BlockchainMemberCollection; +import com.azure.resourcemanager.blockchain.models.BlockchainMemberUpdate; +import com.azure.resourcemanager.blockchain.models.ConsortiumMemberCollection; +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 BlockchainMembersClient. */ +public final class BlockchainMembersClientImpl implements BlockchainMembersClient { + private final ClientLogger logger = new ClientLogger(BlockchainMembersClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final BlockchainMembersService service; + + /** The service client containing this operation class. */ + private final BlockchainManagementClientImpl client; + + /** + * Initializes an instance of BlockchainMembersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + BlockchainMembersClientImpl(BlockchainManagementClientImpl client) { + this.service = + RestProxy.create(BlockchainMembersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for BlockchainManagementClientBlockchainMembers to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "BlockchainManagement") + private interface BlockchainMembersService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain" + + "/blockchainMembers/{blockchainMemberName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("blockchainMemberName") String blockchainMemberName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain" + + "/blockchainMembers/{blockchainMemberName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> create( + @HostParam("$host") String endpoint, + @PathParam("blockchainMemberName") String blockchainMemberName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @BodyParam("application/json") BlockchainMemberInner blockchainMember, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain" + + "/blockchainMembers/{blockchainMemberName}") + @ExpectedResponses({202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("blockchainMemberName") String blockchainMemberName, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain" + + "/blockchainMembers/{blockchainMemberName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("blockchainMemberName") String blockchainMemberName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @BodyParam("application/json") BlockchainMemberUpdate blockchainMember, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain" + + "/blockchainMembers") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Blockchain/blockchainMembers") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain" + + "/blockchainMembers/{blockchainMemberName}/consortiumMembers") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listConsortiumMembers( + @HostParam("$host") String endpoint, + @PathParam("blockchainMemberName") String blockchainMemberName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain" + + "/blockchainMembers/{blockchainMemberName}/listApiKeys") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listApiKeys( + @HostParam("$host") String endpoint, + @PathParam("blockchainMemberName") String blockchainMemberName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain" + + "/blockchainMembers/{blockchainMemberName}/regenerateApiKeys") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listRegenerateApiKeys( + @HostParam("$host") String endpoint, + @PathParam("blockchainMemberName") String blockchainMemberName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @BodyParam("application/json") ApiKey apiKey, + @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); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listAllNext( + @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> listConsortiumMembersNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get details about a blockchain member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param blockchainMemberName Blockchain member name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return details about a blockchain member. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String blockchainMemberName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (blockchainMemberName == null) { + return Mono + .error(new IllegalArgumentException("Parameter blockchainMemberName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + blockchainMemberName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get details about a blockchain member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param blockchainMemberName Blockchain member name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return details about a blockchain member. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String blockchainMemberName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (blockchainMemberName == null) { + return Mono + .error(new IllegalArgumentException("Parameter blockchainMemberName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + blockchainMemberName, + accept, + context); + } + + /** + * Get details about a blockchain member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param blockchainMemberName Blockchain member name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return details about a blockchain member. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String blockchainMemberName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, blockchainMemberName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get details about a blockchain member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param blockchainMemberName Blockchain member name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return details about a blockchain member. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BlockchainMemberInner getByResourceGroup(String resourceGroupName, String blockchainMemberName) { + return getByResourceGroupAsync(resourceGroupName, blockchainMemberName).block(); + } + + /** + * Get details about a blockchain member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param blockchainMemberName Blockchain member name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return details about a blockchain member. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String blockchainMemberName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, blockchainMemberName, context).block(); + } + + /** + * Create a blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param blockchainMember Payload to create a blockchain member. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return payload of the blockchain member which is exposed in the request/response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String blockchainMemberName, String resourceGroupName, BlockchainMemberInner blockchainMember) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (blockchainMemberName == null) { + return Mono + .error(new IllegalArgumentException("Parameter blockchainMemberName 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 (blockchainMember != null) { + blockchainMember.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .create( + this.client.getEndpoint(), + blockchainMemberName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + blockchainMember, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create a blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param blockchainMember Payload to create a blockchain member. + * @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 payload of the blockchain member which is exposed in the request/response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String blockchainMemberName, + String resourceGroupName, + BlockchainMemberInner blockchainMember, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (blockchainMemberName == null) { + return Mono + .error(new IllegalArgumentException("Parameter blockchainMemberName 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 (blockchainMember != null) { + blockchainMember.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .create( + this.client.getEndpoint(), + blockchainMemberName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + blockchainMember, + accept, + context); + } + + /** + * Create a blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param blockchainMember Payload to create a blockchain member. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return payload of the blockchain member which is exposed in the request/response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, BlockchainMemberInner> beginCreateAsync( + String blockchainMemberName, String resourceGroupName, BlockchainMemberInner blockchainMember) { + Mono>> mono = + createWithResponseAsync(blockchainMemberName, resourceGroupName, blockchainMember); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + BlockchainMemberInner.class, + BlockchainMemberInner.class, + Context.NONE); + } + + /** + * Create a blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param blockchainMember Payload to create a blockchain member. + * @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 payload of the blockchain member which is exposed in the request/response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, BlockchainMemberInner> beginCreateAsync( + String blockchainMemberName, + String resourceGroupName, + BlockchainMemberInner blockchainMember, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createWithResponseAsync(blockchainMemberName, resourceGroupName, blockchainMember, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), BlockchainMemberInner.class, BlockchainMemberInner.class, context); + } + + /** + * Create a blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param blockchainMember Payload to create a blockchain member. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return payload of the blockchain member which is exposed in the request/response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, BlockchainMemberInner> beginCreate( + String blockchainMemberName, String resourceGroupName, BlockchainMemberInner blockchainMember) { + return beginCreateAsync(blockchainMemberName, resourceGroupName, blockchainMember).getSyncPoller(); + } + + /** + * Create a blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param blockchainMember Payload to create a blockchain member. + * @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 payload of the blockchain member which is exposed in the request/response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, BlockchainMemberInner> beginCreate( + String blockchainMemberName, + String resourceGroupName, + BlockchainMemberInner blockchainMember, + Context context) { + return beginCreateAsync(blockchainMemberName, resourceGroupName, blockchainMember, context).getSyncPoller(); + } + + /** + * Create a blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param blockchainMember Payload to create a blockchain member. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return payload of the blockchain member which is exposed in the request/response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String blockchainMemberName, String resourceGroupName, BlockchainMemberInner blockchainMember) { + return beginCreateAsync(blockchainMemberName, resourceGroupName, blockchainMember) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return payload of the blockchain member which is exposed in the request/response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String blockchainMemberName, String resourceGroupName) { + final BlockchainMemberInner blockchainMember = null; + return beginCreateAsync(blockchainMemberName, resourceGroupName, blockchainMember) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param blockchainMember Payload to create a blockchain member. + * @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 payload of the blockchain member which is exposed in the request/response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String blockchainMemberName, + String resourceGroupName, + BlockchainMemberInner blockchainMember, + Context context) { + return beginCreateAsync(blockchainMemberName, resourceGroupName, blockchainMember, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param blockchainMember Payload to create a blockchain member. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return payload of the blockchain member which is exposed in the request/response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BlockchainMemberInner create( + String blockchainMemberName, String resourceGroupName, BlockchainMemberInner blockchainMember) { + return createAsync(blockchainMemberName, resourceGroupName, blockchainMember).block(); + } + + /** + * Create a blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return payload of the blockchain member which is exposed in the request/response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BlockchainMemberInner create(String blockchainMemberName, String resourceGroupName) { + final BlockchainMemberInner blockchainMember = null; + return createAsync(blockchainMemberName, resourceGroupName, blockchainMember).block(); + } + + /** + * Create a blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param blockchainMember Payload to create a blockchain member. + * @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 payload of the blockchain member which is exposed in the request/response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BlockchainMemberInner create( + String blockchainMemberName, + String resourceGroupName, + BlockchainMemberInner blockchainMember, + Context context) { + return createAsync(blockchainMemberName, resourceGroupName, blockchainMember, context).block(); + } + + /** + * Delete a blockchain member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param blockchainMemberName Blockchain member name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String blockchainMemberName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (blockchainMemberName == null) { + return Mono + .error(new IllegalArgumentException("Parameter blockchainMemberName is required and cannot be null.")); + } + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + blockchainMemberName, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Delete a blockchain member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param blockchainMemberName Blockchain member name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String blockchainMemberName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (blockchainMemberName == null) { + return Mono + .error(new IllegalArgumentException("Parameter blockchainMemberName is required and cannot be null.")); + } + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + blockchainMemberName, + context); + } + + /** + * Delete a blockchain member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param blockchainMemberName Blockchain member name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String blockchainMemberName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, blockchainMemberName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Delete a blockchain member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param blockchainMemberName Blockchain member name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String blockchainMemberName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, blockchainMemberName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Delete a blockchain member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param blockchainMemberName Blockchain member name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete(String resourceGroupName, String blockchainMemberName) { + return beginDeleteAsync(resourceGroupName, blockchainMemberName).getSyncPoller(); + } + + /** + * Delete a blockchain member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param blockchainMemberName Blockchain member name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String blockchainMemberName, Context context) { + return beginDeleteAsync(resourceGroupName, blockchainMemberName, context).getSyncPoller(); + } + + /** + * Delete a blockchain member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param blockchainMemberName Blockchain member name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String blockchainMemberName) { + return beginDeleteAsync(resourceGroupName, blockchainMemberName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a blockchain member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param blockchainMemberName Blockchain member name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String blockchainMemberName, Context context) { + return beginDeleteAsync(resourceGroupName, blockchainMemberName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a blockchain member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param blockchainMemberName Blockchain member name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String blockchainMemberName) { + deleteAsync(resourceGroupName, blockchainMemberName).block(); + } + + /** + * Delete a blockchain member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param blockchainMemberName Blockchain member name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String blockchainMemberName, Context context) { + deleteAsync(resourceGroupName, blockchainMemberName, context).block(); + } + + /** + * Update a blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param blockchainMember Payload to update the blockchain member. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return payload of the blockchain member which is exposed in the request/response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String blockchainMemberName, String resourceGroupName, BlockchainMemberUpdate blockchainMember) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (blockchainMemberName == null) { + return Mono + .error(new IllegalArgumentException("Parameter blockchainMemberName 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 (blockchainMember != null) { + blockchainMember.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + blockchainMemberName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + blockchainMember, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Update a blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param blockchainMember Payload to update the blockchain member. + * @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 payload of the blockchain member which is exposed in the request/response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String blockchainMemberName, + String resourceGroupName, + BlockchainMemberUpdate blockchainMember, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (blockchainMemberName == null) { + return Mono + .error(new IllegalArgumentException("Parameter blockchainMemberName 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 (blockchainMember != null) { + blockchainMember.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + blockchainMemberName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + blockchainMember, + accept, + context); + } + + /** + * Update a blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param blockchainMember Payload to update the blockchain member. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return payload of the blockchain member which is exposed in the request/response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String blockchainMemberName, String resourceGroupName, BlockchainMemberUpdate blockchainMember) { + return updateWithResponseAsync(blockchainMemberName, resourceGroupName, blockchainMember) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Update a blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return payload of the blockchain member which is exposed in the request/response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String blockchainMemberName, String resourceGroupName) { + final BlockchainMemberUpdate blockchainMember = null; + return updateWithResponseAsync(blockchainMemberName, resourceGroupName, blockchainMember) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Update a blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return payload of the blockchain member which is exposed in the request/response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BlockchainMemberInner update(String blockchainMemberName, String resourceGroupName) { + final BlockchainMemberUpdate blockchainMember = null; + return updateAsync(blockchainMemberName, resourceGroupName, blockchainMember).block(); + } + + /** + * Update a blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param blockchainMember Payload to update the blockchain member. + * @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 payload of the blockchain member which is exposed in the request/response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String blockchainMemberName, + String resourceGroupName, + BlockchainMemberUpdate blockchainMember, + Context context) { + return updateWithResponseAsync(blockchainMemberName, resourceGroupName, blockchainMember, context).block(); + } + + /** + * Lists the blockchain members for a resource group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return collection of the blockchain member payload which is exposed in the request/response of the resource + * provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Lists the blockchain members for a resource group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @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 collection of the blockchain member payload which is exposed in the request/response of the resource + * provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the blockchain members for a resource group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return collection of the blockchain member payload which is exposed in the request/response of the resource + * provider. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists the blockchain members for a resource group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @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 collection of the blockchain member payload which is exposed in the request/response of the resource + * provider. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the blockchain members for a resource group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return collection of the blockchain member payload which is exposed in the request/response of the resource + * provider. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Lists the blockchain members for a resource group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @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 collection of the blockchain member payload which is exposed in the request/response of the resource + * provider. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Lists the blockchain members for a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return collection of the blockchain member payload which is exposed in the request/response of the resource + * provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Lists the blockchain members for a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return collection of the blockchain member payload which is exposed in the request/response of the resource + * provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the blockchain members for a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return collection of the blockchain member payload which is exposed in the request/response of the resource + * provider. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listAllNextSinglePageAsync(nextLink)); + } + + /** + * Lists the blockchain members for a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return collection of the blockchain member payload which is exposed in the request/response of the resource + * provider. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listAllNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the blockchain members for a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return collection of the blockchain member payload which is exposed in the request/response of the resource + * provider. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists the blockchain members for a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return collection of the blockchain member payload which is exposed in the request/response of the resource + * provider. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Lists the consortium members for a blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return collection of consortium payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listConsortiumMembersSinglePageAsync( + String blockchainMemberName, String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (blockchainMemberName == null) { + return Mono + .error(new IllegalArgumentException("Parameter blockchainMemberName 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 + .listConsortiumMembers( + this.client.getEndpoint(), + blockchainMemberName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Lists the consortium members for a blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @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 collection of consortium payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listConsortiumMembersSinglePageAsync( + String blockchainMemberName, String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (blockchainMemberName == null) { + return Mono + .error(new IllegalArgumentException("Parameter blockchainMemberName 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 + .listConsortiumMembers( + this.client.getEndpoint(), + blockchainMemberName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the consortium members for a blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return collection of consortium payload. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listConsortiumMembersAsync( + String blockchainMemberName, String resourceGroupName) { + return new PagedFlux<>( + () -> listConsortiumMembersSinglePageAsync(blockchainMemberName, resourceGroupName), + nextLink -> listConsortiumMembersNextSinglePageAsync(nextLink)); + } + + /** + * Lists the consortium members for a blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @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 collection of consortium payload. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listConsortiumMembersAsync( + String blockchainMemberName, String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listConsortiumMembersSinglePageAsync(blockchainMemberName, resourceGroupName, context), + nextLink -> listConsortiumMembersNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the consortium members for a blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return collection of consortium payload. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listConsortiumMembers( + String blockchainMemberName, String resourceGroupName) { + return new PagedIterable<>(listConsortiumMembersAsync(blockchainMemberName, resourceGroupName)); + } + + /** + * Lists the consortium members for a blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @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 collection of consortium payload. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listConsortiumMembers( + String blockchainMemberName, String resourceGroupName, Context context) { + return new PagedIterable<>(listConsortiumMembersAsync(blockchainMemberName, resourceGroupName, context)); + } + + /** + * Lists the API keys for a blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return collection of the API key payload which is exposed in the response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listApiKeysWithResponseAsync( + String blockchainMemberName, String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (blockchainMemberName == null) { + return Mono + .error(new IllegalArgumentException("Parameter blockchainMemberName 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 + .listApiKeys( + this.client.getEndpoint(), + blockchainMemberName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Lists the API keys for a blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @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 collection of the API key payload which is exposed in the response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listApiKeysWithResponseAsync( + String blockchainMemberName, String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (blockchainMemberName == null) { + return Mono + .error(new IllegalArgumentException("Parameter blockchainMemberName 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 + .listApiKeys( + this.client.getEndpoint(), + blockchainMemberName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + accept, + context); + } + + /** + * Lists the API keys for a blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return collection of the API key payload which is exposed in the response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listApiKeysAsync(String blockchainMemberName, String resourceGroupName) { + return listApiKeysWithResponseAsync(blockchainMemberName, resourceGroupName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Lists the API keys for a blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return collection of the API key payload which is exposed in the response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApiKeyCollectionInner listApiKeys(String blockchainMemberName, String resourceGroupName) { + return listApiKeysAsync(blockchainMemberName, resourceGroupName).block(); + } + + /** + * Lists the API keys for a blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @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 collection of the API key payload which is exposed in the response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listApiKeysWithResponse( + String blockchainMemberName, String resourceGroupName, Context context) { + return listApiKeysWithResponseAsync(blockchainMemberName, resourceGroupName, context).block(); + } + + /** + * Regenerate the API keys for a blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param apiKey api key to be regenerate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return collection of the API key payload which is exposed in the response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listRegenerateApiKeysWithResponseAsync( + String blockchainMemberName, String resourceGroupName, ApiKey apiKey) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (blockchainMemberName == null) { + return Mono + .error(new IllegalArgumentException("Parameter blockchainMemberName 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 (apiKey != null) { + apiKey.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listRegenerateApiKeys( + this.client.getEndpoint(), + blockchainMemberName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + apiKey, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Regenerate the API keys for a blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param apiKey api key to be regenerate. + * @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 collection of the API key payload which is exposed in the response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listRegenerateApiKeysWithResponseAsync( + String blockchainMemberName, String resourceGroupName, ApiKey apiKey, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (blockchainMemberName == null) { + return Mono + .error(new IllegalArgumentException("Parameter blockchainMemberName 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 (apiKey != null) { + apiKey.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listRegenerateApiKeys( + this.client.getEndpoint(), + blockchainMemberName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + apiKey, + accept, + context); + } + + /** + * Regenerate the API keys for a blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param apiKey api key to be regenerate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return collection of the API key payload which is exposed in the response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listRegenerateApiKeysAsync( + String blockchainMemberName, String resourceGroupName, ApiKey apiKey) { + return listRegenerateApiKeysWithResponseAsync(blockchainMemberName, resourceGroupName, apiKey) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Regenerate the API keys for a blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return collection of the API key payload which is exposed in the response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listRegenerateApiKeysAsync( + String blockchainMemberName, String resourceGroupName) { + final ApiKey apiKey = null; + return listRegenerateApiKeysWithResponseAsync(blockchainMemberName, resourceGroupName, apiKey) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Regenerate the API keys for a blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return collection of the API key payload which is exposed in the response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApiKeyCollectionInner listRegenerateApiKeys(String blockchainMemberName, String resourceGroupName) { + final ApiKey apiKey = null; + return listRegenerateApiKeysAsync(blockchainMemberName, resourceGroupName, apiKey).block(); + } + + /** + * Regenerate the API keys for a blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param apiKey api key to be regenerate. + * @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 collection of the API key payload which is exposed in the response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listRegenerateApiKeysWithResponse( + String blockchainMemberName, String resourceGroupName, ApiKey apiKey, Context context) { + return listRegenerateApiKeysWithResponseAsync(blockchainMemberName, resourceGroupName, apiKey, context).block(); + } + + /** + * 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 collection of the blockchain member payload which is exposed in the request/response of the resource + * provider. + */ + @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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 collection of the blockchain member payload which is exposed in the request/response of the resource + * provider. + */ + @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)); + } + + /** + * 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 collection of the blockchain member payload which is exposed in the request/response of the resource + * provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAllNextSinglePageAsync(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.listAllNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 collection of the blockchain member payload which is exposed in the request/response of the resource + * provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAllNextSinglePageAsync(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 + .listAllNext(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 collection of consortium payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listConsortiumMembersNextSinglePageAsync(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.listConsortiumMembersNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 collection of consortium payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listConsortiumMembersNextSinglePageAsync( + 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 + .listConsortiumMembersNext(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/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/BlockchainMembersImpl.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/BlockchainMembersImpl.java new file mode 100644 index 000000000000..3820db4bd0d5 --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/BlockchainMembersImpl.java @@ -0,0 +1,249 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.blockchain.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.blockchain.BlockchainManager; +import com.azure.resourcemanager.blockchain.fluent.BlockchainMembersClient; +import com.azure.resourcemanager.blockchain.fluent.models.ApiKeyCollectionInner; +import com.azure.resourcemanager.blockchain.fluent.models.BlockchainMemberInner; +import com.azure.resourcemanager.blockchain.fluent.models.ConsortiumMemberInner; +import com.azure.resourcemanager.blockchain.models.ApiKey; +import com.azure.resourcemanager.blockchain.models.ApiKeyCollection; +import com.azure.resourcemanager.blockchain.models.BlockchainMember; +import com.azure.resourcemanager.blockchain.models.BlockchainMembers; +import com.azure.resourcemanager.blockchain.models.ConsortiumMember; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class BlockchainMembersImpl implements BlockchainMembers { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BlockchainMembersImpl.class); + + private final BlockchainMembersClient innerClient; + + private final BlockchainManager serviceManager; + + public BlockchainMembersImpl(BlockchainMembersClient innerClient, BlockchainManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public BlockchainMember getByResourceGroup(String resourceGroupName, String blockchainMemberName) { + BlockchainMemberInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, blockchainMemberName); + if (inner != null) { + return new BlockchainMemberImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String blockchainMemberName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, blockchainMemberName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new BlockchainMemberImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String blockchainMemberName) { + this.serviceClient().delete(resourceGroupName, blockchainMemberName); + } + + public void delete(String resourceGroupName, String blockchainMemberName, Context context) { + this.serviceClient().delete(resourceGroupName, blockchainMemberName, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new BlockchainMemberImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new BlockchainMemberImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new BlockchainMemberImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new BlockchainMemberImpl(inner1, this.manager())); + } + + public PagedIterable listConsortiumMembers( + String blockchainMemberName, String resourceGroupName) { + PagedIterable inner = + this.serviceClient().listConsortiumMembers(blockchainMemberName, resourceGroupName); + return Utils.mapPage(inner, inner1 -> new ConsortiumMemberImpl(inner1, this.manager())); + } + + public PagedIterable listConsortiumMembers( + String blockchainMemberName, String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listConsortiumMembers(blockchainMemberName, resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new ConsortiumMemberImpl(inner1, this.manager())); + } + + public ApiKeyCollection listApiKeys(String blockchainMemberName, String resourceGroupName) { + ApiKeyCollectionInner inner = this.serviceClient().listApiKeys(blockchainMemberName, resourceGroupName); + if (inner != null) { + return new ApiKeyCollectionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listApiKeysWithResponse( + String blockchainMemberName, String resourceGroupName, Context context) { + Response inner = + this.serviceClient().listApiKeysWithResponse(blockchainMemberName, resourceGroupName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ApiKeyCollectionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ApiKeyCollection listRegenerateApiKeys(String blockchainMemberName, String resourceGroupName) { + ApiKeyCollectionInner inner = + this.serviceClient().listRegenerateApiKeys(blockchainMemberName, resourceGroupName); + if (inner != null) { + return new ApiKeyCollectionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listRegenerateApiKeysWithResponse( + String blockchainMemberName, String resourceGroupName, ApiKey apiKey, Context context) { + Response inner = + this + .serviceClient() + .listRegenerateApiKeysWithResponse(blockchainMemberName, resourceGroupName, apiKey, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ApiKeyCollectionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public BlockchainMember 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 blockchainMemberName = Utils.getValueFromIdByName(id, "blockchainMembers"); + if (blockchainMemberName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'blockchainMembers'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, blockchainMemberName, 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 blockchainMemberName = Utils.getValueFromIdByName(id, "blockchainMembers"); + if (blockchainMemberName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'blockchainMembers'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, blockchainMemberName, 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 blockchainMemberName = Utils.getValueFromIdByName(id, "blockchainMembers"); + if (blockchainMemberName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'blockchainMembers'.", id))); + } + this.delete(resourceGroupName, blockchainMemberName, 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 blockchainMemberName = Utils.getValueFromIdByName(id, "blockchainMembers"); + if (blockchainMemberName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'blockchainMembers'.", id))); + } + this.delete(resourceGroupName, blockchainMemberName, context); + } + + private BlockchainMembersClient serviceClient() { + return this.innerClient; + } + + private BlockchainManager manager() { + return this.serviceManager; + } + + public BlockchainMemberImpl define(String name) { + return new BlockchainMemberImpl(name, this.manager()); + } +} diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/ConsortiumCollectionImpl.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/ConsortiumCollectionImpl.java new file mode 100644 index 000000000000..ccca555ebd07 --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/ConsortiumCollectionImpl.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.blockchain.implementation; + +import com.azure.resourcemanager.blockchain.BlockchainManager; +import com.azure.resourcemanager.blockchain.fluent.models.ConsortiumCollectionInner; +import com.azure.resourcemanager.blockchain.models.Consortium; +import com.azure.resourcemanager.blockchain.models.ConsortiumCollection; +import java.util.Collections; +import java.util.List; + +public final class ConsortiumCollectionImpl implements ConsortiumCollection { + private ConsortiumCollectionInner innerObject; + + private final BlockchainManager serviceManager; + + ConsortiumCollectionImpl(ConsortiumCollectionInner innerObject, BlockchainManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List value() { + List inner = this.innerModel().value(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public ConsortiumCollectionInner innerModel() { + return this.innerObject; + } + + private BlockchainManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/ConsortiumMemberImpl.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/ConsortiumMemberImpl.java new file mode 100644 index 000000000000..c0163adf2381 --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/ConsortiumMemberImpl.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.blockchain.implementation; + +import com.azure.resourcemanager.blockchain.BlockchainManager; +import com.azure.resourcemanager.blockchain.fluent.models.ConsortiumMemberInner; +import com.azure.resourcemanager.blockchain.models.ConsortiumMember; +import java.time.OffsetDateTime; + +public final class ConsortiumMemberImpl implements ConsortiumMember { + private ConsortiumMemberInner innerObject; + + private final BlockchainManager serviceManager; + + ConsortiumMemberImpl(ConsortiumMemberInner innerObject, BlockchainManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public String displayName() { + return this.innerModel().displayName(); + } + + public String subscriptionId() { + return this.innerModel().subscriptionId(); + } + + public String role() { + return this.innerModel().role(); + } + + public String status() { + return this.innerModel().status(); + } + + public OffsetDateTime joinDate() { + return this.innerModel().joinDate(); + } + + public OffsetDateTime dateModified() { + return this.innerModel().dateModified(); + } + + public ConsortiumMemberInner innerModel() { + return this.innerObject; + } + + private BlockchainManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/LocationsClientImpl.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/LocationsClientImpl.java new file mode 100644 index 000000000000..f8eb8d2ce6da --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/LocationsClientImpl.java @@ -0,0 +1,390 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.blockchain.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.blockchain.fluent.LocationsClient; +import com.azure.resourcemanager.blockchain.fluent.models.ConsortiumCollectionInner; +import com.azure.resourcemanager.blockchain.fluent.models.NameAvailabilityInner; +import com.azure.resourcemanager.blockchain.models.NameAvailabilityRequest; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in LocationsClient. */ +public final class LocationsClientImpl implements LocationsClient { + private final ClientLogger logger = new ClientLogger(LocationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final LocationsService service; + + /** The service client containing this operation class. */ + private final BlockchainManagementClientImpl client; + + /** + * Initializes an instance of LocationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + LocationsClientImpl(BlockchainManagementClientImpl client) { + this.service = + RestProxy.create(LocationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for BlockchainManagementClientLocations to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "BlockchainManagement") + private interface LocationsService { + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/providers/Microsoft.Blockchain/locations/{locationName}" + + "/checkNameAvailability") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> checkNameAvailability( + @HostParam("$host") String endpoint, + @PathParam("locationName") String locationName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") NameAvailabilityRequest nameAvailabilityRequest, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.Blockchain/locations/{locationName}/listConsortiums") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listConsortiums( + @HostParam("$host") String endpoint, + @PathParam("locationName") String locationName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * To check whether a resource name is available. + * + * @param locationName Location Name. + * @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 name availability payload which is exposed in the response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkNameAvailabilityWithResponseAsync( + String locationName, NameAvailabilityRequest nameAvailabilityRequest) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName 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) { + nameAvailabilityRequest.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .checkNameAvailability( + this.client.getEndpoint(), + locationName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + nameAvailabilityRequest, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * To check whether a resource name is available. + * + * @param locationName Location Name. + * @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 name availability payload which is exposed in the response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkNameAvailabilityWithResponseAsync( + String locationName, NameAvailabilityRequest nameAvailabilityRequest, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName 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) { + nameAvailabilityRequest.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .checkNameAvailability( + this.client.getEndpoint(), + locationName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + nameAvailabilityRequest, + accept, + context); + } + + /** + * To check whether a resource name is available. + * + * @param locationName Location Name. + * @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 name availability payload which is exposed in the response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono checkNameAvailabilityAsync( + String locationName, NameAvailabilityRequest nameAvailabilityRequest) { + return checkNameAvailabilityWithResponseAsync(locationName, 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 locationName Location Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return name availability payload which is exposed in the response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono checkNameAvailabilityAsync(String locationName) { + final NameAvailabilityRequest nameAvailabilityRequest = null; + return checkNameAvailabilityWithResponseAsync(locationName, 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 locationName Location Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return name availability payload which is exposed in the response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NameAvailabilityInner checkNameAvailability(String locationName) { + final NameAvailabilityRequest nameAvailabilityRequest = null; + return checkNameAvailabilityAsync(locationName, nameAvailabilityRequest).block(); + } + + /** + * To check whether a resource name is available. + * + * @param locationName Location Name. + * @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 name availability payload which is exposed in the response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response checkNameAvailabilityWithResponse( + String locationName, NameAvailabilityRequest nameAvailabilityRequest, Context context) { + return checkNameAvailabilityWithResponseAsync(locationName, nameAvailabilityRequest, context).block(); + } + + /** + * Lists the available consortiums for a subscription. + * + * @param locationName Location Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return collection of the consortium payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listConsortiumsWithResponseAsync(String locationName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName 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 + .listConsortiums( + this.client.getEndpoint(), + locationName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Lists the available consortiums for a subscription. + * + * @param locationName Location Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return collection of the consortium payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listConsortiumsWithResponseAsync( + String locationName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName 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 + .listConsortiums( + this.client.getEndpoint(), + locationName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Lists the available consortiums for a subscription. + * + * @param locationName Location Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return collection of the consortium payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listConsortiumsAsync(String locationName) { + return listConsortiumsWithResponseAsync(locationName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Lists the available consortiums for a subscription. + * + * @param locationName Location Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return collection of the consortium payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ConsortiumCollectionInner listConsortiums(String locationName) { + return listConsortiumsAsync(locationName).block(); + } + + /** + * Lists the available consortiums for a subscription. + * + * @param locationName Location Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return collection of the consortium payload. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listConsortiumsWithResponse(String locationName, Context context) { + return listConsortiumsWithResponseAsync(locationName, context).block(); + } +} diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/LocationsImpl.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/LocationsImpl.java new file mode 100644 index 000000000000..fcce91a495fb --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/LocationsImpl.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.blockchain.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.blockchain.BlockchainManager; +import com.azure.resourcemanager.blockchain.fluent.LocationsClient; +import com.azure.resourcemanager.blockchain.fluent.models.ConsortiumCollectionInner; +import com.azure.resourcemanager.blockchain.fluent.models.NameAvailabilityInner; +import com.azure.resourcemanager.blockchain.models.ConsortiumCollection; +import com.azure.resourcemanager.blockchain.models.Locations; +import com.azure.resourcemanager.blockchain.models.NameAvailability; +import com.azure.resourcemanager.blockchain.models.NameAvailabilityRequest; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class LocationsImpl implements Locations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LocationsImpl.class); + + private final LocationsClient innerClient; + + private final BlockchainManager serviceManager; + + public LocationsImpl(LocationsClient innerClient, BlockchainManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public NameAvailability checkNameAvailability(String locationName) { + NameAvailabilityInner inner = this.serviceClient().checkNameAvailability(locationName); + if (inner != null) { + return new NameAvailabilityImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response checkNameAvailabilityWithResponse( + String locationName, NameAvailabilityRequest nameAvailabilityRequest, Context context) { + Response inner = + this.serviceClient().checkNameAvailabilityWithResponse(locationName, nameAvailabilityRequest, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new NameAvailabilityImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ConsortiumCollection listConsortiums(String locationName) { + ConsortiumCollectionInner inner = this.serviceClient().listConsortiums(locationName); + if (inner != null) { + return new ConsortiumCollectionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listConsortiumsWithResponse(String locationName, Context context) { + Response inner = + this.serviceClient().listConsortiumsWithResponse(locationName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ConsortiumCollectionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private LocationsClient serviceClient() { + return this.innerClient; + } + + private BlockchainManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/NameAvailabilityImpl.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/NameAvailabilityImpl.java new file mode 100644 index 000000000000..51e90b6a069b --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/NameAvailabilityImpl.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.blockchain.implementation; + +import com.azure.resourcemanager.blockchain.BlockchainManager; +import com.azure.resourcemanager.blockchain.fluent.models.NameAvailabilityInner; +import com.azure.resourcemanager.blockchain.models.NameAvailability; +import com.azure.resourcemanager.blockchain.models.NameAvailabilityReason; + +public final class NameAvailabilityImpl implements NameAvailability { + private NameAvailabilityInner innerObject; + + private final BlockchainManager serviceManager; + + NameAvailabilityImpl(NameAvailabilityInner innerObject, BlockchainManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public Boolean nameAvailable() { + return this.innerModel().nameAvailable(); + } + + public String message() { + return this.innerModel().message(); + } + + public NameAvailabilityReason reason() { + return this.innerModel().reason(); + } + + public NameAvailabilityInner innerModel() { + return this.innerObject; + } + + private BlockchainManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/OperationResultImpl.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/OperationResultImpl.java new file mode 100644 index 000000000000..1747b30d1e5f --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/OperationResultImpl.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.blockchain.implementation; + +import com.azure.resourcemanager.blockchain.BlockchainManager; +import com.azure.resourcemanager.blockchain.fluent.models.OperationResultInner; +import com.azure.resourcemanager.blockchain.models.OperationResult; +import java.time.OffsetDateTime; + +public final class OperationResultImpl implements OperationResult { + private OperationResultInner innerObject; + + private final BlockchainManager serviceManager; + + OperationResultImpl(OperationResultInner innerObject, BlockchainManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public OffsetDateTime startTime() { + return this.innerModel().startTime(); + } + + public OffsetDateTime endTime() { + return this.innerModel().endTime(); + } + + public OperationResultInner innerModel() { + return this.innerObject; + } + + private BlockchainManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/OperationsClientImpl.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/OperationsClientImpl.java new file mode 100644 index 000000000000..bf53955cdbf8 --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/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.blockchain.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.blockchain.fluent.OperationsClient; +import com.azure.resourcemanager.blockchain.fluent.models.ResourceProviderOperationInner; +import com.azure.resourcemanager.blockchain.models.ResourceProviderOperationCollection; +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 BlockchainManagementClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(BlockchainManagementClientImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for BlockchainManagementClientOperations to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "BlockchainManagement") + private interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Blockchain/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); + } + + /** + * Lists the available operations of Microsoft.Blockchain resource provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return collection of operation payload which is exposed in the response of the resource provider. + */ + @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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Lists the available operations of Microsoft.Blockchain resource provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return collection of operation payload which is exposed in the response of the resource provider. + */ + @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)); + } + + /** + * Lists the available operations of Microsoft.Blockchain resource provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return collection of operation payload which is exposed in the response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists the available operations of Microsoft.Blockchain resource provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return collection of operation payload which is exposed in the response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the available operations of Microsoft.Blockchain resource provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return collection of operation payload which is exposed in the response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists the available operations of Microsoft.Blockchain resource provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return collection of operation payload which is exposed in the response of the resource provider. + */ + @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 collection of operation payload which is exposed in the response of the resource provider. + */ + @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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 collection of operation payload which is exposed in the response of the resource provider. + */ + @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/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/OperationsImpl.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/OperationsImpl.java new file mode 100644 index 000000000000..00aa1bc97a70 --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/OperationsImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.blockchain.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.blockchain.BlockchainManager; +import com.azure.resourcemanager.blockchain.fluent.OperationsClient; +import com.azure.resourcemanager.blockchain.fluent.models.ResourceProviderOperationInner; +import com.azure.resourcemanager.blockchain.models.Operations; +import com.azure.resourcemanager.blockchain.models.ResourceProviderOperation; +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 BlockchainManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, BlockchainManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new ResourceProviderOperationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new ResourceProviderOperationImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private BlockchainManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/ResourceProviderOperationImpl.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/ResourceProviderOperationImpl.java new file mode 100644 index 000000000000..391ed9a14953 --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/ResourceProviderOperationImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.blockchain.implementation; + +import com.azure.resourcemanager.blockchain.BlockchainManager; +import com.azure.resourcemanager.blockchain.fluent.models.ResourceProviderOperationInner; +import com.azure.resourcemanager.blockchain.models.ResourceProviderOperation; +import com.azure.resourcemanager.blockchain.models.ResourceProviderOperationDisplay; + +public final class ResourceProviderOperationImpl implements ResourceProviderOperation { + private ResourceProviderOperationInner innerObject; + + private final BlockchainManager serviceManager; + + ResourceProviderOperationImpl(ResourceProviderOperationInner innerObject, BlockchainManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String origin() { + return this.innerModel().origin(); + } + + public String name() { + return this.innerModel().name(); + } + + public Boolean isDataAction() { + return this.innerModel().isDataAction(); + } + + public ResourceProviderOperationDisplay display() { + return this.innerModel().display(); + } + + public ResourceProviderOperationInner innerModel() { + return this.innerObject; + } + + private BlockchainManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/ResourceTypeSkuCollectionImpl.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/ResourceTypeSkuCollectionImpl.java new file mode 100644 index 000000000000..92955a3d605e --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/ResourceTypeSkuCollectionImpl.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.blockchain.implementation; + +import com.azure.resourcemanager.blockchain.BlockchainManager; +import com.azure.resourcemanager.blockchain.fluent.models.ResourceTypeSkuCollectionInner; +import com.azure.resourcemanager.blockchain.models.ResourceTypeSku; +import com.azure.resourcemanager.blockchain.models.ResourceTypeSkuCollection; +import java.util.Collections; +import java.util.List; + +public final class ResourceTypeSkuCollectionImpl implements ResourceTypeSkuCollection { + private ResourceTypeSkuCollectionInner innerObject; + + private final BlockchainManager serviceManager; + + ResourceTypeSkuCollectionImpl(ResourceTypeSkuCollectionInner innerObject, BlockchainManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List value() { + List inner = this.innerModel().value(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public ResourceTypeSkuCollectionInner innerModel() { + return this.innerObject; + } + + private BlockchainManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/SkusClientImpl.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/SkusClientImpl.java new file mode 100644 index 000000000000..6dad276c8aac --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/SkusClientImpl.java @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.blockchain.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.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.blockchain.fluent.SkusClient; +import com.azure.resourcemanager.blockchain.fluent.models.ResourceTypeSkuCollectionInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in SkusClient. */ +public final class SkusClientImpl implements SkusClient { + private final ClientLogger logger = new ClientLogger(SkusClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final SkusService service; + + /** The service client containing this operation class. */ + private final BlockchainManagementClientImpl client; + + /** + * Initializes an instance of SkusClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SkusClientImpl(BlockchainManagementClientImpl client) { + this.service = RestProxy.create(SkusService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for BlockchainManagementClientSkus to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "BlockchainManagement") + private interface SkusService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Blockchain/skus") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists the Skus of the resource type. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return collection of the resource type Sku. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Lists the Skus of the resource type. + * + * @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 collection of the resource type Sku. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Lists the Skus of the resource type. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return collection of the resource type Sku. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listAsync() { + return listWithResponseAsync() + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Lists the Skus of the resource type. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return collection of the resource type Sku. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResourceTypeSkuCollectionInner list() { + return listAsync().block(); + } + + /** + * Lists the Skus of the resource type. + * + * @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 collection of the resource type Sku. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse(Context context) { + return listWithResponseAsync(context).block(); + } +} diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/SkusImpl.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/SkusImpl.java new file mode 100644 index 000000000000..b9f3cc289200 --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/SkusImpl.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.blockchain.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.blockchain.BlockchainManager; +import com.azure.resourcemanager.blockchain.fluent.SkusClient; +import com.azure.resourcemanager.blockchain.fluent.models.ResourceTypeSkuCollectionInner; +import com.azure.resourcemanager.blockchain.models.ResourceTypeSkuCollection; +import com.azure.resourcemanager.blockchain.models.Skus; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class SkusImpl implements Skus { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SkusImpl.class); + + private final SkusClient innerClient; + + private final BlockchainManager serviceManager; + + public SkusImpl(SkusClient innerClient, BlockchainManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ResourceTypeSkuCollection list() { + ResourceTypeSkuCollectionInner inner = this.serviceClient().list(); + if (inner != null) { + return new ResourceTypeSkuCollectionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listWithResponse(Context context) { + Response inner = this.serviceClient().listWithResponse(context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ResourceTypeSkuCollectionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private SkusClient serviceClient() { + return this.innerClient; + } + + private BlockchainManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/TransactionNodeImpl.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/TransactionNodeImpl.java new file mode 100644 index 000000000000..64b7a04c5756 --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/TransactionNodeImpl.java @@ -0,0 +1,238 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.blockchain.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.blockchain.BlockchainManager; +import com.azure.resourcemanager.blockchain.fluent.models.TransactionNodeInner; +import com.azure.resourcemanager.blockchain.models.ApiKey; +import com.azure.resourcemanager.blockchain.models.ApiKeyCollection; +import com.azure.resourcemanager.blockchain.models.FirewallRule; +import com.azure.resourcemanager.blockchain.models.NodeProvisioningState; +import com.azure.resourcemanager.blockchain.models.TransactionNode; +import com.azure.resourcemanager.blockchain.models.TransactionNodeUpdate; +import java.util.Collections; +import java.util.List; + +public final class TransactionNodeImpl implements TransactionNode, TransactionNode.Definition, TransactionNode.Update { + private TransactionNodeInner innerObject; + + private final BlockchainManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public NodeProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public String dns() { + return this.innerModel().dns(); + } + + public String publicKey() { + return this.innerModel().publicKey(); + } + + public String username() { + return this.innerModel().username(); + } + + public String password() { + return this.innerModel().password(); + } + + public List firewallRules() { + List inner = this.innerModel().firewallRules(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public TransactionNodeInner innerModel() { + return this.innerObject; + } + + private BlockchainManager manager() { + return this.serviceManager; + } + + private String blockchainMemberName; + + private String transactionNodeName; + + private String resourceGroupName; + + private TransactionNodeUpdate updateTransactionNode; + + public TransactionNodeImpl withExistingBlockchainMember(String blockchainMemberName, String resourceGroupName) { + this.blockchainMemberName = blockchainMemberName; + this.resourceGroupName = resourceGroupName; + return this; + } + + public TransactionNode create() { + this.innerObject = + serviceManager + .serviceClient() + .getTransactionNodes() + .create(blockchainMemberName, transactionNodeName, resourceGroupName, this.innerModel(), Context.NONE); + return this; + } + + public TransactionNode create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getTransactionNodes() + .create(blockchainMemberName, transactionNodeName, resourceGroupName, this.innerModel(), context); + return this; + } + + TransactionNodeImpl(String name, BlockchainManager serviceManager) { + this.innerObject = new TransactionNodeInner(); + this.serviceManager = serviceManager; + this.transactionNodeName = name; + } + + public TransactionNodeImpl update() { + this.updateTransactionNode = new TransactionNodeUpdate(); + return this; + } + + public TransactionNode apply() { + this.innerObject = + serviceManager + .serviceClient() + .getTransactionNodes() + .updateWithResponse( + blockchainMemberName, transactionNodeName, resourceGroupName, updateTransactionNode, Context.NONE) + .getValue(); + return this; + } + + public TransactionNode apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getTransactionNodes() + .updateWithResponse( + blockchainMemberName, transactionNodeName, resourceGroupName, updateTransactionNode, context) + .getValue(); + return this; + } + + TransactionNodeImpl(TransactionNodeInner innerObject, BlockchainManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.blockchainMemberName = Utils.getValueFromIdByName(innerObject.id(), "blockchainMembers"); + this.transactionNodeName = Utils.getValueFromIdByName(innerObject.id(), "transactionNodes"); + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + } + + public TransactionNode refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getTransactionNodes() + .getWithResponse(blockchainMemberName, transactionNodeName, resourceGroupName, Context.NONE) + .getValue(); + return this; + } + + public TransactionNode refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getTransactionNodes() + .getWithResponse(blockchainMemberName, transactionNodeName, resourceGroupName, context) + .getValue(); + return this; + } + + public ApiKeyCollection listApiKeys() { + return serviceManager + .transactionNodes() + .listApiKeys(blockchainMemberName, transactionNodeName, resourceGroupName); + } + + public Response listApiKeysWithResponse(Context context) { + return serviceManager + .transactionNodes() + .listApiKeysWithResponse(blockchainMemberName, transactionNodeName, resourceGroupName, context); + } + + public ApiKeyCollection listRegenerateApiKeys() { + return serviceManager + .transactionNodes() + .listRegenerateApiKeys(blockchainMemberName, transactionNodeName, resourceGroupName); + } + + public Response listRegenerateApiKeysWithResponse(ApiKey apiKey, Context context) { + return serviceManager + .transactionNodes() + .listRegenerateApiKeysWithResponse( + blockchainMemberName, transactionNodeName, resourceGroupName, apiKey, context); + } + + public TransactionNodeImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public TransactionNodeImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public TransactionNodeImpl withPassword(String password) { + if (isInCreateMode()) { + this.innerModel().withPassword(password); + return this; + } else { + this.updateTransactionNode.withPassword(password); + return this; + } + } + + public TransactionNodeImpl withFirewallRules(List firewallRules) { + if (isInCreateMode()) { + this.innerModel().withFirewallRules(firewallRules); + return this; + } else { + this.updateTransactionNode.withFirewallRules(firewallRules); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/TransactionNodesClientImpl.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/TransactionNodesClientImpl.java new file mode 100644 index 000000000000..814f5697e299 --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/TransactionNodesClientImpl.java @@ -0,0 +1,1894 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.blockchain.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.blockchain.fluent.TransactionNodesClient; +import com.azure.resourcemanager.blockchain.fluent.models.ApiKeyCollectionInner; +import com.azure.resourcemanager.blockchain.fluent.models.TransactionNodeInner; +import com.azure.resourcemanager.blockchain.models.ApiKey; +import com.azure.resourcemanager.blockchain.models.TransactionNodeCollection; +import com.azure.resourcemanager.blockchain.models.TransactionNodeUpdate; +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 TransactionNodesClient. */ +public final class TransactionNodesClientImpl implements TransactionNodesClient { + private final ClientLogger logger = new ClientLogger(TransactionNodesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final TransactionNodesService service; + + /** The service client containing this operation class. */ + private final BlockchainManagementClientImpl client; + + /** + * Initializes an instance of TransactionNodesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + TransactionNodesClientImpl(BlockchainManagementClientImpl client) { + this.service = + RestProxy.create(TransactionNodesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for BlockchainManagementClientTransactionNodes to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "BlockchainManagement") + private interface TransactionNodesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain" + + "/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("blockchainMemberName") String blockchainMemberName, + @PathParam("transactionNodeName") String transactionNodeName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain" + + "/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> create( + @HostParam("$host") String endpoint, + @PathParam("blockchainMemberName") String blockchainMemberName, + @PathParam("transactionNodeName") String transactionNodeName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @BodyParam("application/json") TransactionNodeInner transactionNode, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain" + + "/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}") + @ExpectedResponses({202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("blockchainMemberName") String blockchainMemberName, + @PathParam("transactionNodeName") String transactionNodeName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain" + + "/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("blockchainMemberName") String blockchainMemberName, + @PathParam("transactionNodeName") String transactionNodeName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @BodyParam("application/json") TransactionNodeUpdate transactionNode, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain" + + "/blockchainMembers/{blockchainMemberName}/transactionNodes") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("blockchainMemberName") String blockchainMemberName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain" + + "/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}/listApiKeys") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listApiKeys( + @HostParam("$host") String endpoint, + @PathParam("blockchainMemberName") String blockchainMemberName, + @PathParam("transactionNodeName") String transactionNodeName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Blockchain" + + "/blockchainMembers/{blockchainMemberName}/transactionNodes/{transactionNodeName}/regenerateApiKeys") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listRegenerateApiKeys( + @HostParam("$host") String endpoint, + @PathParam("blockchainMemberName") String blockchainMemberName, + @PathParam("transactionNodeName") String transactionNodeName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @BodyParam("application/json") ApiKey apiKey, + @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); + } + + /** + * Get the details of the transaction node. + * + * @param blockchainMemberName Blockchain member name. + * @param transactionNodeName Transaction node name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the transaction node. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String blockchainMemberName, String transactionNodeName, String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (blockchainMemberName == null) { + return Mono + .error(new IllegalArgumentException("Parameter blockchainMemberName is required and cannot be null.")); + } + if (transactionNodeName == null) { + return Mono + .error(new IllegalArgumentException("Parameter transactionNodeName 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 + .get( + this.client.getEndpoint(), + blockchainMemberName, + transactionNodeName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the details of the transaction node. + * + * @param blockchainMemberName Blockchain member name. + * @param transactionNodeName Transaction node name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @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 details of the transaction node. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String blockchainMemberName, String transactionNodeName, String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (blockchainMemberName == null) { + return Mono + .error(new IllegalArgumentException("Parameter blockchainMemberName is required and cannot be null.")); + } + if (transactionNodeName == null) { + return Mono + .error(new IllegalArgumentException("Parameter transactionNodeName 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 + .get( + this.client.getEndpoint(), + blockchainMemberName, + transactionNodeName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + accept, + context); + } + + /** + * Get the details of the transaction node. + * + * @param blockchainMemberName Blockchain member name. + * @param transactionNodeName Transaction node name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the transaction node. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String blockchainMemberName, String transactionNodeName, String resourceGroupName) { + return getWithResponseAsync(blockchainMemberName, transactionNodeName, resourceGroupName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get the details of the transaction node. + * + * @param blockchainMemberName Blockchain member name. + * @param transactionNodeName Transaction node name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the transaction node. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TransactionNodeInner get(String blockchainMemberName, String transactionNodeName, String resourceGroupName) { + return getAsync(blockchainMemberName, transactionNodeName, resourceGroupName).block(); + } + + /** + * Get the details of the transaction node. + * + * @param blockchainMemberName Blockchain member name. + * @param transactionNodeName Transaction node name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @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 details of the transaction node. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String blockchainMemberName, String transactionNodeName, String resourceGroupName, Context context) { + return getWithResponseAsync(blockchainMemberName, transactionNodeName, resourceGroupName, context).block(); + } + + /** + * Create or update the transaction node. + * + * @param blockchainMemberName Blockchain member name. + * @param transactionNodeName Transaction node name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param transactionNode Payload to create the transaction node. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return payload of the transaction node which is the request/response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String blockchainMemberName, + String transactionNodeName, + String resourceGroupName, + TransactionNodeInner transactionNode) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (blockchainMemberName == null) { + return Mono + .error(new IllegalArgumentException("Parameter blockchainMemberName is required and cannot be null.")); + } + if (transactionNodeName == null) { + return Mono + .error(new IllegalArgumentException("Parameter transactionNodeName 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 (transactionNode != null) { + transactionNode.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .create( + this.client.getEndpoint(), + blockchainMemberName, + transactionNodeName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + transactionNode, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create or update the transaction node. + * + * @param blockchainMemberName Blockchain member name. + * @param transactionNodeName Transaction node name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param transactionNode Payload to create the transaction node. + * @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 payload of the transaction node which is the request/response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String blockchainMemberName, + String transactionNodeName, + String resourceGroupName, + TransactionNodeInner transactionNode, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (blockchainMemberName == null) { + return Mono + .error(new IllegalArgumentException("Parameter blockchainMemberName is required and cannot be null.")); + } + if (transactionNodeName == null) { + return Mono + .error(new IllegalArgumentException("Parameter transactionNodeName 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 (transactionNode != null) { + transactionNode.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .create( + this.client.getEndpoint(), + blockchainMemberName, + transactionNodeName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + transactionNode, + accept, + context); + } + + /** + * Create or update the transaction node. + * + * @param blockchainMemberName Blockchain member name. + * @param transactionNodeName Transaction node name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param transactionNode Payload to create the transaction node. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return payload of the transaction node which is the request/response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, TransactionNodeInner> beginCreateAsync( + String blockchainMemberName, + String transactionNodeName, + String resourceGroupName, + TransactionNodeInner transactionNode) { + Mono>> mono = + createWithResponseAsync(blockchainMemberName, transactionNodeName, resourceGroupName, transactionNode); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + TransactionNodeInner.class, + TransactionNodeInner.class, + Context.NONE); + } + + /** + * Create or update the transaction node. + * + * @param blockchainMemberName Blockchain member name. + * @param transactionNodeName Transaction node name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param transactionNode Payload to create the transaction node. + * @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 payload of the transaction node which is the request/response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, TransactionNodeInner> beginCreateAsync( + String blockchainMemberName, + String transactionNodeName, + String resourceGroupName, + TransactionNodeInner transactionNode, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createWithResponseAsync( + blockchainMemberName, transactionNodeName, resourceGroupName, transactionNode, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), TransactionNodeInner.class, TransactionNodeInner.class, context); + } + + /** + * Create or update the transaction node. + * + * @param blockchainMemberName Blockchain member name. + * @param transactionNodeName Transaction node name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param transactionNode Payload to create the transaction node. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return payload of the transaction node which is the request/response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, TransactionNodeInner> beginCreate( + String blockchainMemberName, + String transactionNodeName, + String resourceGroupName, + TransactionNodeInner transactionNode) { + return beginCreateAsync(blockchainMemberName, transactionNodeName, resourceGroupName, transactionNode) + .getSyncPoller(); + } + + /** + * Create or update the transaction node. + * + * @param blockchainMemberName Blockchain member name. + * @param transactionNodeName Transaction node name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param transactionNode Payload to create the transaction node. + * @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 payload of the transaction node which is the request/response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, TransactionNodeInner> beginCreate( + String blockchainMemberName, + String transactionNodeName, + String resourceGroupName, + TransactionNodeInner transactionNode, + Context context) { + return beginCreateAsync(blockchainMemberName, transactionNodeName, resourceGroupName, transactionNode, context) + .getSyncPoller(); + } + + /** + * Create or update the transaction node. + * + * @param blockchainMemberName Blockchain member name. + * @param transactionNodeName Transaction node name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param transactionNode Payload to create the transaction node. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return payload of the transaction node which is the request/response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String blockchainMemberName, + String transactionNodeName, + String resourceGroupName, + TransactionNodeInner transactionNode) { + return beginCreateAsync(blockchainMemberName, transactionNodeName, resourceGroupName, transactionNode) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update the transaction node. + * + * @param blockchainMemberName Blockchain member name. + * @param transactionNodeName Transaction node name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return payload of the transaction node which is the request/response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String blockchainMemberName, String transactionNodeName, String resourceGroupName) { + final TransactionNodeInner transactionNode = null; + return beginCreateAsync(blockchainMemberName, transactionNodeName, resourceGroupName, transactionNode) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update the transaction node. + * + * @param blockchainMemberName Blockchain member name. + * @param transactionNodeName Transaction node name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param transactionNode Payload to create the transaction node. + * @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 payload of the transaction node which is the request/response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String blockchainMemberName, + String transactionNodeName, + String resourceGroupName, + TransactionNodeInner transactionNode, + Context context) { + return beginCreateAsync(blockchainMemberName, transactionNodeName, resourceGroupName, transactionNode, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update the transaction node. + * + * @param blockchainMemberName Blockchain member name. + * @param transactionNodeName Transaction node name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param transactionNode Payload to create the transaction node. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return payload of the transaction node which is the request/response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TransactionNodeInner create( + String blockchainMemberName, + String transactionNodeName, + String resourceGroupName, + TransactionNodeInner transactionNode) { + return createAsync(blockchainMemberName, transactionNodeName, resourceGroupName, transactionNode).block(); + } + + /** + * Create or update the transaction node. + * + * @param blockchainMemberName Blockchain member name. + * @param transactionNodeName Transaction node name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return payload of the transaction node which is the request/response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TransactionNodeInner create( + String blockchainMemberName, String transactionNodeName, String resourceGroupName) { + final TransactionNodeInner transactionNode = null; + return createAsync(blockchainMemberName, transactionNodeName, resourceGroupName, transactionNode).block(); + } + + /** + * Create or update the transaction node. + * + * @param blockchainMemberName Blockchain member name. + * @param transactionNodeName Transaction node name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param transactionNode Payload to create the transaction node. + * @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 payload of the transaction node which is the request/response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TransactionNodeInner create( + String blockchainMemberName, + String transactionNodeName, + String resourceGroupName, + TransactionNodeInner transactionNode, + Context context) { + return createAsync(blockchainMemberName, transactionNodeName, resourceGroupName, transactionNode, context) + .block(); + } + + /** + * Delete the transaction node. + * + * @param blockchainMemberName Blockchain member name. + * @param transactionNodeName Transaction node name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 blockchainMemberName, String transactionNodeName, String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (blockchainMemberName == null) { + return Mono + .error(new IllegalArgumentException("Parameter blockchainMemberName is required and cannot be null.")); + } + if (transactionNodeName == null) { + return Mono + .error(new IllegalArgumentException("Parameter transactionNodeName 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.")); + } + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + blockchainMemberName, + transactionNodeName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Delete the transaction node. + * + * @param blockchainMemberName Blockchain member name. + * @param transactionNodeName Transaction node name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @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 blockchainMemberName, String transactionNodeName, String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (blockchainMemberName == null) { + return Mono + .error(new IllegalArgumentException("Parameter blockchainMemberName is required and cannot be null.")); + } + if (transactionNodeName == null) { + return Mono + .error(new IllegalArgumentException("Parameter transactionNodeName 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.")); + } + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + blockchainMemberName, + transactionNodeName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + context); + } + + /** + * Delete the transaction node. + * + * @param blockchainMemberName Blockchain member name. + * @param transactionNodeName Transaction node name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 blockchainMemberName, String transactionNodeName, String resourceGroupName) { + Mono>> mono = + deleteWithResponseAsync(blockchainMemberName, transactionNodeName, resourceGroupName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Delete the transaction node. + * + * @param blockchainMemberName Blockchain member name. + * @param transactionNodeName Transaction node name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @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 blockchainMemberName, String transactionNodeName, String resourceGroupName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(blockchainMemberName, transactionNodeName, resourceGroupName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Delete the transaction node. + * + * @param blockchainMemberName Blockchain member name. + * @param transactionNodeName Transaction node name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 blockchainMemberName, String transactionNodeName, String resourceGroupName) { + return beginDeleteAsync(blockchainMemberName, transactionNodeName, resourceGroupName).getSyncPoller(); + } + + /** + * Delete the transaction node. + * + * @param blockchainMemberName Blockchain member name. + * @param transactionNodeName Transaction node name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @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 blockchainMemberName, String transactionNodeName, String resourceGroupName, Context context) { + return beginDeleteAsync(blockchainMemberName, transactionNodeName, resourceGroupName, context).getSyncPoller(); + } + + /** + * Delete the transaction node. + * + * @param blockchainMemberName Blockchain member name. + * @param transactionNodeName Transaction node name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 blockchainMemberName, String transactionNodeName, String resourceGroupName) { + return beginDeleteAsync(blockchainMemberName, transactionNodeName, resourceGroupName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete the transaction node. + * + * @param blockchainMemberName Blockchain member name. + * @param transactionNodeName Transaction node name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @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 blockchainMemberName, String transactionNodeName, String resourceGroupName, Context context) { + return beginDeleteAsync(blockchainMemberName, transactionNodeName, resourceGroupName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete the transaction node. + * + * @param blockchainMemberName Blockchain member name. + * @param transactionNodeName Transaction node name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 blockchainMemberName, String transactionNodeName, String resourceGroupName) { + deleteAsync(blockchainMemberName, transactionNodeName, resourceGroupName).block(); + } + + /** + * Delete the transaction node. + * + * @param blockchainMemberName Blockchain member name. + * @param transactionNodeName Transaction node name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @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 blockchainMemberName, String transactionNodeName, String resourceGroupName, Context context) { + deleteAsync(blockchainMemberName, transactionNodeName, resourceGroupName, context).block(); + } + + /** + * Update the transaction node. + * + * @param blockchainMemberName Blockchain member name. + * @param transactionNodeName Transaction node name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param transactionNode Payload to create the transaction node. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return payload of the transaction node which is the request/response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String blockchainMemberName, + String transactionNodeName, + String resourceGroupName, + TransactionNodeUpdate transactionNode) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (blockchainMemberName == null) { + return Mono + .error(new IllegalArgumentException("Parameter blockchainMemberName is required and cannot be null.")); + } + if (transactionNodeName == null) { + return Mono + .error(new IllegalArgumentException("Parameter transactionNodeName 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 (transactionNode != null) { + transactionNode.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + blockchainMemberName, + transactionNodeName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + transactionNode, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Update the transaction node. + * + * @param blockchainMemberName Blockchain member name. + * @param transactionNodeName Transaction node name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param transactionNode Payload to create the transaction node. + * @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 payload of the transaction node which is the request/response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String blockchainMemberName, + String transactionNodeName, + String resourceGroupName, + TransactionNodeUpdate transactionNode, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (blockchainMemberName == null) { + return Mono + .error(new IllegalArgumentException("Parameter blockchainMemberName is required and cannot be null.")); + } + if (transactionNodeName == null) { + return Mono + .error(new IllegalArgumentException("Parameter transactionNodeName 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 (transactionNode != null) { + transactionNode.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + blockchainMemberName, + transactionNodeName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + transactionNode, + accept, + context); + } + + /** + * Update the transaction node. + * + * @param blockchainMemberName Blockchain member name. + * @param transactionNodeName Transaction node name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param transactionNode Payload to create the transaction node. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return payload of the transaction node which is the request/response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String blockchainMemberName, + String transactionNodeName, + String resourceGroupName, + TransactionNodeUpdate transactionNode) { + return updateWithResponseAsync(blockchainMemberName, transactionNodeName, resourceGroupName, transactionNode) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Update the transaction node. + * + * @param blockchainMemberName Blockchain member name. + * @param transactionNodeName Transaction node name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return payload of the transaction node which is the request/response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String blockchainMemberName, String transactionNodeName, String resourceGroupName) { + final TransactionNodeUpdate transactionNode = null; + return updateWithResponseAsync(blockchainMemberName, transactionNodeName, resourceGroupName, transactionNode) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Update the transaction node. + * + * @param blockchainMemberName Blockchain member name. + * @param transactionNodeName Transaction node name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return payload of the transaction node which is the request/response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TransactionNodeInner update( + String blockchainMemberName, String transactionNodeName, String resourceGroupName) { + final TransactionNodeUpdate transactionNode = null; + return updateAsync(blockchainMemberName, transactionNodeName, resourceGroupName, transactionNode).block(); + } + + /** + * Update the transaction node. + * + * @param blockchainMemberName Blockchain member name. + * @param transactionNodeName Transaction node name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param transactionNode Payload to create the transaction node. + * @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 payload of the transaction node which is the request/response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String blockchainMemberName, + String transactionNodeName, + String resourceGroupName, + TransactionNodeUpdate transactionNode, + Context context) { + return updateWithResponseAsync( + blockchainMemberName, transactionNodeName, resourceGroupName, transactionNode, context) + .block(); + } + + /** + * Lists the transaction nodes for a blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return collection of transaction node payload which is exposed in the request/response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String blockchainMemberName, String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (blockchainMemberName == null) { + return Mono + .error(new IllegalArgumentException("Parameter blockchainMemberName 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 + .list( + this.client.getEndpoint(), + blockchainMemberName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Lists the transaction nodes for a blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @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 collection of transaction node payload which is exposed in the request/response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String blockchainMemberName, String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (blockchainMemberName == null) { + return Mono + .error(new IllegalArgumentException("Parameter blockchainMemberName 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 + .list( + this.client.getEndpoint(), + blockchainMemberName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the transaction nodes for a blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return collection of transaction node payload which is exposed in the request/response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String blockchainMemberName, String resourceGroupName) { + return new PagedFlux<>( + () -> listSinglePageAsync(blockchainMemberName, resourceGroupName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists the transaction nodes for a blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @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 collection of transaction node payload which is exposed in the request/response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String blockchainMemberName, String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(blockchainMemberName, resourceGroupName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the transaction nodes for a blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return collection of transaction node payload which is exposed in the request/response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String blockchainMemberName, String resourceGroupName) { + return new PagedIterable<>(listAsync(blockchainMemberName, resourceGroupName)); + } + + /** + * Lists the transaction nodes for a blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @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 collection of transaction node payload which is exposed in the request/response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String blockchainMemberName, String resourceGroupName, Context context) { + return new PagedIterable<>(listAsync(blockchainMemberName, resourceGroupName, context)); + } + + /** + * List the API keys for the transaction node. + * + * @param blockchainMemberName Blockchain member name. + * @param transactionNodeName Transaction node name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return collection of the API key payload which is exposed in the response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listApiKeysWithResponseAsync( + String blockchainMemberName, String transactionNodeName, String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (blockchainMemberName == null) { + return Mono + .error(new IllegalArgumentException("Parameter blockchainMemberName is required and cannot be null.")); + } + if (transactionNodeName == null) { + return Mono + .error(new IllegalArgumentException("Parameter transactionNodeName 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 + .listApiKeys( + this.client.getEndpoint(), + blockchainMemberName, + transactionNodeName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List the API keys for the transaction node. + * + * @param blockchainMemberName Blockchain member name. + * @param transactionNodeName Transaction node name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @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 collection of the API key payload which is exposed in the response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listApiKeysWithResponseAsync( + String blockchainMemberName, String transactionNodeName, String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (blockchainMemberName == null) { + return Mono + .error(new IllegalArgumentException("Parameter blockchainMemberName is required and cannot be null.")); + } + if (transactionNodeName == null) { + return Mono + .error(new IllegalArgumentException("Parameter transactionNodeName 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 + .listApiKeys( + this.client.getEndpoint(), + blockchainMemberName, + transactionNodeName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + accept, + context); + } + + /** + * List the API keys for the transaction node. + * + * @param blockchainMemberName Blockchain member name. + * @param transactionNodeName Transaction node name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return collection of the API key payload which is exposed in the response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listApiKeysAsync( + String blockchainMemberName, String transactionNodeName, String resourceGroupName) { + return listApiKeysWithResponseAsync(blockchainMemberName, transactionNodeName, resourceGroupName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * List the API keys for the transaction node. + * + * @param blockchainMemberName Blockchain member name. + * @param transactionNodeName Transaction node name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return collection of the API key payload which is exposed in the response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApiKeyCollectionInner listApiKeys( + String blockchainMemberName, String transactionNodeName, String resourceGroupName) { + return listApiKeysAsync(blockchainMemberName, transactionNodeName, resourceGroupName).block(); + } + + /** + * List the API keys for the transaction node. + * + * @param blockchainMemberName Blockchain member name. + * @param transactionNodeName Transaction node name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @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 collection of the API key payload which is exposed in the response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listApiKeysWithResponse( + String blockchainMemberName, String transactionNodeName, String resourceGroupName, Context context) { + return listApiKeysWithResponseAsync(blockchainMemberName, transactionNodeName, resourceGroupName, context) + .block(); + } + + /** + * Regenerate the API keys for the blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param transactionNodeName Transaction node name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param apiKey api key to be regenerated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return collection of the API key payload which is exposed in the response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listRegenerateApiKeysWithResponseAsync( + String blockchainMemberName, String transactionNodeName, String resourceGroupName, ApiKey apiKey) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (blockchainMemberName == null) { + return Mono + .error(new IllegalArgumentException("Parameter blockchainMemberName is required and cannot be null.")); + } + if (transactionNodeName == null) { + return Mono + .error(new IllegalArgumentException("Parameter transactionNodeName 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 (apiKey != null) { + apiKey.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listRegenerateApiKeys( + this.client.getEndpoint(), + blockchainMemberName, + transactionNodeName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + apiKey, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Regenerate the API keys for the blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param transactionNodeName Transaction node name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param apiKey api key to be regenerated. + * @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 collection of the API key payload which is exposed in the response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listRegenerateApiKeysWithResponseAsync( + String blockchainMemberName, + String transactionNodeName, + String resourceGroupName, + ApiKey apiKey, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (blockchainMemberName == null) { + return Mono + .error(new IllegalArgumentException("Parameter blockchainMemberName is required and cannot be null.")); + } + if (transactionNodeName == null) { + return Mono + .error(new IllegalArgumentException("Parameter transactionNodeName 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 (apiKey != null) { + apiKey.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listRegenerateApiKeys( + this.client.getEndpoint(), + blockchainMemberName, + transactionNodeName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + apiKey, + accept, + context); + } + + /** + * Regenerate the API keys for the blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param transactionNodeName Transaction node name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param apiKey api key to be regenerated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return collection of the API key payload which is exposed in the response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listRegenerateApiKeysAsync( + String blockchainMemberName, String transactionNodeName, String resourceGroupName, ApiKey apiKey) { + return listRegenerateApiKeysWithResponseAsync( + blockchainMemberName, transactionNodeName, resourceGroupName, apiKey) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Regenerate the API keys for the blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param transactionNodeName Transaction node name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return collection of the API key payload which is exposed in the response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listRegenerateApiKeysAsync( + String blockchainMemberName, String transactionNodeName, String resourceGroupName) { + final ApiKey apiKey = null; + return listRegenerateApiKeysWithResponseAsync( + blockchainMemberName, transactionNodeName, resourceGroupName, apiKey) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Regenerate the API keys for the blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param transactionNodeName Transaction node name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return collection of the API key payload which is exposed in the response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApiKeyCollectionInner listRegenerateApiKeys( + String blockchainMemberName, String transactionNodeName, String resourceGroupName) { + final ApiKey apiKey = null; + return listRegenerateApiKeysAsync(blockchainMemberName, transactionNodeName, resourceGroupName, apiKey).block(); + } + + /** + * Regenerate the API keys for the blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param transactionNodeName Transaction node name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param apiKey api key to be regenerated. + * @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 collection of the API key payload which is exposed in the response of the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listRegenerateApiKeysWithResponse( + String blockchainMemberName, + String transactionNodeName, + String resourceGroupName, + ApiKey apiKey, + Context context) { + return listRegenerateApiKeysWithResponseAsync( + blockchainMemberName, transactionNodeName, resourceGroupName, apiKey, context) + .block(); + } + + /** + * 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 collection of transaction node payload which is exposed in the request/response of the resource provider. + */ + @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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 collection of transaction node payload which is exposed in the request/response of the resource provider. + */ + @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/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/TransactionNodesImpl.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/TransactionNodesImpl.java new file mode 100644 index 000000000000..8d542e934329 --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/TransactionNodesImpl.java @@ -0,0 +1,273 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.blockchain.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.blockchain.BlockchainManager; +import com.azure.resourcemanager.blockchain.fluent.TransactionNodesClient; +import com.azure.resourcemanager.blockchain.fluent.models.ApiKeyCollectionInner; +import com.azure.resourcemanager.blockchain.fluent.models.TransactionNodeInner; +import com.azure.resourcemanager.blockchain.models.ApiKey; +import com.azure.resourcemanager.blockchain.models.ApiKeyCollection; +import com.azure.resourcemanager.blockchain.models.TransactionNode; +import com.azure.resourcemanager.blockchain.models.TransactionNodes; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class TransactionNodesImpl implements TransactionNodes { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TransactionNodesImpl.class); + + private final TransactionNodesClient innerClient; + + private final BlockchainManager serviceManager; + + public TransactionNodesImpl(TransactionNodesClient innerClient, BlockchainManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public TransactionNode get(String blockchainMemberName, String transactionNodeName, String resourceGroupName) { + TransactionNodeInner inner = + this.serviceClient().get(blockchainMemberName, transactionNodeName, resourceGroupName); + if (inner != null) { + return new TransactionNodeImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String blockchainMemberName, String transactionNodeName, String resourceGroupName, Context context) { + Response inner = + this.serviceClient().getWithResponse(blockchainMemberName, transactionNodeName, resourceGroupName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new TransactionNodeImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String blockchainMemberName, String transactionNodeName, String resourceGroupName) { + this.serviceClient().delete(blockchainMemberName, transactionNodeName, resourceGroupName); + } + + public void delete( + String blockchainMemberName, String transactionNodeName, String resourceGroupName, Context context) { + this.serviceClient().delete(blockchainMemberName, transactionNodeName, resourceGroupName, context); + } + + public PagedIterable list(String blockchainMemberName, String resourceGroupName) { + PagedIterable inner = this.serviceClient().list(blockchainMemberName, resourceGroupName); + return Utils.mapPage(inner, inner1 -> new TransactionNodeImpl(inner1, this.manager())); + } + + public PagedIterable list(String blockchainMemberName, String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().list(blockchainMemberName, resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new TransactionNodeImpl(inner1, this.manager())); + } + + public ApiKeyCollection listApiKeys( + String blockchainMemberName, String transactionNodeName, String resourceGroupName) { + ApiKeyCollectionInner inner = + this.serviceClient().listApiKeys(blockchainMemberName, transactionNodeName, resourceGroupName); + if (inner != null) { + return new ApiKeyCollectionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listApiKeysWithResponse( + String blockchainMemberName, String transactionNodeName, String resourceGroupName, Context context) { + Response inner = + this + .serviceClient() + .listApiKeysWithResponse(blockchainMemberName, transactionNodeName, resourceGroupName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ApiKeyCollectionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ApiKeyCollection listRegenerateApiKeys( + String blockchainMemberName, String transactionNodeName, String resourceGroupName) { + ApiKeyCollectionInner inner = + this.serviceClient().listRegenerateApiKeys(blockchainMemberName, transactionNodeName, resourceGroupName); + if (inner != null) { + return new ApiKeyCollectionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listRegenerateApiKeysWithResponse( + String blockchainMemberName, + String transactionNodeName, + String resourceGroupName, + ApiKey apiKey, + Context context) { + Response inner = + this + .serviceClient() + .listRegenerateApiKeysWithResponse( + blockchainMemberName, transactionNodeName, resourceGroupName, apiKey, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ApiKeyCollectionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public TransactionNode getById(String id) { + String blockchainMemberName = Utils.getValueFromIdByName(id, "blockchainMembers"); + if (blockchainMemberName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'blockchainMembers'.", id))); + } + String transactionNodeName = Utils.getValueFromIdByName(id, "transactionNodes"); + if (transactionNodeName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'transactionNodes'.", 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))); + } + return this + .getWithResponse(blockchainMemberName, transactionNodeName, resourceGroupName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String blockchainMemberName = Utils.getValueFromIdByName(id, "blockchainMembers"); + if (blockchainMemberName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'blockchainMembers'.", id))); + } + String transactionNodeName = Utils.getValueFromIdByName(id, "transactionNodes"); + if (transactionNodeName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'transactionNodes'.", 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))); + } + return this.getWithResponse(blockchainMemberName, transactionNodeName, resourceGroupName, context); + } + + public void deleteById(String id) { + String blockchainMemberName = Utils.getValueFromIdByName(id, "blockchainMembers"); + if (blockchainMemberName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'blockchainMembers'.", id))); + } + String transactionNodeName = Utils.getValueFromIdByName(id, "transactionNodes"); + if (transactionNodeName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'transactionNodes'.", 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))); + } + this.delete(blockchainMemberName, transactionNodeName, resourceGroupName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String blockchainMemberName = Utils.getValueFromIdByName(id, "blockchainMembers"); + if (blockchainMemberName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'blockchainMembers'.", id))); + } + String transactionNodeName = Utils.getValueFromIdByName(id, "transactionNodes"); + if (transactionNodeName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'transactionNodes'.", 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))); + } + this.delete(blockchainMemberName, transactionNodeName, resourceGroupName, context); + } + + private TransactionNodesClient serviceClient() { + return this.innerClient; + } + + private BlockchainManager manager() { + return this.serviceManager; + } + + public TransactionNodeImpl define(String name) { + return new TransactionNodeImpl(name, this.manager()); + } +} diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/Utils.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/Utils.java new file mode 100644 index 000000000000..8f7aabbee073 --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/Utils.java @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.blockchain.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.Mono; + +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 pageIterable; + private final Function mapper; + private final Function, PagedResponse> pageMapper; + + private PagedIterableImpl(PagedIterable pageIterable, Function mapper) { + super(new PagedFlux(Mono::empty)); + this.pageIterable = pageIterable; + this.mapper = mapper; + this.pageMapper = + 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 pageIterable.stream().map(mapper); + } + + @Override + public Stream> streamByPage() { + return pageIterable.streamByPage().map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken) { + return pageIterable.streamByPage(continuationToken).map(pageMapper); + } + + @Override + public Stream> streamByPage(int preferredPageSize) { + return pageIterable.streamByPage(preferredPageSize).map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken, int preferredPageSize) { + return pageIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + } + + @Override + public Iterator iterator() { + return new IteratorImpl(pageIterable.iterator(), mapper); + } + + @Override + public Iterable> iterableByPage() { + return new IterableImpl, PagedResponse>(pageIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl, PagedResponse>( + pageIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pageIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pageIterable.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/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/package-info.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/package-info.java new file mode 100644 index 000000000000..0815f91f8d26 --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/implementation/package-info.java @@ -0,0 +1,6 @@ +// 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 BlockchainManagementClient. REST API for Azure Blockchain Service. */ +package com.azure.resourcemanager.blockchain.implementation; diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/ApiKey.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/ApiKey.java new file mode 100644 index 000000000000..2d10af3e3ac0 --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/ApiKey.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.blockchain.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; + +/** API key payload which is exposed in the request/response of the resource provider. */ +@Fluent +public final class ApiKey { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ApiKey.class); + + /* + * Gets or sets the API key name. + */ + @JsonProperty(value = "keyName") + private String keyName; + + /* + * Gets or sets the API key value. + */ + @JsonProperty(value = "value") + private String value; + + /** + * Get the keyName property: Gets or sets the API key name. + * + * @return the keyName value. + */ + public String keyName() { + return this.keyName; + } + + /** + * Set the keyName property: Gets or sets the API key name. + * + * @param keyName the keyName value to set. + * @return the ApiKey object itself. + */ + public ApiKey withKeyName(String keyName) { + this.keyName = keyName; + return this; + } + + /** + * Get the value property: Gets or sets the API key value. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: Gets or sets the API key value. + * + * @param value the value value to set. + * @return the ApiKey object itself. + */ + public ApiKey withValue(String value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/ApiKeyCollection.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/ApiKeyCollection.java new file mode 100644 index 000000000000..7e6ae2b2f0b1 --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/ApiKeyCollection.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.blockchain.models; + +import com.azure.resourcemanager.blockchain.fluent.models.ApiKeyCollectionInner; +import java.util.List; + +/** An immutable client-side representation of ApiKeyCollection. */ +public interface ApiKeyCollection { + /** + * Gets the keys property: Gets or sets the collection of API key. + * + * @return the keys value. + */ + List keys(); + + /** + * Gets the inner com.azure.resourcemanager.blockchain.fluent.models.ApiKeyCollectionInner object. + * + * @return the inner object. + */ + ApiKeyCollectionInner innerModel(); +} diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/BlockchainMember.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/BlockchainMember.java new file mode 100644 index 000000000000..b77cddf8249a --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/BlockchainMember.java @@ -0,0 +1,479 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.blockchain.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.blockchain.fluent.models.BlockchainMemberInner; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of BlockchainMember. */ +public interface BlockchainMember { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the sku property: Gets or sets the blockchain member Sku. + * + * @return the sku value. + */ + Sku sku(); + + /** + * Gets the protocol property: Gets or sets the blockchain protocol. + * + * @return the protocol value. + */ + BlockchainProtocol protocol(); + + /** + * Gets the validatorNodesSku property: Gets or sets the blockchain validator nodes Sku. + * + * @return the validatorNodesSku value. + */ + BlockchainMemberNodesSku validatorNodesSku(); + + /** + * Gets the provisioningState property: Gets or sets the blockchain member provision state. + * + * @return the provisioningState value. + */ + BlockchainMemberProvisioningState provisioningState(); + + /** + * Gets the dns property: Gets the dns endpoint of the blockchain member. + * + * @return the dns value. + */ + String dns(); + + /** + * Gets the username property: Gets the auth user name of the blockchain member. + * + * @return the username value. + */ + String username(); + + /** + * Gets the password property: Sets the basic auth password of the blockchain member. + * + * @return the password value. + */ + String password(); + + /** + * Gets the consortium property: Gets or sets the consortium for the blockchain member. + * + * @return the consortium value. + */ + String consortium(); + + /** + * Gets the consortiumManagementAccountAddress property: Gets the managed consortium management account address. + * + * @return the consortiumManagementAccountAddress value. + */ + String consortiumManagementAccountAddress(); + + /** + * Gets the consortiumManagementAccountPassword property: Sets the managed consortium management account password. + * + * @return the consortiumManagementAccountPassword value. + */ + String consortiumManagementAccountPassword(); + + /** + * Gets the consortiumRole property: Gets the role of the member in the consortium. + * + * @return the consortiumRole value. + */ + String consortiumRole(); + + /** + * Gets the consortiumMemberDisplayName property: Gets the display name of the member in the consortium. + * + * @return the consortiumMemberDisplayName value. + */ + String consortiumMemberDisplayName(); + + /** + * Gets the rootContractAddress property: Gets the Ethereum root contract address of the blockchain. + * + * @return the rootContractAddress value. + */ + String rootContractAddress(); + + /** + * Gets the publicKey property: Gets the public key of the blockchain member (default transaction node). + * + * @return the publicKey value. + */ + String publicKey(); + + /** + * Gets the firewallRules property: Gets or sets firewall rules. + * + * @return the firewallRules value. + */ + List firewallRules(); + + /** + * 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.blockchain.fluent.models.BlockchainMemberInner object. + * + * @return the inner object. + */ + BlockchainMemberInner innerModel(); + + /** The entirety of the BlockchainMember definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The BlockchainMember definition stages. */ + interface DefinitionStages { + /** The first stage of the BlockchainMember definition. */ + interface Blank extends WithLocation { + } + /** The stage of the BlockchainMember definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + /** The stage of the BlockchainMember definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the BlockchainMember definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, + DefinitionStages.WithSku, + DefinitionStages.WithProtocol, + DefinitionStages.WithValidatorNodesSku, + DefinitionStages.WithPassword, + DefinitionStages.WithConsortium, + DefinitionStages.WithConsortiumManagementAccountPassword, + DefinitionStages.WithConsortiumRole, + DefinitionStages.WithConsortiumMemberDisplayName, + DefinitionStages.WithFirewallRules { + /** + * Executes the create request. + * + * @return the created resource. + */ + BlockchainMember create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + BlockchainMember create(Context context); + } + /** The stage of the BlockchainMember definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the BlockchainMember definition allowing to specify sku. */ + interface WithSku { + /** + * Specifies the sku property: Gets or sets the blockchain member Sku.. + * + * @param sku Gets or sets the blockchain member Sku. + * @return the next definition stage. + */ + WithCreate withSku(Sku sku); + } + /** The stage of the BlockchainMember definition allowing to specify protocol. */ + interface WithProtocol { + /** + * Specifies the protocol property: Gets or sets the blockchain protocol.. + * + * @param protocol Gets or sets the blockchain protocol. + * @return the next definition stage. + */ + WithCreate withProtocol(BlockchainProtocol protocol); + } + /** The stage of the BlockchainMember definition allowing to specify validatorNodesSku. */ + interface WithValidatorNodesSku { + /** + * Specifies the validatorNodesSku property: Gets or sets the blockchain validator nodes Sku.. + * + * @param validatorNodesSku Gets or sets the blockchain validator nodes Sku. + * @return the next definition stage. + */ + WithCreate withValidatorNodesSku(BlockchainMemberNodesSku validatorNodesSku); + } + /** The stage of the BlockchainMember definition allowing to specify password. */ + interface WithPassword { + /** + * Specifies the password property: Sets the basic auth password of the blockchain member.. + * + * @param password Sets the basic auth password of the blockchain member. + * @return the next definition stage. + */ + WithCreate withPassword(String password); + } + /** The stage of the BlockchainMember definition allowing to specify consortium. */ + interface WithConsortium { + /** + * Specifies the consortium property: Gets or sets the consortium for the blockchain member.. + * + * @param consortium Gets or sets the consortium for the blockchain member. + * @return the next definition stage. + */ + WithCreate withConsortium(String consortium); + } + /** The stage of the BlockchainMember definition allowing to specify consortiumManagementAccountPassword. */ + interface WithConsortiumManagementAccountPassword { + /** + * Specifies the consortiumManagementAccountPassword property: Sets the managed consortium management + * account password.. + * + * @param consortiumManagementAccountPassword Sets the managed consortium management account password. + * @return the next definition stage. + */ + WithCreate withConsortiumManagementAccountPassword(String consortiumManagementAccountPassword); + } + /** The stage of the BlockchainMember definition allowing to specify consortiumRole. */ + interface WithConsortiumRole { + /** + * Specifies the consortiumRole property: Gets the role of the member in the consortium.. + * + * @param consortiumRole Gets the role of the member in the consortium. + * @return the next definition stage. + */ + WithCreate withConsortiumRole(String consortiumRole); + } + /** The stage of the BlockchainMember definition allowing to specify consortiumMemberDisplayName. */ + interface WithConsortiumMemberDisplayName { + /** + * Specifies the consortiumMemberDisplayName property: Gets the display name of the member in the + * consortium.. + * + * @param consortiumMemberDisplayName Gets the display name of the member in the consortium. + * @return the next definition stage. + */ + WithCreate withConsortiumMemberDisplayName(String consortiumMemberDisplayName); + } + /** The stage of the BlockchainMember definition allowing to specify firewallRules. */ + interface WithFirewallRules { + /** + * Specifies the firewallRules property: Gets or sets firewall rules. + * + * @param firewallRules Gets or sets firewall rules. + * @return the next definition stage. + */ + WithCreate withFirewallRules(List firewallRules); + } + } + /** + * Begins update for the BlockchainMember resource. + * + * @return the stage of resource update. + */ + BlockchainMember.Update update(); + + /** The template for BlockchainMember update. */ + interface Update + extends UpdateStages.WithTags, + UpdateStages.WithPassword, + UpdateStages.WithFirewallRules, + UpdateStages.WithConsortiumManagementAccountPassword { + /** + * Executes the update request. + * + * @return the updated resource. + */ + BlockchainMember apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + BlockchainMember apply(Context context); + } + /** The BlockchainMember update stages. */ + interface UpdateStages { + /** The stage of the BlockchainMember update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Tags of the service which is a list of key value pairs that describes the + * resource.. + * + * @param tags Tags of the service which is a list of key value pairs that describes the resource. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the BlockchainMember update allowing to specify password. */ + interface WithPassword { + /** + * Specifies the password property: Sets the transaction node dns endpoint basic auth password.. + * + * @param password Sets the transaction node dns endpoint basic auth password. + * @return the next definition stage. + */ + Update withPassword(String password); + } + /** The stage of the BlockchainMember update allowing to specify firewallRules. */ + interface WithFirewallRules { + /** + * Specifies the firewallRules property: Gets or sets the firewall rules.. + * + * @param firewallRules Gets or sets the firewall rules. + * @return the next definition stage. + */ + Update withFirewallRules(List firewallRules); + } + /** The stage of the BlockchainMember update allowing to specify consortiumManagementAccountPassword. */ + interface WithConsortiumManagementAccountPassword { + /** + * Specifies the consortiumManagementAccountPassword property: Sets the managed consortium management + * account password.. + * + * @param consortiumManagementAccountPassword Sets the managed consortium management account password. + * @return the next definition stage. + */ + Update withConsortiumManagementAccountPassword(String consortiumManagementAccountPassword); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + BlockchainMember refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + BlockchainMember refresh(Context context); + + /** + * Lists the API keys for a blockchain member. + * + * @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 collection of the API key payload which is exposed in the response of the resource provider. + */ + ApiKeyCollection listApiKeys(); + + /** + * Lists the API keys for a blockchain member. + * + * @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 collection of the API key payload which is exposed in the response of the resource provider. + */ + Response listApiKeysWithResponse(Context context); + + /** + * Regenerate the API keys for a blockchain member. + * + * @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 collection of the API key payload which is exposed in the response of the resource provider. + */ + ApiKeyCollection listRegenerateApiKeys(); + + /** + * Regenerate the API keys for a blockchain member. + * + * @param apiKey api key to be regenerate. + * @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 collection of the API key payload which is exposed in the response of the resource provider. + */ + Response listRegenerateApiKeysWithResponse(ApiKey apiKey, Context context); +} diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/BlockchainMemberCollection.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/BlockchainMemberCollection.java new file mode 100644 index 000000000000..ed503a217678 --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/BlockchainMemberCollection.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.blockchain.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.blockchain.fluent.models.BlockchainMemberInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Collection of the blockchain member payload which is exposed in the request/response of the resource provider. */ +@Fluent +public final class BlockchainMemberCollection { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BlockchainMemberCollection.class); + + /* + * Gets or sets the collection of blockchain members. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Gets or sets the URL, that the client should use to fetch the next page + * (per server side paging). + * It's null for now, added for future use. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: Gets or sets the collection of blockchain members. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Gets or sets the collection of blockchain members. + * + * @param value the value value to set. + * @return the BlockchainMemberCollection object itself. + */ + public BlockchainMemberCollection withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Gets or sets the URL, that the client should use to fetch the next page (per server + * side paging). It's null for now, added for future use. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Gets or sets the URL, that the client should use to fetch the next page (per server + * side paging). It's null for now, added for future use. + * + * @param nextLink the nextLink value to set. + * @return the BlockchainMemberCollection object itself. + */ + public BlockchainMemberCollection 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/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/BlockchainMemberNodesSku.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/BlockchainMemberNodesSku.java new file mode 100644 index 000000000000..8e198c8bc9d1 --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/BlockchainMemberNodesSku.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.blockchain.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; + +/** Payload of the blockchain member nodes Sku for a blockchain member. */ +@Fluent +public final class BlockchainMemberNodesSku { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BlockchainMemberNodesSku.class); + + /* + * Gets or sets the nodes capacity. + */ + @JsonProperty(value = "capacity") + private Integer capacity; + + /** + * Get the capacity property: Gets or sets the nodes capacity. + * + * @return the capacity value. + */ + public Integer capacity() { + return this.capacity; + } + + /** + * Set the capacity property: Gets or sets the nodes capacity. + * + * @param capacity the capacity value to set. + * @return the BlockchainMemberNodesSku object itself. + */ + public BlockchainMemberNodesSku withCapacity(Integer capacity) { + this.capacity = capacity; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/BlockchainMemberOperationResults.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/BlockchainMemberOperationResults.java new file mode 100644 index 000000000000..7c07cdd070a2 --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/BlockchainMemberOperationResults.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.blockchain.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of BlockchainMemberOperationResults. */ +public interface BlockchainMemberOperationResults { + /** + * Get Async operation result. + * + * @param locationName Location name. + * @param operationId Operation 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 async operation result. + */ + OperationResult get(String locationName, String operationId); + + /** + * Get Async operation result. + * + * @param locationName Location name. + * @param operationId Operation 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 async operation result. + */ + Response getWithResponse(String locationName, String operationId, Context context); +} diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/BlockchainMemberPropertiesUpdate.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/BlockchainMemberPropertiesUpdate.java new file mode 100644 index 000000000000..ed59c05010f8 --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/BlockchainMemberPropertiesUpdate.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.blockchain.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; + +/** Update the payload of the blockchain member properties for a blockchain member. */ +@Fluent +public final class BlockchainMemberPropertiesUpdate extends TransactionNodePropertiesUpdate { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BlockchainMemberPropertiesUpdate.class); + + /* + * Sets the managed consortium management account password. + */ + @JsonProperty(value = "consortiumManagementAccountPassword") + private String consortiumManagementAccountPassword; + + /** + * Get the consortiumManagementAccountPassword property: Sets the managed consortium management account password. + * + * @return the consortiumManagementAccountPassword value. + */ + public String consortiumManagementAccountPassword() { + return this.consortiumManagementAccountPassword; + } + + /** + * Set the consortiumManagementAccountPassword property: Sets the managed consortium management account password. + * + * @param consortiumManagementAccountPassword the consortiumManagementAccountPassword value to set. + * @return the BlockchainMemberPropertiesUpdate object itself. + */ + public BlockchainMemberPropertiesUpdate withConsortiumManagementAccountPassword( + String consortiumManagementAccountPassword) { + this.consortiumManagementAccountPassword = consortiumManagementAccountPassword; + return this; + } + + /** {@inheritDoc} */ + @Override + public BlockchainMemberPropertiesUpdate withPassword(String password) { + super.withPassword(password); + return this; + } + + /** {@inheritDoc} */ + @Override + public BlockchainMemberPropertiesUpdate withFirewallRules(List firewallRules) { + super.withFirewallRules(firewallRules); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/BlockchainMemberProvisioningState.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/BlockchainMemberProvisioningState.java new file mode 100644 index 000000000000..18f98885ac3c --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/BlockchainMemberProvisioningState.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.blockchain.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for BlockchainMemberProvisioningState. */ +public final class BlockchainMemberProvisioningState extends ExpandableStringEnum { + /** Static value NotSpecified for BlockchainMemberProvisioningState. */ + public static final BlockchainMemberProvisioningState NOT_SPECIFIED = fromString("NotSpecified"); + + /** Static value Updating for BlockchainMemberProvisioningState. */ + public static final BlockchainMemberProvisioningState UPDATING = fromString("Updating"); + + /** Static value Deleting for BlockchainMemberProvisioningState. */ + public static final BlockchainMemberProvisioningState DELETING = fromString("Deleting"); + + /** Static value Succeeded for BlockchainMemberProvisioningState. */ + public static final BlockchainMemberProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** Static value Failed for BlockchainMemberProvisioningState. */ + public static final BlockchainMemberProvisioningState FAILED = fromString("Failed"); + + /** Static value Stale for BlockchainMemberProvisioningState. */ + public static final BlockchainMemberProvisioningState STALE = fromString("Stale"); + + /** + * Creates or finds a BlockchainMemberProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding BlockchainMemberProvisioningState. + */ + @JsonCreator + public static BlockchainMemberProvisioningState fromString(String name) { + return fromString(name, BlockchainMemberProvisioningState.class); + } + + /** @return known BlockchainMemberProvisioningState values. */ + public static Collection values() { + return values(BlockchainMemberProvisioningState.class); + } +} diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/BlockchainMemberUpdate.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/BlockchainMemberUpdate.java new file mode 100644 index 000000000000..bb2dca8f7583 --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/BlockchainMemberUpdate.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.blockchain.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** Update the payload of the blockchain member which is exposed in the request/response of the resource provider. */ +@JsonFlatten +@Fluent +public class BlockchainMemberUpdate { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BlockchainMemberUpdate.class); + + /* + * Tags of the service which is a list of key value pairs that describes + * the resource. + */ + @JsonProperty(value = "tags") + private Map tags; + + /* + * Sets the transaction node dns endpoint basic auth password. + */ + @JsonProperty(value = "properties.password") + private String password; + + /* + * Gets or sets the firewall rules. + */ + @JsonProperty(value = "properties.firewallRules") + private List firewallRules; + + /* + * Sets the managed consortium management account password. + */ + @JsonProperty(value = "properties.consortiumManagementAccountPassword") + private String consortiumManagementAccountPassword; + + /** + * Get the tags property: Tags of the service which is a list of key value pairs that describes the resource. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Tags of the service which is a list of key value pairs that describes the resource. + * + * @param tags the tags value to set. + * @return the BlockchainMemberUpdate object itself. + */ + public BlockchainMemberUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the password property: Sets the transaction node dns endpoint basic auth password. + * + * @return the password value. + */ + public String password() { + return this.password; + } + + /** + * Set the password property: Sets the transaction node dns endpoint basic auth password. + * + * @param password the password value to set. + * @return the BlockchainMemberUpdate object itself. + */ + public BlockchainMemberUpdate withPassword(String password) { + this.password = password; + return this; + } + + /** + * Get the firewallRules property: Gets or sets the firewall rules. + * + * @return the firewallRules value. + */ + public List firewallRules() { + return this.firewallRules; + } + + /** + * Set the firewallRules property: Gets or sets the firewall rules. + * + * @param firewallRules the firewallRules value to set. + * @return the BlockchainMemberUpdate object itself. + */ + public BlockchainMemberUpdate withFirewallRules(List firewallRules) { + this.firewallRules = firewallRules; + return this; + } + + /** + * Get the consortiumManagementAccountPassword property: Sets the managed consortium management account password. + * + * @return the consortiumManagementAccountPassword value. + */ + public String consortiumManagementAccountPassword() { + return this.consortiumManagementAccountPassword; + } + + /** + * Set the consortiumManagementAccountPassword property: Sets the managed consortium management account password. + * + * @param consortiumManagementAccountPassword the consortiumManagementAccountPassword value to set. + * @return the BlockchainMemberUpdate object itself. + */ + public BlockchainMemberUpdate withConsortiumManagementAccountPassword(String consortiumManagementAccountPassword) { + this.consortiumManagementAccountPassword = consortiumManagementAccountPassword; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (firewallRules() != null) { + firewallRules().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/BlockchainMembers.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/BlockchainMembers.java new file mode 100644 index 000000000000..71d903141d9d --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/BlockchainMembers.java @@ -0,0 +1,251 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.blockchain.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 BlockchainMembers. */ +public interface BlockchainMembers { + /** + * Get details about a blockchain member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param blockchainMemberName Blockchain member name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return details about a blockchain member. + */ + BlockchainMember getByResourceGroup(String resourceGroupName, String blockchainMemberName); + + /** + * Get details about a blockchain member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param blockchainMemberName Blockchain member name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return details about a blockchain member. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String blockchainMemberName, Context context); + + /** + * Delete a blockchain member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param blockchainMemberName Blockchain member name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String blockchainMemberName); + + /** + * Delete a blockchain member. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param blockchainMemberName Blockchain member name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String blockchainMemberName, Context context); + + /** + * Lists the blockchain members for a resource group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @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 collection of the blockchain member payload which is exposed in the request/response of the resource + * provider. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists the blockchain members for a resource group. + * + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @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 collection of the blockchain member payload which is exposed in the request/response of the resource + * provider. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Lists the blockchain members for a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return collection of the blockchain member payload which is exposed in the request/response of the resource + * provider. + */ + PagedIterable list(); + + /** + * Lists the blockchain members for a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return collection of the blockchain member payload which is exposed in the request/response of the resource + * provider. + */ + PagedIterable list(Context context); + + /** + * Lists the consortium members for a blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @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 collection of consortium payload. + */ + PagedIterable listConsortiumMembers(String blockchainMemberName, String resourceGroupName); + + /** + * Lists the consortium members for a blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @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 collection of consortium payload. + */ + PagedIterable listConsortiumMembers( + String blockchainMemberName, String resourceGroupName, Context context); + + /** + * Lists the API keys for a blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @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 collection of the API key payload which is exposed in the response of the resource provider. + */ + ApiKeyCollection listApiKeys(String blockchainMemberName, String resourceGroupName); + + /** + * Lists the API keys for a blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @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 collection of the API key payload which is exposed in the response of the resource provider. + */ + Response listApiKeysWithResponse( + String blockchainMemberName, String resourceGroupName, Context context); + + /** + * Regenerate the API keys for a blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @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 collection of the API key payload which is exposed in the response of the resource provider. + */ + ApiKeyCollection listRegenerateApiKeys(String blockchainMemberName, String resourceGroupName); + + /** + * Regenerate the API keys for a blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param apiKey api key to be regenerate. + * @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 collection of the API key payload which is exposed in the response of the resource provider. + */ + Response listRegenerateApiKeysWithResponse( + String blockchainMemberName, String resourceGroupName, ApiKey apiKey, Context context); + + /** + * Get details about a blockchain member. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return details about a blockchain member. + */ + BlockchainMember getById(String id); + + /** + * Get details about a blockchain member. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return details about a blockchain member. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a blockchain member. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a blockchain member. + * + * @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 BlockchainMember resource. + * + * @param name resource name. + * @return the first stage of the new BlockchainMember definition. + */ + BlockchainMember.DefinitionStages.Blank define(String name); +} diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/BlockchainProtocol.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/BlockchainProtocol.java new file mode 100644 index 000000000000..f2c3803090b6 --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/BlockchainProtocol.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.blockchain.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for BlockchainProtocol. */ +public final class BlockchainProtocol extends ExpandableStringEnum { + /** Static value NotSpecified for BlockchainProtocol. */ + public static final BlockchainProtocol NOT_SPECIFIED = fromString("NotSpecified"); + + /** Static value Parity for BlockchainProtocol. */ + public static final BlockchainProtocol PARITY = fromString("Parity"); + + /** Static value Quorum for BlockchainProtocol. */ + public static final BlockchainProtocol QUORUM = fromString("Quorum"); + + /** Static value Corda for BlockchainProtocol. */ + public static final BlockchainProtocol CORDA = fromString("Corda"); + + /** + * Creates or finds a BlockchainProtocol from its string representation. + * + * @param name a name to look for. + * @return the corresponding BlockchainProtocol. + */ + @JsonCreator + public static BlockchainProtocol fromString(String name) { + return fromString(name, BlockchainProtocol.class); + } + + /** @return known BlockchainProtocol values. */ + public static Collection values() { + return values(BlockchainProtocol.class); + } +} diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/Consortium.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/Consortium.java new file mode 100644 index 000000000000..5a116749d40d --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/Consortium.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.blockchain.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; + +/** Consortium payload. */ +@Fluent +public final class Consortium { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Consortium.class); + + /* + * Gets or sets the blockchain member name. + */ + @JsonProperty(value = "name") + private String name; + + /* + * Gets or sets the protocol for the consortium. + */ + @JsonProperty(value = "protocol") + private BlockchainProtocol protocol; + + /** + * Get the name property: Gets or sets the blockchain member name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Gets or sets the blockchain member name. + * + * @param name the name value to set. + * @return the Consortium object itself. + */ + public Consortium withName(String name) { + this.name = name; + return this; + } + + /** + * Get the protocol property: Gets or sets the protocol for the consortium. + * + * @return the protocol value. + */ + public BlockchainProtocol protocol() { + return this.protocol; + } + + /** + * Set the protocol property: Gets or sets the protocol for the consortium. + * + * @param protocol the protocol value to set. + * @return the Consortium object itself. + */ + public Consortium withProtocol(BlockchainProtocol protocol) { + this.protocol = protocol; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/ConsortiumCollection.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/ConsortiumCollection.java new file mode 100644 index 000000000000..a3fa8ee7b4fd --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/ConsortiumCollection.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.blockchain.models; + +import com.azure.resourcemanager.blockchain.fluent.models.ConsortiumCollectionInner; +import java.util.List; + +/** An immutable client-side representation of ConsortiumCollection. */ +public interface ConsortiumCollection { + /** + * Gets the value property: Gets or sets the collection of consortiums. + * + * @return the value value. + */ + List value(); + + /** + * Gets the inner com.azure.resourcemanager.blockchain.fluent.models.ConsortiumCollectionInner object. + * + * @return the inner object. + */ + ConsortiumCollectionInner innerModel(); +} diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/ConsortiumMember.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/ConsortiumMember.java new file mode 100644 index 000000000000..0e9ac7d20704 --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/ConsortiumMember.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.blockchain.models; + +import com.azure.resourcemanager.blockchain.fluent.models.ConsortiumMemberInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of ConsortiumMember. */ +public interface ConsortiumMember { + /** + * Gets the name property: Gets the consortium member name. + * + * @return the name value. + */ + String name(); + + /** + * Gets the displayName property: Gets the consortium member display name. + * + * @return the displayName value. + */ + String displayName(); + + /** + * Gets the subscriptionId property: Gets the consortium member subscription id. + * + * @return the subscriptionId value. + */ + String subscriptionId(); + + /** + * Gets the role property: Gets the consortium member role. + * + * @return the role value. + */ + String role(); + + /** + * Gets the status property: Gets the consortium member status. + * + * @return the status value. + */ + String status(); + + /** + * Gets the joinDate property: Gets the consortium member join date. + * + * @return the joinDate value. + */ + OffsetDateTime joinDate(); + + /** + * Gets the dateModified property: Gets the consortium member modified date. + * + * @return the dateModified value. + */ + OffsetDateTime dateModified(); + + /** + * Gets the inner com.azure.resourcemanager.blockchain.fluent.models.ConsortiumMemberInner object. + * + * @return the inner object. + */ + ConsortiumMemberInner innerModel(); +} diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/ConsortiumMemberCollection.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/ConsortiumMemberCollection.java new file mode 100644 index 000000000000..5c0a7211d21b --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/ConsortiumMemberCollection.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.blockchain.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.blockchain.fluent.models.ConsortiumMemberInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Collection of consortium payload. */ +@Fluent +public final class ConsortiumMemberCollection { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ConsortiumMemberCollection.class); + + /* + * Gets or sets the collection of consortiums. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Gets or sets the URL, that the client should use to fetch the next page + * (per server side paging). + * It's null for now, added for future use. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: Gets or sets the collection of consortiums. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Gets or sets the collection of consortiums. + * + * @param value the value value to set. + * @return the ConsortiumMemberCollection object itself. + */ + public ConsortiumMemberCollection withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Gets or sets the URL, that the client should use to fetch the next page (per server + * side paging). It's null for now, added for future use. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Gets or sets the URL, that the client should use to fetch the next page (per server + * side paging). It's null for now, added for future use. + * + * @param nextLink the nextLink value to set. + * @return the ConsortiumMemberCollection object itself. + */ + public ConsortiumMemberCollection 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/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/FirewallRule.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/FirewallRule.java new file mode 100644 index 000000000000..19aca46888b0 --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/FirewallRule.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.blockchain.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; + +/** Ip range for firewall rules. */ +@Fluent +public final class FirewallRule { + @JsonIgnore private final ClientLogger logger = new ClientLogger(FirewallRule.class); + + /* + * Gets or sets the name of the firewall rules. + */ + @JsonProperty(value = "ruleName") + private String ruleName; + + /* + * Gets or sets the start IP address of the firewall rule range. + */ + @JsonProperty(value = "startIpAddress") + private String startIpAddress; + + /* + * Gets or sets the end IP address of the firewall rule range. + */ + @JsonProperty(value = "endIpAddress") + private String endIpAddress; + + /** + * Get the ruleName property: Gets or sets the name of the firewall rules. + * + * @return the ruleName value. + */ + public String ruleName() { + return this.ruleName; + } + + /** + * Set the ruleName property: Gets or sets the name of the firewall rules. + * + * @param ruleName the ruleName value to set. + * @return the FirewallRule object itself. + */ + public FirewallRule withRuleName(String ruleName) { + this.ruleName = ruleName; + return this; + } + + /** + * Get the startIpAddress property: Gets or sets the start IP address of the firewall rule range. + * + * @return the startIpAddress value. + */ + public String startIpAddress() { + return this.startIpAddress; + } + + /** + * Set the startIpAddress property: Gets or sets the start IP address of the firewall rule range. + * + * @param startIpAddress the startIpAddress value to set. + * @return the FirewallRule object itself. + */ + public FirewallRule withStartIpAddress(String startIpAddress) { + this.startIpAddress = startIpAddress; + return this; + } + + /** + * Get the endIpAddress property: Gets or sets the end IP address of the firewall rule range. + * + * @return the endIpAddress value. + */ + public String endIpAddress() { + return this.endIpAddress; + } + + /** + * Set the endIpAddress property: Gets or sets the end IP address of the firewall rule range. + * + * @param endIpAddress the endIpAddress value to set. + * @return the FirewallRule object itself. + */ + public FirewallRule withEndIpAddress(String endIpAddress) { + this.endIpAddress = endIpAddress; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/Locations.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/Locations.java new file mode 100644 index 000000000000..2d6efbe0c606 --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/Locations.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.blockchain.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Locations. */ +public interface Locations { + /** + * To check whether a resource name is available. + * + * @param locationName Location Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return name availability payload which is exposed in the response of the resource provider. + */ + NameAvailability checkNameAvailability(String locationName); + + /** + * To check whether a resource name is available. + * + * @param locationName Location Name. + * @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 name availability payload which is exposed in the response of the resource provider. + */ + Response checkNameAvailabilityWithResponse( + String locationName, NameAvailabilityRequest nameAvailabilityRequest, Context context); + + /** + * Lists the available consortiums for a subscription. + * + * @param locationName Location Name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return collection of the consortium payload. + */ + ConsortiumCollection listConsortiums(String locationName); + + /** + * Lists the available consortiums for a subscription. + * + * @param locationName Location Name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return collection of the consortium payload. + */ + Response listConsortiumsWithResponse(String locationName, Context context); +} diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/NameAvailability.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/NameAvailability.java new file mode 100644 index 000000000000..cc86e6288d21 --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/NameAvailability.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.blockchain.models; + +import com.azure.resourcemanager.blockchain.fluent.models.NameAvailabilityInner; + +/** An immutable client-side representation of NameAvailability. */ +public interface NameAvailability { + /** + * Gets the nameAvailable property: Gets or sets the value indicating whether the name is available. + * + * @return the nameAvailable value. + */ + Boolean nameAvailable(); + + /** + * Gets the message property: Gets or sets the message. + * + * @return the message value. + */ + String message(); + + /** + * Gets the reason property: Gets or sets the name availability reason. + * + * @return the reason value. + */ + NameAvailabilityReason reason(); + + /** + * Gets the inner com.azure.resourcemanager.blockchain.fluent.models.NameAvailabilityInner object. + * + * @return the inner object. + */ + NameAvailabilityInner innerModel(); +} diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/NameAvailabilityReason.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/NameAvailabilityReason.java new file mode 100644 index 000000000000..c1e66e72a058 --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/NameAvailabilityReason.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.blockchain.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for NameAvailabilityReason. */ +public final class NameAvailabilityReason extends ExpandableStringEnum { + /** Static value NotSpecified for NameAvailabilityReason. */ + public static final NameAvailabilityReason NOT_SPECIFIED = fromString("NotSpecified"); + + /** Static value AlreadyExists for NameAvailabilityReason. */ + public static final NameAvailabilityReason ALREADY_EXISTS = fromString("AlreadyExists"); + + /** Static value Invalid for NameAvailabilityReason. */ + public static final NameAvailabilityReason INVALID = fromString("Invalid"); + + /** + * Creates or finds a NameAvailabilityReason from its string representation. + * + * @param name a name to look for. + * @return the corresponding NameAvailabilityReason. + */ + @JsonCreator + public static NameAvailabilityReason fromString(String name) { + return fromString(name, NameAvailabilityReason.class); + } + + /** @return known NameAvailabilityReason values. */ + public static Collection values() { + return values(NameAvailabilityReason.class); + } +} diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/NameAvailabilityRequest.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/NameAvailabilityRequest.java new file mode 100644 index 000000000000..ad47d1692f7b --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/NameAvailabilityRequest.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.blockchain.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; + +/** Name availability request payload which is exposed in the request of the resource provider. */ +@Fluent +public final class NameAvailabilityRequest { + @JsonIgnore private final ClientLogger logger = new ClientLogger(NameAvailabilityRequest.class); + + /* + * Gets or sets the name to check. + */ + @JsonProperty(value = "name") + private String name; + + /* + * Gets or sets the type of the resource to check. + */ + @JsonProperty(value = "type") + private String type; + + /** + * Get the name property: Gets or sets the name to check. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Gets or sets the name to check. + * + * @param name the name value to set. + * @return the NameAvailabilityRequest object itself. + */ + public NameAvailabilityRequest withName(String name) { + this.name = name; + return this; + } + + /** + * Get the type property: Gets or sets the type of the resource to check. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: Gets or sets the type of the resource to check. + * + * @param type the type value to set. + * @return the NameAvailabilityRequest object itself. + */ + public NameAvailabilityRequest 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/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/NodeProvisioningState.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/NodeProvisioningState.java new file mode 100644 index 000000000000..7e1676de2824 --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/NodeProvisioningState.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.blockchain.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for NodeProvisioningState. */ +public final class NodeProvisioningState extends ExpandableStringEnum { + /** Static value NotSpecified for NodeProvisioningState. */ + public static final NodeProvisioningState NOT_SPECIFIED = fromString("NotSpecified"); + + /** Static value Updating for NodeProvisioningState. */ + public static final NodeProvisioningState UPDATING = fromString("Updating"); + + /** Static value Deleting for NodeProvisioningState. */ + public static final NodeProvisioningState DELETING = fromString("Deleting"); + + /** Static value Succeeded for NodeProvisioningState. */ + public static final NodeProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** Static value Failed for NodeProvisioningState. */ + public static final NodeProvisioningState FAILED = fromString("Failed"); + + /** + * Creates or finds a NodeProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding NodeProvisioningState. + */ + @JsonCreator + public static NodeProvisioningState fromString(String name) { + return fromString(name, NodeProvisioningState.class); + } + + /** @return known NodeProvisioningState values. */ + public static Collection values() { + return values(NodeProvisioningState.class); + } +} diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/OperationResult.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/OperationResult.java new file mode 100644 index 000000000000..238b25b12747 --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/OperationResult.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.blockchain.models; + +import com.azure.resourcemanager.blockchain.fluent.models.OperationResultInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of OperationResult. */ +public interface OperationResult { + /** + * Gets the name property: Gets or sets the operation name. + * + * @return the name value. + */ + String name(); + + /** + * Gets the startTime property: Gets or sets the operation start time. + * + * @return the startTime value. + */ + OffsetDateTime startTime(); + + /** + * Gets the endTime property: Gets or sets the operation end time. + * + * @return the endTime value. + */ + OffsetDateTime endTime(); + + /** + * Gets the inner com.azure.resourcemanager.blockchain.fluent.models.OperationResultInner object. + * + * @return the inner object. + */ + OperationResultInner innerModel(); +} diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/Operations.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/Operations.java new file mode 100644 index 000000000000..de34e72d4a0c --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/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.blockchain.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Operations. */ +public interface Operations { + /** + * Lists the available operations of Microsoft.Blockchain resource provider. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return collection of operation payload which is exposed in the response of the resource provider. + */ + PagedIterable list(); + + /** + * Lists the available operations of Microsoft.Blockchain resource provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return collection of operation payload which is exposed in the response of the resource provider. + */ + PagedIterable list(Context context); +} diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/ResourceProviderOperation.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/ResourceProviderOperation.java new file mode 100644 index 000000000000..8d6488f1ca2d --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/ResourceProviderOperation.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.blockchain.models; + +import com.azure.resourcemanager.blockchain.fluent.models.ResourceProviderOperationInner; + +/** An immutable client-side representation of ResourceProviderOperation. */ +public interface ResourceProviderOperation { + /** + * Gets the origin property: Gets or sets the origin. + * + * @return the origin value. + */ + String origin(); + + /** + * Gets the name property: Gets or sets the operation name. + * + * @return the name value. + */ + String name(); + + /** + * Gets the isDataAction property: Gets or sets a value indicating whether the operation is a data action or not. + * + * @return the isDataAction value. + */ + Boolean isDataAction(); + + /** + * Gets the display property: Gets or sets operation display. + * + * @return the display value. + */ + ResourceProviderOperationDisplay display(); + + /** + * Gets the inner com.azure.resourcemanager.blockchain.fluent.models.ResourceProviderOperationInner object. + * + * @return the inner object. + */ + ResourceProviderOperationInner innerModel(); +} diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/ResourceProviderOperationCollection.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/ResourceProviderOperationCollection.java new file mode 100644 index 000000000000..9711eb10a514 --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/ResourceProviderOperationCollection.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.blockchain.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.blockchain.fluent.models.ResourceProviderOperationInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Collection of operation payload which is exposed in the response of the resource provider. */ +@Fluent +public final class ResourceProviderOperationCollection { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceProviderOperationCollection.class); + + /* + * Gets or sets the collection of operations. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Gets or sets the URL, that the client should use to fetch the next page + * (per server side paging). + * It's null for now, added for future use. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: Gets or sets the collection of operations. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Gets or sets the collection of operations. + * + * @param value the value value to set. + * @return the ResourceProviderOperationCollection object itself. + */ + public ResourceProviderOperationCollection withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Gets or sets the URL, that the client should use to fetch the next page (per server + * side paging). It's null for now, added for future use. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Gets or sets the URL, that the client should use to fetch the next page (per server + * side paging). It's null for now, added for future use. + * + * @param nextLink the nextLink value to set. + * @return the ResourceProviderOperationCollection object itself. + */ + public ResourceProviderOperationCollection 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/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/ResourceProviderOperationDisplay.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/ResourceProviderOperationDisplay.java new file mode 100644 index 000000000000..311793b09721 --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/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.blockchain.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; + +/** Operation display payload which is exposed in the response of the resource provider. */ +@Fluent +public final class ResourceProviderOperationDisplay { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceProviderOperationDisplay.class); + + /* + * Gets or sets the name of the provider for display purposes. + */ + @JsonProperty(value = "provider") + private String provider; + + /* + * Gets or sets the name of the resource type for display purposes. + */ + @JsonProperty(value = "resource") + private String resource; + + /* + * Gets or sets the name of the operation for display purposes. + */ + @JsonProperty(value = "operation") + private String operation; + + /* + * Gets or sets the description of the provider for display purposes. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get the provider property: Gets or sets the name of the provider for display purposes. + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Set the provider property: Gets or sets the name of the provider for display purposes. + * + * @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: Gets or sets the name of the resource type for display purposes. + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Set the resource property: Gets or sets the name of the resource type for display purposes. + * + * @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: Gets or sets the name of the operation for display purposes. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Set the operation property: Gets or sets the name of the operation for display purposes. + * + * @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: Gets or sets the description of the provider for display purposes. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Gets or sets the description of the provider for display purposes. + * + * @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/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/ResourceTypeSku.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/ResourceTypeSku.java new file mode 100644 index 000000000000..75572aac9867 --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/ResourceTypeSku.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.blockchain.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; + +/** Resource type Sku. */ +@Fluent +public final class ResourceTypeSku { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceTypeSku.class); + + /* + * Gets or sets the resource type + */ + @JsonProperty(value = "resourceType") + private String resourceType; + + /* + * Gets or sets the Skus + */ + @JsonProperty(value = "skus") + private List skus; + + /** + * Get the resourceType property: Gets or sets the resource type. + * + * @return the resourceType value. + */ + public String resourceType() { + return this.resourceType; + } + + /** + * Set the resourceType property: Gets or sets the resource type. + * + * @param resourceType the resourceType value to set. + * @return the ResourceTypeSku object itself. + */ + public ResourceTypeSku withResourceType(String resourceType) { + this.resourceType = resourceType; + return this; + } + + /** + * Get the skus property: Gets or sets the Skus. + * + * @return the skus value. + */ + public List skus() { + return this.skus; + } + + /** + * Set the skus property: Gets or sets the Skus. + * + * @param skus the skus value to set. + * @return the ResourceTypeSku object itself. + */ + public ResourceTypeSku withSkus(List skus) { + this.skus = skus; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (skus() != null) { + skus().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/ResourceTypeSkuCollection.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/ResourceTypeSkuCollection.java new file mode 100644 index 000000000000..3c80d9c29a9b --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/ResourceTypeSkuCollection.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.blockchain.models; + +import com.azure.resourcemanager.blockchain.fluent.models.ResourceTypeSkuCollectionInner; +import java.util.List; + +/** An immutable client-side representation of ResourceTypeSkuCollection. */ +public interface ResourceTypeSkuCollection { + /** + * Gets the value property: Gets or sets the collection of resource type Sku. + * + * @return the value value. + */ + List value(); + + /** + * Gets the inner com.azure.resourcemanager.blockchain.fluent.models.ResourceTypeSkuCollectionInner object. + * + * @return the inner object. + */ + ResourceTypeSkuCollectionInner innerModel(); +} diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/Sku.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/Sku.java new file mode 100644 index 000000000000..39bd10b0152e --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/Sku.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.blockchain.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; + +/** Blockchain member Sku in payload. */ +@Fluent +public final class Sku { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Sku.class); + + /* + * Gets or sets Sku name + */ + @JsonProperty(value = "name") + private String name; + + /* + * Gets or sets Sku tier + */ + @JsonProperty(value = "tier") + private String tier; + + /** + * Get the name property: Gets or sets Sku name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Gets or sets Sku name. + * + * @param name the name value to set. + * @return the Sku object itself. + */ + public Sku withName(String name) { + this.name = name; + return this; + } + + /** + * Get the tier property: Gets or sets Sku tier. + * + * @return the tier value. + */ + public String tier() { + return this.tier; + } + + /** + * Set the tier property: Gets or sets Sku tier. + * + * @param tier the tier value to set. + * @return the Sku object itself. + */ + public Sku withTier(String tier) { + this.tier = tier; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/SkuSetting.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/SkuSetting.java new file mode 100644 index 000000000000..954370124557 --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/SkuSetting.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.blockchain.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; + +/** Sku Setting. */ +@Fluent +public final class SkuSetting { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SkuSetting.class); + + /* + * Gets or sets the Sku name. + */ + @JsonProperty(value = "name") + private String name; + + /* + * Gets or sets the Sku tier. + */ + @JsonProperty(value = "tier") + private String tier; + + /* + * Gets or sets the locations. + */ + @JsonProperty(value = "locations") + private List locations; + + /* + * Gets or sets the required features. + */ + @JsonProperty(value = "requiredFeatures") + private List requiredFeatures; + + /** + * Get the name property: Gets or sets the Sku name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Gets or sets the Sku name. + * + * @param name the name value to set. + * @return the SkuSetting object itself. + */ + public SkuSetting withName(String name) { + this.name = name; + return this; + } + + /** + * Get the tier property: Gets or sets the Sku tier. + * + * @return the tier value. + */ + public String tier() { + return this.tier; + } + + /** + * Set the tier property: Gets or sets the Sku tier. + * + * @param tier the tier value to set. + * @return the SkuSetting object itself. + */ + public SkuSetting withTier(String tier) { + this.tier = tier; + return this; + } + + /** + * Get the locations property: Gets or sets the locations. + * + * @return the locations value. + */ + public List locations() { + return this.locations; + } + + /** + * Set the locations property: Gets or sets the locations. + * + * @param locations the locations value to set. + * @return the SkuSetting object itself. + */ + public SkuSetting withLocations(List locations) { + this.locations = locations; + return this; + } + + /** + * Get the requiredFeatures property: Gets or sets the required features. + * + * @return the requiredFeatures value. + */ + public List requiredFeatures() { + return this.requiredFeatures; + } + + /** + * Set the requiredFeatures property: Gets or sets the required features. + * + * @param requiredFeatures the requiredFeatures value to set. + * @return the SkuSetting object itself. + */ + public SkuSetting withRequiredFeatures(List requiredFeatures) { + this.requiredFeatures = requiredFeatures; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/Skus.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/Skus.java new file mode 100644 index 000000000000..1683e395a31a --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/Skus.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.blockchain.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Skus. */ +public interface Skus { + /** + * Lists the Skus of the resource type. + * + * @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 collection of the resource type Sku. + */ + ResourceTypeSkuCollection list(); + + /** + * Lists the Skus of the resource type. + * + * @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 collection of the resource type Sku. + */ + Response listWithResponse(Context context); +} diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/TransactionNode.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/TransactionNode.java new file mode 100644 index 000000000000..fdd5a18392f2 --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/TransactionNode.java @@ -0,0 +1,289 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.blockchain.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.blockchain.fluent.models.TransactionNodeInner; +import java.util.List; + +/** An immutable client-side representation of TransactionNode. */ +public interface TransactionNode { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: Gets or sets the transaction node location. + * + * @return the location value. + */ + String location(); + + /** + * Gets the provisioningState property: Gets or sets the blockchain member provision state. + * + * @return the provisioningState value. + */ + NodeProvisioningState provisioningState(); + + /** + * Gets the dns property: Gets or sets the transaction node dns endpoint. + * + * @return the dns value. + */ + String dns(); + + /** + * Gets the publicKey property: Gets or sets the transaction node public key. + * + * @return the publicKey value. + */ + String publicKey(); + + /** + * Gets the username property: Gets or sets the transaction node dns endpoint basic auth user name. + * + * @return the username value. + */ + String username(); + + /** + * Gets the password property: Sets the transaction node dns endpoint basic auth password. + * + * @return the password value. + */ + String password(); + + /** + * Gets the firewallRules property: Gets or sets the firewall rules. + * + * @return the firewallRules value. + */ + List firewallRules(); + + /** + * 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.blockchain.fluent.models.TransactionNodeInner object. + * + * @return the inner object. + */ + TransactionNodeInner innerModel(); + + /** The entirety of the TransactionNode definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The TransactionNode definition stages. */ + interface DefinitionStages { + /** The first stage of the TransactionNode definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the TransactionNode definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies blockchainMemberName, resourceGroupName. + * + * @param blockchainMemberName Blockchain member name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this + * value from the Azure Resource Manager API or the portal. + * @return the next definition stage. + */ + WithCreate withExistingBlockchainMember(String blockchainMemberName, String resourceGroupName); + } + /** + * The stage of the TransactionNode 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.WithPassword, DefinitionStages.WithFirewallRules { + /** + * Executes the create request. + * + * @return the created resource. + */ + TransactionNode create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + TransactionNode create(Context context); + } + /** The stage of the TransactionNode definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location Gets or sets the transaction node location. + * @return the next definition stage. + */ + WithCreate withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location Gets or sets the transaction node location. + * @return the next definition stage. + */ + WithCreate withRegion(String location); + } + /** The stage of the TransactionNode definition allowing to specify password. */ + interface WithPassword { + /** + * Specifies the password property: Sets the transaction node dns endpoint basic auth password.. + * + * @param password Sets the transaction node dns endpoint basic auth password. + * @return the next definition stage. + */ + WithCreate withPassword(String password); + } + /** The stage of the TransactionNode definition allowing to specify firewallRules. */ + interface WithFirewallRules { + /** + * Specifies the firewallRules property: Gets or sets the firewall rules.. + * + * @param firewallRules Gets or sets the firewall rules. + * @return the next definition stage. + */ + WithCreate withFirewallRules(List firewallRules); + } + } + /** + * Begins update for the TransactionNode resource. + * + * @return the stage of resource update. + */ + TransactionNode.Update update(); + + /** The template for TransactionNode update. */ + interface Update extends UpdateStages.WithPassword, UpdateStages.WithFirewallRules { + /** + * Executes the update request. + * + * @return the updated resource. + */ + TransactionNode apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + TransactionNode apply(Context context); + } + /** The TransactionNode update stages. */ + interface UpdateStages { + /** The stage of the TransactionNode update allowing to specify password. */ + interface WithPassword { + /** + * Specifies the password property: Sets the transaction node dns endpoint basic auth password.. + * + * @param password Sets the transaction node dns endpoint basic auth password. + * @return the next definition stage. + */ + Update withPassword(String password); + } + /** The stage of the TransactionNode update allowing to specify firewallRules. */ + interface WithFirewallRules { + /** + * Specifies the firewallRules property: Gets or sets the firewall rules.. + * + * @param firewallRules Gets or sets the firewall rules. + * @return the next definition stage. + */ + Update withFirewallRules(List firewallRules); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + TransactionNode refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + TransactionNode refresh(Context context); + + /** + * List the API keys for the transaction node. + * + * @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 collection of the API key payload which is exposed in the response of the resource provider. + */ + ApiKeyCollection listApiKeys(); + + /** + * List the API keys for the transaction node. + * + * @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 collection of the API key payload which is exposed in the response of the resource provider. + */ + Response listApiKeysWithResponse(Context context); + + /** + * Regenerate the API keys for the blockchain member. + * + * @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 collection of the API key payload which is exposed in the response of the resource provider. + */ + ApiKeyCollection listRegenerateApiKeys(); + + /** + * Regenerate the API keys for the blockchain member. + * + * @param apiKey api key to be regenerated. + * @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 collection of the API key payload which is exposed in the response of the resource provider. + */ + Response listRegenerateApiKeysWithResponse(ApiKey apiKey, Context context); +} diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/TransactionNodeCollection.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/TransactionNodeCollection.java new file mode 100644 index 000000000000..ea4680197490 --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/TransactionNodeCollection.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.blockchain.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.blockchain.fluent.models.TransactionNodeInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Collection of transaction node payload which is exposed in the request/response of the resource provider. */ +@Fluent +public final class TransactionNodeCollection { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TransactionNodeCollection.class); + + /* + * Gets or sets the collection of transaction nodes. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Gets or sets the URL, that the client should use to fetch the next page + * (per server side paging). + * It's null for now, added for future use. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: Gets or sets the collection of transaction nodes. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Gets or sets the collection of transaction nodes. + * + * @param value the value value to set. + * @return the TransactionNodeCollection object itself. + */ + public TransactionNodeCollection withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Gets or sets the URL, that the client should use to fetch the next page (per server + * side paging). It's null for now, added for future use. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Gets or sets the URL, that the client should use to fetch the next page (per server + * side paging). It's null for now, added for future use. + * + * @param nextLink the nextLink value to set. + * @return the TransactionNodeCollection object itself. + */ + public TransactionNodeCollection 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/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/TransactionNodePropertiesUpdate.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/TransactionNodePropertiesUpdate.java new file mode 100644 index 000000000000..46a9ce6decd5 --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/TransactionNodePropertiesUpdate.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.blockchain.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; + +/** Update the payload of the transaction node properties in the transaction node payload. */ +@Fluent +public class TransactionNodePropertiesUpdate { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TransactionNodePropertiesUpdate.class); + + /* + * Sets the transaction node dns endpoint basic auth password. + */ + @JsonProperty(value = "password") + private String password; + + /* + * Gets or sets the firewall rules. + */ + @JsonProperty(value = "firewallRules") + private List firewallRules; + + /** + * Get the password property: Sets the transaction node dns endpoint basic auth password. + * + * @return the password value. + */ + public String password() { + return this.password; + } + + /** + * Set the password property: Sets the transaction node dns endpoint basic auth password. + * + * @param password the password value to set. + * @return the TransactionNodePropertiesUpdate object itself. + */ + public TransactionNodePropertiesUpdate withPassword(String password) { + this.password = password; + return this; + } + + /** + * Get the firewallRules property: Gets or sets the firewall rules. + * + * @return the firewallRules value. + */ + public List firewallRules() { + return this.firewallRules; + } + + /** + * Set the firewallRules property: Gets or sets the firewall rules. + * + * @param firewallRules the firewallRules value to set. + * @return the TransactionNodePropertiesUpdate object itself. + */ + public TransactionNodePropertiesUpdate withFirewallRules(List firewallRules) { + this.firewallRules = firewallRules; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (firewallRules() != null) { + firewallRules().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/TransactionNodeUpdate.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/TransactionNodeUpdate.java new file mode 100644 index 000000000000..9602202cd8c7 --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/TransactionNodeUpdate.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.blockchain.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Update the transaction node payload which is exposed in the request/response of the resource provider. */ +@JsonFlatten +@Fluent +public class TransactionNodeUpdate { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TransactionNodeUpdate.class); + + /* + * Sets the transaction node dns endpoint basic auth password. + */ + @JsonProperty(value = "properties.password") + private String password; + + /* + * Gets or sets the firewall rules. + */ + @JsonProperty(value = "properties.firewallRules") + private List firewallRules; + + /** + * Get the password property: Sets the transaction node dns endpoint basic auth password. + * + * @return the password value. + */ + public String password() { + return this.password; + } + + /** + * Set the password property: Sets the transaction node dns endpoint basic auth password. + * + * @param password the password value to set. + * @return the TransactionNodeUpdate object itself. + */ + public TransactionNodeUpdate withPassword(String password) { + this.password = password; + return this; + } + + /** + * Get the firewallRules property: Gets or sets the firewall rules. + * + * @return the firewallRules value. + */ + public List firewallRules() { + return this.firewallRules; + } + + /** + * Set the firewallRules property: Gets or sets the firewall rules. + * + * @param firewallRules the firewallRules value to set. + * @return the TransactionNodeUpdate object itself. + */ + public TransactionNodeUpdate withFirewallRules(List firewallRules) { + this.firewallRules = firewallRules; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (firewallRules() != null) { + firewallRules().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/TransactionNodes.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/TransactionNodes.java new file mode 100644 index 000000000000..a07e82dfe39d --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/TransactionNodes.java @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.blockchain.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 TransactionNodes. */ +public interface TransactionNodes { + /** + * Get the details of the transaction node. + * + * @param blockchainMemberName Blockchain member name. + * @param transactionNodeName Transaction node name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @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 details of the transaction node. + */ + TransactionNode get(String blockchainMemberName, String transactionNodeName, String resourceGroupName); + + /** + * Get the details of the transaction node. + * + * @param blockchainMemberName Blockchain member name. + * @param transactionNodeName Transaction node name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @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 details of the transaction node. + */ + Response getWithResponse( + String blockchainMemberName, String transactionNodeName, String resourceGroupName, Context context); + + /** + * Delete the transaction node. + * + * @param blockchainMemberName Blockchain member name. + * @param transactionNodeName Transaction node name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @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 blockchainMemberName, String transactionNodeName, String resourceGroupName); + + /** + * Delete the transaction node. + * + * @param blockchainMemberName Blockchain member name. + * @param transactionNodeName Transaction node name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @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 blockchainMemberName, String transactionNodeName, String resourceGroupName, Context context); + + /** + * Lists the transaction nodes for a blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @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 collection of transaction node payload which is exposed in the request/response of the resource provider. + */ + PagedIterable list(String blockchainMemberName, String resourceGroupName); + + /** + * Lists the transaction nodes for a blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @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 collection of transaction node payload which is exposed in the request/response of the resource provider. + */ + PagedIterable list(String blockchainMemberName, String resourceGroupName, Context context); + + /** + * List the API keys for the transaction node. + * + * @param blockchainMemberName Blockchain member name. + * @param transactionNodeName Transaction node name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @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 collection of the API key payload which is exposed in the response of the resource provider. + */ + ApiKeyCollection listApiKeys(String blockchainMemberName, String transactionNodeName, String resourceGroupName); + + /** + * List the API keys for the transaction node. + * + * @param blockchainMemberName Blockchain member name. + * @param transactionNodeName Transaction node name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @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 collection of the API key payload which is exposed in the response of the resource provider. + */ + Response listApiKeysWithResponse( + String blockchainMemberName, String transactionNodeName, String resourceGroupName, Context context); + + /** + * Regenerate the API keys for the blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param transactionNodeName Transaction node name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @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 collection of the API key payload which is exposed in the response of the resource provider. + */ + ApiKeyCollection listRegenerateApiKeys( + String blockchainMemberName, String transactionNodeName, String resourceGroupName); + + /** + * Regenerate the API keys for the blockchain member. + * + * @param blockchainMemberName Blockchain member name. + * @param transactionNodeName Transaction node name. + * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value + * from the Azure Resource Manager API or the portal. + * @param apiKey api key to be regenerated. + * @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 collection of the API key payload which is exposed in the response of the resource provider. + */ + Response listRegenerateApiKeysWithResponse( + String blockchainMemberName, + String transactionNodeName, + String resourceGroupName, + ApiKey apiKey, + Context context); + + /** + * Get the details of the transaction node. + * + * @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 the details of the transaction node. + */ + TransactionNode getById(String id); + + /** + * Get the details of the transaction node. + * + * @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 the details of the transaction node. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete the transaction node. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete the transaction node. + * + * @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 TransactionNode resource. + * + * @param name resource name. + * @return the first stage of the new TransactionNode definition. + */ + TransactionNode.DefinitionStages.Blank define(String name); +} diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/package-info.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/package-info.java new file mode 100644 index 000000000000..a9a0332c4fbb --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/models/package-info.java @@ -0,0 +1,6 @@ +// 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 BlockchainManagementClient. REST API for Azure Blockchain Service. */ +package com.azure.resourcemanager.blockchain.models; diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/package-info.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/package-info.java new file mode 100644 index 000000000000..882136f7c619 --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/com/azure/resourcemanager/blockchain/package-info.java @@ -0,0 +1,6 @@ +// 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 BlockchainManagementClient. REST API for Azure Blockchain Service. */ +package com.azure.resourcemanager.blockchain; diff --git a/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/module-info.java b/sdk/blockchain/azure-resourcemanager-blockchain/src/main/java/module-info.java new file mode 100644 index 000000000000..1e6da816109b --- /dev/null +++ b/sdk/blockchain/azure-resourcemanager-blockchain/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.blockchain { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.blockchain; + exports com.azure.resourcemanager.blockchain.fluent; + exports com.azure.resourcemanager.blockchain.fluent.models; + exports com.azure.resourcemanager.blockchain.models; + + opens com.azure.resourcemanager.blockchain.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.blockchain.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/blockchain/ci.yml b/sdk/blockchain/ci.yml new file mode 100644 index 000000000000..358c171f7248 --- /dev/null +++ b/sdk/blockchain/ci.yml @@ -0,0 +1,33 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - master + - main + - hotfix/* + - release/* + paths: + include: + - sdk/blockchain/ + +pr: + branches: + include: + - master + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/blockchain/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: blockchain + Artifacts: + - name: azure-resourcemanager-blockchain + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerblockchain diff --git a/sdk/blockchain/pom.xml b/sdk/blockchain/pom.xml new file mode 100644 index 000000000000..f53ab7e31187 --- /dev/null +++ b/sdk/blockchain/pom.xml @@ -0,0 +1,53 @@ + + + 4.0.0 + com.azure + azure-blockchain-service + pom + 1.0.0 + + + + coverage + + + + + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + + report-aggregate + verify + + report-aggregate + + + ${project.reporting.outputDirectory}/test-coverage + + + + + + + + + default + + true + + + azure-resourcemanager-blockchain + + + + diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-obo/src/main/java/com/azure/spring/sample/aad/configuration/AADSampleConfiguration.java b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-obo/src/main/java/com/azure/spring/sample/aad/configuration/AADSampleConfiguration.java index c1f5d8b283bc..41ff9abd115e 100644 --- a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-obo/src/main/java/com/azure/spring/sample/aad/configuration/AADSampleConfiguration.java +++ b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-obo/src/main/java/com/azure/spring/sample/aad/configuration/AADSampleConfiguration.java @@ -15,25 +15,13 @@ public class AADSampleConfiguration { @Bean - public OAuth2AuthorizedClientManager authorizedClientManager( - ClientRegistrationRepository clientRegistrationRepository, - OAuth2AuthorizedClientRepository authorizedClientRepository) { - OAuth2AuthorizedClientProvider authorizedClientProvider = - OAuth2AuthorizedClientProviderBuilder.builder() - .refreshToken() - .build(); - DefaultOAuth2AuthorizedClientManager authorizedClientManager = - new DefaultOAuth2AuthorizedClientManager(clientRegistrationRepository, authorizedClientRepository); - authorizedClientManager.setAuthorizedClientProvider(authorizedClientProvider); - return authorizedClientManager; - } - - @Bean - public WebClient webClient(OAuth2AuthorizedClientManager authorizedClientManager) { - ServletOAuth2AuthorizedClientExchangeFilterFunction oauth2Client = - new ServletOAuth2AuthorizedClientExchangeFilterFunction(authorizedClientManager); + public static WebClient webClient(ClientRegistrationRepository clientRegistrationRepository, + OAuth2AuthorizedClientRepository authorizedClientRepository) { + ServletOAuth2AuthorizedClientExchangeFilterFunction function = + new ServletOAuth2AuthorizedClientExchangeFilterFunction(clientRegistrationRepository, + authorizedClientRepository); return WebClient.builder() - .apply(oauth2Client.oauth2Configuration()) + .apply(function.oauth2Configuration()) .build(); } } diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-obo/src/main/java/com/azure/spring/sample/aad/controller/SampleController.java b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-obo/src/main/java/com/azure/spring/sample/aad/controller/SampleController.java index 0ca6afc267e1..4c90780e4101 100644 --- a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-obo/src/main/java/com/azure/spring/sample/aad/controller/SampleController.java +++ b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server-obo/src/main/java/com/azure/spring/sample/aad/controller/SampleController.java @@ -28,7 +28,7 @@ public class SampleController { private static final String GRAPH_ME_ENDPOINT = "https://graph.microsoft.com/v1.0/me"; - private static final String CUSTOM_LOCAL_FILE_ENDPOINT = "http://localhost:8080/file"; + private static final String CUSTOM_LOCAL_FILE_ENDPOINT = "http://localhost:8082/file"; @Autowired private WebClient webClient; diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server/src/main/resources/application.yml b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server/src/main/resources/application.yml index e0beedb9ab07..bb6453e448e4 100644 --- a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server/src/main/resources/application.yml +++ b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-resource-server/src/main/resources/application.yml @@ -2,6 +2,9 @@ # In v2.0 tokens, this is always the client ID of the API, while in v1.0 tokens it can be the client ID or the resource URI used in the request. # If you are using v1.0 tokens, configure both to properly complete the audience validation. +server: + port: 8082 + #azure: # activedirectory: # client-id: diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-webapp/src/main/java/com/azure/spring/sample/aad/config/WebClientConfig.java b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-webapp/src/main/java/com/azure/spring/sample/aad/config/WebClientConfig.java new file mode 100644 index 000000000000..846c28b5c15c --- /dev/null +++ b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-webapp/src/main/java/com/azure/spring/sample/aad/config/WebClientConfig.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.spring.sample.aad.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.oauth2.client.registration.ClientRegistrationRepository; +import org.springframework.security.oauth2.client.web.OAuth2AuthorizedClientRepository; +import org.springframework.security.oauth2.client.web.reactive.function.client.ServletOAuth2AuthorizedClientExchangeFilterFunction; +import org.springframework.web.reactive.function.client.WebClient; + + +@Configuration +public class WebClientConfig { + + @Bean + public static WebClient webClient(ClientRegistrationRepository clientRegistrationRepository, + OAuth2AuthorizedClientRepository authorizedClientRepository) { + ServletOAuth2AuthorizedClientExchangeFilterFunction function = + new ServletOAuth2AuthorizedClientExchangeFilterFunction(clientRegistrationRepository, + authorizedClientRepository); + return WebClient.builder() + .apply(function.oauth2Configuration()) + .build(); + } +} diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-webapp/src/main/java/com/azure/spring/sample/aad/controller/CallOboServerController.java b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-webapp/src/main/java/com/azure/spring/sample/aad/controller/CallOboServerController.java new file mode 100644 index 000000000000..1a5f1564fd19 --- /dev/null +++ b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-webapp/src/main/java/com/azure/spring/sample/aad/controller/CallOboServerController.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.spring.sample.aad.controller; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.oauth2.client.OAuth2AuthorizedClient; +import org.springframework.security.oauth2.client.annotation.RegisteredOAuth2AuthorizedClient; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.reactive.function.client.WebClient; + + +import static org.springframework.security.oauth2.client.web.reactive.function.client.ServletOAuth2AuthorizedClientExchangeFilterFunction.oauth2AuthorizedClient; + +@Controller +public class CallOboServerController { + + private static final Logger LOGGER = LoggerFactory.getLogger(CallOboServerController.class); + + private static final String CUSTOM_LOCAL_FILE_ENDPOINT = "http://localhost:8081/call-custom"; + + @Autowired + private WebClient webClient; + + /** + * Call obo server, combine all the response and return. + * @param obo authorized client for Custom + * @return Response Graph and Custom data. + */ + @GetMapping("/obo") + @ResponseBody + public String callOboServer(@RegisteredOAuth2AuthorizedClient("obo") OAuth2AuthorizedClient obo) { + return callOboEndpoint(obo); + } + + /** + * Call obo local file endpoint + * @param obo Authorized Client + * @return Response string data. + */ + private String callOboEndpoint(OAuth2AuthorizedClient obo) { + if (null != obo) { + String body = webClient + .get() + .uri(CUSTOM_LOCAL_FILE_ENDPOINT) + .attributes(oauth2AuthorizedClient(obo)) + .retrieve() + .bodyToMono(String.class) + .block(); + LOGGER.info("Response from obo server: {}", body); + return "Obo server response " + (null != body ? "success." : "failed."); + } else { + return "Obo server response failed."; + } + } +} diff --git a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-webapp/src/main/resources/templates/index.html b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-webapp/src/main/resources/templates/index.html index 7fe764b65dcd..edacd62d1799 100644 --- a/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-webapp/src/main/resources/templates/index.html +++ b/sdk/spring/azure-spring-boot-samples/azure-spring-boot-sample-active-directory-webapp/src/main/resources/templates/index.html @@ -34,6 +34,7 @@

Azure Active Directory OAuth 2.0 Login with Spring Security

Group2 Message | Graph Client | Arm Client | + Obo Client | diff --git a/sdk/spring/azure-spring-boot/pom.xml b/sdk/spring/azure-spring-boot/pom.xml index bb4d8f5460e7..8a8aaa9ab0f9 100644 --- a/sdk/spring/azure-spring-boot/pom.xml +++ b/sdk/spring/azure-spring-boot/pom.xml @@ -270,6 +270,12 @@ spring-core 5.2.10.RELEASE + + org.springframework + spring-webflux + 5.2.10.RELEASE + true + org.apache.httpcomponents httpclient @@ -302,6 +308,7 @@ org.springframework:spring-core:[5.2.10.RELEASE] org.springframework:spring-web:[5.2.10.RELEASE] org.springframework:spring-jms:[5.2.10.RELEASE] + org.springframework:spring-webflux:[5.2.10.RELEASE] org.springframework.boot:spring-boot-actuator-autoconfigure:[2.3.5.RELEASE] org.springframework.boot:spring-boot-autoconfigure-processor:[2.3.5.RELEASE] org.springframework.boot:spring-boot-autoconfigure:[2.3.5.RELEASE] diff --git a/sdk/spring/azure-spring-boot/src/main/java/com/azure/spring/aad/webapi/AADOAuth2OboAuthorizedClientRepository.java b/sdk/spring/azure-spring-boot/src/main/java/com/azure/spring/aad/webapi/AADOAuth2OboAuthorizedClientRepository.java index 82c74fbaa251..5e649b9265b6 100644 --- a/sdk/spring/azure-spring-boot/src/main/java/com/azure/spring/aad/webapi/AADOAuth2OboAuthorizedClientRepository.java +++ b/sdk/spring/azure-spring-boot/src/main/java/com/azure/spring/aad/webapi/AADOAuth2OboAuthorizedClientRepository.java @@ -3,28 +3,42 @@ package com.azure.spring.aad.webapi; +import com.azure.spring.autoconfigure.aad.Constants; import com.microsoft.aad.msal4j.ClientCredentialFactory; import com.microsoft.aad.msal4j.ConfidentialClientApplication; import com.microsoft.aad.msal4j.IClientSecret; +import com.microsoft.aad.msal4j.MsalInteractionRequiredException; import com.microsoft.aad.msal4j.OnBehalfOfParameters; import com.microsoft.aad.msal4j.UserAssertion; import com.nimbusds.jwt.JWT; import com.nimbusds.jwt.JWTParser; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpStatus; import org.springframework.security.core.Authentication; import org.springframework.security.oauth2.client.OAuth2AuthorizedClient; import org.springframework.security.oauth2.client.registration.ClientRegistration; import org.springframework.security.oauth2.client.registration.ClientRegistrationRepository; import org.springframework.security.oauth2.client.web.OAuth2AuthorizedClientRepository; import org.springframework.security.oauth2.core.OAuth2AccessToken; +import org.springframework.security.oauth2.core.OAuth2ErrorCodes; +import org.springframework.security.oauth2.core.endpoint.OAuth2ParameterNames; import org.springframework.security.oauth2.server.resource.authentication.AbstractOAuth2TokenAuthenticationToken; +import org.springframework.util.Assert; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.net.MalformedURLException; +import java.text.ParseException; import java.time.Instant; import java.util.Date; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Optional; +import java.util.concurrent.ExecutionException; /** *

@@ -86,8 +100,18 @@ public T loadAuthorizedClient(String registra oAuth2AccessToken); request.setAttribute(oboAuthorizedClientAttributeName, (T) oAuth2AuthorizedClient); return (T) oAuth2AuthorizedClient; - } catch (Throwable throwable) { - LOGGER.error("Failed to load authorized client.", throwable); + } catch (ExecutionException exception) { + // Handle conditional access policy for obo flow. + // A user interaction is required, but we are in a web API, and therefore, we need to report back to the + // client through a 'WWW-Authenticate' header https://tools.ietf.org/html/rfc6750#section-3.1 + Optional.of(exception) + .map(Throwable::getCause) + .filter(e -> e instanceof MsalInteractionRequiredException) + .map(e -> (MsalInteractionRequiredException) e) + .ifPresent(this::replyForbiddenWithWwwAuthenticateHeader); + LOGGER.error("Failed to load authorized client.", exception); + } catch (InterruptedException | ParseException exception) { + LOGGER.error("Failed to load authorized client.", exception); } return null; } @@ -130,4 +154,18 @@ private String interceptAuthorizationUri(String authorizationUri) { } return null; } + + void replyForbiddenWithWwwAuthenticateHeader(MsalInteractionRequiredException exception) { + ServletRequestAttributes attr = + (ServletRequestAttributes) RequestContextHolder.currentRequestAttributes(); + HttpServletResponse response = attr.getResponse(); + Assert.notNull(response, "HttpServletResponse should not be null."); + response.setStatus(HttpStatus.FORBIDDEN.value()); + Map parameters = new LinkedHashMap<>(); + parameters.put(Constants.CONDITIONAL_ACCESS_POLICY_CLAIMS, exception.claims()); + parameters.put(OAuth2ParameterNames.ERROR, OAuth2ErrorCodes.INVALID_TOKEN); + parameters.put(OAuth2ParameterNames.ERROR_DESCRIPTION, "The resource server requires higher privileges than " + + "provided by the access token"); + response.addHeader(HttpHeaders.WWW_AUTHENTICATE, Constants.BEARER_PREFIX + parameters.toString()); + } } diff --git a/sdk/spring/azure-spring-boot/src/main/java/com/azure/spring/aad/webapp/AADAuthenticationFailureHandler.java b/sdk/spring/azure-spring-boot/src/main/java/com/azure/spring/aad/webapp/AADAuthenticationFailureHandler.java deleted file mode 100644 index 2a9ddaeb78b9..000000000000 --- a/sdk/spring/azure-spring-boot/src/main/java/com/azure/spring/aad/webapp/AADAuthenticationFailureHandler.java +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.spring.aad.webapp; - -import com.azure.spring.autoconfigure.aad.Constants; -import org.springframework.security.core.AuthenticationException; -import org.springframework.security.oauth2.core.OAuth2AuthenticationException; -import org.springframework.security.web.authentication.AuthenticationFailureHandler; -import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler; -import org.springframework.security.web.savedrequest.DefaultSavedRequest; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.util.Optional; - -/** - * Redirect URL for handling OAuthentication failure - */ -public class AADAuthenticationFailureHandler implements AuthenticationFailureHandler { - private static final String DEFAULT_FAILURE_URL = "/login?error"; - private final AuthenticationFailureHandler defaultHandler; - - public AADAuthenticationFailureHandler() { - this.defaultHandler = new SimpleUrlAuthenticationFailureHandler(DEFAULT_FAILURE_URL); - } - - @Override - public void onAuthenticationFailure(HttpServletRequest request, - HttpServletResponse response, - AuthenticationException exception) throws IOException, ServletException { - String claims = Optional.of(exception) - .filter(e -> e instanceof OAuth2AuthenticationException) - .map(e -> (OAuth2AuthenticationException) e) - .map(OAuth2AuthenticationException::getError) - .filter(e -> e instanceof AADOAuth2Error) - .map(e -> (AADOAuth2Error) e) - .map(AADOAuth2Error::getClaims) - .orElse(null); - - if (claims == null) { - // Default handle logic - defaultHandler.onAuthenticationFailure(request, response, exception); - } else { - // Handle conditional access policy, step 2. - response.setStatus(302); - request.getSession().setAttribute(Constants.CONDITIONAL_ACCESS_POLICY_CLAIMS, claims); - String redirectUrl = Optional.of(request) - .map(HttpServletRequest::getSession) - .map(s -> s.getAttribute(Constants.SAVED_REQUEST)) - .map(r -> (DefaultSavedRequest) r) - .map(DefaultSavedRequest::getRedirectUrl) - .orElse(null); - response.sendRedirect(redirectUrl); - } - } -} diff --git a/sdk/spring/azure-spring-boot/src/main/java/com/azure/spring/aad/webapp/AADHandleConditionalAccessFilter.java b/sdk/spring/azure-spring-boot/src/main/java/com/azure/spring/aad/webapp/AADHandleConditionalAccessFilter.java new file mode 100644 index 000000000000..8a5a8fff81d7 --- /dev/null +++ b/sdk/spring/azure-spring-boot/src/main/java/com/azure/spring/aad/webapp/AADHandleConditionalAccessFilter.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.spring.aad.webapp; + +import com.azure.spring.autoconfigure.aad.Constants; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.http.HttpHeaders; +import org.springframework.util.StringUtils; +import org.springframework.web.filter.OncePerRequestFilter; +import org.springframework.web.reactive.function.client.WebClientResponseException; + +import javax.servlet.FilterChain; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.Map; +import java.util.Optional; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +/** + * Handle the {@link WebClientResponseException} in On-Behalf-Of flow. + * + *

+ * When the resource-server needs re-acquire token(The request requires higher privileges than provided by the access + * token in On-Behalf-Of flow.), it can sent a 403 with information in the WWW-Authenticate header to web client ,web + * client will throw {@link WebClientResponseException}, web-application can handle this exception to challenge the + * user. + */ +public class AADHandleConditionalAccessFilter extends OncePerRequestFilter { + + private static final Logger LOGGER = LoggerFactory.getLogger(AADHandleConditionalAccessFilter.class); + + @Override + protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, + FilterChain filterChain) throws IOException, ServletException { + try { + filterChain.doFilter(request, response); + } catch (Exception exception) { + Map authParameters = + Optional.of(exception) + .map(Throwable::getCause) + .filter(e -> e instanceof WebClientResponseException) + .map(e -> (WebClientResponseException) e) + .map(WebClientResponseException::getHeaders) + .map(httpHeaders -> httpHeaders.get(HttpHeaders.WWW_AUTHENTICATE)) + .map(list -> list.get(0)) + .map(this::parseAuthParameters) + .orElse(null); + if (authParameters != null && authParameters.containsKey(Constants.CONDITIONAL_ACCESS_POLICY_CLAIMS)) { + request.getSession().setAttribute(Constants.CONDITIONAL_ACCESS_POLICY_CLAIMS, + authParameters.get(Constants.CONDITIONAL_ACCESS_POLICY_CLAIMS)); + response.setStatus(302); + try { + response.sendRedirect(Constants.DEFAULT_AUTHORITY_ENDPOINT_URI); + } catch (IOException e) { + LOGGER.error("Failed to redirect at this response.", exception); + } + return; + } + throw exception; + } + } + + private Map parseAuthParameters(String wwwAuthenticateHeader) { + return Stream.of(wwwAuthenticateHeader) + .filter(header -> !StringUtils.isEmpty(header)) + .filter(header -> header.startsWith(Constants.BEARER_PREFIX)) + .map(str -> str.substring(Constants.BEARER_PREFIX.length() + 1, str.length() - 1)) + .map(str -> str.split(", ")) + .flatMap(Stream::of) + .map(parameter -> parameter.split("=")) + .filter(parameter -> parameter.length > 1) + .collect(Collectors.toMap( + parameters -> parameters[0], + parameters -> parameters[1])); + } +} diff --git a/sdk/spring/azure-spring-boot/src/main/java/com/azure/spring/aad/webapp/AADOAuth2Error.java b/sdk/spring/azure-spring-boot/src/main/java/com/azure/spring/aad/webapp/AADOAuth2Error.java deleted file mode 100644 index bdad533007d8..000000000000 --- a/sdk/spring/azure-spring-boot/src/main/java/com/azure/spring/aad/webapp/AADOAuth2Error.java +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.spring.aad.webapp; - -import org.springframework.security.core.SpringSecurityCoreVersion; -import org.springframework.security.oauth2.core.OAuth2Error; - -/** - * Custom error with the error code returned by aad - */ -public class AADOAuth2Error extends OAuth2Error { - private static final long serialVersionUID = SpringSecurityCoreVersion.SERIAL_VERSION_UID; - - private final String errorCodes; - - private final String timestamp; - - private final String traceId; - - private final String correlationId; - - private final String subError; - - private final String claims; - - public AADOAuth2Error(String error, String errorDescription, String errorCodes, String timestamp, - String traceId, String correlationId, String errorUri, String subError, String claims) { - super(error, errorDescription, errorUri); - this.errorCodes = errorCodes; - this.timestamp = timestamp; - this.traceId = traceId; - this.correlationId = correlationId; - this.subError = subError; - this.claims = claims; - } - - - public final String getErrorCodes() { - return errorCodes; - } - - public final String getTimestamp() { - return timestamp; - } - - public final String getTraceId() { - return traceId; - } - - public final String getCorrelationId() { - return correlationId; - } - - public final String getSubError() { - return subError; - } - - public final String getClaims() { - return claims; - } - - - @Override - public String toString() { - - return "AADAuthenticationException{" - + ", error_codes='" + errorCodes + '\'' - + ", timestamp='" + timestamp + '\'' - + ", trace_id='" + traceId + '\'' - + ", correlation_id='" + correlationId + '\'' - + ", suberror='" + subError + '\'' - + ", claims='" + claims + '\'' - + '}'; - } -} diff --git a/sdk/spring/azure-spring-boot/src/main/java/com/azure/spring/aad/webapp/AADWebAppConfiguration.java b/sdk/spring/azure-spring-boot/src/main/java/com/azure/spring/aad/webapp/AADWebAppConfiguration.java index 5d81dd95429b..e24505eef3c9 100644 --- a/sdk/spring/azure-spring-boot/src/main/java/com/azure/spring/aad/webapp/AADWebAppConfiguration.java +++ b/sdk/spring/azure-spring-boot/src/main/java/com/azure/spring/aad/webapp/AADWebAppConfiguration.java @@ -121,6 +121,7 @@ private Set accessTokenScopes() { return result; } + private Set openidScopes() { Set result = new HashSet<>(); result.add("openid"); @@ -198,5 +199,4 @@ protected void configure(HttpSecurity http) throws Exception { .anyRequest().authenticated(); } } - } diff --git a/sdk/spring/azure-spring-boot/src/main/java/com/azure/spring/aad/webapp/AADWebSecurityConfigurerAdapter.java b/sdk/spring/azure-spring-boot/src/main/java/com/azure/spring/aad/webapp/AADWebSecurityConfigurerAdapter.java index 09d00f40a062..b29a4f63ef28 100644 --- a/sdk/spring/azure-spring-boot/src/main/java/com/azure/spring/aad/webapp/AADWebSecurityConfigurerAdapter.java +++ b/sdk/spring/azure-spring-boot/src/main/java/com/azure/spring/aad/webapp/AADWebSecurityConfigurerAdapter.java @@ -5,7 +5,6 @@ import com.azure.spring.autoconfigure.aad.AADAuthenticationProperties; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.converter.FormHttpMessageConverter; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.oauth2.client.endpoint.DefaultAuthorizationCodeTokenResponseClient; @@ -15,19 +14,16 @@ import org.springframework.security.oauth2.client.oidc.web.logout.OidcClientInitiatedLogoutSuccessHandler; import org.springframework.security.oauth2.client.userinfo.OAuth2UserService; import org.springframework.security.oauth2.client.web.OAuth2AuthorizationRequestResolver; -import org.springframework.security.oauth2.core.http.converter.OAuth2AccessTokenResponseHttpMessageConverter; import org.springframework.security.oauth2.core.oidc.user.OidcUser; -import org.springframework.security.web.authentication.AuthenticationFailureHandler; +import org.springframework.security.web.access.ExceptionTranslationFilter; import org.springframework.security.web.authentication.logout.LogoutSuccessHandler; import org.springframework.util.StringUtils; -import org.springframework.web.client.RestTemplate; import java.net.URI; -import java.util.Arrays; /** - * Abstract configuration class, used to make AzureClientRegistrationRepository - * and AuthzCodeGrantRequestEntityConverter take effect. + * Abstract configuration class, used to make AzureClientRegistrationRepository and AuthzCodeGrantRequestEntityConverter + * take effect. */ public abstract class AADWebSecurityConfigurerAdapter extends WebSecurityConfigurerAdapter { @@ -42,6 +38,9 @@ public abstract class AADWebSecurityConfigurerAdapter extends WebSecurityConfigu protected void configure(HttpSecurity http) throws Exception { // @formatter:off http.oauth2Login() + .authorizationEndpoint() + .authorizationRequestResolver(requestResolver()) + .and() .tokenEndpoint() .accessTokenResponseClient(accessTokenResponseClient()) .and() @@ -51,7 +50,8 @@ protected void configure(HttpSecurity http) throws Exception { .and() .logout() .logoutSuccessHandler(oidcLogoutSuccessHandler()) - .and(); + .and() + .addFilterBefore(new AADHandleConditionalAccessFilter(), ExceptionTranslationFilter.class); // @formatter:off } @@ -68,10 +68,6 @@ protected LogoutSuccessHandler oidcLogoutSuccessHandler() { protected OAuth2AccessTokenResponseClient accessTokenResponseClient() { DefaultAuthorizationCodeTokenResponseClient result = new DefaultAuthorizationCodeTokenResponseClient(); - RestTemplate restTemplate = new RestTemplate(Arrays.asList( - new FormHttpMessageConverter(), new OAuth2AccessTokenResponseHttpMessageConverter())); - restTemplate.setErrorHandler(new ConditionalAccessResponseErrorHandler()); - result.setRestOperations(restTemplate); result.setRequestEntityConverter( new AADOAuth2AuthorizationCodeGrantRequestEntityConverter(repo.getAzureClient())); return result; @@ -80,8 +76,4 @@ protected OAuth2AccessTokenResponseClient a protected OAuth2AuthorizationRequestResolver requestResolver() { return new AADOAuth2AuthorizationRequestResolver(this.repo); } - - protected AuthenticationFailureHandler failureHandler() { - return new AADAuthenticationFailureHandler(); - } } diff --git a/sdk/spring/azure-spring-boot/src/main/java/com/azure/spring/aad/webapp/ConditionalAccessResponseErrorHandler.java b/sdk/spring/azure-spring-boot/src/main/java/com/azure/spring/aad/webapp/ConditionalAccessResponseErrorHandler.java deleted file mode 100644 index 1acce08fb812..000000000000 --- a/sdk/spring/azure-spring-boot/src/main/java/com/azure/spring/aad/webapp/ConditionalAccessResponseErrorHandler.java +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.spring.aad.webapp; - -import com.nimbusds.oauth2.sdk.token.BearerTokenError; -import org.springframework.core.convert.converter.Converter; -import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpStatus; -import org.springframework.http.client.ClientHttpResponse; -import org.springframework.security.oauth2.core.OAuth2AuthorizationException; -import org.springframework.security.oauth2.core.OAuth2Error; -import org.springframework.security.oauth2.core.OAuth2ErrorCodes; -import org.springframework.security.oauth2.core.http.converter.OAuth2ErrorHttpMessageConverter; -import org.springframework.util.StringUtils; -import org.springframework.web.client.DefaultResponseErrorHandler; -import org.springframework.web.client.ResponseErrorHandler; - -import java.io.IOException; -import java.util.Map; - -/** - * Handle conditional access. - */ -public class ConditionalAccessResponseErrorHandler implements ResponseErrorHandler { - - private final OAuth2ErrorHttpMessageConverter oauth2ErrorConverter = new OAuth2ErrorHttpMessageConverter(); - - private final ResponseErrorHandler defaultErrorHandler = new DefaultResponseErrorHandler(); - - protected ConditionalAccessResponseErrorHandler() { - this.oauth2ErrorConverter.setErrorConverter(new AADOAuth2ErrorConverter()); - } - - @Override - public boolean hasError(ClientHttpResponse response) throws IOException { - return this.defaultErrorHandler.hasError(response); - } - - @Override - public void handleError(ClientHttpResponse response) throws IOException { - - if (!HttpStatus.BAD_REQUEST.equals(response.getStatusCode())) { - this.defaultErrorHandler.handleError(response); - } - - // A Bearer Token Error may be in the WWW-Authenticate response header - OAuth2Error oauth2Error = this.readErrorFromWwwAuthenticate(response.getHeaders()); - if (oauth2Error == null) { - oauth2Error = this.oauth2ErrorConverter.read(OAuth2Error.class, response); - } - /** - * Handle conditional access policy, step 1. - * https://docs.microsoft.com/en-us/azure/active-directory/conditional-access/howto-conditional-access-policy-all-users-mfa - */ - throw new OAuth2AuthorizationException(oauth2Error); - } - - private OAuth2Error readErrorFromWwwAuthenticate(HttpHeaders headers) { - String wwwAuthenticateHeader = headers.getFirst(HttpHeaders.WWW_AUTHENTICATE); - if (!StringUtils.hasText(wwwAuthenticateHeader)) { - return null; - } - - BearerTokenError bearerTokenError; - try { - bearerTokenError = BearerTokenError.parse(wwwAuthenticateHeader); - } catch (Exception ex) { - return null; - } - - String errorCode = bearerTokenError.getCode() != null - ? bearerTokenError.getCode() : OAuth2ErrorCodes.SERVER_ERROR; - String errorDescription = bearerTokenError.getDescription(); - - String errorUri = bearerTokenError.getURI() != null - ? bearerTokenError.getURI().toString() : null; - - return new OAuth2Error(errorCode, errorDescription, errorUri); - } - - - private static class AADOAuth2ErrorConverter implements Converter, OAuth2Error> { - @Override - public OAuth2Error convert(Map parameters) { - String errorCode = parameters.get("error"); - String description = parameters.get("error_description"); - String errorCodes = parameters.get("error_codes"); - String timestamp = parameters.get("timestamp"); - String traceId = parameters.get("trace_id"); - String correlationId = parameters.get("correlation_id"); - String uri = parameters.get("error_uri"); - String subError = parameters.get("suberror"); - String claims = parameters.get("claims"); - - return new AADOAuth2Error(errorCode, description, errorCodes, timestamp, traceId, correlationId, - uri, subError, claims); - } - } -} diff --git a/sdk/spring/azure-spring-boot/src/main/java/com/azure/spring/autoconfigure/aad/Constants.java b/sdk/spring/azure-spring-boot/src/main/java/com/azure/spring/autoconfigure/aad/Constants.java index 87be1cd2f4e2..e37205c1ca84 100644 --- a/sdk/spring/azure-spring-boot/src/main/java/com/azure/spring/autoconfigure/aad/Constants.java +++ b/sdk/spring/azure-spring-boot/src/main/java/com/azure/spring/autoconfigure/aad/Constants.java @@ -19,6 +19,7 @@ public class Constants { public static final Set DEFAULT_AUTHORITY_SET; public static final String ROLE_PREFIX = "ROLE_"; public static final String SAVED_REQUEST = "SPRING_SECURITY_SAVED_REQUEST"; + public static final String DEFAULT_AUTHORITY_ENDPOINT_URI = "/oauth2/authorization/azure"; static { Set authoritySet = new HashSet<>(); diff --git a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/aad/webapp/ConditionalAccessResponseErrorHandlerTest.java b/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/aad/webapp/ConditionalAccessResponseErrorHandlerTest.java deleted file mode 100644 index 8922efb79d57..000000000000 --- a/sdk/spring/azure-spring-boot/src/test/java/com/azure/spring/aad/webapp/ConditionalAccessResponseErrorHandlerTest.java +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.spring.aad.webapp; - -import org.junit.Assert; -import org.junit.Test; -import org.springframework.http.HttpStatus; -import org.springframework.http.client.ClientHttpResponse; -import org.springframework.mock.http.client.MockClientHttpResponse; -import org.springframework.security.oauth2.core.OAuth2AuthorizationException; -import org.springframework.web.client.HttpClientErrorException; -import org.springframework.web.client.ResponseErrorHandler; - -import java.io.IOException; -import java.util.Optional; - -public class ConditionalAccessResponseErrorHandlerTest { - private ResponseErrorHandler azureHandler = new ConditionalAccessResponseErrorHandler(); - private ClientHttpResponse clientHttpResponse = new MockClientHttpResponse(("{\n" - + " \"error\": \"fake_error\",\n" - + " \"error_description\": \" fake_error_description\",\n" - + " \"error_codes\": [\n" - + " 53001\n" - + " ],\n" - + " \"timestamp\": \"fake_timestamp\",\n" - + " \"trace_id\": \"fake_trace_id\",\n" - + " \"correlation_id\": \"fake_correlation_id\",\n" - + " \"error_uri\": \"fake_error_uri\",\n" - + " \"suberror\": \"message_only\",\n" - + " \"claims\": \"{\\\"access_token\\\":{\\\"fake_token\\\":{\\\"essential\\\":true," - + "\\\"values\\\":[\\\"fake_values\\\"]}}}\"\n" - + "}").getBytes(), HttpStatus.BAD_REQUEST); - - @Test - public void azureResponseErrorHandleTest() throws IOException { - AADOAuth2Error error = null; - try { - azureHandler.handleError(clientHttpResponse); - } catch (OAuth2AuthorizationException exception) { - error = (AADOAuth2Error) Optional.of(exception) - .map(OAuth2AuthorizationException::getError).orElse(null); - } - Assert.assertNotNull(error); - } - - @Test - public void defaultErrorHandlerTest() throws IOException { - clientHttpResponse = new MockClientHttpResponse("".getBytes(), HttpStatus.UNAUTHORIZED); - try { - azureHandler.handleError(clientHttpResponse); - } catch (HttpClientErrorException exception) { - Assert.assertNotNull(exception); - } - } -}