diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 6fc46af54275e..d7e641f73ae97 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -308,6 +308,7 @@ com.azure.resourcemanager:azure-resourcemanager-elastic;1.0.0-beta.1;1.0.0-beta. com.azure.resourcemanager:azure-resourcemanager-webpubsub;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-security;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-azurearcdata;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-fluidrelay;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 edd475ba5d02b..8ab667930fae6 100644 --- a/pom.xml +++ b/pom.xml @@ -754,6 +754,7 @@ sdk/elastic sdk/eventgrid sdk/eventhubs + sdk/fluidrelay sdk/formrecognizer sdk/frontdoor sdk/hanaonazure diff --git a/sdk/fluidrelay/azure-resourcemanager-fluidrelay/CHANGELOG.md b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/CHANGELOG.md new file mode 100644 index 0000000000000..2478fa7ec52c7 --- /dev/null +++ b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2021-07-26) + +- Azure Resource Manager FluidRelay client library for Java. This package contains Microsoft Azure SDK for FluidRelay Management SDK. Package tag package-2021-03-12-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/fluidrelay/azure-resourcemanager-fluidrelay/README.md b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/README.md new file mode 100644 index 0000000000000..3a9c5ab1eff63 --- /dev/null +++ b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/README.md @@ -0,0 +1,101 @@ +# Azure Resource Manager FluidRelay client library for Java + +Azure Resource Manager FluidRelay client library for Java. + +This package contains Microsoft Azure SDK for FluidRelay Management SDK. Package tag package-2021-03-12-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-fluidrelay;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-fluidrelay + 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(); +FluidRelayManager manager = FluidRelayManager + .authenticate(credential, profile); +``` + +The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise. + +See [Authentication][authenticate] for more options. + +## Key concepts + +See [API design][design] for general introduction on design and key concepts on Azure Management Libraries. + +## Examples + + + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md). + +1. Fork it +1. Create your feature branch (`git checkout -b my-new-feature`) +1. Commit your changes (`git commit -am 'Add some feature'`) +1. Push to the branch (`git push origin my-new-feature`) +1. Create new Pull Request + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://docs.microsoft.com/java/azure/jdk/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/DESIGN.md diff --git a/sdk/fluidrelay/azure-resourcemanager-fluidrelay/pom.xml b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/pom.xml new file mode 100644 index 0000000000000..171ae870983bc --- /dev/null +++ b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/pom.xml @@ -0,0 +1,86 @@ + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-fluidrelay + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for FluidRelay Management + This package contains Microsoft Azure SDK for FluidRelay Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Package tag package-2021-03-12-preview. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + + + + + com.azure + azure-core + 1.18.0 + + + com.azure + azure-core-management + 1.3.1 + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + true + + + + org.revapi + revapi-maven-plugin + 0.11.2 + + + + + java.method.addedToInterface + + + true + .* + com\.azure\.resourcemanager(\.[^.]+)+\.fluent(\.[^.]+)* + + + + + + + + diff --git a/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/FluidRelayManager.java b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/FluidRelayManager.java new file mode 100644 index 0000000000000..8afb6b27e1c71 --- /dev/null +++ b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/FluidRelayManager.java @@ -0,0 +1,239 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.fluidrelay; + +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.http.policy.ArmChallengeAuthenticationPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.fluidrelay.fluent.FluidRelayManagementClient; +import com.azure.resourcemanager.fluidrelay.implementation.FluidRelayManagementClientBuilder; +import com.azure.resourcemanager.fluidrelay.implementation.FluidRelayOperationsImpl; +import com.azure.resourcemanager.fluidrelay.implementation.FluidRelayServersImpl; +import com.azure.resourcemanager.fluidrelay.models.FluidRelayOperations; +import com.azure.resourcemanager.fluidrelay.models.FluidRelayServers; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** Entry point to FluidRelayManager. */ +public final class FluidRelayManager { + private FluidRelayOperations fluidRelayOperations; + + private FluidRelayServers fluidRelayServers; + + private final FluidRelayManagementClient clientObject; + + private FluidRelayManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new FluidRelayManagementClientBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of FluidRelay service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the FluidRelay service API instance. + */ + public static FluidRelayManager 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 FluidRelayManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new FluidRelayManager.Configurable(); + } + + /** The Configurable allowing configurations to be set. */ + public static final class Configurable { + private final ClientLogger logger = new ClientLogger(Configurable.class); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); + private RetryPolicy retryPolicy; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = Objects.requireNonNull(defaultPollInterval, "'retryPolicy' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw logger.logExceptionAsError(new IllegalArgumentException("'httpPipeline' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of FluidRelay service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the FluidRelay service API instance. + */ + public FluidRelayManager 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.fluidrelay") + .append("/") + .append("1.0.0-beta.1"); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder + .append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } + if (retryPolicy == null) { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new RequestIdPolicy()); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies.addAll(this.policies); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new FluidRelayManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** @return Resource collection API of FluidRelayOperations. */ + public FluidRelayOperations fluidRelayOperations() { + if (this.fluidRelayOperations == null) { + this.fluidRelayOperations = new FluidRelayOperationsImpl(clientObject.getFluidRelayOperations(), this); + } + return fluidRelayOperations; + } + + /** @return Resource collection API of FluidRelayServers. */ + public FluidRelayServers fluidRelayServers() { + if (this.fluidRelayServers == null) { + this.fluidRelayServers = new FluidRelayServersImpl(clientObject.getFluidRelayServers(), this); + } + return fluidRelayServers; + } + + /** + * @return Wrapped service client FluidRelayManagementClient providing direct access to the underlying + * auto-generated API implementation, based on Azure REST API. + */ + public FluidRelayManagementClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/fluent/FluidRelayManagementClient.java b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/fluent/FluidRelayManagementClient.java new file mode 100644 index 0000000000000..977c54344dde4 --- /dev/null +++ b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/fluent/FluidRelayManagementClient.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.fluidrelay.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for FluidRelayManagementClient class. */ +public interface FluidRelayManagementClient { + /** + * Gets The subscription id (GUID) for this resource. + * + * @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 FluidRelayOperationsClient object to access its operations. + * + * @return the FluidRelayOperationsClient object. + */ + FluidRelayOperationsClient getFluidRelayOperations(); + + /** + * Gets the FluidRelayServersClient object to access its operations. + * + * @return the FluidRelayServersClient object. + */ + FluidRelayServersClient getFluidRelayServers(); +} diff --git a/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/fluent/FluidRelayOperationsClient.java b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/fluent/FluidRelayOperationsClient.java new file mode 100644 index 0000000000000..15f32897f7f7f --- /dev/null +++ b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/fluent/FluidRelayOperationsClient.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.fluidrelay.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.fluidrelay.fluent.models.OperationResultInner; + +/** An instance of this class provides access to all the operations defined in FluidRelayOperationsClient. */ +public interface FluidRelayOperationsClient { + /** + * List all operations provided by Microsoft.FluidRelay. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of GET request to list FluidRelay operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List all operations provided by Microsoft.FluidRelay. + * + * @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 result of GET request to list FluidRelay operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/fluent/FluidRelayServersClient.java b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/fluent/FluidRelayServersClient.java new file mode 100644 index 0000000000000..38656d8f2ee08 --- /dev/null +++ b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/fluent/FluidRelayServersClient.java @@ -0,0 +1,240 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.fluidrelay.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.util.Context; +import com.azure.resourcemanager.fluidrelay.fluent.models.FluidRelayServerInner; +import com.azure.resourcemanager.fluidrelay.fluent.models.FluidRelayServerKeysInner; +import com.azure.resourcemanager.fluidrelay.models.FluidRelayServerUpdate; +import com.azure.resourcemanager.fluidrelay.models.FluidRelayServersCreateOrUpdateResponse; +import com.azure.resourcemanager.fluidrelay.models.FluidRelayServersDeleteResponse; +import com.azure.resourcemanager.fluidrelay.models.FluidRelayServersGetKeysResponse; +import com.azure.resourcemanager.fluidrelay.models.FluidRelayServersRegenerateKeyResponse; +import com.azure.resourcemanager.fluidrelay.models.FluidRelayServersUpdateResponse; +import com.azure.resourcemanager.fluidrelay.models.RegenerateKeyRequest; + +/** An instance of this class provides access to all the operations defined in FluidRelayServersClient. */ +public interface FluidRelayServersClient { + /** + * Get a Fluid Relay server. + * + * @param resourceGroup The resource group containing the resource. + * @param name The resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Fluid Relay server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FluidRelayServerInner getByResourceGroup(String resourceGroup, String name); + + /** + * Get a Fluid Relay server. + * + * @param resourceGroup The resource group containing the resource. + * @param name The resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Fluid Relay server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroup, String name, Context context); + + /** + * Create or Update a Fluid Relay server. + * + * @param resourceGroup The resource group containing the resource. + * @param name The resource name. + * @param resource The details of the Fluid Relay server resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a FluidRelay Server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FluidRelayServerInner createOrUpdate(String resourceGroup, String name, FluidRelayServerInner resource); + + /** + * Create or Update a Fluid Relay server. + * + * @param resourceGroup The resource group containing the resource. + * @param name The resource name. + * @param resource The details of the Fluid Relay server resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a FluidRelay Server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FluidRelayServersCreateOrUpdateResponse createOrUpdateWithResponse( + String resourceGroup, String name, FluidRelayServerInner resource, Context context); + + /** + * Update a Fluid Relay server. + * + * @param resourceGroup The resource group containing the resource. + * @param name The resource name. + * @param resource The updatable details of the Fluid Relay server resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a FluidRelay Server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FluidRelayServerInner update(String resourceGroup, String name, FluidRelayServerUpdate resource); + + /** + * Update a Fluid Relay server. + * + * @param resourceGroup The resource group containing the resource. + * @param name The resource name. + * @param resource The updatable details of the Fluid Relay server resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a FluidRelay Server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FluidRelayServersUpdateResponse updateWithResponse( + String resourceGroup, String name, FluidRelayServerUpdate resource, Context context); + + /** + * Delete a Fluid Relay server. + * + * @param resourceGroup The resource group containing the resource. + * @param name The resource 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 resourceGroup, String name); + + /** + * Delete a Fluid Relay server. + * + * @param resourceGroup The resource group containing the resource. + * @param name The resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FluidRelayServersDeleteResponse deleteWithResponse(String resourceGroup, String name, Context context); + + /** + * Regenerate the primary or secondary key for this server. + * + * @param resourceGroup The resource group containing the resource. + * @param name The resource name. + * @param parameters The details of which keys to generate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the set of available keys for this server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FluidRelayServerKeysInner regenerateKey(String resourceGroup, String name, RegenerateKeyRequest parameters); + + /** + * Regenerate the primary or secondary key for this server. + * + * @param resourceGroup The resource group containing the resource. + * @param name The resource name. + * @param parameters The details of which keys to generate. + * @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 set of available keys for this server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FluidRelayServersRegenerateKeyResponse regenerateKeyWithResponse( + String resourceGroup, String name, RegenerateKeyRequest parameters, Context context); + + /** + * Regenerate the primary or secondary key for this server. + * + * @param resourceGroup The resource group containing the resource. + * @param name The resource 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 set of available keys for this server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FluidRelayServerKeysInner getKeys(String resourceGroup, String name); + + /** + * Regenerate the primary or secondary key for this server. + * + * @param resourceGroup The resource group containing the resource. + * @param name The resource 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 set of available keys for this server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FluidRelayServersGetKeysResponse getKeysWithResponse(String resourceGroup, String name, Context context); + + /** + * List all Fluid Relay servers in 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 paged response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List all Fluid Relay servers in 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 paged response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * List all Fluid Relay servers in a resource group. + * + * @param resourceGroup The resource group containing the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroup); + + /** + * List all Fluid Relay servers in a resource group. + * + * @param resourceGroup The resource group containing the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroup, Context context); +} diff --git a/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/fluent/models/FluidRelayServerInner.java b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/fluent/models/FluidRelayServerInner.java new file mode 100644 index 0000000000000..7f7462c4bbbf6 --- /dev/null +++ b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/fluent/models/FluidRelayServerInner.java @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.fluidrelay.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.fluidrelay.models.FluidRelayEndpoints; +import com.azure.resourcemanager.fluidrelay.models.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** A FluidRelay Server. */ +@JsonFlatten +@Fluent +public class FluidRelayServerInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(FluidRelayServerInner.class); + + /* + * System meta data for this resource, including creation and modification + * information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /* + * The Fluid tenantId for this server + */ + @JsonProperty(value = "properties.frsTenantId", access = JsonProperty.Access.WRITE_ONLY) + private String frsTenantId; + + /* + * The Fluid Relay Service endpoints for this server. + */ + @JsonProperty(value = "properties.fluidRelayEndpoints", access = JsonProperty.Access.WRITE_ONLY) + private FluidRelayEndpoints fluidRelayEndpoints; + + /* + * Provision states for FluidRelay RP + */ + @JsonProperty(value = "properties.provisioningState") + private ProvisioningState provisioningState; + + /** + * Get the systemData property: System meta data for this resource, including creation and modification information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the frsTenantId property: The Fluid tenantId for this server. + * + * @return the frsTenantId value. + */ + public String frsTenantId() { + return this.frsTenantId; + } + + /** + * Get the fluidRelayEndpoints property: The Fluid Relay Service endpoints for this server. + * + * @return the fluidRelayEndpoints value. + */ + public FluidRelayEndpoints fluidRelayEndpoints() { + return this.fluidRelayEndpoints; + } + + /** + * Get the provisioningState property: Provision states for FluidRelay RP. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioningState property: Provision states for FluidRelay RP. + * + * @param provisioningState the provisioningState value to set. + * @return the FluidRelayServerInner object itself. + */ + public FluidRelayServerInner withProvisioningState(ProvisioningState provisioningState) { + this.provisioningState = provisioningState; + return this; + } + + /** {@inheritDoc} */ + @Override + public FluidRelayServerInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public FluidRelayServerInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (fluidRelayEndpoints() != null) { + fluidRelayEndpoints().validate(); + } + } +} diff --git a/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/fluent/models/FluidRelayServerKeysInner.java b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/fluent/models/FluidRelayServerKeysInner.java new file mode 100644 index 0000000000000..4fe71ea2f5a53 --- /dev/null +++ b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/fluent/models/FluidRelayServerKeysInner.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.fluidrelay.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The set of available keys for this server. */ +@Immutable +public final class FluidRelayServerKeysInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(FluidRelayServerKeysInner.class); + + /* + * The primary key for this server + */ + @JsonProperty(value = "key1", access = JsonProperty.Access.WRITE_ONLY) + private String key1; + + /* + * The secondary key for this server + */ + @JsonProperty(value = "key2", access = JsonProperty.Access.WRITE_ONLY) + private String key2; + + /** + * Get the key1 property: The primary key for this server. + * + * @return the key1 value. + */ + public String key1() { + return this.key1; + } + + /** + * Get the key2 property: The secondary key for this server. + * + * @return the key2 value. + */ + public String key2() { + return this.key2; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/fluent/models/OperationResultInner.java b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/fluent/models/OperationResultInner.java new file mode 100644 index 0000000000000..333aa0536bca2 --- /dev/null +++ b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/fluent/models/OperationResultInner.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.fluidrelay.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.fluidrelay.models.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A FluidRelay REST API operation. */ +@Fluent +public final class OperationResultInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationResultInner.class); + + /* + * Operation name: {provider}/{resource}/{operation} + */ + @JsonProperty(value = "name") + private String name; + + /* + * The object that represents the operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /* + * Indicates whether the operation is a data action + */ + @JsonProperty(value = "isDataAction") + private Boolean isDataAction; + + /** + * Get the name property: Operation name: {provider}/{resource}/{operation}. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Operation name: {provider}/{resource}/{operation}. + * + * @param name the name value to set. + * @return the OperationResultInner object itself. + */ + public OperationResultInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the display property: The object that represents the operation. + * + * @return the display value. + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the display property: The object that represents the operation. + * + * @param display the display value to set. + * @return the OperationResultInner object itself. + */ + public OperationResultInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + + /** + * Get the isDataAction property: Indicates whether the operation is a data action. + * + * @return the isDataAction value. + */ + public Boolean isDataAction() { + return this.isDataAction; + } + + /** + * Set the isDataAction property: Indicates whether the operation is a data action. + * + * @param isDataAction the isDataAction value to set. + * @return the OperationResultInner object itself. + */ + public OperationResultInner withIsDataAction(Boolean isDataAction) { + this.isDataAction = isDataAction; + 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/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/fluent/models/package-info.java b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/fluent/models/package-info.java new file mode 100644 index 0000000000000..02f18b4dfe376 --- /dev/null +++ b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/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 FluidRelayManagementClient. null. */ +package com.azure.resourcemanager.fluidrelay.fluent.models; diff --git a/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/fluent/package-info.java b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/fluent/package-info.java new file mode 100644 index 0000000000000..5b46472344e2d --- /dev/null +++ b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/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 FluidRelayManagementClient. null. */ +package com.azure.resourcemanager.fluidrelay.fluent; diff --git a/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/implementation/FluidRelayManagementClientBuilder.java b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/implementation/FluidRelayManagementClientBuilder.java new file mode 100644 index 0000000000000..fa5ba0a103913 --- /dev/null +++ b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/implementation/FluidRelayManagementClientBuilder.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.fluidrelay.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 FluidRelayManagementClientImpl type. */ +@ServiceClientBuilder(serviceClients = {FluidRelayManagementClientImpl.class}) +public final class FluidRelayManagementClientBuilder { + /* + * The subscription id (GUID) for this resource. + */ + private String subscriptionId; + + /** + * Sets The subscription id (GUID) for this resource. + * + * @param subscriptionId the subscriptionId value. + * @return the FluidRelayManagementClientBuilder. + */ + public FluidRelayManagementClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the FluidRelayManagementClientBuilder. + */ + public FluidRelayManagementClientBuilder 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 FluidRelayManagementClientBuilder. + */ + public FluidRelayManagementClientBuilder 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 FluidRelayManagementClientBuilder. + */ + public FluidRelayManagementClientBuilder 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 FluidRelayManagementClientBuilder. + */ + public FluidRelayManagementClientBuilder 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 FluidRelayManagementClientBuilder. + */ + public FluidRelayManagementClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of FluidRelayManagementClientImpl with the provided parameters. + * + * @return an instance of FluidRelayManagementClientImpl. + */ + public FluidRelayManagementClientImpl buildClient() { + if (endpoint == null) { + this.endpoint = ""; + } + 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(); + } + FluidRelayManagementClientImpl client = + new FluidRelayManagementClientImpl( + pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + return client; + } +} diff --git a/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/implementation/FluidRelayManagementClientImpl.java b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/implementation/FluidRelayManagementClientImpl.java new file mode 100644 index 0000000000000..2dbbe58f8a78c --- /dev/null +++ b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/implementation/FluidRelayManagementClientImpl.java @@ -0,0 +1,307 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.fluidrelay.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.fluidrelay.fluent.FluidRelayManagementClient; +import com.azure.resourcemanager.fluidrelay.fluent.FluidRelayOperationsClient; +import com.azure.resourcemanager.fluidrelay.fluent.FluidRelayServersClient; +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 FluidRelayManagementClientImpl type. */ +@ServiceClient(builder = FluidRelayManagementClientBuilder.class) +public final class FluidRelayManagementClientImpl implements FluidRelayManagementClient { + private final ClientLogger logger = new ClientLogger(FluidRelayManagementClientImpl.class); + + /** The subscription id (GUID) for this resource. */ + private final String subscriptionId; + + /** + * Gets The subscription id (GUID) for this resource. + * + * @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 FluidRelayOperationsClient object to access its operations. */ + private final FluidRelayOperationsClient fluidRelayOperations; + + /** + * Gets the FluidRelayOperationsClient object to access its operations. + * + * @return the FluidRelayOperationsClient object. + */ + public FluidRelayOperationsClient getFluidRelayOperations() { + return this.fluidRelayOperations; + } + + /** The FluidRelayServersClient object to access its operations. */ + private final FluidRelayServersClient fluidRelayServers; + + /** + * Gets the FluidRelayServersClient object to access its operations. + * + * @return the FluidRelayServersClient object. + */ + public FluidRelayServersClient getFluidRelayServers() { + return this.fluidRelayServers; + } + + /** + * Initializes an instance of FluidRelayManagementClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param subscriptionId The subscription id (GUID) for this resource. + * @param endpoint server parameter. + */ + FluidRelayManagementClientImpl( + HttpPipeline httpPipeline, + SerializerAdapter serializerAdapter, + Duration defaultPollInterval, + AzureEnvironment environment, + String subscriptionId, + String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + this.apiVersion = "2021-03-12-preview"; + this.fluidRelayOperations = new FluidRelayOperationsClientImpl(this); + this.fluidRelayServers = new FluidRelayServersClientImpl(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/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/implementation/FluidRelayOperationsClientImpl.java b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/implementation/FluidRelayOperationsClientImpl.java new file mode 100644 index 0000000000000..bdc1f287e02c9 --- /dev/null +++ b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/implementation/FluidRelayOperationsClientImpl.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.fluidrelay.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.fluidrelay.fluent.FluidRelayOperationsClient; +import com.azure.resourcemanager.fluidrelay.fluent.models.OperationResultInner; +import com.azure.resourcemanager.fluidrelay.models.OperationListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in FluidRelayOperationsClient. */ +public final class FluidRelayOperationsClientImpl implements FluidRelayOperationsClient { + private final ClientLogger logger = new ClientLogger(FluidRelayOperationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final FluidRelayOperationsService service; + + /** The service client containing this operation class. */ + private final FluidRelayManagementClientImpl client; + + /** + * Initializes an instance of FluidRelayOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + FluidRelayOperationsClientImpl(FluidRelayManagementClientImpl client) { + this.service = + RestProxy + .create(FluidRelayOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for FluidRelayManagementClientFluidRelayOperations to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "FluidRelayManagement") + private interface FluidRelayOperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.FluidRelay/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List all operations provided by Microsoft.FluidRelay. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of GET request to list FluidRelay operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List all operations provided by Microsoft.FluidRelay. + * + * @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 result of GET request to list FluidRelay operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List all operations provided by Microsoft.FluidRelay. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of GET request to list FluidRelay operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List all operations provided by Microsoft.FluidRelay. + * + * @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 result of GET request to list FluidRelay operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List all operations provided by Microsoft.FluidRelay. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of GET request to list FluidRelay operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List all operations provided by Microsoft.FluidRelay. + * + * @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 result of GET request to list FluidRelay operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of GET request to list FluidRelay operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of GET request to list FluidRelay operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/implementation/FluidRelayOperationsImpl.java b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/implementation/FluidRelayOperationsImpl.java new file mode 100644 index 0000000000000..ba7fab23e7255 --- /dev/null +++ b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/implementation/FluidRelayOperationsImpl.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.fluidrelay.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.fluidrelay.fluent.FluidRelayOperationsClient; +import com.azure.resourcemanager.fluidrelay.fluent.models.OperationResultInner; +import com.azure.resourcemanager.fluidrelay.models.FluidRelayOperations; +import com.azure.resourcemanager.fluidrelay.models.OperationResult; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class FluidRelayOperationsImpl implements FluidRelayOperations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(FluidRelayOperationsImpl.class); + + private final FluidRelayOperationsClient innerClient; + + private final com.azure.resourcemanager.fluidrelay.FluidRelayManager serviceManager; + + public FluidRelayOperationsImpl( + FluidRelayOperationsClient innerClient, com.azure.resourcemanager.fluidrelay.FluidRelayManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new OperationResultImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new OperationResultImpl(inner1, this.manager())); + } + + private FluidRelayOperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.fluidrelay.FluidRelayManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/implementation/FluidRelayServerImpl.java b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/implementation/FluidRelayServerImpl.java new file mode 100644 index 0000000000000..5855b97319a1d --- /dev/null +++ b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/implementation/FluidRelayServerImpl.java @@ -0,0 +1,218 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.fluidrelay.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.fluidrelay.fluent.models.FluidRelayServerInner; +import com.azure.resourcemanager.fluidrelay.models.FluidRelayEndpoints; +import com.azure.resourcemanager.fluidrelay.models.FluidRelayServer; +import com.azure.resourcemanager.fluidrelay.models.FluidRelayServerKeys; +import com.azure.resourcemanager.fluidrelay.models.FluidRelayServerUpdate; +import com.azure.resourcemanager.fluidrelay.models.ProvisioningState; +import com.azure.resourcemanager.fluidrelay.models.RegenerateKeyRequest; +import java.util.Collections; +import java.util.Map; + +public final class FluidRelayServerImpl + implements FluidRelayServer, FluidRelayServer.Definition, FluidRelayServer.Update { + private FluidRelayServerInner innerObject; + + private final com.azure.resourcemanager.fluidrelay.FluidRelayManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String frsTenantId() { + return this.innerModel().frsTenantId(); + } + + public FluidRelayEndpoints fluidRelayEndpoints() { + return this.innerModel().fluidRelayEndpoints(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public FluidRelayServerInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.fluidrelay.FluidRelayManager manager() { + return this.serviceManager; + } + + private String resourceGroup; + + private String name; + + private FluidRelayServerUpdate updateResource; + + public FluidRelayServerImpl withExistingResourceGroup(String resourceGroup) { + this.resourceGroup = resourceGroup; + return this; + } + + public FluidRelayServer create() { + this.innerObject = + serviceManager + .serviceClient() + .getFluidRelayServers() + .createOrUpdateWithResponse(resourceGroup, name, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public FluidRelayServer create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getFluidRelayServers() + .createOrUpdateWithResponse(resourceGroup, name, this.innerModel(), context) + .getValue(); + return this; + } + + FluidRelayServerImpl(String name, com.azure.resourcemanager.fluidrelay.FluidRelayManager serviceManager) { + this.innerObject = new FluidRelayServerInner(); + this.serviceManager = serviceManager; + this.name = name; + } + + public FluidRelayServerImpl update() { + this.updateResource = new FluidRelayServerUpdate(); + return this; + } + + public FluidRelayServer apply() { + this.innerObject = + serviceManager + .serviceClient() + .getFluidRelayServers() + .updateWithResponse(resourceGroup, name, updateResource, Context.NONE) + .getValue(); + return this; + } + + public FluidRelayServer apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getFluidRelayServers() + .updateWithResponse(resourceGroup, name, updateResource, context) + .getValue(); + return this; + } + + FluidRelayServerImpl( + FluidRelayServerInner innerObject, com.azure.resourcemanager.fluidrelay.FluidRelayManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroup = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.name = Utils.getValueFromIdByName(innerObject.id(), "fluidRelayServers"); + } + + public FluidRelayServer refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getFluidRelayServers() + .getByResourceGroupWithResponse(resourceGroup, name, Context.NONE) + .getValue(); + return this; + } + + public FluidRelayServer refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getFluidRelayServers() + .getByResourceGroupWithResponse(resourceGroup, name, context) + .getValue(); + return this; + } + + public FluidRelayServerKeys regenerateKey(RegenerateKeyRequest parameters) { + return serviceManager.fluidRelayServers().regenerateKey(resourceGroup, name, parameters); + } + + public Response regenerateKeyWithResponse(RegenerateKeyRequest parameters, Context context) { + return serviceManager.fluidRelayServers().regenerateKeyWithResponse(resourceGroup, name, parameters, context); + } + + public FluidRelayServerKeys getKeys() { + return serviceManager.fluidRelayServers().getKeys(resourceGroup, name); + } + + public Response getKeysWithResponse(Context context) { + return serviceManager.fluidRelayServers().getKeysWithResponse(resourceGroup, name, context); + } + + public FluidRelayServerImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public FluidRelayServerImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public FluidRelayServerImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateResource.withTags(tags); + return this; + } + } + + public FluidRelayServerImpl withProvisioningState(ProvisioningState provisioningState) { + this.innerModel().withProvisioningState(provisioningState); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/implementation/FluidRelayServerKeysImpl.java b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/implementation/FluidRelayServerKeysImpl.java new file mode 100644 index 0000000000000..f579e32a2df4d --- /dev/null +++ b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/implementation/FluidRelayServerKeysImpl.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.fluidrelay.implementation; + +import com.azure.resourcemanager.fluidrelay.fluent.models.FluidRelayServerKeysInner; +import com.azure.resourcemanager.fluidrelay.models.FluidRelayServerKeys; + +public final class FluidRelayServerKeysImpl implements FluidRelayServerKeys { + private FluidRelayServerKeysInner innerObject; + + private final com.azure.resourcemanager.fluidrelay.FluidRelayManager serviceManager; + + FluidRelayServerKeysImpl( + FluidRelayServerKeysInner innerObject, com.azure.resourcemanager.fluidrelay.FluidRelayManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String key1() { + return this.innerModel().key1(); + } + + public String key2() { + return this.innerModel().key2(); + } + + public FluidRelayServerKeysInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.fluidrelay.FluidRelayManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/implementation/FluidRelayServersClientImpl.java b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/implementation/FluidRelayServersClientImpl.java new file mode 100644 index 0000000000000..861be195660ab --- /dev/null +++ b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/implementation/FluidRelayServersClientImpl.java @@ -0,0 +1,1585 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.fluidrelay.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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.fluidrelay.fluent.FluidRelayServersClient; +import com.azure.resourcemanager.fluidrelay.fluent.models.FluidRelayServerInner; +import com.azure.resourcemanager.fluidrelay.fluent.models.FluidRelayServerKeysInner; +import com.azure.resourcemanager.fluidrelay.models.FluidRelayServerList; +import com.azure.resourcemanager.fluidrelay.models.FluidRelayServerUpdate; +import com.azure.resourcemanager.fluidrelay.models.FluidRelayServersCreateOrUpdateResponse; +import com.azure.resourcemanager.fluidrelay.models.FluidRelayServersDeleteResponse; +import com.azure.resourcemanager.fluidrelay.models.FluidRelayServersGetKeysResponse; +import com.azure.resourcemanager.fluidrelay.models.FluidRelayServersRegenerateKeyResponse; +import com.azure.resourcemanager.fluidrelay.models.FluidRelayServersUpdateResponse; +import com.azure.resourcemanager.fluidrelay.models.RegenerateKeyRequest; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in FluidRelayServersClient. */ +public final class FluidRelayServersClientImpl implements FluidRelayServersClient { + private final ClientLogger logger = new ClientLogger(FluidRelayServersClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final FluidRelayServersService service; + + /** The service client containing this operation class. */ + private final FluidRelayManagementClientImpl client; + + /** + * Initializes an instance of FluidRelayServersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + FluidRelayServersClientImpl(FluidRelayManagementClientImpl client) { + this.service = + RestProxy.create(FluidRelayServersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for FluidRelayManagementClientFluidRelayServers to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "FluidRelayManagement") + private interface FluidRelayServersService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.FluidRelay" + + "/fluidRelayServers/{name}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroup") String resourceGroup, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.FluidRelay" + + "/fluidRelayServers/{name}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroup") String resourceGroup, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") FluidRelayServerInner resource, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.FluidRelay" + + "/fluidRelayServers/{name}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroup") String resourceGroup, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") FluidRelayServerUpdate resource, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.FluidRelay" + + "/fluidRelayServers/{name}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroup") String resourceGroup, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.FluidRelay" + + "/fluidRelayServers/{name}/regenerateKey") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono regenerateKey( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroup") String resourceGroup, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") RegenerateKeyRequest parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.FluidRelay" + + "/fluidRelayServers/{name}/getKeys") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono getKeys( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroup") String resourceGroup, + @PathParam("name") String name, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.FluidRelay/fluidRelayServers") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.FluidRelay" + + "/fluidRelayServers") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroup") String resourceGroup, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get a Fluid Relay server. + * + * @param resourceGroup The resource group containing the resource. + * @param name The resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Fluid Relay server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroup, String name) { + 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 (resourceGroup == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceGroup is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroup, + name, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a Fluid Relay server. + * + * @param resourceGroup The resource group containing the resource. + * @param name The resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Fluid Relay server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroup, String name, 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 (resourceGroup == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceGroup is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroup, + name, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Get a Fluid Relay server. + * + * @param resourceGroup The resource group containing the resource. + * @param name The resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Fluid Relay server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroup, String name) { + return getByResourceGroupWithResponseAsync(resourceGroup, name) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get a Fluid Relay server. + * + * @param resourceGroup The resource group containing the resource. + * @param name The resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Fluid Relay server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FluidRelayServerInner getByResourceGroup(String resourceGroup, String name) { + return getByResourceGroupAsync(resourceGroup, name).block(); + } + + /** + * Get a Fluid Relay server. + * + * @param resourceGroup The resource group containing the resource. + * @param name The resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Fluid Relay server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroup, String name, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroup, name, context).block(); + } + + /** + * Create or Update a Fluid Relay server. + * + * @param resourceGroup The resource group containing the resource. + * @param name The resource name. + * @param resource The details of the Fluid Relay server resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a FluidRelay Server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateWithResponseAsync( + String resourceGroup, String name, FluidRelayServerInner resource) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroup == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceGroup is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroup, + name, + this.client.getApiVersion(), + resource, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or Update a Fluid Relay server. + * + * @param resourceGroup The resource group containing the resource. + * @param name The resource name. + * @param resource The details of the Fluid Relay server resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a FluidRelay Server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateWithResponseAsync( + String resourceGroup, String name, FluidRelayServerInner resource, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroup == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceGroup is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroup, + name, + this.client.getApiVersion(), + resource, + accept, + context); + } + + /** + * Create or Update a Fluid Relay server. + * + * @param resourceGroup The resource group containing the resource. + * @param name The resource name. + * @param resource The details of the Fluid Relay server resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a FluidRelay Server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroup, String name, FluidRelayServerInner resource) { + return createOrUpdateWithResponseAsync(resourceGroup, name, resource) + .flatMap( + (FluidRelayServersCreateOrUpdateResponse res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Create or Update a Fluid Relay server. + * + * @param resourceGroup The resource group containing the resource. + * @param name The resource name. + * @param resource The details of the Fluid Relay server resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a FluidRelay Server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FluidRelayServerInner createOrUpdate(String resourceGroup, String name, FluidRelayServerInner resource) { + return createOrUpdateAsync(resourceGroup, name, resource).block(); + } + + /** + * Create or Update a Fluid Relay server. + * + * @param resourceGroup The resource group containing the resource. + * @param name The resource name. + * @param resource The details of the Fluid Relay server resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a FluidRelay Server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FluidRelayServersCreateOrUpdateResponse createOrUpdateWithResponse( + String resourceGroup, String name, FluidRelayServerInner resource, Context context) { + return createOrUpdateWithResponseAsync(resourceGroup, name, resource, context).block(); + } + + /** + * Update a Fluid Relay server. + * + * @param resourceGroup The resource group containing the resource. + * @param name The resource name. + * @param resource The updatable details of the Fluid Relay server resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a FluidRelay Server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateWithResponseAsync( + String resourceGroup, String name, FluidRelayServerUpdate resource) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroup == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceGroup is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroup, + name, + this.client.getApiVersion(), + resource, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a Fluid Relay server. + * + * @param resourceGroup The resource group containing the resource. + * @param name The resource name. + * @param resource The updatable details of the Fluid Relay server resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a FluidRelay Server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateWithResponseAsync( + String resourceGroup, String name, FluidRelayServerUpdate resource, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroup == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceGroup is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroup, + name, + this.client.getApiVersion(), + resource, + accept, + context); + } + + /** + * Update a Fluid Relay server. + * + * @param resourceGroup The resource group containing the resource. + * @param name The resource name. + * @param resource The updatable details of the Fluid Relay server resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a FluidRelay Server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroup, String name, FluidRelayServerUpdate resource) { + return updateWithResponseAsync(resourceGroup, name, resource) + .flatMap( + (FluidRelayServersUpdateResponse res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Update a Fluid Relay server. + * + * @param resourceGroup The resource group containing the resource. + * @param name The resource name. + * @param resource The updatable details of the Fluid Relay server resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a FluidRelay Server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FluidRelayServerInner update(String resourceGroup, String name, FluidRelayServerUpdate resource) { + return updateAsync(resourceGroup, name, resource).block(); + } + + /** + * Update a Fluid Relay server. + * + * @param resourceGroup The resource group containing the resource. + * @param name The resource name. + * @param resource The updatable details of the Fluid Relay server resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a FluidRelay Server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FluidRelayServersUpdateResponse updateWithResponse( + String resourceGroup, String name, FluidRelayServerUpdate resource, Context context) { + return updateWithResponseAsync(resourceGroup, name, resource, context).block(); + } + + /** + * Delete a Fluid Relay server. + * + * @param resourceGroup The resource group containing the resource. + * @param name The resource 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 resourceGroup, String name) { + 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 (resourceGroup == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceGroup is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroup, + name, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a Fluid Relay server. + * + * @param resourceGroup The resource group containing the resource. + * @param name The resource 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 resourceGroup, String name, 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 (resourceGroup == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceGroup is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroup, + name, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Delete a Fluid Relay server. + * + * @param resourceGroup The resource group containing the resource. + * @param name The resource 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 resourceGroup, String name) { + return deleteWithResponseAsync(resourceGroup, name) + .flatMap((FluidRelayServersDeleteResponse res) -> Mono.empty()); + } + + /** + * Delete a Fluid Relay server. + * + * @param resourceGroup The resource group containing the resource. + * @param name The resource 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 resourceGroup, String name) { + deleteAsync(resourceGroup, name).block(); + } + + /** + * Delete a Fluid Relay server. + * + * @param resourceGroup The resource group containing the resource. + * @param name The resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FluidRelayServersDeleteResponse deleteWithResponse(String resourceGroup, String name, Context context) { + return deleteWithResponseAsync(resourceGroup, name, context).block(); + } + + /** + * Regenerate the primary or secondary key for this server. + * + * @param resourceGroup The resource group containing the resource. + * @param name The resource name. + * @param parameters The details of which keys to generate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the set of available keys for this server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono regenerateKeyWithResponseAsync( + String resourceGroup, String name, RegenerateKeyRequest parameters) { + 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 (resourceGroup == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceGroup is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .regenerateKey( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroup, + name, + this.client.getApiVersion(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Regenerate the primary or secondary key for this server. + * + * @param resourceGroup The resource group containing the resource. + * @param name The resource name. + * @param parameters The details of which keys to generate. + * @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 set of available keys for this server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono regenerateKeyWithResponseAsync( + String resourceGroup, String name, RegenerateKeyRequest parameters, 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 (resourceGroup == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceGroup is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .regenerateKey( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroup, + name, + this.client.getApiVersion(), + parameters, + accept, + context); + } + + /** + * Regenerate the primary or secondary key for this server. + * + * @param resourceGroup The resource group containing the resource. + * @param name The resource name. + * @param parameters The details of which keys to generate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the set of available keys for this server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono regenerateKeyAsync( + String resourceGroup, String name, RegenerateKeyRequest parameters) { + return regenerateKeyWithResponseAsync(resourceGroup, name, parameters) + .flatMap( + (FluidRelayServersRegenerateKeyResponse res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Regenerate the primary or secondary key for this server. + * + * @param resourceGroup The resource group containing the resource. + * @param name The resource name. + * @param parameters The details of which keys to generate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the set of available keys for this server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FluidRelayServerKeysInner regenerateKey(String resourceGroup, String name, RegenerateKeyRequest parameters) { + return regenerateKeyAsync(resourceGroup, name, parameters).block(); + } + + /** + * Regenerate the primary or secondary key for this server. + * + * @param resourceGroup The resource group containing the resource. + * @param name The resource name. + * @param parameters The details of which keys to generate. + * @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 set of available keys for this server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FluidRelayServersRegenerateKeyResponse regenerateKeyWithResponse( + String resourceGroup, String name, RegenerateKeyRequest parameters, Context context) { + return regenerateKeyWithResponseAsync(resourceGroup, name, parameters, context).block(); + } + + /** + * Regenerate the primary or secondary key for this server. + * + * @param resourceGroup The resource group containing the resource. + * @param name The resource 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 set of available keys for this server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getKeysWithResponseAsync(String resourceGroup, String name) { + 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 (resourceGroup == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceGroup is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getKeys( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroup, + name, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Regenerate the primary or secondary key for this server. + * + * @param resourceGroup The resource group containing the resource. + * @param name The resource 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 set of available keys for this server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getKeysWithResponseAsync( + String resourceGroup, String name, 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 (resourceGroup == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceGroup is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getKeys( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroup, + name, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Regenerate the primary or secondary key for this server. + * + * @param resourceGroup The resource group containing the resource. + * @param name The resource 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 set of available keys for this server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getKeysAsync(String resourceGroup, String name) { + return getKeysWithResponseAsync(resourceGroup, name) + .flatMap( + (FluidRelayServersGetKeysResponse res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Regenerate the primary or secondary key for this server. + * + * @param resourceGroup The resource group containing the resource. + * @param name The resource 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 set of available keys for this server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FluidRelayServerKeysInner getKeys(String resourceGroup, String name) { + return getKeysAsync(resourceGroup, name).block(); + } + + /** + * Regenerate the primary or secondary key for this server. + * + * @param resourceGroup The resource group containing the resource. + * @param name The resource 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 set of available keys for this server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FluidRelayServersGetKeysResponse getKeysWithResponse(String resourceGroup, String name, Context context) { + return getKeysWithResponseAsync(resourceGroup, name, context).block(); + } + + /** + * List all Fluid Relay servers in 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 paged response. + */ + @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.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List all Fluid Relay servers in 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 paged response. + */ + @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.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List all Fluid Relay servers in 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 paged response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>( + () -> listSinglePageAsync(), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List all Fluid Relay servers in 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 paged response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * List all Fluid Relay servers in 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 paged response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List all Fluid Relay servers in 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 paged response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * List all Fluid Relay servers in a resource group. + * + * @param resourceGroup The resource group containing the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroup) { + 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 (resourceGroup == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceGroup is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroup, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List all Fluid Relay servers in a resource group. + * + * @param resourceGroup The resource group containing the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroup, 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 (resourceGroup == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceGroup is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroup, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List all Fluid Relay servers in a resource group. + * + * @param resourceGroup The resource group containing the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroup) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroup), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List all Fluid Relay servers in a resource group. + * + * @param resourceGroup The resource group containing the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroup, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroup, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * List all Fluid Relay servers in a resource group. + * + * @param resourceGroup The resource group containing the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroup) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroup)); + } + + /** + * List all Fluid Relay servers in a resource group. + * + * @param resourceGroup The resource group containing the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroup, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroup, 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 paged response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The 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 paged response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/implementation/FluidRelayServersImpl.java b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/implementation/FluidRelayServersImpl.java new file mode 100644 index 0000000000000..7d0471c3a07a7 --- /dev/null +++ b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/implementation/FluidRelayServersImpl.java @@ -0,0 +1,230 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.fluidrelay.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.fluidrelay.fluent.FluidRelayServersClient; +import com.azure.resourcemanager.fluidrelay.fluent.models.FluidRelayServerInner; +import com.azure.resourcemanager.fluidrelay.fluent.models.FluidRelayServerKeysInner; +import com.azure.resourcemanager.fluidrelay.models.FluidRelayServer; +import com.azure.resourcemanager.fluidrelay.models.FluidRelayServerKeys; +import com.azure.resourcemanager.fluidrelay.models.FluidRelayServers; +import com.azure.resourcemanager.fluidrelay.models.FluidRelayServersDeleteResponse; +import com.azure.resourcemanager.fluidrelay.models.FluidRelayServersGetKeysResponse; +import com.azure.resourcemanager.fluidrelay.models.FluidRelayServersRegenerateKeyResponse; +import com.azure.resourcemanager.fluidrelay.models.RegenerateKeyRequest; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class FluidRelayServersImpl implements FluidRelayServers { + @JsonIgnore private final ClientLogger logger = new ClientLogger(FluidRelayServersImpl.class); + + private final FluidRelayServersClient innerClient; + + private final com.azure.resourcemanager.fluidrelay.FluidRelayManager serviceManager; + + public FluidRelayServersImpl( + FluidRelayServersClient innerClient, com.azure.resourcemanager.fluidrelay.FluidRelayManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public FluidRelayServer getByResourceGroup(String resourceGroup, String name) { + FluidRelayServerInner inner = this.serviceClient().getByResourceGroup(resourceGroup, name); + if (inner != null) { + return new FluidRelayServerImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroup, String name, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroup, name, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new FluidRelayServerImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroup, String name) { + this.serviceClient().delete(resourceGroup, name); + } + + public FluidRelayServersDeleteResponse deleteWithResponse(String resourceGroup, String name, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroup, name, context); + } + + public FluidRelayServerKeys regenerateKey(String resourceGroup, String name, RegenerateKeyRequest parameters) { + FluidRelayServerKeysInner inner = this.serviceClient().regenerateKey(resourceGroup, name, parameters); + if (inner != null) { + return new FluidRelayServerKeysImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response regenerateKeyWithResponse( + String resourceGroup, String name, RegenerateKeyRequest parameters, Context context) { + FluidRelayServersRegenerateKeyResponse inner = + this.serviceClient().regenerateKeyWithResponse(resourceGroup, name, parameters, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new FluidRelayServerKeysImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public FluidRelayServerKeys getKeys(String resourceGroup, String name) { + FluidRelayServerKeysInner inner = this.serviceClient().getKeys(resourceGroup, name); + if (inner != null) { + return new FluidRelayServerKeysImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getKeysWithResponse(String resourceGroup, String name, Context context) { + FluidRelayServersGetKeysResponse inner = this.serviceClient().getKeysWithResponse(resourceGroup, name, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new FluidRelayServerKeysImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new FluidRelayServerImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new FluidRelayServerImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroup) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroup); + return Utils.mapPage(inner, inner1 -> new FluidRelayServerImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroup, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroup, context); + return Utils.mapPage(inner, inner1 -> new FluidRelayServerImpl(inner1, this.manager())); + } + + public FluidRelayServer getById(String id) { + String resourceGroup = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroup == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String name = Utils.getValueFromIdByName(id, "fluidRelayServers"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'fluidRelayServers'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroup, name, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroup = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroup == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String name = Utils.getValueFromIdByName(id, "fluidRelayServers"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'fluidRelayServers'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroup, name, context); + } + + public void deleteById(String id) { + String resourceGroup = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroup == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String name = Utils.getValueFromIdByName(id, "fluidRelayServers"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'fluidRelayServers'.", id))); + } + this.deleteWithResponse(resourceGroup, name, Context.NONE).getValue(); + } + + public FluidRelayServersDeleteResponse deleteByIdWithResponse(String id, Context context) { + String resourceGroup = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroup == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String name = Utils.getValueFromIdByName(id, "fluidRelayServers"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'fluidRelayServers'.", id))); + } + return this.deleteWithResponse(resourceGroup, name, context); + } + + private FluidRelayServersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.fluidrelay.FluidRelayManager manager() { + return this.serviceManager; + } + + public FluidRelayServerImpl define(String name) { + return new FluidRelayServerImpl(name, this.manager()); + } +} diff --git a/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/implementation/OperationResultImpl.java b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/implementation/OperationResultImpl.java new file mode 100644 index 0000000000000..42d9081496e47 --- /dev/null +++ b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/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.fluidrelay.implementation; + +import com.azure.resourcemanager.fluidrelay.fluent.models.OperationResultInner; +import com.azure.resourcemanager.fluidrelay.models.OperationDisplay; +import com.azure.resourcemanager.fluidrelay.models.OperationResult; + +public final class OperationResultImpl implements OperationResult { + private OperationResultInner innerObject; + + private final com.azure.resourcemanager.fluidrelay.FluidRelayManager serviceManager; + + OperationResultImpl( + OperationResultInner innerObject, com.azure.resourcemanager.fluidrelay.FluidRelayManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public OperationDisplay display() { + return this.innerModel().display(); + } + + public Boolean isDataAction() { + return this.innerModel().isDataAction(); + } + + public OperationResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.fluidrelay.FluidRelayManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/implementation/Utils.java b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/implementation/Utils.java new file mode 100644 index 0000000000000..3931f3dee00d1 --- /dev/null +++ b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/implementation/Utils.java @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.fluidrelay.implementation; + +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.util.CoreUtils; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import reactor.core.publisher.Flux; + +final class Utils { + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterator itr = Arrays.stream(id.split("/")).iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && !part.trim().isEmpty()) { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { + if (id == null || pathTemplate == null) { + return null; + } + String parameterNameParentheses = "{" + parameterName + "}"; + List idSegmentsReverted = Arrays.asList(id.split("/")); + List pathSegments = Arrays.asList(pathTemplate.split("/")); + Collections.reverse(idSegmentsReverted); + Iterator idItrReverted = idSegmentsReverted.iterator(); + int pathIndex = pathSegments.size(); + while (idItrReverted.hasNext() && pathIndex > 0) { + String idSegment = idItrReverted.next(); + String pathSegment = pathSegments.get(--pathIndex); + if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { + if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { + if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { + List segments = new ArrayList<>(); + segments.add(idSegment); + idItrReverted.forEachRemaining(segments::add); + Collections.reverse(segments); + if (segments.size() > 0 && segments.get(0).isEmpty()) { + segments.remove(0); + } + return String.join("/", segments); + } else { + return idSegment; + } + } + } + } + return null; + } + + static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { + return new PagedIterableImpl(pageIterable, mapper); + } + + private static final class PagedIterableImpl extends PagedIterable { + + private final PagedIterable pagedIterable; + private final Function mapper; + private final Function, PagedResponse> pageMapper; + + private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { + super( + PagedFlux + .create( + () -> + (continuationToken, pageSize) -> + Flux.fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); + this.pagedIterable = pagedIterable; + this.mapper = mapper; + this.pageMapper = getPageMapper(mapper); + } + + private static Function, PagedResponse> getPageMapper(Function mapper) { + return page -> + new PagedResponseBase( + page.getRequest(), + page.getStatusCode(), + page.getHeaders(), + page.getElements().stream().map(mapper).collect(Collectors.toList()), + page.getContinuationToken(), + null); + } + + @Override + public Stream stream() { + return pagedIterable.stream().map(mapper); + } + + @Override + public Stream> streamByPage() { + return pagedIterable.streamByPage().map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken) { + return pagedIterable.streamByPage(continuationToken).map(pageMapper); + } + + @Override + public Stream> streamByPage(int preferredPageSize) { + return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken, int preferredPageSize) { + return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + } + + @Override + public Iterator iterator() { + return new IteratorImpl(pagedIterable.iterator(), mapper); + } + + @Override + public Iterable> iterableByPage() { + return new IterableImpl, PagedResponse>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); + } + } + + private static final class IteratorImpl implements Iterator { + + private final Iterator iterator; + private final Function mapper; + + private IteratorImpl(Iterator iterator, Function mapper) { + this.iterator = iterator; + this.mapper = mapper; + } + + @Override + public boolean hasNext() { + return iterator.hasNext(); + } + + @Override + public S next() { + return mapper.apply(iterator.next()); + } + + @Override + public void remove() { + iterator.remove(); + } + } + + private static final class IterableImpl implements Iterable { + + private final Iterable iterable; + private final Function mapper; + + private IterableImpl(Iterable iterable, Function mapper) { + this.iterable = iterable; + this.mapper = mapper; + } + + @Override + public Iterator iterator() { + return new IteratorImpl(iterable.iterator(), mapper); + } + } +} diff --git a/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/implementation/package-info.java b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/implementation/package-info.java new file mode 100644 index 0000000000000..9be1a101d6ed1 --- /dev/null +++ b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/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 FluidRelayManagementClient. null. */ +package com.azure.resourcemanager.fluidrelay.implementation; diff --git a/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/FluidRelayEndpoints.java b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/FluidRelayEndpoints.java new file mode 100644 index 0000000000000..18c5347b8a378 --- /dev/null +++ b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/FluidRelayEndpoints.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.fluidrelay.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The Fluid Relay endpoints for this server. */ +@Immutable +public final class FluidRelayEndpoints { + @JsonIgnore private final ClientLogger logger = new ClientLogger(FluidRelayEndpoints.class); + + /* + * The Fluid Relay Orderer endpoints. + */ + @JsonProperty(value = "ordererEndpoints", access = JsonProperty.Access.WRITE_ONLY) + private List ordererEndpoints; + + /* + * The Fluid Relay storage endpoints. + */ + @JsonProperty(value = "storageEndpoints", access = JsonProperty.Access.WRITE_ONLY) + private List storageEndpoints; + + /** + * Get the ordererEndpoints property: The Fluid Relay Orderer endpoints. + * + * @return the ordererEndpoints value. + */ + public List ordererEndpoints() { + return this.ordererEndpoints; + } + + /** + * Get the storageEndpoints property: The Fluid Relay storage endpoints. + * + * @return the storageEndpoints value. + */ + public List storageEndpoints() { + return this.storageEndpoints; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/FluidRelayOperations.java b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/FluidRelayOperations.java new file mode 100644 index 0000000000000..77bdad7580e5a --- /dev/null +++ b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/FluidRelayOperations.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.fluidrelay.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of FluidRelayOperations. */ +public interface FluidRelayOperations { + /** + * List all operations provided by Microsoft.FluidRelay. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of GET request to list FluidRelay operations. + */ + PagedIterable list(); + + /** + * List all operations provided by Microsoft.FluidRelay. + * + * @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 result of GET request to list FluidRelay operations. + */ + PagedIterable list(Context context); +} diff --git a/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/FluidRelayServer.java b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/FluidRelayServer.java new file mode 100644 index 0000000000000..afd9d4d006b95 --- /dev/null +++ b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/FluidRelayServer.java @@ -0,0 +1,276 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.fluidrelay.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.fluidrelay.fluent.models.FluidRelayServerInner; +import java.util.Map; + +/** An immutable client-side representation of FluidRelayServer. */ +public interface FluidRelayServer { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the systemData property: System meta data for this resource, including creation and modification + * information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the frsTenantId property: The Fluid tenantId for this server. + * + * @return the frsTenantId value. + */ + String frsTenantId(); + + /** + * Gets the fluidRelayEndpoints property: The Fluid Relay Service endpoints for this server. + * + * @return the fluidRelayEndpoints value. + */ + FluidRelayEndpoints fluidRelayEndpoints(); + + /** + * Gets the provisioningState property: Provision states for FluidRelay RP. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.fluidrelay.fluent.models.FluidRelayServerInner object. + * + * @return the inner object. + */ + FluidRelayServerInner innerModel(); + + /** The entirety of the FluidRelayServer definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The FluidRelayServer definition stages. */ + interface DefinitionStages { + /** The first stage of the FluidRelayServer definition. */ + interface Blank extends WithLocation { + } + /** The stage of the FluidRelayServer 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 FluidRelayServer definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroup. + * + * @param resourceGroup The resource group containing the resource. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroup); + } + /** + * The stage of the FluidRelayServer 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.WithProvisioningState { + /** + * Executes the create request. + * + * @return the created resource. + */ + FluidRelayServer create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + FluidRelayServer create(Context context); + } + /** The stage of the FluidRelayServer 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 FluidRelayServer definition allowing to specify provisioningState. */ + interface WithProvisioningState { + /** + * Specifies the provisioningState property: Provision states for FluidRelay RP. + * + * @param provisioningState Provision states for FluidRelay RP. + * @return the next definition stage. + */ + WithCreate withProvisioningState(ProvisioningState provisioningState); + } + } + /** + * Begins update for the FluidRelayServer resource. + * + * @return the stage of resource update. + */ + FluidRelayServer.Update update(); + + /** The template for FluidRelayServer update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + FluidRelayServer apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + FluidRelayServer apply(Context context); + } + /** The FluidRelayServer update stages. */ + interface UpdateStages { + /** The stage of the FluidRelayServer update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + FluidRelayServer refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + FluidRelayServer refresh(Context context); + + /** + * Regenerate the primary or secondary key for this server. + * + * @param parameters The details of which keys to generate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the set of available keys for this server. + */ + FluidRelayServerKeys regenerateKey(RegenerateKeyRequest parameters); + + /** + * Regenerate the primary or secondary key for this server. + * + * @param parameters The details of which keys to generate. + * @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 set of available keys for this server. + */ + Response regenerateKeyWithResponse(RegenerateKeyRequest parameters, Context context); + + /** + * Regenerate the primary or secondary key for this server. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the set of available keys for this server. + */ + FluidRelayServerKeys getKeys(); + + /** + * Regenerate the primary or secondary key for this server. + * + * @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 set of available keys for this server. + */ + Response getKeysWithResponse(Context context); +} diff --git a/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/FluidRelayServerKeys.java b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/FluidRelayServerKeys.java new file mode 100644 index 0000000000000..d7421199ab9cc --- /dev/null +++ b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/FluidRelayServerKeys.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.fluidrelay.models; + +import com.azure.resourcemanager.fluidrelay.fluent.models.FluidRelayServerKeysInner; + +/** An immutable client-side representation of FluidRelayServerKeys. */ +public interface FluidRelayServerKeys { + /** + * Gets the key1 property: The primary key for this server. + * + * @return the key1 value. + */ + String key1(); + + /** + * Gets the key2 property: The secondary key for this server. + * + * @return the key2 value. + */ + String key2(); + + /** + * Gets the inner com.azure.resourcemanager.fluidrelay.fluent.models.FluidRelayServerKeysInner object. + * + * @return the inner object. + */ + FluidRelayServerKeysInner innerModel(); +} diff --git a/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/FluidRelayServerList.java b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/FluidRelayServerList.java new file mode 100644 index 0000000000000..bc9f7c9fd878f --- /dev/null +++ b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/FluidRelayServerList.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.fluidrelay.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.fluidrelay.fluent.models.FluidRelayServerInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Paged response. */ +@Fluent +public final class FluidRelayServerList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(FluidRelayServerList.class); + + /* + * A sequence of FluidRelay servers. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * A link to the next page of results, if any. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: A sequence of FluidRelay servers. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: A sequence of FluidRelay servers. + * + * @param value the value value to set. + * @return the FluidRelayServerList object itself. + */ + public FluidRelayServerList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: A link to the next page of results, if any. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: A link to the next page of results, if any. + * + * @param nextLink the nextLink value to set. + * @return the FluidRelayServerList object itself. + */ + public FluidRelayServerList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model FluidRelayServerList")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/FluidRelayServerUpdate.java b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/FluidRelayServerUpdate.java new file mode 100644 index 0000000000000..0cbbd9bc29aaa --- /dev/null +++ b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/FluidRelayServerUpdate.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.fluidrelay.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The updatable properties of a Fluid Relay server. */ +@Fluent +public final class FluidRelayServerUpdate { + @JsonIgnore private final ClientLogger logger = new ClientLogger(FluidRelayServerUpdate.class); + + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the FluidRelayServerUpdate object itself. + */ + public FluidRelayServerUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/FluidRelayServers.java b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/FluidRelayServers.java new file mode 100644 index 0000000000000..6ce82925658fe --- /dev/null +++ b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/FluidRelayServers.java @@ -0,0 +1,210 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.fluidrelay.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 FluidRelayServers. */ +public interface FluidRelayServers { + /** + * Get a Fluid Relay server. + * + * @param resourceGroup The resource group containing the resource. + * @param name The resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Fluid Relay server. + */ + FluidRelayServer getByResourceGroup(String resourceGroup, String name); + + /** + * Get a Fluid Relay server. + * + * @param resourceGroup The resource group containing the resource. + * @param name The resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Fluid Relay server. + */ + Response getByResourceGroupWithResponse(String resourceGroup, String name, Context context); + + /** + * Delete a Fluid Relay server. + * + * @param resourceGroup The resource group containing the resource. + * @param name The resource 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 resourceGroup, String name); + + /** + * Delete a Fluid Relay server. + * + * @param resourceGroup The resource group containing the resource. + * @param name The resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + FluidRelayServersDeleteResponse deleteWithResponse(String resourceGroup, String name, Context context); + + /** + * Regenerate the primary or secondary key for this server. + * + * @param resourceGroup The resource group containing the resource. + * @param name The resource name. + * @param parameters The details of which keys to generate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the set of available keys for this server. + */ + FluidRelayServerKeys regenerateKey(String resourceGroup, String name, RegenerateKeyRequest parameters); + + /** + * Regenerate the primary or secondary key for this server. + * + * @param resourceGroup The resource group containing the resource. + * @param name The resource name. + * @param parameters The details of which keys to generate. + * @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 set of available keys for this server. + */ + Response regenerateKeyWithResponse( + String resourceGroup, String name, RegenerateKeyRequest parameters, Context context); + + /** + * Regenerate the primary or secondary key for this server. + * + * @param resourceGroup The resource group containing the resource. + * @param name The resource 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 set of available keys for this server. + */ + FluidRelayServerKeys getKeys(String resourceGroup, String name); + + /** + * Regenerate the primary or secondary key for this server. + * + * @param resourceGroup The resource group containing the resource. + * @param name The resource 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 set of available keys for this server. + */ + Response getKeysWithResponse(String resourceGroup, String name, Context context); + + /** + * List all Fluid Relay servers in 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 paged response. + */ + PagedIterable list(); + + /** + * List all Fluid Relay servers in 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 paged response. + */ + PagedIterable list(Context context); + + /** + * List all Fluid Relay servers in a resource group. + * + * @param resourceGroup The resource group containing the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged response. + */ + PagedIterable listByResourceGroup(String resourceGroup); + + /** + * List all Fluid Relay servers in a resource group. + * + * @param resourceGroup The resource group containing the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return paged response. + */ + PagedIterable listByResourceGroup(String resourceGroup, Context context); + + /** + * Get a Fluid Relay server. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Fluid Relay server. + */ + FluidRelayServer getById(String id); + + /** + * Get a Fluid Relay server. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Fluid Relay server. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a Fluid Relay server. + * + * @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 Fluid Relay server. + * + * @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 response. + */ + FluidRelayServersDeleteResponse deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new FluidRelayServer resource. + * + * @param name resource name. + * @return the first stage of the new FluidRelayServer definition. + */ + FluidRelayServer.DefinitionStages.Blank define(String name); +} diff --git a/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/FluidRelayServersCreateOrUpdateHeaders.java b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/FluidRelayServersCreateOrUpdateHeaders.java new file mode 100644 index 0000000000000..aeac687e48dfc --- /dev/null +++ b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/FluidRelayServersCreateOrUpdateHeaders.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.fluidrelay.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The FluidRelayServersCreateOrUpdateHeaders model. */ +@Fluent +public final class FluidRelayServersCreateOrUpdateHeaders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(FluidRelayServersCreateOrUpdateHeaders.class); + + /* + * The x-ms-client-request-id property. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String xMsClientRequestId; + + /* + * The x-ms-correlation-request-id property. + */ + @JsonProperty(value = "x-ms-correlation-request-id") + private String xMsCorrelationRequestId; + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String xMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the FluidRelayServersCreateOrUpdateHeaders object itself. + */ + public FluidRelayServersCreateOrUpdateHeaders withXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } + + /** + * Get the xMsCorrelationRequestId property: The x-ms-correlation-request-id property. + * + * @return the xMsCorrelationRequestId value. + */ + public String xMsCorrelationRequestId() { + return this.xMsCorrelationRequestId; + } + + /** + * Set the xMsCorrelationRequestId property: The x-ms-correlation-request-id property. + * + * @param xMsCorrelationRequestId the xMsCorrelationRequestId value to set. + * @return the FluidRelayServersCreateOrUpdateHeaders object itself. + */ + public FluidRelayServersCreateOrUpdateHeaders withXMsCorrelationRequestId(String xMsCorrelationRequestId) { + this.xMsCorrelationRequestId = xMsCorrelationRequestId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/FluidRelayServersCreateOrUpdateResponse.java b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/FluidRelayServersCreateOrUpdateResponse.java new file mode 100644 index 0000000000000..bc673d3b23204 --- /dev/null +++ b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/FluidRelayServersCreateOrUpdateResponse.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.fluidrelay.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import com.azure.resourcemanager.fluidrelay.fluent.models.FluidRelayServerInner; + +/** Contains all response data for the createOrUpdate operation. */ +public final class FluidRelayServersCreateOrUpdateResponse + extends ResponseBase { + /** + * Creates an instance of FluidRelayServersCreateOrUpdateResponse. + * + * @param request the request which resulted in this FluidRelayServersCreateOrUpdateResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public FluidRelayServersCreateOrUpdateResponse( + HttpRequest request, + int statusCode, + HttpHeaders rawHeaders, + FluidRelayServerInner value, + FluidRelayServersCreateOrUpdateHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** @return the deserialized response body. */ + @Override + public FluidRelayServerInner getValue() { + return super.getValue(); + } +} diff --git a/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/FluidRelayServersDeleteHeaders.java b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/FluidRelayServersDeleteHeaders.java new file mode 100644 index 0000000000000..a262ea1cb84e9 --- /dev/null +++ b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/FluidRelayServersDeleteHeaders.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.fluidrelay.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The FluidRelayServersDeleteHeaders model. */ +@Fluent +public final class FluidRelayServersDeleteHeaders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(FluidRelayServersDeleteHeaders.class); + + /* + * The x-ms-client-request-id property. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String xMsClientRequestId; + + /* + * The x-ms-correlation-request-id property. + */ + @JsonProperty(value = "x-ms-correlation-request-id") + private String xMsCorrelationRequestId; + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String xMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the FluidRelayServersDeleteHeaders object itself. + */ + public FluidRelayServersDeleteHeaders withXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } + + /** + * Get the xMsCorrelationRequestId property: The x-ms-correlation-request-id property. + * + * @return the xMsCorrelationRequestId value. + */ + public String xMsCorrelationRequestId() { + return this.xMsCorrelationRequestId; + } + + /** + * Set the xMsCorrelationRequestId property: The x-ms-correlation-request-id property. + * + * @param xMsCorrelationRequestId the xMsCorrelationRequestId value to set. + * @return the FluidRelayServersDeleteHeaders object itself. + */ + public FluidRelayServersDeleteHeaders withXMsCorrelationRequestId(String xMsCorrelationRequestId) { + this.xMsCorrelationRequestId = xMsCorrelationRequestId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/FluidRelayServersDeleteResponse.java b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/FluidRelayServersDeleteResponse.java new file mode 100644 index 0000000000000..bf43095eca601 --- /dev/null +++ b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/FluidRelayServersDeleteResponse.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.fluidrelay.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; + +/** Contains all response data for the delete operation. */ +public final class FluidRelayServersDeleteResponse extends ResponseBase { + /** + * Creates an instance of FluidRelayServersDeleteResponse. + * + * @param request the request which resulted in this FluidRelayServersDeleteResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public FluidRelayServersDeleteResponse( + HttpRequest request, + int statusCode, + HttpHeaders rawHeaders, + Void value, + FluidRelayServersDeleteHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } +} diff --git a/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/FluidRelayServersGetKeysHeaders.java b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/FluidRelayServersGetKeysHeaders.java new file mode 100644 index 0000000000000..bfac1a6724e11 --- /dev/null +++ b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/FluidRelayServersGetKeysHeaders.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.fluidrelay.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The FluidRelayServersGetKeysHeaders model. */ +@Fluent +public final class FluidRelayServersGetKeysHeaders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(FluidRelayServersGetKeysHeaders.class); + + /* + * The x-ms-client-request-id property. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String xMsClientRequestId; + + /* + * The x-ms-correlation-request-id property. + */ + @JsonProperty(value = "x-ms-correlation-request-id") + private String xMsCorrelationRequestId; + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String xMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the FluidRelayServersGetKeysHeaders object itself. + */ + public FluidRelayServersGetKeysHeaders withXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } + + /** + * Get the xMsCorrelationRequestId property: The x-ms-correlation-request-id property. + * + * @return the xMsCorrelationRequestId value. + */ + public String xMsCorrelationRequestId() { + return this.xMsCorrelationRequestId; + } + + /** + * Set the xMsCorrelationRequestId property: The x-ms-correlation-request-id property. + * + * @param xMsCorrelationRequestId the xMsCorrelationRequestId value to set. + * @return the FluidRelayServersGetKeysHeaders object itself. + */ + public FluidRelayServersGetKeysHeaders withXMsCorrelationRequestId(String xMsCorrelationRequestId) { + this.xMsCorrelationRequestId = xMsCorrelationRequestId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/FluidRelayServersGetKeysResponse.java b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/FluidRelayServersGetKeysResponse.java new file mode 100644 index 0000000000000..d45ee2aa05b4d --- /dev/null +++ b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/FluidRelayServersGetKeysResponse.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.fluidrelay.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import com.azure.resourcemanager.fluidrelay.fluent.models.FluidRelayServerKeysInner; + +/** Contains all response data for the getKeys operation. */ +public final class FluidRelayServersGetKeysResponse + extends ResponseBase { + /** + * Creates an instance of FluidRelayServersGetKeysResponse. + * + * @param request the request which resulted in this FluidRelayServersGetKeysResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public FluidRelayServersGetKeysResponse( + HttpRequest request, + int statusCode, + HttpHeaders rawHeaders, + FluidRelayServerKeysInner value, + FluidRelayServersGetKeysHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** @return the deserialized response body. */ + @Override + public FluidRelayServerKeysInner getValue() { + return super.getValue(); + } +} diff --git a/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/FluidRelayServersRegenerateKeyHeaders.java b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/FluidRelayServersRegenerateKeyHeaders.java new file mode 100644 index 0000000000000..2f34c7bbc45ba --- /dev/null +++ b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/FluidRelayServersRegenerateKeyHeaders.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.fluidrelay.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The FluidRelayServersRegenerateKeyHeaders model. */ +@Fluent +public final class FluidRelayServersRegenerateKeyHeaders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(FluidRelayServersRegenerateKeyHeaders.class); + + /* + * The x-ms-client-request-id property. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String xMsClientRequestId; + + /* + * The x-ms-correlation-request-id property. + */ + @JsonProperty(value = "x-ms-correlation-request-id") + private String xMsCorrelationRequestId; + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String xMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the FluidRelayServersRegenerateKeyHeaders object itself. + */ + public FluidRelayServersRegenerateKeyHeaders withXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } + + /** + * Get the xMsCorrelationRequestId property: The x-ms-correlation-request-id property. + * + * @return the xMsCorrelationRequestId value. + */ + public String xMsCorrelationRequestId() { + return this.xMsCorrelationRequestId; + } + + /** + * Set the xMsCorrelationRequestId property: The x-ms-correlation-request-id property. + * + * @param xMsCorrelationRequestId the xMsCorrelationRequestId value to set. + * @return the FluidRelayServersRegenerateKeyHeaders object itself. + */ + public FluidRelayServersRegenerateKeyHeaders withXMsCorrelationRequestId(String xMsCorrelationRequestId) { + this.xMsCorrelationRequestId = xMsCorrelationRequestId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/FluidRelayServersRegenerateKeyResponse.java b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/FluidRelayServersRegenerateKeyResponse.java new file mode 100644 index 0000000000000..65766d0203e65 --- /dev/null +++ b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/FluidRelayServersRegenerateKeyResponse.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.fluidrelay.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import com.azure.resourcemanager.fluidrelay.fluent.models.FluidRelayServerKeysInner; + +/** Contains all response data for the regenerateKey operation. */ +public final class FluidRelayServersRegenerateKeyResponse + extends ResponseBase { + /** + * Creates an instance of FluidRelayServersRegenerateKeyResponse. + * + * @param request the request which resulted in this FluidRelayServersRegenerateKeyResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public FluidRelayServersRegenerateKeyResponse( + HttpRequest request, + int statusCode, + HttpHeaders rawHeaders, + FluidRelayServerKeysInner value, + FluidRelayServersRegenerateKeyHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** @return the deserialized response body. */ + @Override + public FluidRelayServerKeysInner getValue() { + return super.getValue(); + } +} diff --git a/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/FluidRelayServersUpdateHeaders.java b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/FluidRelayServersUpdateHeaders.java new file mode 100644 index 0000000000000..85fc6d7bc70f8 --- /dev/null +++ b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/FluidRelayServersUpdateHeaders.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.fluidrelay.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The FluidRelayServersUpdateHeaders model. */ +@Fluent +public final class FluidRelayServersUpdateHeaders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(FluidRelayServersUpdateHeaders.class); + + /* + * The x-ms-client-request-id property. + */ + @JsonProperty(value = "x-ms-client-request-id") + private String xMsClientRequestId; + + /* + * The x-ms-correlation-request-id property. + */ + @JsonProperty(value = "x-ms-correlation-request-id") + private String xMsCorrelationRequestId; + + /** + * Get the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @return the xMsClientRequestId value. + */ + public String xMsClientRequestId() { + return this.xMsClientRequestId; + } + + /** + * Set the xMsClientRequestId property: The x-ms-client-request-id property. + * + * @param xMsClientRequestId the xMsClientRequestId value to set. + * @return the FluidRelayServersUpdateHeaders object itself. + */ + public FluidRelayServersUpdateHeaders withXMsClientRequestId(String xMsClientRequestId) { + this.xMsClientRequestId = xMsClientRequestId; + return this; + } + + /** + * Get the xMsCorrelationRequestId property: The x-ms-correlation-request-id property. + * + * @return the xMsCorrelationRequestId value. + */ + public String xMsCorrelationRequestId() { + return this.xMsCorrelationRequestId; + } + + /** + * Set the xMsCorrelationRequestId property: The x-ms-correlation-request-id property. + * + * @param xMsCorrelationRequestId the xMsCorrelationRequestId value to set. + * @return the FluidRelayServersUpdateHeaders object itself. + */ + public FluidRelayServersUpdateHeaders withXMsCorrelationRequestId(String xMsCorrelationRequestId) { + this.xMsCorrelationRequestId = xMsCorrelationRequestId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/FluidRelayServersUpdateResponse.java b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/FluidRelayServersUpdateResponse.java new file mode 100644 index 0000000000000..de717f9347deb --- /dev/null +++ b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/FluidRelayServersUpdateResponse.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.fluidrelay.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import com.azure.resourcemanager.fluidrelay.fluent.models.FluidRelayServerInner; + +/** Contains all response data for the update operation. */ +public final class FluidRelayServersUpdateResponse + extends ResponseBase { + /** + * Creates an instance of FluidRelayServersUpdateResponse. + * + * @param request the request which resulted in this FluidRelayServersUpdateResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public FluidRelayServersUpdateResponse( + HttpRequest request, + int statusCode, + HttpHeaders rawHeaders, + FluidRelayServerInner value, + FluidRelayServersUpdateHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** @return the deserialized response body. */ + @Override + public FluidRelayServerInner getValue() { + return super.getValue(); + } +} diff --git a/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/KeyName.java b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/KeyName.java new file mode 100644 index 0000000000000..d86f5e7ef24df --- /dev/null +++ b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/KeyName.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.fluidrelay.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for KeyName. */ +public enum KeyName { + /** Enum value key1. */ + KEY1("key1"), + + /** Enum value key2. */ + KEY2("key2"); + + /** The actual serialized value for a KeyName instance. */ + private final String value; + + KeyName(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a KeyName instance. + * + * @param value the serialized value to parse. + * @return the parsed KeyName object, or null if unable to parse. + */ + @JsonCreator + public static KeyName fromString(String value) { + KeyName[] items = KeyName.values(); + for (KeyName item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/OperationDisplay.java b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/OperationDisplay.java new file mode 100644 index 0000000000000..f2f13702a0898 --- /dev/null +++ b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/OperationDisplay.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.fluidrelay.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The object that represents the operation. */ +@Fluent +public final class OperationDisplay { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationDisplay.class); + + /* + * Service provider: Microsoft.FluidRelay + */ + @JsonProperty(value = "provider") + private String provider; + + /* + * Type on which the operation is performed, e.g., 'servers'. + */ + @JsonProperty(value = "resource") + private String resource; + + /* + * Operation type, e.g., read, write, delete, etc. + */ + @JsonProperty(value = "operation") + private String operation; + + /* + * Description of the operation, e.g., 'Write confluent'. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get the provider property: Service provider: Microsoft.FluidRelay. + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Set the provider property: Service provider: Microsoft.FluidRelay. + * + * @param provider the provider value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get the resource property: Type on which the operation is performed, e.g., 'servers'. + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Set the resource property: Type on which the operation is performed, e.g., 'servers'. + * + * @param resource the resource value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get the operation property: Operation type, e.g., read, write, delete, etc. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Set the operation property: Operation type, e.g., read, write, delete, etc. + * + * @param operation the operation value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get the description property: Description of the operation, e.g., 'Write confluent'. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Description of the operation, e.g., 'Write confluent'. + * + * @param description the description value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay 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/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/OperationListResult.java b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/OperationListResult.java new file mode 100644 index 0000000000000..fef000158bc1a --- /dev/null +++ b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/OperationListResult.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.fluidrelay.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.fluidrelay.fluent.models.OperationResultInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Result of GET request to list FluidRelay operations. */ +@Fluent +public final class OperationListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationListResult.class); + + /* + * List of FluidRelay operations supported by the Microsoft.FluidRelay + * provider. + */ + @JsonProperty(value = "value") + private List value; + + /* + * URL to get the next set of operation list results if there are any. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: List of FluidRelay operations supported by the Microsoft.FluidRelay provider. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of FluidRelay operations supported by the Microsoft.FluidRelay provider. + * + * @param value the value value to set. + * @return the OperationListResult object itself. + */ + public OperationListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: URL to get the next set of operation list results if there are any. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: URL to get the next set of operation list results if there are any. + * + * @param nextLink the nextLink value to set. + * @return the OperationListResult object itself. + */ + public OperationListResult 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/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/OperationResult.java b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/OperationResult.java new file mode 100644 index 0000000000000..542fa0c7e9305 --- /dev/null +++ b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/OperationResult.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.fluidrelay.models; + +import com.azure.resourcemanager.fluidrelay.fluent.models.OperationResultInner; + +/** An immutable client-side representation of OperationResult. */ +public interface OperationResult { + /** + * Gets the name property: Operation name: {provider}/{resource}/{operation}. + * + * @return the name value. + */ + String name(); + + /** + * Gets the display property: The object that represents the operation. + * + * @return the display value. + */ + OperationDisplay display(); + + /** + * Gets the isDataAction property: Indicates whether the operation is a data action. + * + * @return the isDataAction value. + */ + Boolean isDataAction(); + + /** + * Gets the inner com.azure.resourcemanager.fluidrelay.fluent.models.OperationResultInner object. + * + * @return the inner object. + */ + OperationResultInner innerModel(); +} diff --git a/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/ProvisioningState.java b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/ProvisioningState.java new file mode 100644 index 0000000000000..8bb94c43f7562 --- /dev/null +++ b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/ProvisioningState.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.fluidrelay.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ProvisioningState. */ +public final class ProvisioningState extends ExpandableStringEnum { + /** Static value Succeeded for ProvisioningState. */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** Static value Failed for ProvisioningState. */ + public static final ProvisioningState FAILED = fromString("Failed"); + + /** Static value Canceled for ProvisioningState. */ + public static final ProvisioningState CANCELED = fromString("Canceled"); + + /** + * Creates or finds a ProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProvisioningState. + */ + @JsonCreator + public static ProvisioningState fromString(String name) { + return fromString(name, ProvisioningState.class); + } + + /** @return known ProvisioningState values. */ + public static Collection values() { + return values(ProvisioningState.class); + } +} diff --git a/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/RegenerateKeyRequest.java b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/RegenerateKeyRequest.java new file mode 100644 index 0000000000000..b92961728b615 --- /dev/null +++ b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/RegenerateKeyRequest.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.fluidrelay.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; + +/** Specifies which key should be generated. */ +@Fluent +public final class RegenerateKeyRequest { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RegenerateKeyRequest.class); + + /* + * The key to regenerate. + */ + @JsonProperty(value = "keyName", required = true) + private KeyName keyName; + + /** + * Get the keyName property: The key to regenerate. + * + * @return the keyName value. + */ + public KeyName keyName() { + return this.keyName; + } + + /** + * Set the keyName property: The key to regenerate. + * + * @param keyName the keyName value to set. + * @return the RegenerateKeyRequest object itself. + */ + public RegenerateKeyRequest withKeyName(KeyName keyName) { + this.keyName = keyName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (keyName() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property keyName in model RegenerateKeyRequest")); + } + } +} diff --git a/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/package-info.java b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/models/package-info.java new file mode 100644 index 0000000000000..8469b27eb42d5 --- /dev/null +++ b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/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 FluidRelayManagementClient. null. */ +package com.azure.resourcemanager.fluidrelay.models; diff --git a/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/package-info.java b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/package-info.java new file mode 100644 index 0000000000000..ba5ef0b21297f --- /dev/null +++ b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/com/azure/resourcemanager/fluidrelay/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 FluidRelayManagementClient. null. */ +package com.azure.resourcemanager.fluidrelay; diff --git a/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/module-info.java b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/src/main/java/module-info.java new file mode 100644 index 0000000000000..3613a3cc9350b --- /dev/null +++ b/sdk/fluidrelay/azure-resourcemanager-fluidrelay/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.fluidrelay { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.fluidrelay; + exports com.azure.resourcemanager.fluidrelay.fluent; + exports com.azure.resourcemanager.fluidrelay.fluent.models; + exports com.azure.resourcemanager.fluidrelay.models; + + opens com.azure.resourcemanager.fluidrelay.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.fluidrelay.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/fluidrelay/ci.yml b/sdk/fluidrelay/ci.yml new file mode 100644 index 0000000000000..3859650a67536 --- /dev/null +++ b/sdk/fluidrelay/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/fluidrelay/ + +pr: + branches: + include: + - master + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/fluidrelay/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: fluidrelay + Artifacts: + - name: azure-resourcemanager-fluidrelay + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerfluidrelay diff --git a/sdk/fluidrelay/pom.xml b/sdk/fluidrelay/pom.xml new file mode 100644 index 0000000000000..dc936305975b6 --- /dev/null +++ b/sdk/fluidrelay/pom.xml @@ -0,0 +1,53 @@ + + + 4.0.0 + com.azure + azure-fluidrelay-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-fluidrelay + + + +