diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 94985420dc636..adb569822cab0 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -210,6 +210,7 @@ com.azure.resourcemanager:azure-resourcemanager-redisenterprise;1.0.0-beta.2;1.0 com.azure.resourcemanager:azure-resourcemanager-hybridkubernetes;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-iothub;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-datadog;1.0.0-beta.1;1.0.0-beta.1 +com.azure.resourcemanager:azure-resourcemanager-desktopvirtualization;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 f511c48002b32..2ec8935e4976e 100644 --- a/pom.xml +++ b/pom.xml @@ -593,8 +593,9 @@ sdk/core sdk/cosmos sdk/costmanagement - sdk/deviceupdate sdk/datadog + sdk/desktopvirtualization + sdk/deviceupdate sdk/digitaltwins sdk/eventgrid sdk/eventhubs diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/CHANGELOG.md b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/CHANGELOG.md new file mode 100644 index 0000000000000..facfe210534b5 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2021-03-05) + +- Azure Resource Manager DesktopVirtualization client library for Java. This package contains Microsoft Azure SDK for DesktopVirtualization Management SDK. Package tag package-2021-02-01-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/README.md b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/README.md new file mode 100644 index 0000000000000..28fe60a6b71b5 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/README.md @@ -0,0 +1,99 @@ +# Azure Resource Manager DesktopVirtualization client library for Java + +Azure Resource Manager DesktopVirtualization client library for Java. + +This package contains Microsoft Azure SDK for DesktopVirtualization Management SDK. Package tag package-2021-02-01-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +## We'd love to hear your feedback + +We're always working on improving our products and the way we communicate with our users. So we'd love to learn what's working and how we can do better. + +If you haven't already, please take a few minutes to [complete this short survey][survey] we have put together. + +Thank you in advance for your collaboration. We really appreciate your time! + +## Documentation + +Various documentation is available to help you get started + +- [API reference documentation][docs] + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-desktopvirtualization;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-desktopvirtualization + 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(); +DesktopVirtualizationManager manager = DesktopVirtualizationManager + .authenticate(credential, profile); +``` + +The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise. + +See [Authentication][authenticate] for more options. + +## Key concepts + +See [API design][design] for general introduction on design and key concepts on Azure Management Libraries. + +## Examples + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/master/CONTRIBUTING.md). + +1. Fork it +1. Create your feature branch (`git checkout -b my-new-feature`) +1. Commit your changes (`git commit -am 'Add some feature'`) +1. Push to the branch (`git push origin my-new-feature`) +1. Create new Pull Request + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://docs.microsoft.com/java/azure/jdk/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/identity/azure-identity +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/resourcemanager/docs/DESIGN.md diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/pom.xml b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/pom.xml new file mode 100644 index 0000000000000..1ceee35866bfd --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/pom.xml @@ -0,0 +1,67 @@ + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-desktopvirtualization + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for DesktopVirtualization Management + This package contains Microsoft Azure SDK for DesktopVirtualization Management SDK. Package tag package-2021-02-01-preview. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + + + + + com.azure + azure-core + 1.13.0 + + + com.azure + azure-core-management + 1.1.1 + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + true + + + + + diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/DesktopVirtualizationManager.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/DesktopVirtualizationManager.java new file mode 100644 index 0000000000000..28b3893a836a4 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/DesktopVirtualizationManager.java @@ -0,0 +1,347 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization; + +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.desktopvirtualization.fluent.DesktopVirtualizationApiClient; +import com.azure.resourcemanager.desktopvirtualization.implementation.ApplicationGroupsImpl; +import com.azure.resourcemanager.desktopvirtualization.implementation.ApplicationsImpl; +import com.azure.resourcemanager.desktopvirtualization.implementation.DesktopVirtualizationApiClientBuilder; +import com.azure.resourcemanager.desktopvirtualization.implementation.DesktopsImpl; +import com.azure.resourcemanager.desktopvirtualization.implementation.HostPoolsImpl; +import com.azure.resourcemanager.desktopvirtualization.implementation.MsixImagesImpl; +import com.azure.resourcemanager.desktopvirtualization.implementation.MsixPackagesImpl; +import com.azure.resourcemanager.desktopvirtualization.implementation.OperationsImpl; +import com.azure.resourcemanager.desktopvirtualization.implementation.ScalingPlansImpl; +import com.azure.resourcemanager.desktopvirtualization.implementation.SessionHostsImpl; +import com.azure.resourcemanager.desktopvirtualization.implementation.StartMenuItemsImpl; +import com.azure.resourcemanager.desktopvirtualization.implementation.UserSessionsImpl; +import com.azure.resourcemanager.desktopvirtualization.implementation.WorkspacesImpl; +import com.azure.resourcemanager.desktopvirtualization.models.ApplicationGroups; +import com.azure.resourcemanager.desktopvirtualization.models.Applications; +import com.azure.resourcemanager.desktopvirtualization.models.Desktops; +import com.azure.resourcemanager.desktopvirtualization.models.HostPools; +import com.azure.resourcemanager.desktopvirtualization.models.MsixImages; +import com.azure.resourcemanager.desktopvirtualization.models.MsixPackages; +import com.azure.resourcemanager.desktopvirtualization.models.Operations; +import com.azure.resourcemanager.desktopvirtualization.models.ScalingPlans; +import com.azure.resourcemanager.desktopvirtualization.models.SessionHosts; +import com.azure.resourcemanager.desktopvirtualization.models.StartMenuItems; +import com.azure.resourcemanager.desktopvirtualization.models.UserSessions; +import com.azure.resourcemanager.desktopvirtualization.models.Workspaces; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** Entry point to DesktopVirtualizationManager. */ +public final class DesktopVirtualizationManager { + private Operations operations; + + private Workspaces workspaces; + + private ScalingPlans scalingPlans; + + private ApplicationGroups applicationGroups; + + private StartMenuItems startMenuItems; + + private Applications applications; + + private Desktops desktops; + + private HostPools hostPools; + + private UserSessions userSessions; + + private SessionHosts sessionHosts; + + private MsixPackages msixPackages; + + private MsixImages msixImages; + + private final DesktopVirtualizationApiClient clientObject; + + private DesktopVirtualizationManager( + HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new DesktopVirtualizationApiClientBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of DesktopVirtualization service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the DesktopVirtualization service API instance. + */ + public static DesktopVirtualizationManager 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 DesktopVirtualizationManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new DesktopVirtualizationManager.Configurable(); + } + + /** The Configurable allowing configurations to be set. */ + public static final class Configurable { + private final ClientLogger logger = new ClientLogger(Configurable.class); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private RetryPolicy retryPolicy; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = Objects.requireNonNull(defaultPollInterval, "'retryPolicy' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw logger.logExceptionAsError(new IllegalArgumentException("'httpPipeline' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of DesktopVirtualization service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the DesktopVirtualization service API instance. + */ + public DesktopVirtualizationManager 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.desktopvirtualization") + .append("/") + .append("1.0.0-beta.1"); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder + .append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (retryPolicy == null) { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new RequestIdPolicy()); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies + .add( + new BearerTokenAuthenticationPolicy( + credential, profile.getEnvironment().getManagementEndpoint() + "/.default")); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new DesktopVirtualizationManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** @return Resource collection API of Operations. */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** @return Resource collection API of Workspaces. */ + public Workspaces workspaces() { + if (this.workspaces == null) { + this.workspaces = new WorkspacesImpl(clientObject.getWorkspaces(), this); + } + return workspaces; + } + + /** @return Resource collection API of ScalingPlans. */ + public ScalingPlans scalingPlans() { + if (this.scalingPlans == null) { + this.scalingPlans = new ScalingPlansImpl(clientObject.getScalingPlans(), this); + } + return scalingPlans; + } + + /** @return Resource collection API of ApplicationGroups. */ + public ApplicationGroups applicationGroups() { + if (this.applicationGroups == null) { + this.applicationGroups = new ApplicationGroupsImpl(clientObject.getApplicationGroups(), this); + } + return applicationGroups; + } + + /** @return Resource collection API of StartMenuItems. */ + public StartMenuItems startMenuItems() { + if (this.startMenuItems == null) { + this.startMenuItems = new StartMenuItemsImpl(clientObject.getStartMenuItems(), this); + } + return startMenuItems; + } + + /** @return Resource collection API of Applications. */ + public Applications applications() { + if (this.applications == null) { + this.applications = new ApplicationsImpl(clientObject.getApplications(), this); + } + return applications; + } + + /** @return Resource collection API of Desktops. */ + public Desktops desktops() { + if (this.desktops == null) { + this.desktops = new DesktopsImpl(clientObject.getDesktops(), this); + } + return desktops; + } + + /** @return Resource collection API of HostPools. */ + public HostPools hostPools() { + if (this.hostPools == null) { + this.hostPools = new HostPoolsImpl(clientObject.getHostPools(), this); + } + return hostPools; + } + + /** @return Resource collection API of UserSessions. */ + public UserSessions userSessions() { + if (this.userSessions == null) { + this.userSessions = new UserSessionsImpl(clientObject.getUserSessions(), this); + } + return userSessions; + } + + /** @return Resource collection API of SessionHosts. */ + public SessionHosts sessionHosts() { + if (this.sessionHosts == null) { + this.sessionHosts = new SessionHostsImpl(clientObject.getSessionHosts(), this); + } + return sessionHosts; + } + + /** @return Resource collection API of MsixPackages. */ + public MsixPackages msixPackages() { + if (this.msixPackages == null) { + this.msixPackages = new MsixPackagesImpl(clientObject.getMsixPackages(), this); + } + return msixPackages; + } + + /** @return Resource collection API of MsixImages. */ + public MsixImages msixImages() { + if (this.msixImages == null) { + this.msixImages = new MsixImagesImpl(clientObject.getMsixImages(), this); + } + return msixImages; + } + + /** + * @return Wrapped service client DesktopVirtualizationApiClient providing direct access to the underlying + * auto-generated API implementation, based on Azure REST API. + */ + public DesktopVirtualizationApiClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/ApplicationGroupsClient.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/ApplicationGroupsClient.java new file mode 100644 index 0000000000000..07e803f7a1624 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/ApplicationGroupsClient.java @@ -0,0 +1,179 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.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.desktopvirtualization.fluent.models.ApplicationGroupInner; +import com.azure.resourcemanager.desktopvirtualization.models.ApplicationGroupPatch; + +/** An instance of this class provides access to all the operations defined in ApplicationGroupsClient. */ +public interface ApplicationGroupsClient { + /** + * Get an application group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an application group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApplicationGroupInner getByResourceGroup(String resourceGroupName, String applicationGroupName); + + /** + * Get an application group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an application group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String applicationGroupName, Context context); + + /** + * Create or update an applicationGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param applicationGroup Object containing ApplicationGroup definitions. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 represents a ApplicationGroup definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApplicationGroupInner createOrUpdate( + String resourceGroupName, String applicationGroupName, ApplicationGroupInner applicationGroup); + + /** + * Create or update an applicationGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param applicationGroup Object containing ApplicationGroup definitions. + * @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 represents a ApplicationGroup definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, String applicationGroupName, ApplicationGroupInner applicationGroup, Context context); + + /** + * Remove an applicationGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String applicationGroupName); + + /** + * Remove an applicationGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @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) + Response deleteWithResponse(String resourceGroupName, String applicationGroupName, Context context); + + /** + * Update an applicationGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a ApplicationGroup definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApplicationGroupInner update(String resourceGroupName, String applicationGroupName); + + /** + * Update an applicationGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param applicationGroup Object containing ApplicationGroup definitions. + * @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 represents a ApplicationGroup definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, String applicationGroupName, ApplicationGroupPatch applicationGroup, Context context); + + /** + * List applicationGroups. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of ApplicationGroup definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List applicationGroups. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param filter OData filter expression. Valid properties for filtering are applicationGroupType. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of ApplicationGroup definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, String filter, Context context); + + /** + * List applicationGroups in 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 list of ApplicationGroup definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List applicationGroups in subscription. + * + * @param filter OData filter expression. Valid properties for filtering are applicationGroupType. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of ApplicationGroup definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String filter, Context context); +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/ApplicationsClient.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/ApplicationsClient.java new file mode 100644 index 0000000000000..1c756576321f8 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/ApplicationsClient.java @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.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.desktopvirtualization.fluent.models.ApplicationInner; +import com.azure.resourcemanager.desktopvirtualization.models.ApplicationPatch; + +/** An instance of this class provides access to all the operations defined in ApplicationsClient. */ +public interface ApplicationsClient { + /** + * Get an application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param applicationName The name of the application within the specified application group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApplicationInner get(String resourceGroupName, String applicationGroupName, String applicationName); + + /** + * Get an application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param applicationName The name of the application within the specified application group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String applicationGroupName, String applicationName, Context context); + + /** + * Create or update an application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param applicationName The name of the application within the specified application group. + * @param application Object containing Application definitions. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 schema for Application properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApplicationInner createOrUpdate( + String resourceGroupName, String applicationGroupName, String applicationName, ApplicationInner application); + + /** + * Create or update an application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param applicationName The name of the application within the specified application group. + * @param application Object containing Application definitions. + * @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 schema for Application properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String applicationGroupName, + String applicationName, + ApplicationInner application, + Context context); + + /** + * Remove an application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param applicationName The name of the application within the specified application group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String applicationGroupName, String applicationName); + + /** + * Remove an application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param applicationName The name of the application within the specified application group. + * @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) + Response deleteWithResponse( + String resourceGroupName, String applicationGroupName, String applicationName, Context context); + + /** + * Update an application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param applicationName The name of the application within the specified application group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schema for Application properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApplicationInner update(String resourceGroupName, String applicationGroupName, String applicationName); + + /** + * Update an application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param applicationName The name of the application within the specified application group. + * @param application Object containing Application definitions. + * @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 schema for Application properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, + String applicationGroupName, + String applicationName, + ApplicationPatch application, + Context context); + + /** + * List applications. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Application definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String applicationGroupName); + + /** + * List applications. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Application definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String applicationGroupName, Context context); +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/DesktopVirtualizationApiClient.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/DesktopVirtualizationApiClient.java new file mode 100644 index 0000000000000..994bf7ac1d0fe --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/DesktopVirtualizationApiClient.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for DesktopVirtualizationApiClient class. */ +public interface DesktopVirtualizationApiClient { + /** + * Gets The ID of the target subscription. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the WorkspacesClient object to access its operations. + * + * @return the WorkspacesClient object. + */ + WorkspacesClient getWorkspaces(); + + /** + * Gets the ScalingPlansClient object to access its operations. + * + * @return the ScalingPlansClient object. + */ + ScalingPlansClient getScalingPlans(); + + /** + * Gets the ApplicationGroupsClient object to access its operations. + * + * @return the ApplicationGroupsClient object. + */ + ApplicationGroupsClient getApplicationGroups(); + + /** + * Gets the StartMenuItemsClient object to access its operations. + * + * @return the StartMenuItemsClient object. + */ + StartMenuItemsClient getStartMenuItems(); + + /** + * Gets the ApplicationsClient object to access its operations. + * + * @return the ApplicationsClient object. + */ + ApplicationsClient getApplications(); + + /** + * Gets the DesktopsClient object to access its operations. + * + * @return the DesktopsClient object. + */ + DesktopsClient getDesktops(); + + /** + * Gets the HostPoolsClient object to access its operations. + * + * @return the HostPoolsClient object. + */ + HostPoolsClient getHostPools(); + + /** + * Gets the UserSessionsClient object to access its operations. + * + * @return the UserSessionsClient object. + */ + UserSessionsClient getUserSessions(); + + /** + * Gets the SessionHostsClient object to access its operations. + * + * @return the SessionHostsClient object. + */ + SessionHostsClient getSessionHosts(); + + /** + * Gets the MsixPackagesClient object to access its operations. + * + * @return the MsixPackagesClient object. + */ + MsixPackagesClient getMsixPackages(); + + /** + * Gets the MsixImagesClient object to access its operations. + * + * @return the MsixImagesClient object. + */ + MsixImagesClient getMsixImages(); +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/DesktopsClient.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/DesktopsClient.java new file mode 100644 index 0000000000000..7859dc499d8a9 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/DesktopsClient.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.desktopvirtualization.fluent.models.DesktopInner; +import com.azure.resourcemanager.desktopvirtualization.fluent.models.DesktopListInner; +import com.azure.resourcemanager.desktopvirtualization.models.DesktopPatch; + +/** An instance of this class provides access to all the operations defined in DesktopsClient. */ +public interface DesktopsClient { + /** + * Get a desktop. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param desktopName The name of the desktop within the specified desktop group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a desktop. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DesktopInner get(String resourceGroupName, String applicationGroupName, String desktopName); + + /** + * Get a desktop. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param desktopName The name of the desktop within the specified desktop group. + * @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 desktop. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String applicationGroupName, String desktopName, Context context); + + /** + * Update a desktop. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param desktopName The name of the desktop within the specified desktop group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schema for Desktop properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DesktopInner update(String resourceGroupName, String applicationGroupName, String desktopName); + + /** + * Update a desktop. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param desktopName The name of the desktop within the specified desktop group. + * @param desktop Object containing Desktop definitions. + * @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 schema for Desktop properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, + String applicationGroupName, + String desktopName, + DesktopPatch desktop, + Context context); + + /** + * List desktops. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Desktop definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DesktopListInner list(String resourceGroupName, String applicationGroupName); + + /** + * List desktops. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Desktop definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listWithResponse(String resourceGroupName, String applicationGroupName, Context context); +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/HostPoolsClient.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/HostPoolsClient.java new file mode 100644 index 0000000000000..3930e19fcec27 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/HostPoolsClient.java @@ -0,0 +1,206 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.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.desktopvirtualization.fluent.models.HostPoolInner; +import com.azure.resourcemanager.desktopvirtualization.fluent.models.RegistrationInfoInner; +import com.azure.resourcemanager.desktopvirtualization.models.HostPoolPatch; + +/** An instance of this class provides access to all the operations defined in HostPoolsClient. */ +public interface HostPoolsClient { + /** + * Get a host pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a host pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + HostPoolInner getByResourceGroup(String resourceGroupName, String hostPoolName); + + /** + * Get a host pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @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 host pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String hostPoolName, Context context); + + /** + * Create or update a host pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param hostPool Object containing HostPool definitions. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 represents a HostPool definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + HostPoolInner createOrUpdate(String resourceGroupName, String hostPoolName, HostPoolInner hostPool); + + /** + * Create or update a host pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param hostPool Object containing HostPool definitions. + * @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 represents a HostPool definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, String hostPoolName, HostPoolInner hostPool, Context context); + + /** + * Remove a host pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String hostPoolName); + + /** + * Remove a host pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param force Force flag to delete sessionHost. + * @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) + Response deleteWithResponse(String resourceGroupName, String hostPoolName, Boolean force, Context context); + + /** + * Update a host pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a HostPool definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + HostPoolInner update(String resourceGroupName, String hostPoolName); + + /** + * Update a host pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param hostPool Object containing HostPool definitions. + * @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 represents a HostPool definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, String hostPoolName, HostPoolPatch hostPool, Context context); + + /** + * List hostPools. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of HostPool definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List hostPools. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of HostPool definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List hostPools in 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 list of HostPool definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List hostPools in 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 list of HostPool definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Registration token of the host pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a RegistrationInfo definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RegistrationInfoInner retrieveRegistrationToken(String resourceGroupName, String hostPoolName); + + /** + * Registration token of the host pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @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 represents a RegistrationInfo definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response retrieveRegistrationTokenWithResponse( + String resourceGroupName, String hostPoolName, Context context); +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/MsixImagesClient.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/MsixImagesClient.java new file mode 100644 index 0000000000000..a95d24fc77295 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/MsixImagesClient.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.desktopvirtualization.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.desktopvirtualization.fluent.models.ExpandMsixImageInner; +import com.azure.resourcemanager.desktopvirtualization.models.MsixImageUri; + +/** An instance of this class provides access to all the operations defined in MsixImagesClient. */ +public interface MsixImagesClient { + /** + * Expands and Lists MSIX packages in an Image, given the Image Path. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param msixImageUri Object containing URI to MSIX Image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of MSIX package properties retrieved from MSIX Image expansion. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable expand( + String resourceGroupName, String hostPoolName, MsixImageUri msixImageUri); + + /** + * Expands and Lists MSIX packages in an Image, given the Image Path. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param msixImageUri Object containing URI to MSIX Image. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of MSIX package properties retrieved from MSIX Image expansion. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable expand( + String resourceGroupName, String hostPoolName, MsixImageUri msixImageUri, Context context); +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/MsixPackagesClient.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/MsixPackagesClient.java new file mode 100644 index 0000000000000..a4c0604452d84 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/MsixPackagesClient.java @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.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.desktopvirtualization.fluent.models.MsixPackageInner; +import com.azure.resourcemanager.desktopvirtualization.models.MsixPackagePatch; + +/** An instance of this class provides access to all the operations defined in MsixPackagesClient. */ +public interface MsixPackagesClient { + /** + * Get a msixpackage. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param msixPackageFullName The version specific package full name of the MSIX package within specified hostpool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 msixpackage. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MsixPackageInner get(String resourceGroupName, String hostPoolName, String msixPackageFullName); + + /** + * Get a msixpackage. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param msixPackageFullName The version specific package full name of the MSIX package within specified hostpool. + * @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 msixpackage. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String hostPoolName, String msixPackageFullName, Context context); + + /** + * Create or update a MSIX package. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param msixPackageFullName The version specific package full name of the MSIX package within specified hostpool. + * @param msixPackage Object containing MSIX Package definitions. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 schema for MSIX Package properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MsixPackageInner createOrUpdate( + String resourceGroupName, String hostPoolName, String msixPackageFullName, MsixPackageInner msixPackage); + + /** + * Create or update a MSIX package. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param msixPackageFullName The version specific package full name of the MSIX package within specified hostpool. + * @param msixPackage Object containing MSIX Package definitions. + * @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 schema for MSIX Package properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String hostPoolName, + String msixPackageFullName, + MsixPackageInner msixPackage, + Context context); + + /** + * Remove an MSIX Package. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param msixPackageFullName The version specific package full name of the MSIX package within specified hostpool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String hostPoolName, String msixPackageFullName); + + /** + * Remove an MSIX Package. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param msixPackageFullName The version specific package full name of the MSIX package within specified hostpool. + * @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) + Response deleteWithResponse( + String resourceGroupName, String hostPoolName, String msixPackageFullName, Context context); + + /** + * Update an MSIX Package. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param msixPackageFullName The version specific package full name of the MSIX package within specified hostpool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 schema for MSIX Package properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MsixPackageInner update(String resourceGroupName, String hostPoolName, String msixPackageFullName); + + /** + * Update an MSIX Package. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param msixPackageFullName The version specific package full name of the MSIX package within specified hostpool. + * @param msixPackage Object containing MSIX Package definitions. + * @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 schema for MSIX Package properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, + String hostPoolName, + String msixPackageFullName, + MsixPackagePatch msixPackage, + Context context); + + /** + * List MSIX packages in hostpool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of MSIX Package definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String hostPoolName); + + /** + * List MSIX packages in hostpool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of MSIX Package definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String hostPoolName, Context context); +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/OperationsClient.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/OperationsClient.java new file mode 100644 index 0000000000000..41bf5717c4738 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/OperationsClient.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.desktopvirtualization.fluent.models.ResourceProviderOperationListInner; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public interface OperationsClient { + /** + * List all of the available operations the Desktop Virtualization resource provider supports. + * + * @throws com.azure.core.management.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 the request to list operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ResourceProviderOperationListInner list(); + + /** + * List all of the available operations the Desktop Virtualization resource provider supports. + * + * @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 the request to list operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listWithResponse(Context context); +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/ScalingPlansClient.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/ScalingPlansClient.java new file mode 100644 index 0000000000000..650211134bb5f --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/ScalingPlansClient.java @@ -0,0 +1,203 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.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.desktopvirtualization.fluent.models.ScalingPlanInner; +import com.azure.resourcemanager.desktopvirtualization.models.ScalingPlanPatch; + +/** An instance of this class provides access to all the operations defined in ScalingPlansClient. */ +public interface ScalingPlansClient { + /** + * Get a scaling plan. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scalingPlanName The name of the scaling plan. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 scaling plan. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ScalingPlanInner getByResourceGroup(String resourceGroupName, String scalingPlanName); + + /** + * Get a scaling plan. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scalingPlanName The name of the scaling plan. + * @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 scaling plan. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String scalingPlanName, Context context); + + /** + * Create or update a scaling plan. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scalingPlanName The name of the scaling plan. + * @param scalingPlan Object containing scaling plan definitions. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 represents a scaling plan definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ScalingPlanInner create(String resourceGroupName, String scalingPlanName, ScalingPlanInner scalingPlan); + + /** + * Create or update a scaling plan. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scalingPlanName The name of the scaling plan. + * @param scalingPlan Object containing scaling plan definitions. + * @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 represents a scaling plan definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithResponse( + String resourceGroupName, String scalingPlanName, ScalingPlanInner scalingPlan, Context context); + + /** + * Remove a scaling plan. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scalingPlanName The name of the scaling plan. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String scalingPlanName); + + /** + * Remove a scaling plan. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scalingPlanName The name of the scaling plan. + * @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) + Response deleteWithResponse(String resourceGroupName, String scalingPlanName, Context context); + + /** + * Update a scaling plan. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scalingPlanName The name of the scaling plan. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 represents a scaling plan definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ScalingPlanInner update(String resourceGroupName, String scalingPlanName); + + /** + * Update a scaling plan. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scalingPlanName The name of the scaling plan. + * @param scalingPlan Object containing scaling plan definitions. + * @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 represents a scaling plan definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, String scalingPlanName, ScalingPlanPatch scalingPlan, Context context); + + /** + * List scaling plans. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of scaling plan definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List scaling plans. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of scaling plan definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List scaling plans in 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 list of scaling plan definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List scaling plans in 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 list of scaling plan definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * List scaling plan associated with hostpool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of scaling plan definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByHostPool(String resourceGroupName, String hostPoolName); + + /** + * List scaling plan associated with hostpool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of scaling plan definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByHostPool(String resourceGroupName, String hostPoolName, Context context); +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/SessionHostsClient.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/SessionHostsClient.java new file mode 100644 index 0000000000000..28c9320097846 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/SessionHostsClient.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.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.desktopvirtualization.fluent.models.SessionHostInner; +import com.azure.resourcemanager.desktopvirtualization.models.SessionHostPatch; + +/** An instance of this class provides access to all the operations defined in SessionHostsClient. */ +public interface SessionHostsClient { + /** + * Get a session host. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 session host. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SessionHostInner get(String resourceGroupName, String hostPoolName, String sessionHostname); + + /** + * Get a session host. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @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 session host. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String hostPoolName, String sessionHostname, Context context); + + /** + * Remove a SessionHost. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String hostPoolName, String sessionHostname); + + /** + * Remove a SessionHost. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @param force Force flag to force sessionHost deletion even when userSession exists. + * @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) + Response deleteWithResponse( + String resourceGroupName, String hostPoolName, String sessionHostname, Boolean force, Context context); + + /** + * Update a session host. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 represents a SessionHost definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SessionHostInner update(String resourceGroupName, String hostPoolName, String sessionHostname); + + /** + * Update a session host. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @param sessionHost Object containing SessionHost definitions. + * @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 represents a SessionHost definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, + String hostPoolName, + String sessionHostname, + SessionHostPatch sessionHost, + Context context); + + /** + * List sessionHosts. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of SessionHost definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String hostPoolName); + + /** + * List sessionHosts. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of SessionHost definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String hostPoolName, Context context); +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/StartMenuItemsClient.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/StartMenuItemsClient.java new file mode 100644 index 0000000000000..70b0b9128b244 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/StartMenuItemsClient.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.desktopvirtualization.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.desktopvirtualization.fluent.models.StartMenuItemInner; + +/** An instance of this class provides access to all the operations defined in StartMenuItemsClient. */ +public interface StartMenuItemsClient { + /** + * List start menu items in the given application group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of StartMenuItem definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String applicationGroupName); + + /** + * List start menu items in the given application group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of StartMenuItem definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String applicationGroupName, Context context); +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/UserSessionsClient.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/UserSessionsClient.java new file mode 100644 index 0000000000000..66c3ce1f0d596 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/UserSessionsClient.java @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.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.desktopvirtualization.fluent.models.UserSessionInner; +import com.azure.resourcemanager.desktopvirtualization.models.SendMessage; + +/** An instance of this class provides access to all the operations defined in UserSessionsClient. */ +public interface UserSessionsClient { + /** + * List userSessions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of UserSession definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByHostPool(String resourceGroupName, String hostPoolName); + + /** + * List userSessions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param filter OData filter expression. Valid properties for filtering are userprincipalname and sessionstate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of UserSession definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByHostPool( + String resourceGroupName, String hostPoolName, String filter, Context context); + + /** + * Get a userSession. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @param userSessionId The name of the user session within the specified session host. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 userSession. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + UserSessionInner get(String resourceGroupName, String hostPoolName, String sessionHostname, String userSessionId); + + /** + * Get a userSession. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @param userSessionId The name of the user session within the specified session host. + * @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 userSession. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String hostPoolName, String sessionHostname, String userSessionId, Context context); + + /** + * Remove a userSession. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @param userSessionId The name of the user session within the specified session host. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String hostPoolName, String sessionHostname, String userSessionId); + + /** + * Remove a userSession. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @param userSessionId The name of the user session within the specified session host. + * @param force Force flag to login off userSession. + * @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) + Response deleteWithResponse( + String resourceGroupName, + String hostPoolName, + String sessionHostname, + String userSessionId, + Boolean force, + Context context); + + /** + * List userSessions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of UserSession definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String hostPoolName, String sessionHostname); + + /** + * List userSessions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of UserSession definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, String hostPoolName, String sessionHostname, Context context); + + /** + * Disconnect a userSession. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @param userSessionId The name of the user session within the specified session host. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 disconnect(String resourceGroupName, String hostPoolName, String sessionHostname, String userSessionId); + + /** + * Disconnect a userSession. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @param userSessionId The name of the user session within the specified session host. + * @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) + Response disconnectWithResponse( + String resourceGroupName, String hostPoolName, String sessionHostname, String userSessionId, Context context); + + /** + * Send a message to a user. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @param userSessionId The name of the user session within the specified session host. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 sendMessage(String resourceGroupName, String hostPoolName, String sessionHostname, String userSessionId); + + /** + * Send a message to a user. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @param userSessionId The name of the user session within the specified session host. + * @param sendMessage Object containing message includes title and message body. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response sendMessageWithResponse( + String resourceGroupName, + String hostPoolName, + String sessionHostname, + String userSessionId, + SendMessage sendMessage, + Context context); +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/WorkspacesClient.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/WorkspacesClient.java new file mode 100644 index 0000000000000..5487ccb22c2b9 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/WorkspacesClient.java @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.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.desktopvirtualization.fluent.models.WorkspaceInner; +import com.azure.resourcemanager.desktopvirtualization.models.WorkspacePatch; + +/** An instance of this class provides access to all the operations defined in WorkspacesClient. */ +public interface WorkspacesClient { + /** + * Get a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WorkspaceInner getByResourceGroup(String resourceGroupName, String workspaceName); + + /** + * Get a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String workspaceName, Context context); + + /** + * Create or update a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspace Object containing Workspace definitions. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 represents a Workspace definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WorkspaceInner createOrUpdate(String resourceGroupName, String workspaceName, WorkspaceInner workspace); + + /** + * Create or update a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspace Object containing Workspace definitions. + * @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 represents a Workspace definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, String workspaceName, WorkspaceInner workspace, Context context); + + /** + * Remove a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String workspaceName); + + /** + * Remove a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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) + Response deleteWithResponse(String resourceGroupName, String workspaceName, Context context); + + /** + * Update a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 represents a Workspace definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WorkspaceInner update(String resourceGroupName, String workspaceName); + + /** + * Update a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspace Object containing Workspace definitions. + * @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 represents a Workspace definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, String workspaceName, WorkspacePatch workspace, Context context); + + /** + * List workspaces. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Workspace definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List workspaces. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Workspace definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List workspaces in 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 list of Workspace definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List workspaces in 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 list of Workspace definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/models/ApplicationGroupInner.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/models/ApplicationGroupInner.java new file mode 100644 index 0000000000000..378b3df7817ee --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/models/ApplicationGroupInner.java @@ -0,0 +1,274 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.desktopvirtualization.models.ApplicationGroupType; +import com.azure.resourcemanager.desktopvirtualization.models.Identity; +import com.azure.resourcemanager.desktopvirtualization.models.MigrationRequestProperties; +import com.azure.resourcemanager.desktopvirtualization.models.Plan; +import com.azure.resourcemanager.desktopvirtualization.models.ResourceModelWithAllowedPropertySet; +import com.azure.resourcemanager.desktopvirtualization.models.Sku; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Represents a ApplicationGroup definition. */ +@JsonFlatten +@Fluent +public class ApplicationGroupInner extends ResourceModelWithAllowedPropertySet { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ApplicationGroupInner.class); + + /* + * ObjectId of ApplicationGroup. (internal use) + */ + @JsonProperty(value = "properties.objectId", access = JsonProperty.Access.WRITE_ONLY) + private String objectId; + + /* + * Description of ApplicationGroup. + */ + @JsonProperty(value = "properties.description") + private String description; + + /* + * Friendly name of ApplicationGroup. + */ + @JsonProperty(value = "properties.friendlyName") + private String friendlyName; + + /* + * HostPool arm path of ApplicationGroup. + */ + @JsonProperty(value = "properties.hostPoolArmPath", required = true) + private String hostPoolArmPath; + + /* + * Workspace arm path of ApplicationGroup. + */ + @JsonProperty(value = "properties.workspaceArmPath", access = JsonProperty.Access.WRITE_ONLY) + private String workspaceArmPath; + + /* + * Resource Type of ApplicationGroup. + */ + @JsonProperty(value = "properties.applicationGroupType", required = true) + private ApplicationGroupType applicationGroupType; + + /* + * The registration info of HostPool. + */ + @JsonProperty(value = "properties.migrationRequest") + private MigrationRequestProperties migrationRequest; + + /* + * Is cloud pc resource. + */ + @JsonProperty(value = "properties.cloudPcResource", access = JsonProperty.Access.WRITE_ONLY) + private Boolean cloudPcResource; + + /** + * Get the objectId property: ObjectId of ApplicationGroup. (internal use). + * + * @return the objectId value. + */ + public String objectId() { + return this.objectId; + } + + /** + * Get the description property: Description of ApplicationGroup. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Description of ApplicationGroup. + * + * @param description the description value to set. + * @return the ApplicationGroupInner object itself. + */ + public ApplicationGroupInner withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the friendlyName property: Friendly name of ApplicationGroup. + * + * @return the friendlyName value. + */ + public String friendlyName() { + return this.friendlyName; + } + + /** + * Set the friendlyName property: Friendly name of ApplicationGroup. + * + * @param friendlyName the friendlyName value to set. + * @return the ApplicationGroupInner object itself. + */ + public ApplicationGroupInner withFriendlyName(String friendlyName) { + this.friendlyName = friendlyName; + return this; + } + + /** + * Get the hostPoolArmPath property: HostPool arm path of ApplicationGroup. + * + * @return the hostPoolArmPath value. + */ + public String hostPoolArmPath() { + return this.hostPoolArmPath; + } + + /** + * Set the hostPoolArmPath property: HostPool arm path of ApplicationGroup. + * + * @param hostPoolArmPath the hostPoolArmPath value to set. + * @return the ApplicationGroupInner object itself. + */ + public ApplicationGroupInner withHostPoolArmPath(String hostPoolArmPath) { + this.hostPoolArmPath = hostPoolArmPath; + return this; + } + + /** + * Get the workspaceArmPath property: Workspace arm path of ApplicationGroup. + * + * @return the workspaceArmPath value. + */ + public String workspaceArmPath() { + return this.workspaceArmPath; + } + + /** + * Get the applicationGroupType property: Resource Type of ApplicationGroup. + * + * @return the applicationGroupType value. + */ + public ApplicationGroupType applicationGroupType() { + return this.applicationGroupType; + } + + /** + * Set the applicationGroupType property: Resource Type of ApplicationGroup. + * + * @param applicationGroupType the applicationGroupType value to set. + * @return the ApplicationGroupInner object itself. + */ + public ApplicationGroupInner withApplicationGroupType(ApplicationGroupType applicationGroupType) { + this.applicationGroupType = applicationGroupType; + return this; + } + + /** + * Get the migrationRequest property: The registration info of HostPool. + * + * @return the migrationRequest value. + */ + public MigrationRequestProperties migrationRequest() { + return this.migrationRequest; + } + + /** + * Set the migrationRequest property: The registration info of HostPool. + * + * @param migrationRequest the migrationRequest value to set. + * @return the ApplicationGroupInner object itself. + */ + public ApplicationGroupInner withMigrationRequest(MigrationRequestProperties migrationRequest) { + this.migrationRequest = migrationRequest; + return this; + } + + /** + * Get the cloudPcResource property: Is cloud pc resource. + * + * @return the cloudPcResource value. + */ + public Boolean cloudPcResource() { + return this.cloudPcResource; + } + + /** {@inheritDoc} */ + @Override + public ApplicationGroupInner withManagedBy(String managedBy) { + super.withManagedBy(managedBy); + return this; + } + + /** {@inheritDoc} */ + @Override + public ApplicationGroupInner withKind(String kind) { + super.withKind(kind); + return this; + } + + /** {@inheritDoc} */ + @Override + public ApplicationGroupInner withIdentity(Identity identity) { + super.withIdentity(identity); + return this; + } + + /** {@inheritDoc} */ + @Override + public ApplicationGroupInner withSku(Sku sku) { + super.withSku(sku); + return this; + } + + /** {@inheritDoc} */ + @Override + public ApplicationGroupInner withPlan(Plan plan) { + super.withPlan(plan); + return this; + } + + /** {@inheritDoc} */ + @Override + public ApplicationGroupInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public ApplicationGroupInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (hostPoolArmPath() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property hostPoolArmPath in model ApplicationGroupInner")); + } + if (applicationGroupType() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property applicationGroupType in model ApplicationGroupInner")); + } + if (migrationRequest() != null) { + migrationRequest().validate(); + } + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/models/ApplicationInner.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/models/ApplicationInner.java new file mode 100644 index 0000000000000..64eea9f15f999 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/models/ApplicationInner.java @@ -0,0 +1,374 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.desktopvirtualization.models.CommandLineSetting; +import com.azure.resourcemanager.desktopvirtualization.models.RemoteApplicationType; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Schema for Application properties. */ +@JsonFlatten +@Fluent +public class ApplicationInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ApplicationInner.class); + + /* + * ObjectId of Application. (internal use) + */ + @JsonProperty(value = "properties.objectId", access = JsonProperty.Access.WRITE_ONLY) + private String objectId; + + /* + * Description of Application. + */ + @JsonProperty(value = "properties.description") + private String description; + + /* + * Friendly name of Application. + */ + @JsonProperty(value = "properties.friendlyName") + private String friendlyName; + + /* + * Specifies a path for the executable file for the application. + */ + @JsonProperty(value = "properties.filePath") + private String filePath; + + /* + * Specifies the package family name for MSIX applications + */ + @JsonProperty(value = "properties.msixPackageFamilyName") + private String msixPackageFamilyName; + + /* + * Specifies the package application Id for MSIX applications + */ + @JsonProperty(value = "properties.msixPackageApplicationId") + private String msixPackageApplicationId; + + /* + * Resource Type of Application. + */ + @JsonProperty(value = "properties.applicationType") + private RemoteApplicationType applicationType; + + /* + * Specifies whether this published application can be launched with + * command line arguments provided by the client, command line arguments + * specified at publish time, or no command line arguments at all. + */ + @JsonProperty(value = "properties.commandLineSetting", required = true) + private CommandLineSetting commandLineSetting; + + /* + * Command Line Arguments for Application. + */ + @JsonProperty(value = "properties.commandLineArguments") + private String commandLineArguments; + + /* + * Specifies whether to show the RemoteApp program in the RD Web Access + * server. + */ + @JsonProperty(value = "properties.showInPortal") + private Boolean showInPortal; + + /* + * Path to icon. + */ + @JsonProperty(value = "properties.iconPath") + private String iconPath; + + /* + * Index of the icon. + */ + @JsonProperty(value = "properties.iconIndex") + private Integer iconIndex; + + /* + * Hash of the icon. + */ + @JsonProperty(value = "properties.iconHash", access = JsonProperty.Access.WRITE_ONLY) + private String iconHash; + + /* + * the icon a 64 bit string as a byte array. + */ + @JsonProperty(value = "properties.iconContent", access = JsonProperty.Access.WRITE_ONLY) + private byte[] iconContent; + + /** + * Get the objectId property: ObjectId of Application. (internal use). + * + * @return the objectId value. + */ + public String objectId() { + return this.objectId; + } + + /** + * Get the description property: Description of Application. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Description of Application. + * + * @param description the description value to set. + * @return the ApplicationInner object itself. + */ + public ApplicationInner withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the friendlyName property: Friendly name of Application. + * + * @return the friendlyName value. + */ + public String friendlyName() { + return this.friendlyName; + } + + /** + * Set the friendlyName property: Friendly name of Application. + * + * @param friendlyName the friendlyName value to set. + * @return the ApplicationInner object itself. + */ + public ApplicationInner withFriendlyName(String friendlyName) { + this.friendlyName = friendlyName; + return this; + } + + /** + * Get the filePath property: Specifies a path for the executable file for the application. + * + * @return the filePath value. + */ + public String filePath() { + return this.filePath; + } + + /** + * Set the filePath property: Specifies a path for the executable file for the application. + * + * @param filePath the filePath value to set. + * @return the ApplicationInner object itself. + */ + public ApplicationInner withFilePath(String filePath) { + this.filePath = filePath; + return this; + } + + /** + * Get the msixPackageFamilyName property: Specifies the package family name for MSIX applications. + * + * @return the msixPackageFamilyName value. + */ + public String msixPackageFamilyName() { + return this.msixPackageFamilyName; + } + + /** + * Set the msixPackageFamilyName property: Specifies the package family name for MSIX applications. + * + * @param msixPackageFamilyName the msixPackageFamilyName value to set. + * @return the ApplicationInner object itself. + */ + public ApplicationInner withMsixPackageFamilyName(String msixPackageFamilyName) { + this.msixPackageFamilyName = msixPackageFamilyName; + return this; + } + + /** + * Get the msixPackageApplicationId property: Specifies the package application Id for MSIX applications. + * + * @return the msixPackageApplicationId value. + */ + public String msixPackageApplicationId() { + return this.msixPackageApplicationId; + } + + /** + * Set the msixPackageApplicationId property: Specifies the package application Id for MSIX applications. + * + * @param msixPackageApplicationId the msixPackageApplicationId value to set. + * @return the ApplicationInner object itself. + */ + public ApplicationInner withMsixPackageApplicationId(String msixPackageApplicationId) { + this.msixPackageApplicationId = msixPackageApplicationId; + return this; + } + + /** + * Get the applicationType property: Resource Type of Application. + * + * @return the applicationType value. + */ + public RemoteApplicationType applicationType() { + return this.applicationType; + } + + /** + * Set the applicationType property: Resource Type of Application. + * + * @param applicationType the applicationType value to set. + * @return the ApplicationInner object itself. + */ + public ApplicationInner withApplicationType(RemoteApplicationType applicationType) { + this.applicationType = applicationType; + return this; + } + + /** + * Get the commandLineSetting property: Specifies whether this published application can be launched with command + * line arguments provided by the client, command line arguments specified at publish time, or no command line + * arguments at all. + * + * @return the commandLineSetting value. + */ + public CommandLineSetting commandLineSetting() { + return this.commandLineSetting; + } + + /** + * Set the commandLineSetting property: Specifies whether this published application can be launched with command + * line arguments provided by the client, command line arguments specified at publish time, or no command line + * arguments at all. + * + * @param commandLineSetting the commandLineSetting value to set. + * @return the ApplicationInner object itself. + */ + public ApplicationInner withCommandLineSetting(CommandLineSetting commandLineSetting) { + this.commandLineSetting = commandLineSetting; + return this; + } + + /** + * Get the commandLineArguments property: Command Line Arguments for Application. + * + * @return the commandLineArguments value. + */ + public String commandLineArguments() { + return this.commandLineArguments; + } + + /** + * Set the commandLineArguments property: Command Line Arguments for Application. + * + * @param commandLineArguments the commandLineArguments value to set. + * @return the ApplicationInner object itself. + */ + public ApplicationInner withCommandLineArguments(String commandLineArguments) { + this.commandLineArguments = commandLineArguments; + return this; + } + + /** + * Get the showInPortal property: Specifies whether to show the RemoteApp program in the RD Web Access server. + * + * @return the showInPortal value. + */ + public Boolean showInPortal() { + return this.showInPortal; + } + + /** + * Set the showInPortal property: Specifies whether to show the RemoteApp program in the RD Web Access server. + * + * @param showInPortal the showInPortal value to set. + * @return the ApplicationInner object itself. + */ + public ApplicationInner withShowInPortal(Boolean showInPortal) { + this.showInPortal = showInPortal; + return this; + } + + /** + * Get the iconPath property: Path to icon. + * + * @return the iconPath value. + */ + public String iconPath() { + return this.iconPath; + } + + /** + * Set the iconPath property: Path to icon. + * + * @param iconPath the iconPath value to set. + * @return the ApplicationInner object itself. + */ + public ApplicationInner withIconPath(String iconPath) { + this.iconPath = iconPath; + return this; + } + + /** + * Get the iconIndex property: Index of the icon. + * + * @return the iconIndex value. + */ + public Integer iconIndex() { + return this.iconIndex; + } + + /** + * Set the iconIndex property: Index of the icon. + * + * @param iconIndex the iconIndex value to set. + * @return the ApplicationInner object itself. + */ + public ApplicationInner withIconIndex(Integer iconIndex) { + this.iconIndex = iconIndex; + return this; + } + + /** + * Get the iconHash property: Hash of the icon. + * + * @return the iconHash value. + */ + public String iconHash() { + return this.iconHash; + } + + /** + * Get the iconContent property: the icon a 64 bit string as a byte array. + * + * @return the iconContent value. + */ + public byte[] iconContent() { + return CoreUtils.clone(this.iconContent); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (commandLineSetting() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property commandLineSetting in model ApplicationInner")); + } + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/models/DesktopInner.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/models/DesktopInner.java new file mode 100644 index 0000000000000..b0f7a0d5c0116 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/models/DesktopInner.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Schema for Desktop properties. */ +@JsonFlatten +@Fluent +public class DesktopInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DesktopInner.class); + + /* + * ObjectId of Desktop. (internal use) + */ + @JsonProperty(value = "properties.objectId", access = JsonProperty.Access.WRITE_ONLY) + private String objectId; + + /* + * Description of Desktop. + */ + @JsonProperty(value = "properties.description") + private String description; + + /* + * Friendly name of Desktop. + */ + @JsonProperty(value = "properties.friendlyName") + private String friendlyName; + + /* + * Hash of the icon. + */ + @JsonProperty(value = "properties.iconHash", access = JsonProperty.Access.WRITE_ONLY) + private String iconHash; + + /* + * The icon a 64 bit string as a byte array. + */ + @JsonProperty(value = "properties.iconContent", access = JsonProperty.Access.WRITE_ONLY) + private byte[] iconContent; + + /** + * Get the objectId property: ObjectId of Desktop. (internal use). + * + * @return the objectId value. + */ + public String objectId() { + return this.objectId; + } + + /** + * Get the description property: Description of Desktop. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Description of Desktop. + * + * @param description the description value to set. + * @return the DesktopInner object itself. + */ + public DesktopInner withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the friendlyName property: Friendly name of Desktop. + * + * @return the friendlyName value. + */ + public String friendlyName() { + return this.friendlyName; + } + + /** + * Set the friendlyName property: Friendly name of Desktop. + * + * @param friendlyName the friendlyName value to set. + * @return the DesktopInner object itself. + */ + public DesktopInner withFriendlyName(String friendlyName) { + this.friendlyName = friendlyName; + return this; + } + + /** + * Get the iconHash property: Hash of the icon. + * + * @return the iconHash value. + */ + public String iconHash() { + return this.iconHash; + } + + /** + * Get the iconContent property: The icon a 64 bit string as a byte array. + * + * @return the iconContent value. + */ + public byte[] iconContent() { + return CoreUtils.clone(this.iconContent); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/models/DesktopListInner.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/models/DesktopListInner.java new file mode 100644 index 0000000000000..901d9f1f36566 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/models/DesktopListInner.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of Desktop definitions. */ +@Fluent +public final class DesktopListInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DesktopListInner.class); + + /* + * List of Desktop definitions. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Link to the next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: List of Desktop definitions. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of Desktop definitions. + * + * @param value the value value to set. + * @return the DesktopListInner object itself. + */ + public DesktopListInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Link to the next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/models/ExpandMsixImageInner.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/models/ExpandMsixImageInner.java new file mode 100644 index 0000000000000..cb2de2bfd5995 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/models/ExpandMsixImageInner.java @@ -0,0 +1,378 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.desktopvirtualization.models.MsixPackageApplications; +import com.azure.resourcemanager.desktopvirtualization.models.MsixPackageDependencies; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Represents the definition of contents retrieved after expanding the MSIX Image. */ +@JsonFlatten +@Fluent +public class ExpandMsixImageInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ExpandMsixImageInner.class); + + /* + * Alias of MSIX Package. + */ + @JsonProperty(value = "properties.packageAlias") + private String packageAlias; + + /* + * VHD/CIM image path on Network Share. + */ + @JsonProperty(value = "properties.imagePath") + private String imagePath; + + /* + * Package Name from appxmanifest.xml. + */ + @JsonProperty(value = "properties.packageName") + private String packageName; + + /* + * Package Family Name from appxmanifest.xml. Contains Package Name and + * Publisher name. + */ + @JsonProperty(value = "properties.packageFamilyName") + private String packageFamilyName; + + /* + * Package Full Name from appxmanifest.xml. + */ + @JsonProperty(value = "properties.packageFullName") + private String packageFullName; + + /* + * User friendly Name to be displayed in the portal. + */ + @JsonProperty(value = "properties.displayName") + private String displayName; + + /* + * Relative Path to the package inside the image. + */ + @JsonProperty(value = "properties.packageRelativePath") + private String packageRelativePath; + + /* + * Specifies how to register Package in feed. + */ + @JsonProperty(value = "properties.isRegularRegistration") + private Boolean isRegularRegistration; + + /* + * Make this version of the package the active one across the hostpool. + */ + @JsonProperty(value = "properties.isActive") + private Boolean isActive; + + /* + * List of package dependencies. + */ + @JsonProperty(value = "properties.packageDependencies") + private List packageDependencies; + + /* + * Package Version found in the appxmanifest.xml. + */ + @JsonProperty(value = "properties.version") + private String version; + + /* + * Date Package was last updated, found in the appxmanifest.xml. + */ + @JsonProperty(value = "properties.lastUpdated") + private OffsetDateTime lastUpdated; + + /* + * List of package applications. + */ + @JsonProperty(value = "properties.packageApplications") + private List packageApplications; + + /** + * Get the packageAlias property: Alias of MSIX Package. + * + * @return the packageAlias value. + */ + public String packageAlias() { + return this.packageAlias; + } + + /** + * Set the packageAlias property: Alias of MSIX Package. + * + * @param packageAlias the packageAlias value to set. + * @return the ExpandMsixImageInner object itself. + */ + public ExpandMsixImageInner withPackageAlias(String packageAlias) { + this.packageAlias = packageAlias; + return this; + } + + /** + * Get the imagePath property: VHD/CIM image path on Network Share. + * + * @return the imagePath value. + */ + public String imagePath() { + return this.imagePath; + } + + /** + * Set the imagePath property: VHD/CIM image path on Network Share. + * + * @param imagePath the imagePath value to set. + * @return the ExpandMsixImageInner object itself. + */ + public ExpandMsixImageInner withImagePath(String imagePath) { + this.imagePath = imagePath; + return this; + } + + /** + * Get the packageName property: Package Name from appxmanifest.xml. + * + * @return the packageName value. + */ + public String packageName() { + return this.packageName; + } + + /** + * Set the packageName property: Package Name from appxmanifest.xml. + * + * @param packageName the packageName value to set. + * @return the ExpandMsixImageInner object itself. + */ + public ExpandMsixImageInner withPackageName(String packageName) { + this.packageName = packageName; + return this; + } + + /** + * Get the packageFamilyName property: Package Family Name from appxmanifest.xml. Contains Package Name and + * Publisher name. + * + * @return the packageFamilyName value. + */ + public String packageFamilyName() { + return this.packageFamilyName; + } + + /** + * Set the packageFamilyName property: Package Family Name from appxmanifest.xml. Contains Package Name and + * Publisher name. + * + * @param packageFamilyName the packageFamilyName value to set. + * @return the ExpandMsixImageInner object itself. + */ + public ExpandMsixImageInner withPackageFamilyName(String packageFamilyName) { + this.packageFamilyName = packageFamilyName; + return this; + } + + /** + * Get the packageFullName property: Package Full Name from appxmanifest.xml. + * + * @return the packageFullName value. + */ + public String packageFullName() { + return this.packageFullName; + } + + /** + * Set the packageFullName property: Package Full Name from appxmanifest.xml. + * + * @param packageFullName the packageFullName value to set. + * @return the ExpandMsixImageInner object itself. + */ + public ExpandMsixImageInner withPackageFullName(String packageFullName) { + this.packageFullName = packageFullName; + return this; + } + + /** + * Get the displayName property: User friendly Name to be displayed in the portal. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: User friendly Name to be displayed in the portal. + * + * @param displayName the displayName value to set. + * @return the ExpandMsixImageInner object itself. + */ + public ExpandMsixImageInner withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the packageRelativePath property: Relative Path to the package inside the image. + * + * @return the packageRelativePath value. + */ + public String packageRelativePath() { + return this.packageRelativePath; + } + + /** + * Set the packageRelativePath property: Relative Path to the package inside the image. + * + * @param packageRelativePath the packageRelativePath value to set. + * @return the ExpandMsixImageInner object itself. + */ + public ExpandMsixImageInner withPackageRelativePath(String packageRelativePath) { + this.packageRelativePath = packageRelativePath; + return this; + } + + /** + * Get the isRegularRegistration property: Specifies how to register Package in feed. + * + * @return the isRegularRegistration value. + */ + public Boolean isRegularRegistration() { + return this.isRegularRegistration; + } + + /** + * Set the isRegularRegistration property: Specifies how to register Package in feed. + * + * @param isRegularRegistration the isRegularRegistration value to set. + * @return the ExpandMsixImageInner object itself. + */ + public ExpandMsixImageInner withIsRegularRegistration(Boolean isRegularRegistration) { + this.isRegularRegistration = isRegularRegistration; + return this; + } + + /** + * Get the isActive property: Make this version of the package the active one across the hostpool. + * + * @return the isActive value. + */ + public Boolean isActive() { + return this.isActive; + } + + /** + * Set the isActive property: Make this version of the package the active one across the hostpool. + * + * @param isActive the isActive value to set. + * @return the ExpandMsixImageInner object itself. + */ + public ExpandMsixImageInner withIsActive(Boolean isActive) { + this.isActive = isActive; + return this; + } + + /** + * Get the packageDependencies property: List of package dependencies. + * + * @return the packageDependencies value. + */ + public List packageDependencies() { + return this.packageDependencies; + } + + /** + * Set the packageDependencies property: List of package dependencies. + * + * @param packageDependencies the packageDependencies value to set. + * @return the ExpandMsixImageInner object itself. + */ + public ExpandMsixImageInner withPackageDependencies(List packageDependencies) { + this.packageDependencies = packageDependencies; + return this; + } + + /** + * Get the version property: Package Version found in the appxmanifest.xml. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: Package Version found in the appxmanifest.xml. + * + * @param version the version value to set. + * @return the ExpandMsixImageInner object itself. + */ + public ExpandMsixImageInner withVersion(String version) { + this.version = version; + return this; + } + + /** + * Get the lastUpdated property: Date Package was last updated, found in the appxmanifest.xml. + * + * @return the lastUpdated value. + */ + public OffsetDateTime lastUpdated() { + return this.lastUpdated; + } + + /** + * Set the lastUpdated property: Date Package was last updated, found in the appxmanifest.xml. + * + * @param lastUpdated the lastUpdated value to set. + * @return the ExpandMsixImageInner object itself. + */ + public ExpandMsixImageInner withLastUpdated(OffsetDateTime lastUpdated) { + this.lastUpdated = lastUpdated; + return this; + } + + /** + * Get the packageApplications property: List of package applications. + * + * @return the packageApplications value. + */ + public List packageApplications() { + return this.packageApplications; + } + + /** + * Set the packageApplications property: List of package applications. + * + * @param packageApplications the packageApplications value to set. + * @return the ExpandMsixImageInner object itself. + */ + public ExpandMsixImageInner withPackageApplications(List packageApplications) { + this.packageApplications = packageApplications; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (packageDependencies() != null) { + packageDependencies().forEach(e -> e.validate()); + } + if (packageApplications() != null) { + packageApplications().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/models/HostPoolInner.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/models/HostPoolInner.java new file mode 100644 index 0000000000000..c2ab7a886bf38 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/models/HostPoolInner.java @@ -0,0 +1,632 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.desktopvirtualization.models.HostPoolType; +import com.azure.resourcemanager.desktopvirtualization.models.Identity; +import com.azure.resourcemanager.desktopvirtualization.models.LoadBalancerType; +import com.azure.resourcemanager.desktopvirtualization.models.MigrationRequestProperties; +import com.azure.resourcemanager.desktopvirtualization.models.PersonalDesktopAssignmentType; +import com.azure.resourcemanager.desktopvirtualization.models.Plan; +import com.azure.resourcemanager.desktopvirtualization.models.PreferredAppGroupType; +import com.azure.resourcemanager.desktopvirtualization.models.ResourceModelWithAllowedPropertySet; +import com.azure.resourcemanager.desktopvirtualization.models.Sku; +import com.azure.resourcemanager.desktopvirtualization.models.SsoSecretType; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** Represents a HostPool definition. */ +@JsonFlatten +@Fluent +public class HostPoolInner extends ResourceModelWithAllowedPropertySet { + @JsonIgnore private final ClientLogger logger = new ClientLogger(HostPoolInner.class); + + /* + * ObjectId of HostPool. (internal use) + */ + @JsonProperty(value = "properties.objectId", access = JsonProperty.Access.WRITE_ONLY) + private String objectId; + + /* + * Friendly name of HostPool. + */ + @JsonProperty(value = "properties.friendlyName") + private String friendlyName; + + /* + * Description of HostPool. + */ + @JsonProperty(value = "properties.description") + private String description; + + /* + * HostPool type for desktop. + */ + @JsonProperty(value = "properties.hostPoolType", required = true) + private HostPoolType hostPoolType; + + /* + * PersonalDesktopAssignment type for HostPool. + */ + @JsonProperty(value = "properties.personalDesktopAssignmentType") + private PersonalDesktopAssignmentType personalDesktopAssignmentType; + + /* + * Custom rdp property of HostPool. + */ + @JsonProperty(value = "properties.customRdpProperty") + private String customRdpProperty; + + /* + * The max session limit of HostPool. + */ + @JsonProperty(value = "properties.maxSessionLimit") + private Integer maxSessionLimit; + + /* + * The type of the load balancer. + */ + @JsonProperty(value = "properties.loadBalancerType", required = true) + private LoadBalancerType loadBalancerType; + + /* + * The ring number of HostPool. + */ + @JsonProperty(value = "properties.ring") + private Integer ring; + + /* + * Is validation environment. + */ + @JsonProperty(value = "properties.validationEnvironment") + private Boolean validationEnvironment; + + /* + * The registration info of HostPool. + */ + @JsonProperty(value = "properties.registrationInfo") + private RegistrationInfoInner registrationInfo; + + /* + * VM template for sessionhosts configuration within hostpool. + */ + @JsonProperty(value = "properties.vmTemplate") + private String vmTemplate; + + /* + * List of applicationGroup links. + */ + @JsonProperty(value = "properties.applicationGroupReferences", access = JsonProperty.Access.WRITE_ONLY) + private List applicationGroupReferences; + + /* + * URL to customer ADFS server for signing WVD SSO certificates. + */ + @JsonProperty(value = "properties.ssoadfsAuthority") + private String ssoadfsAuthority; + + /* + * ClientId for the registered Relying Party used to issue WVD SSO + * certificates. + */ + @JsonProperty(value = "properties.ssoClientId") + private String ssoClientId; + + /* + * Path to Azure KeyVault storing the secret used for communication to + * ADFS. + */ + @JsonProperty(value = "properties.ssoClientSecretKeyVaultPath") + private String ssoClientSecretKeyVaultPath; + + /* + * The type of single sign on Secret Type. + */ + @JsonProperty(value = "properties.ssoSecretType") + private SsoSecretType ssoSecretType; + + /* + * The type of preferred application group type, default to Desktop + * Application Group + */ + @JsonProperty(value = "properties.preferredAppGroupType", required = true) + private PreferredAppGroupType preferredAppGroupType; + + /* + * The flag to turn on/off StartVMOnConnect feature. + */ + @JsonProperty(value = "properties.startVMOnConnect") + private Boolean startVMOnConnect; + + /* + * The registration info of HostPool. + */ + @JsonProperty(value = "properties.migrationRequest") + private MigrationRequestProperties migrationRequest; + + /* + * Is cloud pc resource. + */ + @JsonProperty(value = "properties.cloudPcResource", access = JsonProperty.Access.WRITE_ONLY) + private Boolean cloudPcResource; + + /** + * Get the objectId property: ObjectId of HostPool. (internal use). + * + * @return the objectId value. + */ + public String objectId() { + return this.objectId; + } + + /** + * Get the friendlyName property: Friendly name of HostPool. + * + * @return the friendlyName value. + */ + public String friendlyName() { + return this.friendlyName; + } + + /** + * Set the friendlyName property: Friendly name of HostPool. + * + * @param friendlyName the friendlyName value to set. + * @return the HostPoolInner object itself. + */ + public HostPoolInner withFriendlyName(String friendlyName) { + this.friendlyName = friendlyName; + return this; + } + + /** + * Get the description property: Description of HostPool. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Description of HostPool. + * + * @param description the description value to set. + * @return the HostPoolInner object itself. + */ + public HostPoolInner withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the hostPoolType property: HostPool type for desktop. + * + * @return the hostPoolType value. + */ + public HostPoolType hostPoolType() { + return this.hostPoolType; + } + + /** + * Set the hostPoolType property: HostPool type for desktop. + * + * @param hostPoolType the hostPoolType value to set. + * @return the HostPoolInner object itself. + */ + public HostPoolInner withHostPoolType(HostPoolType hostPoolType) { + this.hostPoolType = hostPoolType; + return this; + } + + /** + * Get the personalDesktopAssignmentType property: PersonalDesktopAssignment type for HostPool. + * + * @return the personalDesktopAssignmentType value. + */ + public PersonalDesktopAssignmentType personalDesktopAssignmentType() { + return this.personalDesktopAssignmentType; + } + + /** + * Set the personalDesktopAssignmentType property: PersonalDesktopAssignment type for HostPool. + * + * @param personalDesktopAssignmentType the personalDesktopAssignmentType value to set. + * @return the HostPoolInner object itself. + */ + public HostPoolInner withPersonalDesktopAssignmentType( + PersonalDesktopAssignmentType personalDesktopAssignmentType) { + this.personalDesktopAssignmentType = personalDesktopAssignmentType; + return this; + } + + /** + * Get the customRdpProperty property: Custom rdp property of HostPool. + * + * @return the customRdpProperty value. + */ + public String customRdpProperty() { + return this.customRdpProperty; + } + + /** + * Set the customRdpProperty property: Custom rdp property of HostPool. + * + * @param customRdpProperty the customRdpProperty value to set. + * @return the HostPoolInner object itself. + */ + public HostPoolInner withCustomRdpProperty(String customRdpProperty) { + this.customRdpProperty = customRdpProperty; + return this; + } + + /** + * Get the maxSessionLimit property: The max session limit of HostPool. + * + * @return the maxSessionLimit value. + */ + public Integer maxSessionLimit() { + return this.maxSessionLimit; + } + + /** + * Set the maxSessionLimit property: The max session limit of HostPool. + * + * @param maxSessionLimit the maxSessionLimit value to set. + * @return the HostPoolInner object itself. + */ + public HostPoolInner withMaxSessionLimit(Integer maxSessionLimit) { + this.maxSessionLimit = maxSessionLimit; + return this; + } + + /** + * Get the loadBalancerType property: The type of the load balancer. + * + * @return the loadBalancerType value. + */ + public LoadBalancerType loadBalancerType() { + return this.loadBalancerType; + } + + /** + * Set the loadBalancerType property: The type of the load balancer. + * + * @param loadBalancerType the loadBalancerType value to set. + * @return the HostPoolInner object itself. + */ + public HostPoolInner withLoadBalancerType(LoadBalancerType loadBalancerType) { + this.loadBalancerType = loadBalancerType; + return this; + } + + /** + * Get the ring property: The ring number of HostPool. + * + * @return the ring value. + */ + public Integer ring() { + return this.ring; + } + + /** + * Set the ring property: The ring number of HostPool. + * + * @param ring the ring value to set. + * @return the HostPoolInner object itself. + */ + public HostPoolInner withRing(Integer ring) { + this.ring = ring; + return this; + } + + /** + * Get the validationEnvironment property: Is validation environment. + * + * @return the validationEnvironment value. + */ + public Boolean validationEnvironment() { + return this.validationEnvironment; + } + + /** + * Set the validationEnvironment property: Is validation environment. + * + * @param validationEnvironment the validationEnvironment value to set. + * @return the HostPoolInner object itself. + */ + public HostPoolInner withValidationEnvironment(Boolean validationEnvironment) { + this.validationEnvironment = validationEnvironment; + return this; + } + + /** + * Get the registrationInfo property: The registration info of HostPool. + * + * @return the registrationInfo value. + */ + public RegistrationInfoInner registrationInfo() { + return this.registrationInfo; + } + + /** + * Set the registrationInfo property: The registration info of HostPool. + * + * @param registrationInfo the registrationInfo value to set. + * @return the HostPoolInner object itself. + */ + public HostPoolInner withRegistrationInfo(RegistrationInfoInner registrationInfo) { + this.registrationInfo = registrationInfo; + return this; + } + + /** + * Get the vmTemplate property: VM template for sessionhosts configuration within hostpool. + * + * @return the vmTemplate value. + */ + public String vmTemplate() { + return this.vmTemplate; + } + + /** + * Set the vmTemplate property: VM template for sessionhosts configuration within hostpool. + * + * @param vmTemplate the vmTemplate value to set. + * @return the HostPoolInner object itself. + */ + public HostPoolInner withVmTemplate(String vmTemplate) { + this.vmTemplate = vmTemplate; + return this; + } + + /** + * Get the applicationGroupReferences property: List of applicationGroup links. + * + * @return the applicationGroupReferences value. + */ + public List applicationGroupReferences() { + return this.applicationGroupReferences; + } + + /** + * Get the ssoadfsAuthority property: URL to customer ADFS server for signing WVD SSO certificates. + * + * @return the ssoadfsAuthority value. + */ + public String ssoadfsAuthority() { + return this.ssoadfsAuthority; + } + + /** + * Set the ssoadfsAuthority property: URL to customer ADFS server for signing WVD SSO certificates. + * + * @param ssoadfsAuthority the ssoadfsAuthority value to set. + * @return the HostPoolInner object itself. + */ + public HostPoolInner withSsoadfsAuthority(String ssoadfsAuthority) { + this.ssoadfsAuthority = ssoadfsAuthority; + return this; + } + + /** + * Get the ssoClientId property: ClientId for the registered Relying Party used to issue WVD SSO certificates. + * + * @return the ssoClientId value. + */ + public String ssoClientId() { + return this.ssoClientId; + } + + /** + * Set the ssoClientId property: ClientId for the registered Relying Party used to issue WVD SSO certificates. + * + * @param ssoClientId the ssoClientId value to set. + * @return the HostPoolInner object itself. + */ + public HostPoolInner withSsoClientId(String ssoClientId) { + this.ssoClientId = ssoClientId; + return this; + } + + /** + * Get the ssoClientSecretKeyVaultPath property: Path to Azure KeyVault storing the secret used for communication to + * ADFS. + * + * @return the ssoClientSecretKeyVaultPath value. + */ + public String ssoClientSecretKeyVaultPath() { + return this.ssoClientSecretKeyVaultPath; + } + + /** + * Set the ssoClientSecretKeyVaultPath property: Path to Azure KeyVault storing the secret used for communication to + * ADFS. + * + * @param ssoClientSecretKeyVaultPath the ssoClientSecretKeyVaultPath value to set. + * @return the HostPoolInner object itself. + */ + public HostPoolInner withSsoClientSecretKeyVaultPath(String ssoClientSecretKeyVaultPath) { + this.ssoClientSecretKeyVaultPath = ssoClientSecretKeyVaultPath; + return this; + } + + /** + * Get the ssoSecretType property: The type of single sign on Secret Type. + * + * @return the ssoSecretType value. + */ + public SsoSecretType ssoSecretType() { + return this.ssoSecretType; + } + + /** + * Set the ssoSecretType property: The type of single sign on Secret Type. + * + * @param ssoSecretType the ssoSecretType value to set. + * @return the HostPoolInner object itself. + */ + public HostPoolInner withSsoSecretType(SsoSecretType ssoSecretType) { + this.ssoSecretType = ssoSecretType; + return this; + } + + /** + * Get the preferredAppGroupType property: The type of preferred application group type, default to Desktop + * Application Group. + * + * @return the preferredAppGroupType value. + */ + public PreferredAppGroupType preferredAppGroupType() { + return this.preferredAppGroupType; + } + + /** + * Set the preferredAppGroupType property: The type of preferred application group type, default to Desktop + * Application Group. + * + * @param preferredAppGroupType the preferredAppGroupType value to set. + * @return the HostPoolInner object itself. + */ + public HostPoolInner withPreferredAppGroupType(PreferredAppGroupType preferredAppGroupType) { + this.preferredAppGroupType = preferredAppGroupType; + return this; + } + + /** + * Get the startVMOnConnect property: The flag to turn on/off StartVMOnConnect feature. + * + * @return the startVMOnConnect value. + */ + public Boolean startVMOnConnect() { + return this.startVMOnConnect; + } + + /** + * Set the startVMOnConnect property: The flag to turn on/off StartVMOnConnect feature. + * + * @param startVMOnConnect the startVMOnConnect value to set. + * @return the HostPoolInner object itself. + */ + public HostPoolInner withStartVMOnConnect(Boolean startVMOnConnect) { + this.startVMOnConnect = startVMOnConnect; + return this; + } + + /** + * Get the migrationRequest property: The registration info of HostPool. + * + * @return the migrationRequest value. + */ + public MigrationRequestProperties migrationRequest() { + return this.migrationRequest; + } + + /** + * Set the migrationRequest property: The registration info of HostPool. + * + * @param migrationRequest the migrationRequest value to set. + * @return the HostPoolInner object itself. + */ + public HostPoolInner withMigrationRequest(MigrationRequestProperties migrationRequest) { + this.migrationRequest = migrationRequest; + return this; + } + + /** + * Get the cloudPcResource property: Is cloud pc resource. + * + * @return the cloudPcResource value. + */ + public Boolean cloudPcResource() { + return this.cloudPcResource; + } + + /** {@inheritDoc} */ + @Override + public HostPoolInner withManagedBy(String managedBy) { + super.withManagedBy(managedBy); + return this; + } + + /** {@inheritDoc} */ + @Override + public HostPoolInner withKind(String kind) { + super.withKind(kind); + return this; + } + + /** {@inheritDoc} */ + @Override + public HostPoolInner withIdentity(Identity identity) { + super.withIdentity(identity); + return this; + } + + /** {@inheritDoc} */ + @Override + public HostPoolInner withSku(Sku sku) { + super.withSku(sku); + return this; + } + + /** {@inheritDoc} */ + @Override + public HostPoolInner withPlan(Plan plan) { + super.withPlan(plan); + return this; + } + + /** {@inheritDoc} */ + @Override + public HostPoolInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public HostPoolInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (hostPoolType() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property hostPoolType in model HostPoolInner")); + } + if (loadBalancerType() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property loadBalancerType in model HostPoolInner")); + } + if (registrationInfo() != null) { + registrationInfo().validate(); + } + if (preferredAppGroupType() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property preferredAppGroupType in model HostPoolInner")); + } + if (migrationRequest() != null) { + migrationRequest().validate(); + } + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/models/MsixPackageInner.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/models/MsixPackageInner.java new file mode 100644 index 0000000000000..348db6abdd410 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/models/MsixPackageInner.java @@ -0,0 +1,326 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.desktopvirtualization.models.MsixPackageApplications; +import com.azure.resourcemanager.desktopvirtualization.models.MsixPackageDependencies; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Schema for MSIX Package properties. */ +@JsonFlatten +@Fluent +public class MsixPackageInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MsixPackageInner.class); + + /* + * VHD/CIM image path on Network Share. + */ + @JsonProperty(value = "properties.imagePath") + private String imagePath; + + /* + * Package Name from appxmanifest.xml. + */ + @JsonProperty(value = "properties.packageName") + private String packageName; + + /* + * Package Family Name from appxmanifest.xml. Contains Package Name and + * Publisher name. + */ + @JsonProperty(value = "properties.packageFamilyName") + private String packageFamilyName; + + /* + * User friendly Name to be displayed in the portal. + */ + @JsonProperty(value = "properties.displayName") + private String displayName; + + /* + * Relative Path to the package inside the image. + */ + @JsonProperty(value = "properties.packageRelativePath") + private String packageRelativePath; + + /* + * Specifies how to register Package in feed. + */ + @JsonProperty(value = "properties.isRegularRegistration") + private Boolean isRegularRegistration; + + /* + * Make this version of the package the active one across the hostpool. + */ + @JsonProperty(value = "properties.isActive") + private Boolean isActive; + + /* + * List of package dependencies. + */ + @JsonProperty(value = "properties.packageDependencies") + private List packageDependencies; + + /* + * Package Version found in the appxmanifest.xml. + */ + @JsonProperty(value = "properties.version") + private String version; + + /* + * Date Package was last updated, found in the appxmanifest.xml. + */ + @JsonProperty(value = "properties.lastUpdated") + private OffsetDateTime lastUpdated; + + /* + * List of package applications. + */ + @JsonProperty(value = "properties.packageApplications") + private List packageApplications; + + /** + * Get the imagePath property: VHD/CIM image path on Network Share. + * + * @return the imagePath value. + */ + public String imagePath() { + return this.imagePath; + } + + /** + * Set the imagePath property: VHD/CIM image path on Network Share. + * + * @param imagePath the imagePath value to set. + * @return the MsixPackageInner object itself. + */ + public MsixPackageInner withImagePath(String imagePath) { + this.imagePath = imagePath; + return this; + } + + /** + * Get the packageName property: Package Name from appxmanifest.xml. + * + * @return the packageName value. + */ + public String packageName() { + return this.packageName; + } + + /** + * Set the packageName property: Package Name from appxmanifest.xml. + * + * @param packageName the packageName value to set. + * @return the MsixPackageInner object itself. + */ + public MsixPackageInner withPackageName(String packageName) { + this.packageName = packageName; + return this; + } + + /** + * Get the packageFamilyName property: Package Family Name from appxmanifest.xml. Contains Package Name and + * Publisher name. + * + * @return the packageFamilyName value. + */ + public String packageFamilyName() { + return this.packageFamilyName; + } + + /** + * Set the packageFamilyName property: Package Family Name from appxmanifest.xml. Contains Package Name and + * Publisher name. + * + * @param packageFamilyName the packageFamilyName value to set. + * @return the MsixPackageInner object itself. + */ + public MsixPackageInner withPackageFamilyName(String packageFamilyName) { + this.packageFamilyName = packageFamilyName; + return this; + } + + /** + * Get the displayName property: User friendly Name to be displayed in the portal. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: User friendly Name to be displayed in the portal. + * + * @param displayName the displayName value to set. + * @return the MsixPackageInner object itself. + */ + public MsixPackageInner withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the packageRelativePath property: Relative Path to the package inside the image. + * + * @return the packageRelativePath value. + */ + public String packageRelativePath() { + return this.packageRelativePath; + } + + /** + * Set the packageRelativePath property: Relative Path to the package inside the image. + * + * @param packageRelativePath the packageRelativePath value to set. + * @return the MsixPackageInner object itself. + */ + public MsixPackageInner withPackageRelativePath(String packageRelativePath) { + this.packageRelativePath = packageRelativePath; + return this; + } + + /** + * Get the isRegularRegistration property: Specifies how to register Package in feed. + * + * @return the isRegularRegistration value. + */ + public Boolean isRegularRegistration() { + return this.isRegularRegistration; + } + + /** + * Set the isRegularRegistration property: Specifies how to register Package in feed. + * + * @param isRegularRegistration the isRegularRegistration value to set. + * @return the MsixPackageInner object itself. + */ + public MsixPackageInner withIsRegularRegistration(Boolean isRegularRegistration) { + this.isRegularRegistration = isRegularRegistration; + return this; + } + + /** + * Get the isActive property: Make this version of the package the active one across the hostpool. + * + * @return the isActive value. + */ + public Boolean isActive() { + return this.isActive; + } + + /** + * Set the isActive property: Make this version of the package the active one across the hostpool. + * + * @param isActive the isActive value to set. + * @return the MsixPackageInner object itself. + */ + public MsixPackageInner withIsActive(Boolean isActive) { + this.isActive = isActive; + return this; + } + + /** + * Get the packageDependencies property: List of package dependencies. + * + * @return the packageDependencies value. + */ + public List packageDependencies() { + return this.packageDependencies; + } + + /** + * Set the packageDependencies property: List of package dependencies. + * + * @param packageDependencies the packageDependencies value to set. + * @return the MsixPackageInner object itself. + */ + public MsixPackageInner withPackageDependencies(List packageDependencies) { + this.packageDependencies = packageDependencies; + return this; + } + + /** + * Get the version property: Package Version found in the appxmanifest.xml. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: Package Version found in the appxmanifest.xml. + * + * @param version the version value to set. + * @return the MsixPackageInner object itself. + */ + public MsixPackageInner withVersion(String version) { + this.version = version; + return this; + } + + /** + * Get the lastUpdated property: Date Package was last updated, found in the appxmanifest.xml. + * + * @return the lastUpdated value. + */ + public OffsetDateTime lastUpdated() { + return this.lastUpdated; + } + + /** + * Set the lastUpdated property: Date Package was last updated, found in the appxmanifest.xml. + * + * @param lastUpdated the lastUpdated value to set. + * @return the MsixPackageInner object itself. + */ + public MsixPackageInner withLastUpdated(OffsetDateTime lastUpdated) { + this.lastUpdated = lastUpdated; + return this; + } + + /** + * Get the packageApplications property: List of package applications. + * + * @return the packageApplications value. + */ + public List packageApplications() { + return this.packageApplications; + } + + /** + * Set the packageApplications property: List of package applications. + * + * @param packageApplications the packageApplications value to set. + * @return the MsixPackageInner object itself. + */ + public MsixPackageInner withPackageApplications(List packageApplications) { + this.packageApplications = packageApplications; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (packageDependencies() != null) { + packageDependencies().forEach(e -> e.validate()); + } + if (packageApplications() != null) { + packageApplications().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/models/RegistrationInfoInner.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/models/RegistrationInfoInner.java new file mode 100644 index 0000000000000..bfbe442a3627c --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/models/RegistrationInfoInner.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.desktopvirtualization.models.RegistrationTokenOperation; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Represents a RegistrationInfo definition. */ +@Fluent +public final class RegistrationInfoInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RegistrationInfoInner.class); + + /* + * Expiration time of registration token. + */ + @JsonProperty(value = "expirationTime") + private OffsetDateTime expirationTime; + + /* + * The registration token base64 encoded string. + */ + @JsonProperty(value = "token") + private String token; + + /* + * The type of resetting the token. + */ + @JsonProperty(value = "registrationTokenOperation") + private RegistrationTokenOperation registrationTokenOperation; + + /** + * Get the expirationTime property: Expiration time of registration token. + * + * @return the expirationTime value. + */ + public OffsetDateTime expirationTime() { + return this.expirationTime; + } + + /** + * Set the expirationTime property: Expiration time of registration token. + * + * @param expirationTime the expirationTime value to set. + * @return the RegistrationInfoInner object itself. + */ + public RegistrationInfoInner withExpirationTime(OffsetDateTime expirationTime) { + this.expirationTime = expirationTime; + return this; + } + + /** + * Get the token property: The registration token base64 encoded string. + * + * @return the token value. + */ + public String token() { + return this.token; + } + + /** + * Set the token property: The registration token base64 encoded string. + * + * @param token the token value to set. + * @return the RegistrationInfoInner object itself. + */ + public RegistrationInfoInner withToken(String token) { + this.token = token; + return this; + } + + /** + * Get the registrationTokenOperation property: The type of resetting the token. + * + * @return the registrationTokenOperation value. + */ + public RegistrationTokenOperation registrationTokenOperation() { + return this.registrationTokenOperation; + } + + /** + * Set the registrationTokenOperation property: The type of resetting the token. + * + * @param registrationTokenOperation the registrationTokenOperation value to set. + * @return the RegistrationInfoInner object itself. + */ + public RegistrationInfoInner withRegistrationTokenOperation(RegistrationTokenOperation registrationTokenOperation) { + this.registrationTokenOperation = registrationTokenOperation; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/models/ResourceProviderOperationListInner.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/models/ResourceProviderOperationListInner.java new file mode 100644 index 0000000000000..67dfa56230593 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/models/ResourceProviderOperationListInner.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.desktopvirtualization.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.desktopvirtualization.models.ResourceProviderOperation; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Result of the request to list operations. */ +@Fluent +public final class ResourceProviderOperationListInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceProviderOperationListInner.class); + + /* + * List of operations supported by this resource provider. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: List of operations supported by this resource provider. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of operations supported by this resource provider. + * + * @param value the value value to set. + * @return the ResourceProviderOperationListInner object itself. + */ + public ResourceProviderOperationListInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/models/ScalingPlanInner.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/models/ScalingPlanInner.java new file mode 100644 index 0000000000000..bae4a11917bc6 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/models/ScalingPlanInner.java @@ -0,0 +1,315 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.desktopvirtualization.models.HostPoolType; +import com.azure.resourcemanager.desktopvirtualization.models.Identity; +import com.azure.resourcemanager.desktopvirtualization.models.Plan; +import com.azure.resourcemanager.desktopvirtualization.models.ResourceModelWithAllowedPropertySet; +import com.azure.resourcemanager.desktopvirtualization.models.ScalingHostPoolReference; +import com.azure.resourcemanager.desktopvirtualization.models.ScalingSchedule; +import com.azure.resourcemanager.desktopvirtualization.models.Sku; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** Represents a scaling plan definition. */ +@JsonFlatten +@Fluent +public class ScalingPlanInner extends ResourceModelWithAllowedPropertySet { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ScalingPlanInner.class); + + /* + * ObjectId of scaling plan. (internal use) + */ + @JsonProperty(value = "properties.objectId", access = JsonProperty.Access.WRITE_ONLY) + private String objectId; + + /* + * The ring number of scaling plan. + */ + @JsonProperty(value = "properties.ring") + private Integer ring; + + /* + * Description of scaling plan. + */ + @JsonProperty(value = "properties.description") + private String description; + + /* + * User friendly name of scaling plan. + */ + @JsonProperty(value = "properties.friendlyName") + private String friendlyName; + + /* + * Timezone of the scaling plan. + */ + @JsonProperty(value = "properties.timeZone") + private String timeZone; + + /* + * HostPool type for desktop. + */ + @JsonProperty(value = "properties.hostPoolType") + private HostPoolType hostPoolType; + + /* + * Exclusion tag for scaling plan. + */ + @JsonProperty(value = "properties.exclusionTag") + private String exclusionTag; + + /* + * List of ScalingSchedule definitions. + */ + @JsonProperty(value = "properties.schedules") + private List schedules; + + /* + * List of ScalingHostPoolReference definitions. + */ + @JsonProperty(value = "properties.hostPoolReferences") + private List hostPoolReferences; + + /** + * Get the objectId property: ObjectId of scaling plan. (internal use). + * + * @return the objectId value. + */ + public String objectId() { + return this.objectId; + } + + /** + * Get the ring property: The ring number of scaling plan. + * + * @return the ring value. + */ + public Integer ring() { + return this.ring; + } + + /** + * Set the ring property: The ring number of scaling plan. + * + * @param ring the ring value to set. + * @return the ScalingPlanInner object itself. + */ + public ScalingPlanInner withRing(Integer ring) { + this.ring = ring; + return this; + } + + /** + * Get the description property: Description of scaling plan. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Description of scaling plan. + * + * @param description the description value to set. + * @return the ScalingPlanInner object itself. + */ + public ScalingPlanInner withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the friendlyName property: User friendly name of scaling plan. + * + * @return the friendlyName value. + */ + public String friendlyName() { + return this.friendlyName; + } + + /** + * Set the friendlyName property: User friendly name of scaling plan. + * + * @param friendlyName the friendlyName value to set. + * @return the ScalingPlanInner object itself. + */ + public ScalingPlanInner withFriendlyName(String friendlyName) { + this.friendlyName = friendlyName; + return this; + } + + /** + * Get the timeZone property: Timezone of the scaling plan. + * + * @return the timeZone value. + */ + public String timeZone() { + return this.timeZone; + } + + /** + * Set the timeZone property: Timezone of the scaling plan. + * + * @param timeZone the timeZone value to set. + * @return the ScalingPlanInner object itself. + */ + public ScalingPlanInner withTimeZone(String timeZone) { + this.timeZone = timeZone; + return this; + } + + /** + * Get the hostPoolType property: HostPool type for desktop. + * + * @return the hostPoolType value. + */ + public HostPoolType hostPoolType() { + return this.hostPoolType; + } + + /** + * Set the hostPoolType property: HostPool type for desktop. + * + * @param hostPoolType the hostPoolType value to set. + * @return the ScalingPlanInner object itself. + */ + public ScalingPlanInner withHostPoolType(HostPoolType hostPoolType) { + this.hostPoolType = hostPoolType; + return this; + } + + /** + * Get the exclusionTag property: Exclusion tag for scaling plan. + * + * @return the exclusionTag value. + */ + public String exclusionTag() { + return this.exclusionTag; + } + + /** + * Set the exclusionTag property: Exclusion tag for scaling plan. + * + * @param exclusionTag the exclusionTag value to set. + * @return the ScalingPlanInner object itself. + */ + public ScalingPlanInner withExclusionTag(String exclusionTag) { + this.exclusionTag = exclusionTag; + return this; + } + + /** + * Get the schedules property: List of ScalingSchedule definitions. + * + * @return the schedules value. + */ + public List schedules() { + return this.schedules; + } + + /** + * Set the schedules property: List of ScalingSchedule definitions. + * + * @param schedules the schedules value to set. + * @return the ScalingPlanInner object itself. + */ + public ScalingPlanInner withSchedules(List schedules) { + this.schedules = schedules; + return this; + } + + /** + * Get the hostPoolReferences property: List of ScalingHostPoolReference definitions. + * + * @return the hostPoolReferences value. + */ + public List hostPoolReferences() { + return this.hostPoolReferences; + } + + /** + * Set the hostPoolReferences property: List of ScalingHostPoolReference definitions. + * + * @param hostPoolReferences the hostPoolReferences value to set. + * @return the ScalingPlanInner object itself. + */ + public ScalingPlanInner withHostPoolReferences(List hostPoolReferences) { + this.hostPoolReferences = hostPoolReferences; + return this; + } + + /** {@inheritDoc} */ + @Override + public ScalingPlanInner withManagedBy(String managedBy) { + super.withManagedBy(managedBy); + return this; + } + + /** {@inheritDoc} */ + @Override + public ScalingPlanInner withKind(String kind) { + super.withKind(kind); + return this; + } + + /** {@inheritDoc} */ + @Override + public ScalingPlanInner withIdentity(Identity identity) { + super.withIdentity(identity); + return this; + } + + /** {@inheritDoc} */ + @Override + public ScalingPlanInner withSku(Sku sku) { + super.withSku(sku); + return this; + } + + /** {@inheritDoc} */ + @Override + public ScalingPlanInner withPlan(Plan plan) { + super.withPlan(plan); + return this; + } + + /** {@inheritDoc} */ + @Override + public ScalingPlanInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public ScalingPlanInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (schedules() != null) { + schedules().forEach(e -> e.validate()); + } + if (hostPoolReferences() != null) { + hostPoolReferences().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/models/SessionHostInner.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/models/SessionHostInner.java new file mode 100644 index 0000000000000..ee4ee117dfac5 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/models/SessionHostInner.java @@ -0,0 +1,385 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.desktopvirtualization.models.SessionHostHealthCheckReport; +import com.azure.resourcemanager.desktopvirtualization.models.Status; +import com.azure.resourcemanager.desktopvirtualization.models.UpdateState; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Represents a SessionHost definition. */ +@JsonFlatten +@Fluent +public class SessionHostInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SessionHostInner.class); + + /* + * ObjectId of SessionHost. (internal use) + */ + @JsonProperty(value = "properties.objectId", access = JsonProperty.Access.WRITE_ONLY) + private String objectId; + + /* + * Last heart beat from SessionHost. + */ + @JsonProperty(value = "properties.lastHeartBeat") + private OffsetDateTime lastHeartBeat; + + /* + * Number of sessions on SessionHost. + */ + @JsonProperty(value = "properties.sessions") + private Integer sessions; + + /* + * Version of agent on SessionHost. + */ + @JsonProperty(value = "properties.agentVersion") + private String agentVersion; + + /* + * Allow a new session. + */ + @JsonProperty(value = "properties.allowNewSession") + private Boolean allowNewSession; + + /* + * Virtual Machine Id of SessionHost's underlying virtual machine. + */ + @JsonProperty(value = "properties.virtualMachineId", access = JsonProperty.Access.WRITE_ONLY) + private String virtualMachineId; + + /* + * Resource Id of SessionHost's underlying virtual machine. + */ + @JsonProperty(value = "properties.resourceId", access = JsonProperty.Access.WRITE_ONLY) + private String resourceId; + + /* + * User assigned to SessionHost. + */ + @JsonProperty(value = "properties.assignedUser") + private String assignedUser; + + /* + * Status for a SessionHost. + */ + @JsonProperty(value = "properties.status") + private Status status; + + /* + * The timestamp of the status. + */ + @JsonProperty(value = "properties.statusTimestamp", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime statusTimestamp; + + /* + * The version of the OS on the session host. + */ + @JsonProperty(value = "properties.osVersion") + private String osVersion; + + /* + * The version of the side by side stack on the session host. + */ + @JsonProperty(value = "properties.sxSStackVersion") + private String sxSStackVersion; + + /* + * Update state of a SessionHost. + */ + @JsonProperty(value = "properties.updateState") + private UpdateState updateState; + + /* + * The timestamp of the last update. + */ + @JsonProperty(value = "properties.lastUpdateTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastUpdateTime; + + /* + * The error message. + */ + @JsonProperty(value = "properties.updateErrorMessage") + private String updateErrorMessage; + + /* + * List of SessionHostHealthCheckReports + */ + @JsonProperty(value = "properties.sessionHostHealthCheckResults", access = JsonProperty.Access.WRITE_ONLY) + private List sessionHostHealthCheckResults; + + /** + * Get the objectId property: ObjectId of SessionHost. (internal use). + * + * @return the objectId value. + */ + public String objectId() { + return this.objectId; + } + + /** + * Get the lastHeartBeat property: Last heart beat from SessionHost. + * + * @return the lastHeartBeat value. + */ + public OffsetDateTime lastHeartBeat() { + return this.lastHeartBeat; + } + + /** + * Set the lastHeartBeat property: Last heart beat from SessionHost. + * + * @param lastHeartBeat the lastHeartBeat value to set. + * @return the SessionHostInner object itself. + */ + public SessionHostInner withLastHeartBeat(OffsetDateTime lastHeartBeat) { + this.lastHeartBeat = lastHeartBeat; + return this; + } + + /** + * Get the sessions property: Number of sessions on SessionHost. + * + * @return the sessions value. + */ + public Integer sessions() { + return this.sessions; + } + + /** + * Set the sessions property: Number of sessions on SessionHost. + * + * @param sessions the sessions value to set. + * @return the SessionHostInner object itself. + */ + public SessionHostInner withSessions(Integer sessions) { + this.sessions = sessions; + return this; + } + + /** + * Get the agentVersion property: Version of agent on SessionHost. + * + * @return the agentVersion value. + */ + public String agentVersion() { + return this.agentVersion; + } + + /** + * Set the agentVersion property: Version of agent on SessionHost. + * + * @param agentVersion the agentVersion value to set. + * @return the SessionHostInner object itself. + */ + public SessionHostInner withAgentVersion(String agentVersion) { + this.agentVersion = agentVersion; + return this; + } + + /** + * Get the allowNewSession property: Allow a new session. + * + * @return the allowNewSession value. + */ + public Boolean allowNewSession() { + return this.allowNewSession; + } + + /** + * Set the allowNewSession property: Allow a new session. + * + * @param allowNewSession the allowNewSession value to set. + * @return the SessionHostInner object itself. + */ + public SessionHostInner withAllowNewSession(Boolean allowNewSession) { + this.allowNewSession = allowNewSession; + return this; + } + + /** + * Get the virtualMachineId property: Virtual Machine Id of SessionHost's underlying virtual machine. + * + * @return the virtualMachineId value. + */ + public String virtualMachineId() { + return this.virtualMachineId; + } + + /** + * Get the resourceId property: Resource Id of SessionHost's underlying virtual machine. + * + * @return the resourceId value. + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Get the assignedUser property: User assigned to SessionHost. + * + * @return the assignedUser value. + */ + public String assignedUser() { + return this.assignedUser; + } + + /** + * Set the assignedUser property: User assigned to SessionHost. + * + * @param assignedUser the assignedUser value to set. + * @return the SessionHostInner object itself. + */ + public SessionHostInner withAssignedUser(String assignedUser) { + this.assignedUser = assignedUser; + return this; + } + + /** + * Get the status property: Status for a SessionHost. + * + * @return the status value. + */ + public Status status() { + return this.status; + } + + /** + * Set the status property: Status for a SessionHost. + * + * @param status the status value to set. + * @return the SessionHostInner object itself. + */ + public SessionHostInner withStatus(Status status) { + this.status = status; + return this; + } + + /** + * Get the statusTimestamp property: The timestamp of the status. + * + * @return the statusTimestamp value. + */ + public OffsetDateTime statusTimestamp() { + return this.statusTimestamp; + } + + /** + * Get the osVersion property: The version of the OS on the session host. + * + * @return the osVersion value. + */ + public String osVersion() { + return this.osVersion; + } + + /** + * Set the osVersion property: The version of the OS on the session host. + * + * @param osVersion the osVersion value to set. + * @return the SessionHostInner object itself. + */ + public SessionHostInner withOsVersion(String osVersion) { + this.osVersion = osVersion; + return this; + } + + /** + * Get the sxSStackVersion property: The version of the side by side stack on the session host. + * + * @return the sxSStackVersion value. + */ + public String sxSStackVersion() { + return this.sxSStackVersion; + } + + /** + * Set the sxSStackVersion property: The version of the side by side stack on the session host. + * + * @param sxSStackVersion the sxSStackVersion value to set. + * @return the SessionHostInner object itself. + */ + public SessionHostInner withSxSStackVersion(String sxSStackVersion) { + this.sxSStackVersion = sxSStackVersion; + return this; + } + + /** + * Get the updateState property: Update state of a SessionHost. + * + * @return the updateState value. + */ + public UpdateState updateState() { + return this.updateState; + } + + /** + * Set the updateState property: Update state of a SessionHost. + * + * @param updateState the updateState value to set. + * @return the SessionHostInner object itself. + */ + public SessionHostInner withUpdateState(UpdateState updateState) { + this.updateState = updateState; + return this; + } + + /** + * Get the lastUpdateTime property: The timestamp of the last update. + * + * @return the lastUpdateTime value. + */ + public OffsetDateTime lastUpdateTime() { + return this.lastUpdateTime; + } + + /** + * Get the updateErrorMessage property: The error message. + * + * @return the updateErrorMessage value. + */ + public String updateErrorMessage() { + return this.updateErrorMessage; + } + + /** + * Set the updateErrorMessage property: The error message. + * + * @param updateErrorMessage the updateErrorMessage value to set. + * @return the SessionHostInner object itself. + */ + public SessionHostInner withUpdateErrorMessage(String updateErrorMessage) { + this.updateErrorMessage = updateErrorMessage; + return this; + } + + /** + * Get the sessionHostHealthCheckResults property: List of SessionHostHealthCheckReports. + * + * @return the sessionHostHealthCheckResults value. + */ + public List sessionHostHealthCheckResults() { + return this.sessionHostHealthCheckResults; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sessionHostHealthCheckResults() != null) { + sessionHostHealthCheckResults().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/models/StartMenuItemInner.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/models/StartMenuItemInner.java new file mode 100644 index 0000000000000..7256c307fa427 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/models/StartMenuItemInner.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Represents a StartMenuItem definition. */ +@JsonFlatten +@Fluent +public class StartMenuItemInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(StartMenuItemInner.class); + + /* + * Alias of StartMenuItem. + */ + @JsonProperty(value = "properties.appAlias") + private String appAlias; + + /* + * Path to the file of StartMenuItem. + */ + @JsonProperty(value = "properties.filePath") + private String filePath; + + /* + * Command line arguments for StartMenuItem. + */ + @JsonProperty(value = "properties.commandLineArguments") + private String commandLineArguments; + + /* + * Path to the icon. + */ + @JsonProperty(value = "properties.iconPath") + private String iconPath; + + /* + * Index of the icon. + */ + @JsonProperty(value = "properties.iconIndex") + private Integer iconIndex; + + /** + * Get the appAlias property: Alias of StartMenuItem. + * + * @return the appAlias value. + */ + public String appAlias() { + return this.appAlias; + } + + /** + * Set the appAlias property: Alias of StartMenuItem. + * + * @param appAlias the appAlias value to set. + * @return the StartMenuItemInner object itself. + */ + public StartMenuItemInner withAppAlias(String appAlias) { + this.appAlias = appAlias; + return this; + } + + /** + * Get the filePath property: Path to the file of StartMenuItem. + * + * @return the filePath value. + */ + public String filePath() { + return this.filePath; + } + + /** + * Set the filePath property: Path to the file of StartMenuItem. + * + * @param filePath the filePath value to set. + * @return the StartMenuItemInner object itself. + */ + public StartMenuItemInner withFilePath(String filePath) { + this.filePath = filePath; + return this; + } + + /** + * Get the commandLineArguments property: Command line arguments for StartMenuItem. + * + * @return the commandLineArguments value. + */ + public String commandLineArguments() { + return this.commandLineArguments; + } + + /** + * Set the commandLineArguments property: Command line arguments for StartMenuItem. + * + * @param commandLineArguments the commandLineArguments value to set. + * @return the StartMenuItemInner object itself. + */ + public StartMenuItemInner withCommandLineArguments(String commandLineArguments) { + this.commandLineArguments = commandLineArguments; + return this; + } + + /** + * Get the iconPath property: Path to the icon. + * + * @return the iconPath value. + */ + public String iconPath() { + return this.iconPath; + } + + /** + * Set the iconPath property: Path to the icon. + * + * @param iconPath the iconPath value to set. + * @return the StartMenuItemInner object itself. + */ + public StartMenuItemInner withIconPath(String iconPath) { + this.iconPath = iconPath; + return this; + } + + /** + * Get the iconIndex property: Index of the icon. + * + * @return the iconIndex value. + */ + public Integer iconIndex() { + return this.iconIndex; + } + + /** + * Set the iconIndex property: Index of the icon. + * + * @param iconIndex the iconIndex value to set. + * @return the StartMenuItemInner object itself. + */ + public StartMenuItemInner withIconIndex(Integer iconIndex) { + this.iconIndex = iconIndex; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/models/UserSessionInner.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/models/UserSessionInner.java new file mode 100644 index 0000000000000..bf4dc0a32a7af --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/models/UserSessionInner.java @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.desktopvirtualization.models.ApplicationType; +import com.azure.resourcemanager.desktopvirtualization.models.SessionState; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Represents a UserSession definition. */ +@JsonFlatten +@Fluent +public class UserSessionInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UserSessionInner.class); + + /* + * ObjectId of user session. (internal use) + */ + @JsonProperty(value = "properties.objectId", access = JsonProperty.Access.WRITE_ONLY) + private String objectId; + + /* + * The user principal name. + */ + @JsonProperty(value = "properties.userPrincipalName") + private String userPrincipalName; + + /* + * Application type of application. + */ + @JsonProperty(value = "properties.applicationType") + private ApplicationType applicationType; + + /* + * State of user session. + */ + @JsonProperty(value = "properties.sessionState") + private SessionState sessionState; + + /* + * The active directory user name. + */ + @JsonProperty(value = "properties.activeDirectoryUserName") + private String activeDirectoryUsername; + + /* + * The timestamp of the user session create. + */ + @JsonProperty(value = "properties.createTime") + private OffsetDateTime createTime; + + /** + * Get the objectId property: ObjectId of user session. (internal use). + * + * @return the objectId value. + */ + public String objectId() { + return this.objectId; + } + + /** + * Get the userPrincipalName property: The user principal name. + * + * @return the userPrincipalName value. + */ + public String userPrincipalName() { + return this.userPrincipalName; + } + + /** + * Set the userPrincipalName property: The user principal name. + * + * @param userPrincipalName the userPrincipalName value to set. + * @return the UserSessionInner object itself. + */ + public UserSessionInner withUserPrincipalName(String userPrincipalName) { + this.userPrincipalName = userPrincipalName; + return this; + } + + /** + * Get the applicationType property: Application type of application. + * + * @return the applicationType value. + */ + public ApplicationType applicationType() { + return this.applicationType; + } + + /** + * Set the applicationType property: Application type of application. + * + * @param applicationType the applicationType value to set. + * @return the UserSessionInner object itself. + */ + public UserSessionInner withApplicationType(ApplicationType applicationType) { + this.applicationType = applicationType; + return this; + } + + /** + * Get the sessionState property: State of user session. + * + * @return the sessionState value. + */ + public SessionState sessionState() { + return this.sessionState; + } + + /** + * Set the sessionState property: State of user session. + * + * @param sessionState the sessionState value to set. + * @return the UserSessionInner object itself. + */ + public UserSessionInner withSessionState(SessionState sessionState) { + this.sessionState = sessionState; + return this; + } + + /** + * Get the activeDirectoryUsername property: The active directory user name. + * + * @return the activeDirectoryUsername value. + */ + public String activeDirectoryUsername() { + return this.activeDirectoryUsername; + } + + /** + * Set the activeDirectoryUsername property: The active directory user name. + * + * @param activeDirectoryUsername the activeDirectoryUsername value to set. + * @return the UserSessionInner object itself. + */ + public UserSessionInner withActiveDirectoryUsername(String activeDirectoryUsername) { + this.activeDirectoryUsername = activeDirectoryUsername; + return this; + } + + /** + * Get the createTime property: The timestamp of the user session create. + * + * @return the createTime value. + */ + public OffsetDateTime createTime() { + return this.createTime; + } + + /** + * Set the createTime property: The timestamp of the user session create. + * + * @param createTime the createTime value to set. + * @return the UserSessionInner object itself. + */ + public UserSessionInner withCreateTime(OffsetDateTime createTime) { + this.createTime = createTime; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/models/WorkspaceInner.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/models/WorkspaceInner.java new file mode 100644 index 0000000000000..e2f1135bf3414 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/models/WorkspaceInner.java @@ -0,0 +1,191 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.desktopvirtualization.models.Identity; +import com.azure.resourcemanager.desktopvirtualization.models.Plan; +import com.azure.resourcemanager.desktopvirtualization.models.ResourceModelWithAllowedPropertySet; +import com.azure.resourcemanager.desktopvirtualization.models.Sku; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** Represents a Workspace definition. */ +@JsonFlatten +@Fluent +public class WorkspaceInner extends ResourceModelWithAllowedPropertySet { + @JsonIgnore private final ClientLogger logger = new ClientLogger(WorkspaceInner.class); + + /* + * ObjectId of Workspace. (internal use) + */ + @JsonProperty(value = "properties.objectId", access = JsonProperty.Access.WRITE_ONLY) + private String objectId; + + /* + * Description of Workspace. + */ + @JsonProperty(value = "properties.description") + private String description; + + /* + * Friendly name of Workspace. + */ + @JsonProperty(value = "properties.friendlyName") + private String friendlyName; + + /* + * List of applicationGroup resource Ids. + */ + @JsonProperty(value = "properties.applicationGroupReferences") + private List applicationGroupReferences; + + /* + * Is cloud pc resource. + */ + @JsonProperty(value = "properties.cloudPcResource", access = JsonProperty.Access.WRITE_ONLY) + private Boolean cloudPcResource; + + /** + * Get the objectId property: ObjectId of Workspace. (internal use). + * + * @return the objectId value. + */ + public String objectId() { + return this.objectId; + } + + /** + * Get the description property: Description of Workspace. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Description of Workspace. + * + * @param description the description value to set. + * @return the WorkspaceInner object itself. + */ + public WorkspaceInner withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the friendlyName property: Friendly name of Workspace. + * + * @return the friendlyName value. + */ + public String friendlyName() { + return this.friendlyName; + } + + /** + * Set the friendlyName property: Friendly name of Workspace. + * + * @param friendlyName the friendlyName value to set. + * @return the WorkspaceInner object itself. + */ + public WorkspaceInner withFriendlyName(String friendlyName) { + this.friendlyName = friendlyName; + return this; + } + + /** + * Get the applicationGroupReferences property: List of applicationGroup resource Ids. + * + * @return the applicationGroupReferences value. + */ + public List applicationGroupReferences() { + return this.applicationGroupReferences; + } + + /** + * Set the applicationGroupReferences property: List of applicationGroup resource Ids. + * + * @param applicationGroupReferences the applicationGroupReferences value to set. + * @return the WorkspaceInner object itself. + */ + public WorkspaceInner withApplicationGroupReferences(List applicationGroupReferences) { + this.applicationGroupReferences = applicationGroupReferences; + return this; + } + + /** + * Get the cloudPcResource property: Is cloud pc resource. + * + * @return the cloudPcResource value. + */ + public Boolean cloudPcResource() { + return this.cloudPcResource; + } + + /** {@inheritDoc} */ + @Override + public WorkspaceInner withManagedBy(String managedBy) { + super.withManagedBy(managedBy); + return this; + } + + /** {@inheritDoc} */ + @Override + public WorkspaceInner withKind(String kind) { + super.withKind(kind); + return this; + } + + /** {@inheritDoc} */ + @Override + public WorkspaceInner withIdentity(Identity identity) { + super.withIdentity(identity); + return this; + } + + /** {@inheritDoc} */ + @Override + public WorkspaceInner withSku(Sku sku) { + super.withSku(sku); + return this; + } + + /** {@inheritDoc} */ + @Override + public WorkspaceInner withPlan(Plan plan) { + super.withPlan(plan); + return this; + } + + /** {@inheritDoc} */ + @Override + public WorkspaceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public WorkspaceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/models/package-info.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/models/package-info.java new file mode 100644 index 0000000000000..54e0b1a1a6567 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/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 DesktopVirtualizationApiClient. null. */ +package com.azure.resourcemanager.desktopvirtualization.fluent.models; diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/package-info.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/package-info.java new file mode 100644 index 0000000000000..fd55e7d101254 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/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 DesktopVirtualizationApiClient. null. */ +package com.azure.resourcemanager.desktopvirtualization.fluent; diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/ApplicationGroupImpl.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/ApplicationGroupImpl.java new file mode 100644 index 0000000000000..7c4ba57f706a4 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/ApplicationGroupImpl.java @@ -0,0 +1,296 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.desktopvirtualization.DesktopVirtualizationManager; +import com.azure.resourcemanager.desktopvirtualization.fluent.models.ApplicationGroupInner; +import com.azure.resourcemanager.desktopvirtualization.models.ApplicationGroup; +import com.azure.resourcemanager.desktopvirtualization.models.ApplicationGroupPatch; +import com.azure.resourcemanager.desktopvirtualization.models.ApplicationGroupType; +import com.azure.resourcemanager.desktopvirtualization.models.Identity; +import com.azure.resourcemanager.desktopvirtualization.models.MigrationRequestProperties; +import com.azure.resourcemanager.desktopvirtualization.models.Plan; +import com.azure.resourcemanager.desktopvirtualization.models.Sku; +import java.util.Collections; +import java.util.Map; + +public final class ApplicationGroupImpl + implements ApplicationGroup, ApplicationGroup.Definition, ApplicationGroup.Update { + private ApplicationGroupInner innerObject; + + private final DesktopVirtualizationManager 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 String managedBy() { + return this.innerModel().managedBy(); + } + + public String kind() { + return this.innerModel().kind(); + } + + public String etag() { + return this.innerModel().etag(); + } + + public Identity identity() { + return this.innerModel().identity(); + } + + public Sku sku() { + return this.innerModel().sku(); + } + + public Plan plan() { + return this.innerModel().plan(); + } + + public String objectId() { + return this.innerModel().objectId(); + } + + public String description() { + return this.innerModel().description(); + } + + public String friendlyName() { + return this.innerModel().friendlyName(); + } + + public String hostPoolArmPath() { + return this.innerModel().hostPoolArmPath(); + } + + public String workspaceArmPath() { + return this.innerModel().workspaceArmPath(); + } + + public ApplicationGroupType applicationGroupType() { + return this.innerModel().applicationGroupType(); + } + + public MigrationRequestProperties migrationRequest() { + return this.innerModel().migrationRequest(); + } + + public Boolean cloudPcResource() { + return this.innerModel().cloudPcResource(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public ApplicationGroupInner innerModel() { + return this.innerObject; + } + + private DesktopVirtualizationManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String applicationGroupName; + + private ApplicationGroupPatch updateApplicationGroup; + + public ApplicationGroupImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public ApplicationGroup create() { + this.innerObject = + serviceManager + .serviceClient() + .getApplicationGroups() + .createOrUpdateWithResponse(resourceGroupName, applicationGroupName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public ApplicationGroup create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getApplicationGroups() + .createOrUpdateWithResponse(resourceGroupName, applicationGroupName, this.innerModel(), context) + .getValue(); + return this; + } + + ApplicationGroupImpl(String name, DesktopVirtualizationManager serviceManager) { + this.innerObject = new ApplicationGroupInner(); + this.serviceManager = serviceManager; + this.applicationGroupName = name; + } + + public ApplicationGroupImpl update() { + this.updateApplicationGroup = new ApplicationGroupPatch(); + return this; + } + + public ApplicationGroup apply() { + this.innerObject = + serviceManager + .serviceClient() + .getApplicationGroups() + .updateWithResponse(resourceGroupName, applicationGroupName, updateApplicationGroup, Context.NONE) + .getValue(); + return this; + } + + public ApplicationGroup apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getApplicationGroups() + .updateWithResponse(resourceGroupName, applicationGroupName, updateApplicationGroup, context) + .getValue(); + return this; + } + + ApplicationGroupImpl(ApplicationGroupInner innerObject, DesktopVirtualizationManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.applicationGroupName = Utils.getValueFromIdByName(innerObject.id(), "applicationGroups"); + } + + public ApplicationGroup refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getApplicationGroups() + .getByResourceGroupWithResponse(resourceGroupName, applicationGroupName, Context.NONE) + .getValue(); + return this; + } + + public ApplicationGroup refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getApplicationGroups() + .getByResourceGroupWithResponse(resourceGroupName, applicationGroupName, context) + .getValue(); + return this; + } + + public ApplicationGroupImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public ApplicationGroupImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public ApplicationGroupImpl withHostPoolArmPath(String hostPoolArmPath) { + this.innerModel().withHostPoolArmPath(hostPoolArmPath); + return this; + } + + public ApplicationGroupImpl withApplicationGroupType(ApplicationGroupType applicationGroupType) { + this.innerModel().withApplicationGroupType(applicationGroupType); + return this; + } + + public ApplicationGroupImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateApplicationGroup.withTags(tags); + return this; + } + } + + public ApplicationGroupImpl withManagedBy(String managedBy) { + this.innerModel().withManagedBy(managedBy); + return this; + } + + public ApplicationGroupImpl withKind(String kind) { + this.innerModel().withKind(kind); + return this; + } + + public ApplicationGroupImpl withIdentity(Identity identity) { + this.innerModel().withIdentity(identity); + return this; + } + + public ApplicationGroupImpl withSku(Sku sku) { + this.innerModel().withSku(sku); + return this; + } + + public ApplicationGroupImpl withPlan(Plan plan) { + this.innerModel().withPlan(plan); + return this; + } + + public ApplicationGroupImpl withDescription(String description) { + if (isInCreateMode()) { + this.innerModel().withDescription(description); + return this; + } else { + this.updateApplicationGroup.withDescription(description); + return this; + } + } + + public ApplicationGroupImpl withFriendlyName(String friendlyName) { + if (isInCreateMode()) { + this.innerModel().withFriendlyName(friendlyName); + return this; + } else { + this.updateApplicationGroup.withFriendlyName(friendlyName); + return this; + } + } + + public ApplicationGroupImpl withMigrationRequest(MigrationRequestProperties migrationRequest) { + this.innerModel().withMigrationRequest(migrationRequest); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/ApplicationGroupsClientImpl.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/ApplicationGroupsClientImpl.java new file mode 100644 index 0000000000000..4346aaaab9e3a --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/ApplicationGroupsClientImpl.java @@ -0,0 +1,1345 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.desktopvirtualization.fluent.ApplicationGroupsClient; +import com.azure.resourcemanager.desktopvirtualization.fluent.models.ApplicationGroupInner; +import com.azure.resourcemanager.desktopvirtualization.models.ApplicationGroupList; +import com.azure.resourcemanager.desktopvirtualization.models.ApplicationGroupPatch; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ApplicationGroupsClient. */ +public final class ApplicationGroupsClientImpl implements ApplicationGroupsClient { + private final ClientLogger logger = new ClientLogger(ApplicationGroupsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ApplicationGroupsService service; + + /** The service client containing this operation class. */ + private final DesktopVirtualizationApiClientImpl client; + + /** + * Initializes an instance of ApplicationGroupsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ApplicationGroupsClientImpl(DesktopVirtualizationApiClientImpl client) { + this.service = + RestProxy.create(ApplicationGroupsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DesktopVirtualizationApiClientApplicationGroups to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DesktopVirtualizatio") + private interface ApplicationGroupsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("applicationGroupName") String applicationGroupName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("applicationGroupName") String applicationGroupName, + @BodyParam("application/json") ApplicationGroupInner applicationGroup, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("applicationGroupName") String applicationGroupName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("applicationGroupName") String applicationGroupName, + @BodyParam("application/json") ApplicationGroupPatch applicationGroup, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.DesktopVirtualization/applicationGroups") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/applicationGroups") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get an application group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an application group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String applicationGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (applicationGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + applicationGroupName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get an application group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an application group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String applicationGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (applicationGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + applicationGroupName, + accept, + context); + } + + /** + * Get an application group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an application group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String applicationGroupName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, applicationGroupName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get an application group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an application group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApplicationGroupInner getByResourceGroup(String resourceGroupName, String applicationGroupName) { + return getByResourceGroupAsync(resourceGroupName, applicationGroupName).block(); + } + + /** + * Get an application group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an application group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String applicationGroupName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, applicationGroupName, context).block(); + } + + /** + * Create or update an applicationGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param applicationGroup Object containing ApplicationGroup definitions. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a ApplicationGroup definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String applicationGroupName, ApplicationGroupInner applicationGroup) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (applicationGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationGroupName is required and cannot be null.")); + } + if (applicationGroup == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationGroup is required and cannot be null.")); + } else { + applicationGroup.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + applicationGroupName, + applicationGroup, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create or update an applicationGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param applicationGroup Object containing ApplicationGroup definitions. + * @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 represents a ApplicationGroup definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String applicationGroupName, + ApplicationGroupInner applicationGroup, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (applicationGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationGroupName is required and cannot be null.")); + } + if (applicationGroup == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationGroup is required and cannot be null.")); + } else { + applicationGroup.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + applicationGroupName, + applicationGroup, + accept, + context); + } + + /** + * Create or update an applicationGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param applicationGroup Object containing ApplicationGroup definitions. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a ApplicationGroup definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String applicationGroupName, ApplicationGroupInner applicationGroup) { + return createOrUpdateWithResponseAsync(resourceGroupName, applicationGroupName, applicationGroup) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Create or update an applicationGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param applicationGroup Object containing ApplicationGroup definitions. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a ApplicationGroup definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApplicationGroupInner createOrUpdate( + String resourceGroupName, String applicationGroupName, ApplicationGroupInner applicationGroup) { + return createOrUpdateAsync(resourceGroupName, applicationGroupName, applicationGroup).block(); + } + + /** + * Create or update an applicationGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param applicationGroup Object containing ApplicationGroup definitions. + * @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 represents a ApplicationGroup definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String applicationGroupName, + ApplicationGroupInner applicationGroup, + Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, applicationGroupName, applicationGroup, context) + .block(); + } + + /** + * Remove an applicationGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String applicationGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (applicationGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + applicationGroupName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Remove an applicationGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String applicationGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (applicationGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + applicationGroupName, + accept, + context); + } + + /** + * Remove an applicationGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String applicationGroupName) { + return deleteWithResponseAsync(resourceGroupName, applicationGroupName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Remove an applicationGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String applicationGroupName) { + deleteAsync(resourceGroupName, applicationGroupName).block(); + } + + /** + * Remove an applicationGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @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 Response deleteWithResponse(String resourceGroupName, String applicationGroupName, Context context) { + return deleteWithResponseAsync(resourceGroupName, applicationGroupName, context).block(); + } + + /** + * Update an applicationGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param applicationGroup Object containing ApplicationGroup definitions. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a ApplicationGroup definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String applicationGroupName, ApplicationGroupPatch applicationGroup) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (applicationGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationGroupName is required and cannot be null.")); + } + if (applicationGroup != null) { + applicationGroup.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + applicationGroupName, + applicationGroup, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Update an applicationGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param applicationGroup Object containing ApplicationGroup definitions. + * @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 represents a ApplicationGroup definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String applicationGroupName, + ApplicationGroupPatch applicationGroup, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (applicationGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationGroupName is required and cannot be null.")); + } + if (applicationGroup != null) { + applicationGroup.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + applicationGroupName, + applicationGroup, + accept, + context); + } + + /** + * Update an applicationGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param applicationGroup Object containing ApplicationGroup definitions. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a ApplicationGroup definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String applicationGroupName, ApplicationGroupPatch applicationGroup) { + return updateWithResponseAsync(resourceGroupName, applicationGroupName, applicationGroup) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Update an applicationGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a ApplicationGroup definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String applicationGroupName) { + final ApplicationGroupPatch applicationGroup = null; + return updateWithResponseAsync(resourceGroupName, applicationGroupName, applicationGroup) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Update an applicationGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a ApplicationGroup definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApplicationGroupInner update(String resourceGroupName, String applicationGroupName) { + final ApplicationGroupPatch applicationGroup = null; + return updateAsync(resourceGroupName, applicationGroupName, applicationGroup).block(); + } + + /** + * Update an applicationGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param applicationGroup Object containing ApplicationGroup definitions. + * @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 represents a ApplicationGroup definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, + String applicationGroupName, + ApplicationGroupPatch applicationGroup, + Context context) { + return updateWithResponseAsync(resourceGroupName, applicationGroupName, applicationGroup, context).block(); + } + + /** + * List applicationGroups. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param filter OData filter expression. Valid properties for filtering are applicationGroupType. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of ApplicationGroup definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List applicationGroups. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param filter OData filter expression. Valid properties for filtering are applicationGroupType. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of ApplicationGroup definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, String filter, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + filter, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List applicationGroups. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param filter OData filter expression. Valid properties for filtering are applicationGroupType. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of ApplicationGroup definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, String filter) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, filter), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List applicationGroups. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of ApplicationGroup definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + final String filter = null; + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, filter), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List applicationGroups. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param filter OData filter expression. Valid properties for filtering are applicationGroupType. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of ApplicationGroup definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync( + String resourceGroupName, String filter, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, filter, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * List applicationGroups. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of ApplicationGroup definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + final String filter = null; + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, filter)); + } + + /** + * List applicationGroups. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param filter OData filter expression. Valid properties for filtering are applicationGroupType. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of ApplicationGroup definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup( + String resourceGroupName, String filter, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, filter, context)); + } + + /** + * List applicationGroups in subscription. + * + * @param filter OData filter expression. Valid properties for filtering are applicationGroupType. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of ApplicationGroup definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List applicationGroups in subscription. + * + * @param filter OData filter expression. Valid properties for filtering are applicationGroupType. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of ApplicationGroup definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String filter, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + filter, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List applicationGroups in subscription. + * + * @param filter OData filter expression. Valid properties for filtering are applicationGroupType. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of ApplicationGroup definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String filter) { + return new PagedFlux<>( + () -> listSinglePageAsync(filter), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List applicationGroups in 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 list of ApplicationGroup definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + final String filter = null; + return new PagedFlux<>( + () -> listSinglePageAsync(filter), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List applicationGroups in subscription. + * + * @param filter OData filter expression. Valid properties for filtering are applicationGroupType. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of ApplicationGroup definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String filter, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(filter, context), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * List applicationGroups in 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 list of ApplicationGroup definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + final String filter = null; + return new PagedIterable<>(listAsync(filter)); + } + + /** + * List applicationGroups in subscription. + * + * @param filter OData filter expression. Valid properties for filtering are applicationGroupType. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of ApplicationGroup definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String filter, Context context) { + return new PagedIterable<>(listAsync(filter, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of ApplicationGroup definitions. + */ + @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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of ApplicationGroup definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of ApplicationGroup definitions. + */ + @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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of ApplicationGroup definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/ApplicationGroupsImpl.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/ApplicationGroupsImpl.java new file mode 100644 index 0000000000000..cbea46ca89850 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/ApplicationGroupsImpl.java @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.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.desktopvirtualization.DesktopVirtualizationManager; +import com.azure.resourcemanager.desktopvirtualization.fluent.ApplicationGroupsClient; +import com.azure.resourcemanager.desktopvirtualization.fluent.models.ApplicationGroupInner; +import com.azure.resourcemanager.desktopvirtualization.models.ApplicationGroup; +import com.azure.resourcemanager.desktopvirtualization.models.ApplicationGroups; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ApplicationGroupsImpl implements ApplicationGroups { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ApplicationGroupsImpl.class); + + private final ApplicationGroupsClient innerClient; + + private final DesktopVirtualizationManager serviceManager; + + public ApplicationGroupsImpl(ApplicationGroupsClient innerClient, DesktopVirtualizationManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ApplicationGroup getByResourceGroup(String resourceGroupName, String applicationGroupName) { + ApplicationGroupInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, applicationGroupName); + if (inner != null) { + return new ApplicationGroupImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String applicationGroupName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, applicationGroupName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ApplicationGroupImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String applicationGroupName) { + this.serviceClient().delete(resourceGroupName, applicationGroupName); + } + + public Response deleteWithResponse(String resourceGroupName, String applicationGroupName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, applicationGroupName, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new ApplicationGroupImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup( + String resourceGroupName, String filter, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, filter, context); + return Utils.mapPage(inner, inner1 -> new ApplicationGroupImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new ApplicationGroupImpl(inner1, this.manager())); + } + + public PagedIterable list(String filter, Context context) { + PagedIterable inner = this.serviceClient().list(filter, context); + return Utils.mapPage(inner, inner1 -> new ApplicationGroupImpl(inner1, this.manager())); + } + + public ApplicationGroup getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String applicationGroupName = Utils.getValueFromIdByName(id, "applicationGroups"); + if (applicationGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'applicationGroups'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, applicationGroupName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String applicationGroupName = Utils.getValueFromIdByName(id, "applicationGroups"); + if (applicationGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'applicationGroups'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, applicationGroupName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String applicationGroupName = Utils.getValueFromIdByName(id, "applicationGroups"); + if (applicationGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'applicationGroups'.", id))); + } + this.deleteWithResponse(resourceGroupName, applicationGroupName, Context.NONE).getValue(); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String applicationGroupName = Utils.getValueFromIdByName(id, "applicationGroups"); + if (applicationGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'applicationGroups'.", id))); + } + return this.deleteWithResponse(resourceGroupName, applicationGroupName, context); + } + + private ApplicationGroupsClient serviceClient() { + return this.innerClient; + } + + private DesktopVirtualizationManager manager() { + return this.serviceManager; + } + + public ApplicationGroupImpl define(String name) { + return new ApplicationGroupImpl(name, this.manager()); + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/ApplicationImpl.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/ApplicationImpl.java new file mode 100644 index 0000000000000..61e178245110e --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/ApplicationImpl.java @@ -0,0 +1,312 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.desktopvirtualization.DesktopVirtualizationManager; +import com.azure.resourcemanager.desktopvirtualization.fluent.models.ApplicationInner; +import com.azure.resourcemanager.desktopvirtualization.models.Application; +import com.azure.resourcemanager.desktopvirtualization.models.ApplicationPatch; +import com.azure.resourcemanager.desktopvirtualization.models.CommandLineSetting; +import com.azure.resourcemanager.desktopvirtualization.models.RemoteApplicationType; +import java.util.Map; + +public final class ApplicationImpl implements Application, Application.Definition, Application.Update { + private ApplicationInner innerObject; + + private final DesktopVirtualizationManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String objectId() { + return this.innerModel().objectId(); + } + + public String description() { + return this.innerModel().description(); + } + + public String friendlyName() { + return this.innerModel().friendlyName(); + } + + public String filePath() { + return this.innerModel().filePath(); + } + + public String msixPackageFamilyName() { + return this.innerModel().msixPackageFamilyName(); + } + + public String msixPackageApplicationId() { + return this.innerModel().msixPackageApplicationId(); + } + + public RemoteApplicationType applicationType() { + return this.innerModel().applicationType(); + } + + public CommandLineSetting commandLineSetting() { + return this.innerModel().commandLineSetting(); + } + + public String commandLineArguments() { + return this.innerModel().commandLineArguments(); + } + + public Boolean showInPortal() { + return this.innerModel().showInPortal(); + } + + public String iconPath() { + return this.innerModel().iconPath(); + } + + public Integer iconIndex() { + return this.innerModel().iconIndex(); + } + + public String iconHash() { + return this.innerModel().iconHash(); + } + + public byte[] iconContent() { + return this.innerModel().iconContent(); + } + + public ApplicationInner innerModel() { + return this.innerObject; + } + + private DesktopVirtualizationManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String applicationGroupName; + + private String applicationName; + + private ApplicationPatch updateApplication; + + public ApplicationImpl withExistingApplicationGroup(String resourceGroupName, String applicationGroupName) { + this.resourceGroupName = resourceGroupName; + this.applicationGroupName = applicationGroupName; + return this; + } + + public Application create() { + this.innerObject = + serviceManager + .serviceClient() + .getApplications() + .createOrUpdateWithResponse( + resourceGroupName, applicationGroupName, applicationName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public Application create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getApplications() + .createOrUpdateWithResponse( + resourceGroupName, applicationGroupName, applicationName, this.innerModel(), context) + .getValue(); + return this; + } + + ApplicationImpl(String name, DesktopVirtualizationManager serviceManager) { + this.innerObject = new ApplicationInner(); + this.serviceManager = serviceManager; + this.applicationName = name; + } + + public ApplicationImpl update() { + this.updateApplication = new ApplicationPatch(); + return this; + } + + public Application apply() { + this.innerObject = + serviceManager + .serviceClient() + .getApplications() + .updateWithResponse( + resourceGroupName, applicationGroupName, applicationName, updateApplication, Context.NONE) + .getValue(); + return this; + } + + public Application apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getApplications() + .updateWithResponse( + resourceGroupName, applicationGroupName, applicationName, updateApplication, context) + .getValue(); + return this; + } + + ApplicationImpl(ApplicationInner innerObject, DesktopVirtualizationManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.applicationGroupName = Utils.getValueFromIdByName(innerObject.id(), "applicationGroups"); + this.applicationName = Utils.getValueFromIdByName(innerObject.id(), "applications"); + } + + public Application refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getApplications() + .getWithResponse(resourceGroupName, applicationGroupName, applicationName, Context.NONE) + .getValue(); + return this; + } + + public Application refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getApplications() + .getWithResponse(resourceGroupName, applicationGroupName, applicationName, context) + .getValue(); + return this; + } + + public ApplicationImpl withCommandLineSetting(CommandLineSetting commandLineSetting) { + if (isInCreateMode()) { + this.innerModel().withCommandLineSetting(commandLineSetting); + return this; + } else { + this.updateApplication.withCommandLineSetting(commandLineSetting); + return this; + } + } + + public ApplicationImpl withDescription(String description) { + if (isInCreateMode()) { + this.innerModel().withDescription(description); + return this; + } else { + this.updateApplication.withDescription(description); + return this; + } + } + + public ApplicationImpl withFriendlyName(String friendlyName) { + if (isInCreateMode()) { + this.innerModel().withFriendlyName(friendlyName); + return this; + } else { + this.updateApplication.withFriendlyName(friendlyName); + return this; + } + } + + public ApplicationImpl withFilePath(String filePath) { + if (isInCreateMode()) { + this.innerModel().withFilePath(filePath); + return this; + } else { + this.updateApplication.withFilePath(filePath); + return this; + } + } + + public ApplicationImpl withMsixPackageFamilyName(String msixPackageFamilyName) { + if (isInCreateMode()) { + this.innerModel().withMsixPackageFamilyName(msixPackageFamilyName); + return this; + } else { + this.updateApplication.withMsixPackageFamilyName(msixPackageFamilyName); + return this; + } + } + + public ApplicationImpl withMsixPackageApplicationId(String msixPackageApplicationId) { + if (isInCreateMode()) { + this.innerModel().withMsixPackageApplicationId(msixPackageApplicationId); + return this; + } else { + this.updateApplication.withMsixPackageApplicationId(msixPackageApplicationId); + return this; + } + } + + public ApplicationImpl withApplicationType(RemoteApplicationType applicationType) { + if (isInCreateMode()) { + this.innerModel().withApplicationType(applicationType); + return this; + } else { + this.updateApplication.withApplicationType(applicationType); + return this; + } + } + + public ApplicationImpl withCommandLineArguments(String commandLineArguments) { + if (isInCreateMode()) { + this.innerModel().withCommandLineArguments(commandLineArguments); + return this; + } else { + this.updateApplication.withCommandLineArguments(commandLineArguments); + return this; + } + } + + public ApplicationImpl withShowInPortal(Boolean showInPortal) { + if (isInCreateMode()) { + this.innerModel().withShowInPortal(showInPortal); + return this; + } else { + this.updateApplication.withShowInPortal(showInPortal); + return this; + } + } + + public ApplicationImpl withIconPath(String iconPath) { + if (isInCreateMode()) { + this.innerModel().withIconPath(iconPath); + return this; + } else { + this.updateApplication.withIconPath(iconPath); + return this; + } + } + + public ApplicationImpl withIconIndex(Integer iconIndex) { + if (isInCreateMode()) { + this.innerModel().withIconIndex(iconIndex); + return this; + } else { + this.updateApplication.withIconIndex(iconIndex); + return this; + } + } + + public ApplicationImpl withTags(Map tags) { + this.updateApplication.withTags(tags); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/ApplicationsClientImpl.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/ApplicationsClientImpl.java new file mode 100644 index 0000000000000..a665b699fe8ac --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/ApplicationsClientImpl.java @@ -0,0 +1,1150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.desktopvirtualization.fluent.ApplicationsClient; +import com.azure.resourcemanager.desktopvirtualization.fluent.models.ApplicationInner; +import com.azure.resourcemanager.desktopvirtualization.models.ApplicationList; +import com.azure.resourcemanager.desktopvirtualization.models.ApplicationPatch; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ApplicationsClient. */ +public final class ApplicationsClientImpl implements ApplicationsClient { + private final ClientLogger logger = new ClientLogger(ApplicationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ApplicationsService service; + + /** The service client containing this operation class. */ + private final DesktopVirtualizationApiClientImpl client; + + /** + * Initializes an instance of ApplicationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ApplicationsClientImpl(DesktopVirtualizationApiClientImpl client) { + this.service = + RestProxy.create(ApplicationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DesktopVirtualizationApiClientApplications to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DesktopVirtualizatio") + private interface ApplicationsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications" + + "/{applicationName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("applicationGroupName") String applicationGroupName, + @PathParam("applicationName") String applicationName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications" + + "/{applicationName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("applicationGroupName") String applicationGroupName, + @PathParam("applicationName") String applicationName, + @BodyParam("application/json") ApplicationInner application, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications" + + "/{applicationName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("applicationGroupName") String applicationGroupName, + @PathParam("applicationName") String applicationName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications" + + "/{applicationName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("applicationGroupName") String applicationGroupName, + @PathParam("applicationName") String applicationName, + @BodyParam("application/json") ApplicationPatch application, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("applicationGroupName") String applicationGroupName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get an application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param applicationName The name of the application within the specified application group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String applicationGroupName, String applicationName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (applicationGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationGroupName is required and cannot be null.")); + } + if (applicationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + applicationGroupName, + applicationName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get an application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param applicationName The name of the application within the specified application group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String applicationGroupName, String applicationName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (applicationGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationGroupName is required and cannot be null.")); + } + if (applicationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + applicationGroupName, + applicationName, + accept, + context); + } + + /** + * Get an application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param applicationName The name of the application within the specified application group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String applicationGroupName, String applicationName) { + return getWithResponseAsync(resourceGroupName, applicationGroupName, applicationName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get an application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param applicationName The name of the application within the specified application group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApplicationInner get(String resourceGroupName, String applicationGroupName, String applicationName) { + return getAsync(resourceGroupName, applicationGroupName, applicationName).block(); + } + + /** + * Get an application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param applicationName The name of the application within the specified application group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an application. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String applicationGroupName, String applicationName, Context context) { + return getWithResponseAsync(resourceGroupName, applicationGroupName, applicationName, context).block(); + } + + /** + * Create or update an application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param applicationName The name of the application within the specified application group. + * @param application Object containing Application definitions. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schema for Application properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String applicationGroupName, String applicationName, ApplicationInner application) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (applicationGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationGroupName is required and cannot be null.")); + } + if (applicationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationName is required and cannot be null.")); + } + if (application == null) { + return Mono.error(new IllegalArgumentException("Parameter application is required and cannot be null.")); + } else { + application.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + applicationGroupName, + applicationName, + application, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create or update an application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param applicationName The name of the application within the specified application group. + * @param application Object containing Application definitions. + * @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 schema for Application properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String applicationGroupName, + String applicationName, + ApplicationInner application, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (applicationGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationGroupName is required and cannot be null.")); + } + if (applicationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationName is required and cannot be null.")); + } + if (application == null) { + return Mono.error(new IllegalArgumentException("Parameter application is required and cannot be null.")); + } else { + application.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + applicationGroupName, + applicationName, + application, + accept, + context); + } + + /** + * Create or update an application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param applicationName The name of the application within the specified application group. + * @param application Object containing Application definitions. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schema for Application properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String applicationGroupName, String applicationName, ApplicationInner application) { + return createOrUpdateWithResponseAsync(resourceGroupName, applicationGroupName, applicationName, application) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Create or update an application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param applicationName The name of the application within the specified application group. + * @param application Object containing Application definitions. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schema for Application properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApplicationInner createOrUpdate( + String resourceGroupName, String applicationGroupName, String applicationName, ApplicationInner application) { + return createOrUpdateAsync(resourceGroupName, applicationGroupName, applicationName, application).block(); + } + + /** + * Create or update an application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param applicationName The name of the application within the specified application group. + * @param application Object containing Application definitions. + * @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 schema for Application properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String applicationGroupName, + String applicationName, + ApplicationInner application, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, applicationGroupName, applicationName, application, context) + .block(); + } + + /** + * Remove an application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param applicationName The name of the application within the specified application group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String applicationGroupName, String applicationName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (applicationGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationGroupName is required and cannot be null.")); + } + if (applicationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + applicationGroupName, + applicationName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Remove an application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param applicationName The name of the application within the specified application group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String applicationGroupName, String applicationName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (applicationGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationGroupName is required and cannot be null.")); + } + if (applicationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + applicationGroupName, + applicationName, + accept, + context); + } + + /** + * Remove an application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param applicationName The name of the application within the specified application group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String applicationGroupName, String applicationName) { + return deleteWithResponseAsync(resourceGroupName, applicationGroupName, applicationName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Remove an application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param applicationName The name of the application within the specified application group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String applicationGroupName, String applicationName) { + deleteAsync(resourceGroupName, applicationGroupName, applicationName).block(); + } + + /** + * Remove an application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param applicationName The name of the application within the specified application group. + * @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 Response deleteWithResponse( + String resourceGroupName, String applicationGroupName, String applicationName, Context context) { + return deleteWithResponseAsync(resourceGroupName, applicationGroupName, applicationName, context).block(); + } + + /** + * Update an application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param applicationName The name of the application within the specified application group. + * @param application Object containing Application definitions. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schema for Application properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String applicationGroupName, String applicationName, ApplicationPatch application) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (applicationGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationGroupName is required and cannot be null.")); + } + if (applicationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationName is required and cannot be null.")); + } + if (application != null) { + application.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + applicationGroupName, + applicationName, + application, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Update an application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param applicationName The name of the application within the specified application group. + * @param application Object containing Application definitions. + * @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 schema for Application properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String applicationGroupName, + String applicationName, + ApplicationPatch application, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (applicationGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationGroupName is required and cannot be null.")); + } + if (applicationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationName is required and cannot be null.")); + } + if (application != null) { + application.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + applicationGroupName, + applicationName, + application, + accept, + context); + } + + /** + * Update an application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param applicationName The name of the application within the specified application group. + * @param application Object containing Application definitions. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schema for Application properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String applicationGroupName, String applicationName, ApplicationPatch application) { + return updateWithResponseAsync(resourceGroupName, applicationGroupName, applicationName, application) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Update an application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param applicationName The name of the application within the specified application group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schema for Application properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String applicationGroupName, String applicationName) { + final ApplicationPatch application = null; + return updateWithResponseAsync(resourceGroupName, applicationGroupName, applicationName, application) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Update an application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param applicationName The name of the application within the specified application group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schema for Application properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApplicationInner update(String resourceGroupName, String applicationGroupName, String applicationName) { + final ApplicationPatch application = null; + return updateAsync(resourceGroupName, applicationGroupName, applicationName, application).block(); + } + + /** + * Update an application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param applicationName The name of the application within the specified application group. + * @param application Object containing Application definitions. + * @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 schema for Application properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, + String applicationGroupName, + String applicationName, + ApplicationPatch application, + Context context) { + return updateWithResponseAsync(resourceGroupName, applicationGroupName, applicationName, application, context) + .block(); + } + + /** + * List applications. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Application definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String applicationGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (applicationGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + applicationGroupName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List applications. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Application definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String applicationGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (applicationGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + applicationGroupName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List applications. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Application definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String applicationGroupName) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, applicationGroupName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List applications. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Application definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String applicationGroupName, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, applicationGroupName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List applications. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Application definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String applicationGroupName) { + return new PagedIterable<>(listAsync(resourceGroupName, applicationGroupName)); + } + + /** + * List applications. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Application definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, String applicationGroupName, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, applicationGroupName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Application definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Application definitions. + */ + @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/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/ApplicationsImpl.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/ApplicationsImpl.java new file mode 100644 index 0000000000000..bfac058c181fa --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/ApplicationsImpl.java @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.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.desktopvirtualization.DesktopVirtualizationManager; +import com.azure.resourcemanager.desktopvirtualization.fluent.ApplicationsClient; +import com.azure.resourcemanager.desktopvirtualization.fluent.models.ApplicationInner; +import com.azure.resourcemanager.desktopvirtualization.models.Application; +import com.azure.resourcemanager.desktopvirtualization.models.Applications; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ApplicationsImpl implements Applications { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ApplicationsImpl.class); + + private final ApplicationsClient innerClient; + + private final DesktopVirtualizationManager serviceManager; + + public ApplicationsImpl(ApplicationsClient innerClient, DesktopVirtualizationManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Application get(String resourceGroupName, String applicationGroupName, String applicationName) { + ApplicationInner inner = this.serviceClient().get(resourceGroupName, applicationGroupName, applicationName); + if (inner != null) { + return new ApplicationImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String applicationGroupName, String applicationName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, applicationGroupName, applicationName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ApplicationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String applicationGroupName, String applicationName) { + this.serviceClient().delete(resourceGroupName, applicationGroupName, applicationName); + } + + public Response deleteWithResponse( + String resourceGroupName, String applicationGroupName, String applicationName, Context context) { + return this + .serviceClient() + .deleteWithResponse(resourceGroupName, applicationGroupName, applicationName, context); + } + + public PagedIterable list(String resourceGroupName, String applicationGroupName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, applicationGroupName); + return Utils.mapPage(inner, inner1 -> new ApplicationImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String applicationGroupName, Context context) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, applicationGroupName, context); + return Utils.mapPage(inner, inner1 -> new ApplicationImpl(inner1, this.manager())); + } + + public Application getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String applicationGroupName = Utils.getValueFromIdByName(id, "applicationGroups"); + if (applicationGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'applicationGroups'.", id))); + } + String applicationName = Utils.getValueFromIdByName(id, "applications"); + if (applicationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'applications'.", id))); + } + return this.getWithResponse(resourceGroupName, applicationGroupName, applicationName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String applicationGroupName = Utils.getValueFromIdByName(id, "applicationGroups"); + if (applicationGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'applicationGroups'.", id))); + } + String applicationName = Utils.getValueFromIdByName(id, "applications"); + if (applicationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'applications'.", id))); + } + return this.getWithResponse(resourceGroupName, applicationGroupName, applicationName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String applicationGroupName = Utils.getValueFromIdByName(id, "applicationGroups"); + if (applicationGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'applicationGroups'.", id))); + } + String applicationName = Utils.getValueFromIdByName(id, "applications"); + if (applicationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'applications'.", id))); + } + this.deleteWithResponse(resourceGroupName, applicationGroupName, applicationName, Context.NONE).getValue(); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String applicationGroupName = Utils.getValueFromIdByName(id, "applicationGroups"); + if (applicationGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'applicationGroups'.", id))); + } + String applicationName = Utils.getValueFromIdByName(id, "applications"); + if (applicationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'applications'.", id))); + } + return this.deleteWithResponse(resourceGroupName, applicationGroupName, applicationName, context); + } + + private ApplicationsClient serviceClient() { + return this.innerClient; + } + + private DesktopVirtualizationManager manager() { + return this.serviceManager; + } + + public ApplicationImpl define(String name) { + return new ApplicationImpl(name, this.manager()); + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/DesktopImpl.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/DesktopImpl.java new file mode 100644 index 0000000000000..72bdf224c3112 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/DesktopImpl.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.desktopvirtualization.implementation; + +import com.azure.resourcemanager.desktopvirtualization.DesktopVirtualizationManager; +import com.azure.resourcemanager.desktopvirtualization.fluent.models.DesktopInner; +import com.azure.resourcemanager.desktopvirtualization.models.Desktop; + +public final class DesktopImpl implements Desktop { + private DesktopInner innerObject; + + private final DesktopVirtualizationManager serviceManager; + + DesktopImpl(DesktopInner innerObject, DesktopVirtualizationManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String objectId() { + return this.innerModel().objectId(); + } + + public String description() { + return this.innerModel().description(); + } + + public String friendlyName() { + return this.innerModel().friendlyName(); + } + + public String iconHash() { + return this.innerModel().iconHash(); + } + + public byte[] iconContent() { + return this.innerModel().iconContent(); + } + + public DesktopInner innerModel() { + return this.innerObject; + } + + private DesktopVirtualizationManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/DesktopListImpl.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/DesktopListImpl.java new file mode 100644 index 0000000000000..f6563aa400bfe --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/DesktopListImpl.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.implementation; + +import com.azure.resourcemanager.desktopvirtualization.DesktopVirtualizationManager; +import com.azure.resourcemanager.desktopvirtualization.fluent.models.DesktopInner; +import com.azure.resourcemanager.desktopvirtualization.fluent.models.DesktopListInner; +import com.azure.resourcemanager.desktopvirtualization.models.Desktop; +import com.azure.resourcemanager.desktopvirtualization.models.DesktopList; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class DesktopListImpl implements DesktopList { + private DesktopListInner innerObject; + + private final DesktopVirtualizationManager serviceManager; + + DesktopListImpl(DesktopListInner innerObject, DesktopVirtualizationManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List value() { + List inner = this.innerModel().value(); + if (inner != null) { + return Collections + .unmodifiableList( + inner.stream().map(inner1 -> new DesktopImpl(inner1, this.manager())).collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public String nextLink() { + return this.innerModel().nextLink(); + } + + public DesktopListInner innerModel() { + return this.innerObject; + } + + private DesktopVirtualizationManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/DesktopVirtualizationApiClientBuilder.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/DesktopVirtualizationApiClientBuilder.java new file mode 100644 index 0000000000000..5c4a630c575d0 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/DesktopVirtualizationApiClientBuilder.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.desktopvirtualization.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 DesktopVirtualizationApiClientImpl type. */ +@ServiceClientBuilder(serviceClients = {DesktopVirtualizationApiClientImpl.class}) +public final class DesktopVirtualizationApiClientBuilder { + /* + * The ID of the target subscription. + */ + private String subscriptionId; + + /** + * Sets The ID of the target subscription. + * + * @param subscriptionId the subscriptionId value. + * @return the DesktopVirtualizationApiClientBuilder. + */ + public DesktopVirtualizationApiClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the DesktopVirtualizationApiClientBuilder. + */ + public DesktopVirtualizationApiClientBuilder 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 DesktopVirtualizationApiClientBuilder. + */ + public DesktopVirtualizationApiClientBuilder 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 DesktopVirtualizationApiClientBuilder. + */ + public DesktopVirtualizationApiClientBuilder 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 DesktopVirtualizationApiClientBuilder. + */ + public DesktopVirtualizationApiClientBuilder 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 DesktopVirtualizationApiClientBuilder. + */ + public DesktopVirtualizationApiClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of DesktopVirtualizationApiClientImpl with the provided parameters. + * + * @return an instance of DesktopVirtualizationApiClientImpl. + */ + public DesktopVirtualizationApiClientImpl buildClient() { + if (endpoint == null) { + this.endpoint = "https://management.azure.com"; + } + if (environment == null) { + this.environment = AzureEnvironment.AZURE; + } + if (defaultPollInterval == null) { + this.defaultPollInterval = Duration.ofSeconds(30); + } + if (pipeline == null) { + this.pipeline = + new HttpPipelineBuilder() + .policies(new UserAgentPolicy(), new RetryPolicy(), new CookiePolicy()) + .build(); + } + if (serializerAdapter == null) { + this.serializerAdapter = SerializerFactory.createDefaultManagementSerializerAdapter(); + } + DesktopVirtualizationApiClientImpl client = + new DesktopVirtualizationApiClientImpl( + pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + return client; + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/DesktopVirtualizationApiClientImpl.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/DesktopVirtualizationApiClientImpl.java new file mode 100644 index 0000000000000..583e89047c7f1 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/DesktopVirtualizationApiClientImpl.java @@ -0,0 +1,447 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.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.desktopvirtualization.fluent.ApplicationGroupsClient; +import com.azure.resourcemanager.desktopvirtualization.fluent.ApplicationsClient; +import com.azure.resourcemanager.desktopvirtualization.fluent.DesktopVirtualizationApiClient; +import com.azure.resourcemanager.desktopvirtualization.fluent.DesktopsClient; +import com.azure.resourcemanager.desktopvirtualization.fluent.HostPoolsClient; +import com.azure.resourcemanager.desktopvirtualization.fluent.MsixImagesClient; +import com.azure.resourcemanager.desktopvirtualization.fluent.MsixPackagesClient; +import com.azure.resourcemanager.desktopvirtualization.fluent.OperationsClient; +import com.azure.resourcemanager.desktopvirtualization.fluent.ScalingPlansClient; +import com.azure.resourcemanager.desktopvirtualization.fluent.SessionHostsClient; +import com.azure.resourcemanager.desktopvirtualization.fluent.StartMenuItemsClient; +import com.azure.resourcemanager.desktopvirtualization.fluent.UserSessionsClient; +import com.azure.resourcemanager.desktopvirtualization.fluent.WorkspacesClient; +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 DesktopVirtualizationApiClientImpl type. */ +@ServiceClient(builder = DesktopVirtualizationApiClientBuilder.class) +public final class DesktopVirtualizationApiClientImpl implements DesktopVirtualizationApiClient { + private final ClientLogger logger = new ClientLogger(DesktopVirtualizationApiClientImpl.class); + + /** The ID of the target subscription. */ + private final String subscriptionId; + + /** + * Gets The ID of the target subscription. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** server parameter. */ + private final String endpoint; + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** Api Version. */ + private final String apiVersion; + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** The HTTP pipeline to send requests through. */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** The serializer to serialize an object into a string. */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** The default poll interval for long-running operation. */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** The OperationsClient object to access its operations. */ + private final OperationsClient operations; + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + public OperationsClient getOperations() { + return this.operations; + } + + /** The WorkspacesClient object to access its operations. */ + private final WorkspacesClient workspaces; + + /** + * Gets the WorkspacesClient object to access its operations. + * + * @return the WorkspacesClient object. + */ + public WorkspacesClient getWorkspaces() { + return this.workspaces; + } + + /** The ScalingPlansClient object to access its operations. */ + private final ScalingPlansClient scalingPlans; + + /** + * Gets the ScalingPlansClient object to access its operations. + * + * @return the ScalingPlansClient object. + */ + public ScalingPlansClient getScalingPlans() { + return this.scalingPlans; + } + + /** The ApplicationGroupsClient object to access its operations. */ + private final ApplicationGroupsClient applicationGroups; + + /** + * Gets the ApplicationGroupsClient object to access its operations. + * + * @return the ApplicationGroupsClient object. + */ + public ApplicationGroupsClient getApplicationGroups() { + return this.applicationGroups; + } + + /** The StartMenuItemsClient object to access its operations. */ + private final StartMenuItemsClient startMenuItems; + + /** + * Gets the StartMenuItemsClient object to access its operations. + * + * @return the StartMenuItemsClient object. + */ + public StartMenuItemsClient getStartMenuItems() { + return this.startMenuItems; + } + + /** The ApplicationsClient object to access its operations. */ + private final ApplicationsClient applications; + + /** + * Gets the ApplicationsClient object to access its operations. + * + * @return the ApplicationsClient object. + */ + public ApplicationsClient getApplications() { + return this.applications; + } + + /** The DesktopsClient object to access its operations. */ + private final DesktopsClient desktops; + + /** + * Gets the DesktopsClient object to access its operations. + * + * @return the DesktopsClient object. + */ + public DesktopsClient getDesktops() { + return this.desktops; + } + + /** The HostPoolsClient object to access its operations. */ + private final HostPoolsClient hostPools; + + /** + * Gets the HostPoolsClient object to access its operations. + * + * @return the HostPoolsClient object. + */ + public HostPoolsClient getHostPools() { + return this.hostPools; + } + + /** The UserSessionsClient object to access its operations. */ + private final UserSessionsClient userSessions; + + /** + * Gets the UserSessionsClient object to access its operations. + * + * @return the UserSessionsClient object. + */ + public UserSessionsClient getUserSessions() { + return this.userSessions; + } + + /** The SessionHostsClient object to access its operations. */ + private final SessionHostsClient sessionHosts; + + /** + * Gets the SessionHostsClient object to access its operations. + * + * @return the SessionHostsClient object. + */ + public SessionHostsClient getSessionHosts() { + return this.sessionHosts; + } + + /** The MsixPackagesClient object to access its operations. */ + private final MsixPackagesClient msixPackages; + + /** + * Gets the MsixPackagesClient object to access its operations. + * + * @return the MsixPackagesClient object. + */ + public MsixPackagesClient getMsixPackages() { + return this.msixPackages; + } + + /** The MsixImagesClient object to access its operations. */ + private final MsixImagesClient msixImages; + + /** + * Gets the MsixImagesClient object to access its operations. + * + * @return the MsixImagesClient object. + */ + public MsixImagesClient getMsixImages() { + return this.msixImages; + } + + /** + * Initializes an instance of DesktopVirtualizationApiClient 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 ID of the target subscription. + * @param endpoint server parameter. + */ + DesktopVirtualizationApiClientImpl( + 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-02-01-preview"; + this.operations = new OperationsClientImpl(this); + this.workspaces = new WorkspacesClientImpl(this); + this.scalingPlans = new ScalingPlansClientImpl(this); + this.applicationGroups = new ApplicationGroupsClientImpl(this); + this.startMenuItems = new StartMenuItemsClientImpl(this); + this.applications = new ApplicationsClientImpl(this); + this.desktops = new DesktopsClientImpl(this); + this.hostPools = new HostPoolsClientImpl(this); + this.userSessions = new UserSessionsClientImpl(this); + this.sessionHosts = new SessionHostsClientImpl(this); + this.msixPackages = new MsixPackagesClientImpl(this); + this.msixImages = new MsixImagesClientImpl(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/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/DesktopsClientImpl.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/DesktopsClientImpl.java new file mode 100644 index 0000000000000..1255a8489a7dc --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/DesktopsClientImpl.java @@ -0,0 +1,634 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.implementation; + +import com.azure.core.annotation.BodyParam; +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.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.desktopvirtualization.fluent.DesktopsClient; +import com.azure.resourcemanager.desktopvirtualization.fluent.models.DesktopInner; +import com.azure.resourcemanager.desktopvirtualization.fluent.models.DesktopListInner; +import com.azure.resourcemanager.desktopvirtualization.models.DesktopPatch; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in DesktopsClient. */ +public final class DesktopsClientImpl implements DesktopsClient { + private final ClientLogger logger = new ClientLogger(DesktopsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final DesktopsService service; + + /** The service client containing this operation class. */ + private final DesktopVirtualizationApiClientImpl client; + + /** + * Initializes an instance of DesktopsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DesktopsClientImpl(DesktopVirtualizationApiClientImpl client) { + this.service = RestProxy.create(DesktopsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DesktopVirtualizationApiClientDesktops to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DesktopVirtualizatio") + private interface DesktopsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/desktops/{desktopName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("applicationGroupName") String applicationGroupName, + @PathParam("desktopName") String desktopName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/desktops/{desktopName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("applicationGroupName") String applicationGroupName, + @PathParam("desktopName") String desktopName, + @BodyParam("application/json") DesktopPatch desktop, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/desktops") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("applicationGroupName") String applicationGroupName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get a desktop. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param desktopName The name of the desktop within the specified desktop group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a desktop. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String applicationGroupName, String desktopName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (applicationGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationGroupName is required and cannot be null.")); + } + if (desktopName == null) { + return Mono.error(new IllegalArgumentException("Parameter desktopName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + applicationGroupName, + desktopName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get a desktop. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param desktopName The name of the desktop within the specified desktop group. + * @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 desktop. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String applicationGroupName, String desktopName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (applicationGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationGroupName is required and cannot be null.")); + } + if (desktopName == null) { + return Mono.error(new IllegalArgumentException("Parameter desktopName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + applicationGroupName, + desktopName, + accept, + context); + } + + /** + * Get a desktop. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param desktopName The name of the desktop within the specified desktop group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a desktop. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String applicationGroupName, String desktopName) { + return getWithResponseAsync(resourceGroupName, applicationGroupName, desktopName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get a desktop. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param desktopName The name of the desktop within the specified desktop group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a desktop. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DesktopInner get(String resourceGroupName, String applicationGroupName, String desktopName) { + return getAsync(resourceGroupName, applicationGroupName, desktopName).block(); + } + + /** + * Get a desktop. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param desktopName The name of the desktop within the specified desktop group. + * @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 desktop. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String applicationGroupName, String desktopName, Context context) { + return getWithResponseAsync(resourceGroupName, applicationGroupName, desktopName, context).block(); + } + + /** + * Update a desktop. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param desktopName The name of the desktop within the specified desktop group. + * @param desktop Object containing Desktop definitions. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schema for Desktop properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String applicationGroupName, String desktopName, DesktopPatch desktop) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (applicationGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationGroupName is required and cannot be null.")); + } + if (desktopName == null) { + return Mono.error(new IllegalArgumentException("Parameter desktopName is required and cannot be null.")); + } + if (desktop != null) { + desktop.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + applicationGroupName, + desktopName, + desktop, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Update a desktop. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param desktopName The name of the desktop within the specified desktop group. + * @param desktop Object containing Desktop definitions. + * @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 schema for Desktop properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String applicationGroupName, + String desktopName, + DesktopPatch desktop, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (applicationGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationGroupName is required and cannot be null.")); + } + if (desktopName == null) { + return Mono.error(new IllegalArgumentException("Parameter desktopName is required and cannot be null.")); + } + if (desktop != null) { + desktop.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + applicationGroupName, + desktopName, + desktop, + accept, + context); + } + + /** + * Update a desktop. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param desktopName The name of the desktop within the specified desktop group. + * @param desktop Object containing Desktop definitions. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schema for Desktop properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String applicationGroupName, String desktopName, DesktopPatch desktop) { + return updateWithResponseAsync(resourceGroupName, applicationGroupName, desktopName, desktop) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Update a desktop. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param desktopName The name of the desktop within the specified desktop group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schema for Desktop properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String applicationGroupName, String desktopName) { + final DesktopPatch desktop = null; + return updateWithResponseAsync(resourceGroupName, applicationGroupName, desktopName, desktop) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Update a desktop. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param desktopName The name of the desktop within the specified desktop group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schema for Desktop properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DesktopInner update(String resourceGroupName, String applicationGroupName, String desktopName) { + final DesktopPatch desktop = null; + return updateAsync(resourceGroupName, applicationGroupName, desktopName, desktop).block(); + } + + /** + * Update a desktop. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param desktopName The name of the desktop within the specified desktop group. + * @param desktop Object containing Desktop definitions. + * @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 schema for Desktop properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, + String applicationGroupName, + String desktopName, + DesktopPatch desktop, + Context context) { + return updateWithResponseAsync(resourceGroupName, applicationGroupName, desktopName, desktop, context).block(); + } + + /** + * List desktops. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Desktop definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync( + String resourceGroupName, String applicationGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (applicationGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + applicationGroupName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List desktops. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Desktop definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync( + String resourceGroupName, String applicationGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (applicationGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + applicationGroupName, + accept, + context); + } + + /** + * List desktops. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Desktop definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listAsync(String resourceGroupName, String applicationGroupName) { + return listWithResponseAsync(resourceGroupName, applicationGroupName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * List desktops. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Desktop definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DesktopListInner list(String resourceGroupName, String applicationGroupName) { + return listAsync(resourceGroupName, applicationGroupName).block(); + } + + /** + * List desktops. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Desktop definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse( + String resourceGroupName, String applicationGroupName, Context context) { + return listWithResponseAsync(resourceGroupName, applicationGroupName, context).block(); + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/DesktopsImpl.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/DesktopsImpl.java new file mode 100644 index 0000000000000..82d4f89005c9b --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/DesktopsImpl.java @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.desktopvirtualization.DesktopVirtualizationManager; +import com.azure.resourcemanager.desktopvirtualization.fluent.DesktopsClient; +import com.azure.resourcemanager.desktopvirtualization.fluent.models.DesktopInner; +import com.azure.resourcemanager.desktopvirtualization.fluent.models.DesktopListInner; +import com.azure.resourcemanager.desktopvirtualization.models.Desktop; +import com.azure.resourcemanager.desktopvirtualization.models.DesktopList; +import com.azure.resourcemanager.desktopvirtualization.models.DesktopPatch; +import com.azure.resourcemanager.desktopvirtualization.models.Desktops; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class DesktopsImpl implements Desktops { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DesktopsImpl.class); + + private final DesktopsClient innerClient; + + private final DesktopVirtualizationManager serviceManager; + + public DesktopsImpl(DesktopsClient innerClient, DesktopVirtualizationManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Desktop get(String resourceGroupName, String applicationGroupName, String desktopName) { + DesktopInner inner = this.serviceClient().get(resourceGroupName, applicationGroupName, desktopName); + if (inner != null) { + return new DesktopImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String applicationGroupName, String desktopName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, applicationGroupName, desktopName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DesktopImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Desktop update(String resourceGroupName, String applicationGroupName, String desktopName) { + DesktopInner inner = this.serviceClient().update(resourceGroupName, applicationGroupName, desktopName); + if (inner != null) { + return new DesktopImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response updateWithResponse( + String resourceGroupName, + String applicationGroupName, + String desktopName, + DesktopPatch desktop, + Context context) { + Response inner = + this + .serviceClient() + .updateWithResponse(resourceGroupName, applicationGroupName, desktopName, desktop, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DesktopImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DesktopList list(String resourceGroupName, String applicationGroupName) { + DesktopListInner inner = this.serviceClient().list(resourceGroupName, applicationGroupName); + if (inner != null) { + return new DesktopListImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listWithResponse( + String resourceGroupName, String applicationGroupName, Context context) { + Response inner = + this.serviceClient().listWithResponse(resourceGroupName, applicationGroupName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DesktopListImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private DesktopsClient serviceClient() { + return this.innerClient; + } + + private DesktopVirtualizationManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/ExpandMsixImageImpl.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/ExpandMsixImageImpl.java new file mode 100644 index 0000000000000..12ff528fd8b73 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/ExpandMsixImageImpl.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.implementation; + +import com.azure.resourcemanager.desktopvirtualization.DesktopVirtualizationManager; +import com.azure.resourcemanager.desktopvirtualization.fluent.models.ExpandMsixImageInner; +import com.azure.resourcemanager.desktopvirtualization.models.ExpandMsixImage; +import com.azure.resourcemanager.desktopvirtualization.models.MsixPackageApplications; +import com.azure.resourcemanager.desktopvirtualization.models.MsixPackageDependencies; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; + +public final class ExpandMsixImageImpl implements ExpandMsixImage { + private ExpandMsixImageInner innerObject; + + private final DesktopVirtualizationManager serviceManager; + + ExpandMsixImageImpl(ExpandMsixImageInner innerObject, DesktopVirtualizationManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String packageAlias() { + return this.innerModel().packageAlias(); + } + + public String imagePath() { + return this.innerModel().imagePath(); + } + + public String packageName() { + return this.innerModel().packageName(); + } + + public String packageFamilyName() { + return this.innerModel().packageFamilyName(); + } + + public String packageFullName() { + return this.innerModel().packageFullName(); + } + + public String displayName() { + return this.innerModel().displayName(); + } + + public String packageRelativePath() { + return this.innerModel().packageRelativePath(); + } + + public Boolean isRegularRegistration() { + return this.innerModel().isRegularRegistration(); + } + + public Boolean isActive() { + return this.innerModel().isActive(); + } + + public List packageDependencies() { + List inner = this.innerModel().packageDependencies(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String version() { + return this.innerModel().version(); + } + + public OffsetDateTime lastUpdated() { + return this.innerModel().lastUpdated(); + } + + public List packageApplications() { + List inner = this.innerModel().packageApplications(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public ExpandMsixImageInner innerModel() { + return this.innerObject; + } + + private DesktopVirtualizationManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/HostPoolImpl.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/HostPoolImpl.java new file mode 100644 index 0000000000000..f03a110a4c92f --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/HostPoolImpl.java @@ -0,0 +1,511 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.desktopvirtualization.DesktopVirtualizationManager; +import com.azure.resourcemanager.desktopvirtualization.fluent.models.HostPoolInner; +import com.azure.resourcemanager.desktopvirtualization.fluent.models.RegistrationInfoInner; +import com.azure.resourcemanager.desktopvirtualization.models.HostPool; +import com.azure.resourcemanager.desktopvirtualization.models.HostPoolPatch; +import com.azure.resourcemanager.desktopvirtualization.models.HostPoolType; +import com.azure.resourcemanager.desktopvirtualization.models.Identity; +import com.azure.resourcemanager.desktopvirtualization.models.LoadBalancerType; +import com.azure.resourcemanager.desktopvirtualization.models.MigrationRequestProperties; +import com.azure.resourcemanager.desktopvirtualization.models.PersonalDesktopAssignmentType; +import com.azure.resourcemanager.desktopvirtualization.models.Plan; +import com.azure.resourcemanager.desktopvirtualization.models.PreferredAppGroupType; +import com.azure.resourcemanager.desktopvirtualization.models.RegistrationInfo; +import com.azure.resourcemanager.desktopvirtualization.models.RegistrationInfoPatch; +import com.azure.resourcemanager.desktopvirtualization.models.Sku; +import com.azure.resourcemanager.desktopvirtualization.models.SsoSecretType; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class HostPoolImpl implements HostPool, HostPool.Definition, HostPool.Update { + private HostPoolInner innerObject; + + private final DesktopVirtualizationManager 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 String managedBy() { + return this.innerModel().managedBy(); + } + + public String kind() { + return this.innerModel().kind(); + } + + public String etag() { + return this.innerModel().etag(); + } + + public Identity identity() { + return this.innerModel().identity(); + } + + public Sku sku() { + return this.innerModel().sku(); + } + + public Plan plan() { + return this.innerModel().plan(); + } + + public String objectId() { + return this.innerModel().objectId(); + } + + public String friendlyName() { + return this.innerModel().friendlyName(); + } + + public String description() { + return this.innerModel().description(); + } + + public HostPoolType hostPoolType() { + return this.innerModel().hostPoolType(); + } + + public PersonalDesktopAssignmentType personalDesktopAssignmentType() { + return this.innerModel().personalDesktopAssignmentType(); + } + + public String customRdpProperty() { + return this.innerModel().customRdpProperty(); + } + + public Integer maxSessionLimit() { + return this.innerModel().maxSessionLimit(); + } + + public LoadBalancerType loadBalancerType() { + return this.innerModel().loadBalancerType(); + } + + public Integer ring() { + return this.innerModel().ring(); + } + + public Boolean validationEnvironment() { + return this.innerModel().validationEnvironment(); + } + + public RegistrationInfo registrationInfo() { + RegistrationInfoInner inner = this.innerModel().registrationInfo(); + if (inner != null) { + return new RegistrationInfoImpl(inner, this.manager()); + } else { + return null; + } + } + + public String vmTemplate() { + return this.innerModel().vmTemplate(); + } + + public List applicationGroupReferences() { + List inner = this.innerModel().applicationGroupReferences(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String ssoadfsAuthority() { + return this.innerModel().ssoadfsAuthority(); + } + + public String ssoClientId() { + return this.innerModel().ssoClientId(); + } + + public String ssoClientSecretKeyVaultPath() { + return this.innerModel().ssoClientSecretKeyVaultPath(); + } + + public SsoSecretType ssoSecretType() { + return this.innerModel().ssoSecretType(); + } + + public PreferredAppGroupType preferredAppGroupType() { + return this.innerModel().preferredAppGroupType(); + } + + public Boolean startVMOnConnect() { + return this.innerModel().startVMOnConnect(); + } + + public MigrationRequestProperties migrationRequest() { + return this.innerModel().migrationRequest(); + } + + public Boolean cloudPcResource() { + return this.innerModel().cloudPcResource(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public HostPoolInner innerModel() { + return this.innerObject; + } + + private DesktopVirtualizationManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String hostPoolName; + + private HostPoolPatch updateHostPool; + + public HostPoolImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public HostPool create() { + this.innerObject = + serviceManager + .serviceClient() + .getHostPools() + .createOrUpdateWithResponse(resourceGroupName, hostPoolName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public HostPool create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getHostPools() + .createOrUpdateWithResponse(resourceGroupName, hostPoolName, this.innerModel(), context) + .getValue(); + return this; + } + + HostPoolImpl(String name, DesktopVirtualizationManager serviceManager) { + this.innerObject = new HostPoolInner(); + this.serviceManager = serviceManager; + this.hostPoolName = name; + } + + public HostPoolImpl update() { + this.updateHostPool = new HostPoolPatch(); + return this; + } + + public HostPool apply() { + this.innerObject = + serviceManager + .serviceClient() + .getHostPools() + .updateWithResponse(resourceGroupName, hostPoolName, updateHostPool, Context.NONE) + .getValue(); + return this; + } + + public HostPool apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getHostPools() + .updateWithResponse(resourceGroupName, hostPoolName, updateHostPool, context) + .getValue(); + return this; + } + + HostPoolImpl(HostPoolInner innerObject, DesktopVirtualizationManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.hostPoolName = Utils.getValueFromIdByName(innerObject.id(), "hostPools"); + } + + public HostPool refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getHostPools() + .getByResourceGroupWithResponse(resourceGroupName, hostPoolName, Context.NONE) + .getValue(); + return this; + } + + public HostPool refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getHostPools() + .getByResourceGroupWithResponse(resourceGroupName, hostPoolName, context) + .getValue(); + return this; + } + + public RegistrationInfo retrieveRegistrationToken() { + return serviceManager.hostPools().retrieveRegistrationToken(resourceGroupName, hostPoolName); + } + + public Response retrieveRegistrationTokenWithResponse(Context context) { + return serviceManager + .hostPools() + .retrieveRegistrationTokenWithResponse(resourceGroupName, hostPoolName, context); + } + + public HostPoolImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public HostPoolImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public HostPoolImpl withHostPoolType(HostPoolType hostPoolType) { + this.innerModel().withHostPoolType(hostPoolType); + return this; + } + + public HostPoolImpl withLoadBalancerType(LoadBalancerType loadBalancerType) { + if (isInCreateMode()) { + this.innerModel().withLoadBalancerType(loadBalancerType); + return this; + } else { + this.updateHostPool.withLoadBalancerType(loadBalancerType); + return this; + } + } + + public HostPoolImpl withPreferredAppGroupType(PreferredAppGroupType preferredAppGroupType) { + if (isInCreateMode()) { + this.innerModel().withPreferredAppGroupType(preferredAppGroupType); + return this; + } else { + this.updateHostPool.withPreferredAppGroupType(preferredAppGroupType); + return this; + } + } + + public HostPoolImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateHostPool.withTags(tags); + return this; + } + } + + public HostPoolImpl withManagedBy(String managedBy) { + this.innerModel().withManagedBy(managedBy); + return this; + } + + public HostPoolImpl withKind(String kind) { + this.innerModel().withKind(kind); + return this; + } + + public HostPoolImpl withIdentity(Identity identity) { + this.innerModel().withIdentity(identity); + return this; + } + + public HostPoolImpl withSku(Sku sku) { + this.innerModel().withSku(sku); + return this; + } + + public HostPoolImpl withPlan(Plan plan) { + this.innerModel().withPlan(plan); + return this; + } + + public HostPoolImpl withFriendlyName(String friendlyName) { + if (isInCreateMode()) { + this.innerModel().withFriendlyName(friendlyName); + return this; + } else { + this.updateHostPool.withFriendlyName(friendlyName); + return this; + } + } + + public HostPoolImpl withDescription(String description) { + if (isInCreateMode()) { + this.innerModel().withDescription(description); + return this; + } else { + this.updateHostPool.withDescription(description); + return this; + } + } + + public HostPoolImpl withPersonalDesktopAssignmentType(PersonalDesktopAssignmentType personalDesktopAssignmentType) { + if (isInCreateMode()) { + this.innerModel().withPersonalDesktopAssignmentType(personalDesktopAssignmentType); + return this; + } else { + this.updateHostPool.withPersonalDesktopAssignmentType(personalDesktopAssignmentType); + return this; + } + } + + public HostPoolImpl withCustomRdpProperty(String customRdpProperty) { + if (isInCreateMode()) { + this.innerModel().withCustomRdpProperty(customRdpProperty); + return this; + } else { + this.updateHostPool.withCustomRdpProperty(customRdpProperty); + return this; + } + } + + public HostPoolImpl withMaxSessionLimit(Integer maxSessionLimit) { + if (isInCreateMode()) { + this.innerModel().withMaxSessionLimit(maxSessionLimit); + return this; + } else { + this.updateHostPool.withMaxSessionLimit(maxSessionLimit); + return this; + } + } + + public HostPoolImpl withRing(Integer ring) { + if (isInCreateMode()) { + this.innerModel().withRing(ring); + return this; + } else { + this.updateHostPool.withRing(ring); + return this; + } + } + + public HostPoolImpl withValidationEnvironment(Boolean validationEnvironment) { + if (isInCreateMode()) { + this.innerModel().withValidationEnvironment(validationEnvironment); + return this; + } else { + this.updateHostPool.withValidationEnvironment(validationEnvironment); + return this; + } + } + + public HostPoolImpl withRegistrationInfo(RegistrationInfoInner registrationInfo) { + this.innerModel().withRegistrationInfo(registrationInfo); + return this; + } + + public HostPoolImpl withVmTemplate(String vmTemplate) { + if (isInCreateMode()) { + this.innerModel().withVmTemplate(vmTemplate); + return this; + } else { + this.updateHostPool.withVmTemplate(vmTemplate); + return this; + } + } + + public HostPoolImpl withSsoadfsAuthority(String ssoadfsAuthority) { + if (isInCreateMode()) { + this.innerModel().withSsoadfsAuthority(ssoadfsAuthority); + return this; + } else { + this.updateHostPool.withSsoadfsAuthority(ssoadfsAuthority); + return this; + } + } + + public HostPoolImpl withSsoClientId(String ssoClientId) { + if (isInCreateMode()) { + this.innerModel().withSsoClientId(ssoClientId); + return this; + } else { + this.updateHostPool.withSsoClientId(ssoClientId); + return this; + } + } + + public HostPoolImpl withSsoClientSecretKeyVaultPath(String ssoClientSecretKeyVaultPath) { + if (isInCreateMode()) { + this.innerModel().withSsoClientSecretKeyVaultPath(ssoClientSecretKeyVaultPath); + return this; + } else { + this.updateHostPool.withSsoClientSecretKeyVaultPath(ssoClientSecretKeyVaultPath); + return this; + } + } + + public HostPoolImpl withSsoSecretType(SsoSecretType ssoSecretType) { + if (isInCreateMode()) { + this.innerModel().withSsoSecretType(ssoSecretType); + return this; + } else { + this.updateHostPool.withSsoSecretType(ssoSecretType); + return this; + } + } + + public HostPoolImpl withStartVMOnConnect(Boolean startVMOnConnect) { + if (isInCreateMode()) { + this.innerModel().withStartVMOnConnect(startVMOnConnect); + return this; + } else { + this.updateHostPool.withStartVMOnConnect(startVMOnConnect); + return this; + } + } + + public HostPoolImpl withMigrationRequest(MigrationRequestProperties migrationRequest) { + this.innerModel().withMigrationRequest(migrationRequest); + return this; + } + + public HostPoolImpl withRegistrationInfo(RegistrationInfoPatch registrationInfo) { + this.updateHostPool.withRegistrationInfo(registrationInfo); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/HostPoolsClientImpl.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/HostPoolsClientImpl.java new file mode 100644 index 0000000000000..cb8e97948c85f --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/HostPoolsClientImpl.java @@ -0,0 +1,1454 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.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.desktopvirtualization.fluent.HostPoolsClient; +import com.azure.resourcemanager.desktopvirtualization.fluent.models.HostPoolInner; +import com.azure.resourcemanager.desktopvirtualization.fluent.models.RegistrationInfoInner; +import com.azure.resourcemanager.desktopvirtualization.models.HostPoolList; +import com.azure.resourcemanager.desktopvirtualization.models.HostPoolPatch; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in HostPoolsClient. */ +public final class HostPoolsClientImpl implements HostPoolsClient { + private final ClientLogger logger = new ClientLogger(HostPoolsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final HostPoolsService service; + + /** The service client containing this operation class. */ + private final DesktopVirtualizationApiClientImpl client; + + /** + * Initializes an instance of HostPoolsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + HostPoolsClientImpl(DesktopVirtualizationApiClientImpl client) { + this.service = + RestProxy.create(HostPoolsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DesktopVirtualizationApiClientHostPools to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DesktopVirtualizatio") + private interface HostPoolsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("hostPoolName") String hostPoolName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("hostPoolName") String hostPoolName, + @BodyParam("application/json") HostPoolInner hostPool, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("hostPoolName") String hostPoolName, + @QueryParam("force") Boolean force, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("hostPoolName") String hostPoolName, + @BodyParam("application/json") HostPoolPatch hostPool, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.DesktopVirtualization/hostPools") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/hostPools") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/retrieveRegistrationToken") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> retrieveRegistrationToken( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("hostPoolName") String hostPoolName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get a host pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a host pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String hostPoolName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (hostPoolName == null) { + return Mono.error(new IllegalArgumentException("Parameter hostPoolName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + hostPoolName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get a host pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @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 host pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String hostPoolName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (hostPoolName == null) { + return Mono.error(new IllegalArgumentException("Parameter hostPoolName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + hostPoolName, + accept, + context); + } + + /** + * Get a host pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a host pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String hostPoolName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, hostPoolName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get a host pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a host pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public HostPoolInner getByResourceGroup(String resourceGroupName, String hostPoolName) { + return getByResourceGroupAsync(resourceGroupName, hostPoolName).block(); + } + + /** + * Get a host pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @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 host pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String hostPoolName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, hostPoolName, context).block(); + } + + /** + * Create or update a host pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param hostPool Object containing HostPool definitions. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a HostPool definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String hostPoolName, HostPoolInner hostPool) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (hostPoolName == null) { + return Mono.error(new IllegalArgumentException("Parameter hostPoolName is required and cannot be null.")); + } + if (hostPool == null) { + return Mono.error(new IllegalArgumentException("Parameter hostPool is required and cannot be null.")); + } else { + hostPool.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + hostPoolName, + hostPool, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create or update a host pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param hostPool Object containing HostPool definitions. + * @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 represents a HostPool definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String hostPoolName, HostPoolInner hostPool, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (hostPoolName == null) { + return Mono.error(new IllegalArgumentException("Parameter hostPoolName is required and cannot be null.")); + } + if (hostPool == null) { + return Mono.error(new IllegalArgumentException("Parameter hostPool is required and cannot be null.")); + } else { + hostPool.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + hostPoolName, + hostPool, + accept, + context); + } + + /** + * Create or update a host pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param hostPool Object containing HostPool definitions. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a HostPool definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String hostPoolName, HostPoolInner hostPool) { + return createOrUpdateWithResponseAsync(resourceGroupName, hostPoolName, hostPool) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Create or update a host pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param hostPool Object containing HostPool definitions. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a HostPool definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public HostPoolInner createOrUpdate(String resourceGroupName, String hostPoolName, HostPoolInner hostPool) { + return createOrUpdateAsync(resourceGroupName, hostPoolName, hostPool).block(); + } + + /** + * Create or update a host pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param hostPool Object containing HostPool definitions. + * @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 represents a HostPool definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, String hostPoolName, HostPoolInner hostPool, Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, hostPoolName, hostPool, context).block(); + } + + /** + * Remove a host pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param force Force flag to delete sessionHost. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String hostPoolName, Boolean force) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (hostPoolName == null) { + return Mono.error(new IllegalArgumentException("Parameter hostPoolName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + hostPoolName, + force, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Remove a host pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param force Force flag to delete sessionHost. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String hostPoolName, Boolean force, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (hostPoolName == null) { + return Mono.error(new IllegalArgumentException("Parameter hostPoolName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + hostPoolName, + force, + accept, + context); + } + + /** + * Remove a host pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param force Force flag to delete sessionHost. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String hostPoolName, Boolean force) { + return deleteWithResponseAsync(resourceGroupName, hostPoolName, force) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Remove a host pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String hostPoolName) { + final Boolean force = null; + return deleteWithResponseAsync(resourceGroupName, hostPoolName, force) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Remove a host pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String hostPoolName) { + final Boolean force = null; + deleteAsync(resourceGroupName, hostPoolName, force).block(); + } + + /** + * Remove a host pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param force Force flag to delete sessionHost. + * @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 Response deleteWithResponse( + String resourceGroupName, String hostPoolName, Boolean force, Context context) { + return deleteWithResponseAsync(resourceGroupName, hostPoolName, force, context).block(); + } + + /** + * Update a host pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param hostPool Object containing HostPool definitions. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a HostPool definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String hostPoolName, HostPoolPatch hostPool) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (hostPoolName == null) { + return Mono.error(new IllegalArgumentException("Parameter hostPoolName is required and cannot be null.")); + } + if (hostPool != null) { + hostPool.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + hostPoolName, + hostPool, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Update a host pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param hostPool Object containing HostPool definitions. + * @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 represents a HostPool definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String hostPoolName, HostPoolPatch hostPool, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (hostPoolName == null) { + return Mono.error(new IllegalArgumentException("Parameter hostPoolName is required and cannot be null.")); + } + if (hostPool != null) { + hostPool.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + hostPoolName, + hostPool, + accept, + context); + } + + /** + * Update a host pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param hostPool Object containing HostPool definitions. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a HostPool definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String hostPoolName, HostPoolPatch hostPool) { + return updateWithResponseAsync(resourceGroupName, hostPoolName, hostPool) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Update a host pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a HostPool definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String hostPoolName) { + final HostPoolPatch hostPool = null; + return updateWithResponseAsync(resourceGroupName, hostPoolName, hostPool) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Update a host pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a HostPool definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public HostPoolInner update(String resourceGroupName, String hostPoolName) { + final HostPoolPatch hostPool = null; + return updateAsync(resourceGroupName, hostPoolName, hostPool).block(); + } + + /** + * Update a host pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param hostPool Object containing HostPool definitions. + * @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 represents a HostPool definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, String hostPoolName, HostPoolPatch hostPool, Context context) { + return updateWithResponseAsync(resourceGroupName, hostPoolName, hostPool, context).block(); + } + + /** + * List hostPools. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of HostPool definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List hostPools. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of HostPool definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List hostPools. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of HostPool definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List hostPools. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of HostPool definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * List hostPools. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of HostPool definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * List hostPools. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of HostPool definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * List hostPools in 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 list of HostPool definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List hostPools in 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 list of HostPool definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List hostPools in 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 list of HostPool definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List hostPools in 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 list of HostPool definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List hostPools in 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 list of HostPool definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List hostPools in 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 list of HostPool definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Registration token of the host pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a RegistrationInfo definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> retrieveRegistrationTokenWithResponseAsync( + String resourceGroupName, String hostPoolName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (hostPoolName == null) { + return Mono.error(new IllegalArgumentException("Parameter hostPoolName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .retrieveRegistrationToken( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + hostPoolName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Registration token of the host pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @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 represents a RegistrationInfo definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> retrieveRegistrationTokenWithResponseAsync( + String resourceGroupName, String hostPoolName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (hostPoolName == null) { + return Mono.error(new IllegalArgumentException("Parameter hostPoolName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .retrieveRegistrationToken( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + hostPoolName, + accept, + context); + } + + /** + * Registration token of the host pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a RegistrationInfo definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono retrieveRegistrationTokenAsync(String resourceGroupName, String hostPoolName) { + return retrieveRegistrationTokenWithResponseAsync(resourceGroupName, hostPoolName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Registration token of the host pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a RegistrationInfo definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RegistrationInfoInner retrieveRegistrationToken(String resourceGroupName, String hostPoolName) { + return retrieveRegistrationTokenAsync(resourceGroupName, hostPoolName).block(); + } + + /** + * Registration token of the host pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @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 represents a RegistrationInfo definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response retrieveRegistrationTokenWithResponse( + String resourceGroupName, String hostPoolName, Context context) { + return retrieveRegistrationTokenWithResponseAsync(resourceGroupName, hostPoolName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of HostPool definitions. + */ + @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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of HostPool definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of HostPool definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of HostPool definitions. + */ + @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/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/HostPoolsImpl.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/HostPoolsImpl.java new file mode 100644 index 0000000000000..f62cbe8295d33 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/HostPoolsImpl.java @@ -0,0 +1,198 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.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.desktopvirtualization.DesktopVirtualizationManager; +import com.azure.resourcemanager.desktopvirtualization.fluent.HostPoolsClient; +import com.azure.resourcemanager.desktopvirtualization.fluent.models.HostPoolInner; +import com.azure.resourcemanager.desktopvirtualization.fluent.models.RegistrationInfoInner; +import com.azure.resourcemanager.desktopvirtualization.models.HostPool; +import com.azure.resourcemanager.desktopvirtualization.models.HostPools; +import com.azure.resourcemanager.desktopvirtualization.models.RegistrationInfo; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class HostPoolsImpl implements HostPools { + @JsonIgnore private final ClientLogger logger = new ClientLogger(HostPoolsImpl.class); + + private final HostPoolsClient innerClient; + + private final DesktopVirtualizationManager serviceManager; + + public HostPoolsImpl(HostPoolsClient innerClient, DesktopVirtualizationManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public HostPool getByResourceGroup(String resourceGroupName, String hostPoolName) { + HostPoolInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, hostPoolName); + if (inner != null) { + return new HostPoolImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String hostPoolName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, hostPoolName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new HostPoolImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String hostPoolName) { + this.serviceClient().delete(resourceGroupName, hostPoolName); + } + + public Response deleteWithResponse( + String resourceGroupName, String hostPoolName, Boolean force, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, hostPoolName, force, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new HostPoolImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new HostPoolImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new HostPoolImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new HostPoolImpl(inner1, this.manager())); + } + + public RegistrationInfo retrieveRegistrationToken(String resourceGroupName, String hostPoolName) { + RegistrationInfoInner inner = this.serviceClient().retrieveRegistrationToken(resourceGroupName, hostPoolName); + if (inner != null) { + return new RegistrationInfoImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response retrieveRegistrationTokenWithResponse( + String resourceGroupName, String hostPoolName, Context context) { + Response inner = + this.serviceClient().retrieveRegistrationTokenWithResponse(resourceGroupName, hostPoolName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RegistrationInfoImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public HostPool getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String hostPoolName = Utils.getValueFromIdByName(id, "hostPools"); + if (hostPoolName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'hostPools'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, hostPoolName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String hostPoolName = Utils.getValueFromIdByName(id, "hostPools"); + if (hostPoolName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'hostPools'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, hostPoolName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String hostPoolName = Utils.getValueFromIdByName(id, "hostPools"); + if (hostPoolName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'hostPools'.", id))); + } + Boolean localForce = null; + this.deleteWithResponse(resourceGroupName, hostPoolName, localForce, Context.NONE).getValue(); + } + + public Response deleteByIdWithResponse(String id, Boolean force, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String hostPoolName = Utils.getValueFromIdByName(id, "hostPools"); + if (hostPoolName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'hostPools'.", id))); + } + return this.deleteWithResponse(resourceGroupName, hostPoolName, force, context); + } + + private HostPoolsClient serviceClient() { + return this.innerClient; + } + + private DesktopVirtualizationManager manager() { + return this.serviceManager; + } + + public HostPoolImpl define(String name) { + return new HostPoolImpl(name, this.manager()); + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/MsixImagesClientImpl.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/MsixImagesClientImpl.java new file mode 100644 index 0000000000000..81398df223171 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/MsixImagesClientImpl.java @@ -0,0 +1,362 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.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.desktopvirtualization.fluent.MsixImagesClient; +import com.azure.resourcemanager.desktopvirtualization.fluent.models.ExpandMsixImageInner; +import com.azure.resourcemanager.desktopvirtualization.models.ExpandMsixImageList; +import com.azure.resourcemanager.desktopvirtualization.models.MsixImageUri; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in MsixImagesClient. */ +public final class MsixImagesClientImpl implements MsixImagesClient { + private final ClientLogger logger = new ClientLogger(MsixImagesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final MsixImagesService service; + + /** The service client containing this operation class. */ + private final DesktopVirtualizationApiClientImpl client; + + /** + * Initializes an instance of MsixImagesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + MsixImagesClientImpl(DesktopVirtualizationApiClientImpl client) { + this.service = + RestProxy.create(MsixImagesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DesktopVirtualizationApiClientMsixImages to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DesktopVirtualizatio") + private interface MsixImagesService { + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/expandMsixImage") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> expand( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("hostPoolName") String hostPoolName, + @BodyParam("application/json") MsixImageUri msixImageUri, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> expandNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Expands and Lists MSIX packages in an Image, given the Image Path. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param msixImageUri Object containing URI to MSIX Image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of MSIX package properties retrieved from MSIX Image expansion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> expandSinglePageAsync( + String resourceGroupName, String hostPoolName, MsixImageUri msixImageUri) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (hostPoolName == null) { + return Mono.error(new IllegalArgumentException("Parameter hostPoolName is required and cannot be null.")); + } + if (msixImageUri == null) { + return Mono.error(new IllegalArgumentException("Parameter msixImageUri is required and cannot be null.")); + } else { + msixImageUri.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .expand( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + hostPoolName, + msixImageUri, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Expands and Lists MSIX packages in an Image, given the Image Path. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param msixImageUri Object containing URI to MSIX Image. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of MSIX package properties retrieved from MSIX Image expansion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> expandSinglePageAsync( + String resourceGroupName, String hostPoolName, MsixImageUri msixImageUri, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (hostPoolName == null) { + return Mono.error(new IllegalArgumentException("Parameter hostPoolName is required and cannot be null.")); + } + if (msixImageUri == null) { + return Mono.error(new IllegalArgumentException("Parameter msixImageUri is required and cannot be null.")); + } else { + msixImageUri.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .expand( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + hostPoolName, + msixImageUri, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Expands and Lists MSIX packages in an Image, given the Image Path. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param msixImageUri Object containing URI to MSIX Image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of MSIX package properties retrieved from MSIX Image expansion. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux expandAsync( + String resourceGroupName, String hostPoolName, MsixImageUri msixImageUri) { + return new PagedFlux<>( + () -> expandSinglePageAsync(resourceGroupName, hostPoolName, msixImageUri), + nextLink -> expandNextSinglePageAsync(nextLink)); + } + + /** + * Expands and Lists MSIX packages in an Image, given the Image Path. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param msixImageUri Object containing URI to MSIX Image. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of MSIX package properties retrieved from MSIX Image expansion. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux expandAsync( + String resourceGroupName, String hostPoolName, MsixImageUri msixImageUri, Context context) { + return new PagedFlux<>( + () -> expandSinglePageAsync(resourceGroupName, hostPoolName, msixImageUri, context), + nextLink -> expandNextSinglePageAsync(nextLink, context)); + } + + /** + * Expands and Lists MSIX packages in an Image, given the Image Path. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param msixImageUri Object containing URI to MSIX Image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of MSIX package properties retrieved from MSIX Image expansion. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable expand( + String resourceGroupName, String hostPoolName, MsixImageUri msixImageUri) { + return new PagedIterable<>(expandAsync(resourceGroupName, hostPoolName, msixImageUri)); + } + + /** + * Expands and Lists MSIX packages in an Image, given the Image Path. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param msixImageUri Object containing URI to MSIX Image. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of MSIX package properties retrieved from MSIX Image expansion. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable expand( + String resourceGroupName, String hostPoolName, MsixImageUri msixImageUri, Context context) { + return new PagedIterable<>(expandAsync(resourceGroupName, hostPoolName, msixImageUri, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of MSIX package properties retrieved from MSIX Image expansion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> expandNextSinglePageAsync(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.expandNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of MSIX package properties retrieved from MSIX Image expansion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> expandNextSinglePageAsync(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 + .expandNext(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/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/MsixImagesImpl.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/MsixImagesImpl.java new file mode 100644 index 0000000000000..f1bf0e8d8a3b0 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/MsixImagesImpl.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.desktopvirtualization.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.desktopvirtualization.DesktopVirtualizationManager; +import com.azure.resourcemanager.desktopvirtualization.fluent.MsixImagesClient; +import com.azure.resourcemanager.desktopvirtualization.fluent.models.ExpandMsixImageInner; +import com.azure.resourcemanager.desktopvirtualization.models.ExpandMsixImage; +import com.azure.resourcemanager.desktopvirtualization.models.MsixImageUri; +import com.azure.resourcemanager.desktopvirtualization.models.MsixImages; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class MsixImagesImpl implements MsixImages { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MsixImagesImpl.class); + + private final MsixImagesClient innerClient; + + private final DesktopVirtualizationManager serviceManager; + + public MsixImagesImpl(MsixImagesClient innerClient, DesktopVirtualizationManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable expand( + String resourceGroupName, String hostPoolName, MsixImageUri msixImageUri) { + PagedIterable inner = + this.serviceClient().expand(resourceGroupName, hostPoolName, msixImageUri); + return Utils.mapPage(inner, inner1 -> new ExpandMsixImageImpl(inner1, this.manager())); + } + + public PagedIterable expand( + String resourceGroupName, String hostPoolName, MsixImageUri msixImageUri, Context context) { + PagedIterable inner = + this.serviceClient().expand(resourceGroupName, hostPoolName, msixImageUri, context); + return Utils.mapPage(inner, inner1 -> new ExpandMsixImageImpl(inner1, this.manager())); + } + + private MsixImagesClient serviceClient() { + return this.innerClient; + } + + private DesktopVirtualizationManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/MsixPackageImpl.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/MsixPackageImpl.java new file mode 100644 index 0000000000000..25b46bf3d1004 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/MsixPackageImpl.java @@ -0,0 +1,266 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.desktopvirtualization.DesktopVirtualizationManager; +import com.azure.resourcemanager.desktopvirtualization.fluent.models.MsixPackageInner; +import com.azure.resourcemanager.desktopvirtualization.models.MsixPackage; +import com.azure.resourcemanager.desktopvirtualization.models.MsixPackageApplications; +import com.azure.resourcemanager.desktopvirtualization.models.MsixPackageDependencies; +import com.azure.resourcemanager.desktopvirtualization.models.MsixPackagePatch; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; + +public final class MsixPackageImpl implements MsixPackage, MsixPackage.Definition, MsixPackage.Update { + private MsixPackageInner innerObject; + + private final DesktopVirtualizationManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String imagePath() { + return this.innerModel().imagePath(); + } + + public String packageName() { + return this.innerModel().packageName(); + } + + public String packageFamilyName() { + return this.innerModel().packageFamilyName(); + } + + public String displayName() { + return this.innerModel().displayName(); + } + + public String packageRelativePath() { + return this.innerModel().packageRelativePath(); + } + + public Boolean isRegularRegistration() { + return this.innerModel().isRegularRegistration(); + } + + public Boolean isActive() { + return this.innerModel().isActive(); + } + + public List packageDependencies() { + List inner = this.innerModel().packageDependencies(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String version() { + return this.innerModel().version(); + } + + public OffsetDateTime lastUpdated() { + return this.innerModel().lastUpdated(); + } + + public List packageApplications() { + List inner = this.innerModel().packageApplications(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public MsixPackageInner innerModel() { + return this.innerObject; + } + + private DesktopVirtualizationManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String hostPoolName; + + private String msixPackageFullName; + + private MsixPackagePatch updateMsixPackage; + + public MsixPackageImpl withExistingHostPool(String resourceGroupName, String hostPoolName) { + this.resourceGroupName = resourceGroupName; + this.hostPoolName = hostPoolName; + return this; + } + + public MsixPackage create() { + this.innerObject = + serviceManager + .serviceClient() + .getMsixPackages() + .createOrUpdateWithResponse( + resourceGroupName, hostPoolName, msixPackageFullName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public MsixPackage create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getMsixPackages() + .createOrUpdateWithResponse( + resourceGroupName, hostPoolName, msixPackageFullName, this.innerModel(), context) + .getValue(); + return this; + } + + MsixPackageImpl(String name, DesktopVirtualizationManager serviceManager) { + this.innerObject = new MsixPackageInner(); + this.serviceManager = serviceManager; + this.msixPackageFullName = name; + } + + public MsixPackageImpl update() { + this.updateMsixPackage = new MsixPackagePatch(); + return this; + } + + public MsixPackage apply() { + this.innerObject = + serviceManager + .serviceClient() + .getMsixPackages() + .updateWithResponse( + resourceGroupName, hostPoolName, msixPackageFullName, updateMsixPackage, Context.NONE) + .getValue(); + return this; + } + + public MsixPackage apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getMsixPackages() + .updateWithResponse(resourceGroupName, hostPoolName, msixPackageFullName, updateMsixPackage, context) + .getValue(); + return this; + } + + MsixPackageImpl(MsixPackageInner innerObject, DesktopVirtualizationManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourcegroups"); + this.hostPoolName = Utils.getValueFromIdByName(innerObject.id(), "hostPools"); + this.msixPackageFullName = Utils.getValueFromIdByName(innerObject.id(), "msixPackages"); + } + + public MsixPackage refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getMsixPackages() + .getWithResponse(resourceGroupName, hostPoolName, msixPackageFullName, Context.NONE) + .getValue(); + return this; + } + + public MsixPackage refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getMsixPackages() + .getWithResponse(resourceGroupName, hostPoolName, msixPackageFullName, context) + .getValue(); + return this; + } + + public MsixPackageImpl withImagePath(String imagePath) { + this.innerModel().withImagePath(imagePath); + return this; + } + + public MsixPackageImpl withPackageName(String packageName) { + this.innerModel().withPackageName(packageName); + return this; + } + + public MsixPackageImpl withPackageFamilyName(String packageFamilyName) { + this.innerModel().withPackageFamilyName(packageFamilyName); + return this; + } + + public MsixPackageImpl withDisplayName(String displayName) { + if (isInCreateMode()) { + this.innerModel().withDisplayName(displayName); + return this; + } else { + this.updateMsixPackage.withDisplayName(displayName); + return this; + } + } + + public MsixPackageImpl withPackageRelativePath(String packageRelativePath) { + this.innerModel().withPackageRelativePath(packageRelativePath); + return this; + } + + public MsixPackageImpl withIsRegularRegistration(Boolean isRegularRegistration) { + if (isInCreateMode()) { + this.innerModel().withIsRegularRegistration(isRegularRegistration); + return this; + } else { + this.updateMsixPackage.withIsRegularRegistration(isRegularRegistration); + return this; + } + } + + public MsixPackageImpl withIsActive(Boolean isActive) { + if (isInCreateMode()) { + this.innerModel().withIsActive(isActive); + return this; + } else { + this.updateMsixPackage.withIsActive(isActive); + return this; + } + } + + public MsixPackageImpl withPackageDependencies(List packageDependencies) { + this.innerModel().withPackageDependencies(packageDependencies); + return this; + } + + public MsixPackageImpl withVersion(String version) { + this.innerModel().withVersion(version); + return this; + } + + public MsixPackageImpl withLastUpdated(OffsetDateTime lastUpdated) { + this.innerModel().withLastUpdated(lastUpdated); + return this; + } + + public MsixPackageImpl withPackageApplications(List packageApplications) { + this.innerModel().withPackageApplications(packageApplications); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/MsixPackagesClientImpl.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/MsixPackagesClientImpl.java new file mode 100644 index 0000000000000..93d8b81ff72af --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/MsixPackagesClientImpl.java @@ -0,0 +1,1131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.desktopvirtualization.fluent.MsixPackagesClient; +import com.azure.resourcemanager.desktopvirtualization.fluent.models.MsixPackageInner; +import com.azure.resourcemanager.desktopvirtualization.models.MsixPackageList; +import com.azure.resourcemanager.desktopvirtualization.models.MsixPackagePatch; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in MsixPackagesClient. */ +public final class MsixPackagesClientImpl implements MsixPackagesClient { + private final ClientLogger logger = new ClientLogger(MsixPackagesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final MsixPackagesService service; + + /** The service client containing this operation class. */ + private final DesktopVirtualizationApiClientImpl client; + + /** + * Initializes an instance of MsixPackagesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + MsixPackagesClientImpl(DesktopVirtualizationApiClientImpl client) { + this.service = + RestProxy.create(MsixPackagesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DesktopVirtualizationApiClientMsixPackages to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DesktopVirtualizatio") + private interface MsixPackagesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers" + + "/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("hostPoolName") String hostPoolName, + @PathParam("msixPackageFullName") String msixPackageFullName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers" + + "/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("hostPoolName") String hostPoolName, + @PathParam("msixPackageFullName") String msixPackageFullName, + @BodyParam("application/json") MsixPackageInner msixPackage, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers" + + "/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("hostPoolName") String hostPoolName, + @PathParam("msixPackageFullName") String msixPackageFullName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers" + + "/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("hostPoolName") String hostPoolName, + @PathParam("msixPackageFullName") String msixPackageFullName, + @BodyParam("application/json") MsixPackagePatch msixPackage, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers" + + "/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("hostPoolName") String hostPoolName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get a msixpackage. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param msixPackageFullName The version specific package full name of the MSIX package within specified hostpool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 msixpackage. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String hostPoolName, String msixPackageFullName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (hostPoolName == null) { + return Mono.error(new IllegalArgumentException("Parameter hostPoolName is required and cannot be null.")); + } + if (msixPackageFullName == null) { + return Mono + .error(new IllegalArgumentException("Parameter msixPackageFullName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + hostPoolName, + msixPackageFullName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get a msixpackage. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param msixPackageFullName The version specific package full name of the MSIX package within specified hostpool. + * @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 msixpackage. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String hostPoolName, String msixPackageFullName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (hostPoolName == null) { + return Mono.error(new IllegalArgumentException("Parameter hostPoolName is required and cannot be null.")); + } + if (msixPackageFullName == null) { + return Mono + .error(new IllegalArgumentException("Parameter msixPackageFullName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + hostPoolName, + msixPackageFullName, + accept, + context); + } + + /** + * Get a msixpackage. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param msixPackageFullName The version specific package full name of the MSIX package within specified hostpool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 msixpackage. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String hostPoolName, String msixPackageFullName) { + return getWithResponseAsync(resourceGroupName, hostPoolName, msixPackageFullName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get a msixpackage. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param msixPackageFullName The version specific package full name of the MSIX package within specified hostpool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 msixpackage. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MsixPackageInner get(String resourceGroupName, String hostPoolName, String msixPackageFullName) { + return getAsync(resourceGroupName, hostPoolName, msixPackageFullName).block(); + } + + /** + * Get a msixpackage. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param msixPackageFullName The version specific package full name of the MSIX package within specified hostpool. + * @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 msixpackage. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String hostPoolName, String msixPackageFullName, Context context) { + return getWithResponseAsync(resourceGroupName, hostPoolName, msixPackageFullName, context).block(); + } + + /** + * Create or update a MSIX package. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param msixPackageFullName The version specific package full name of the MSIX package within specified hostpool. + * @param msixPackage Object containing MSIX Package definitions. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schema for MSIX Package properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String hostPoolName, String msixPackageFullName, MsixPackageInner msixPackage) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (hostPoolName == null) { + return Mono.error(new IllegalArgumentException("Parameter hostPoolName is required and cannot be null.")); + } + if (msixPackageFullName == null) { + return Mono + .error(new IllegalArgumentException("Parameter msixPackageFullName is required and cannot be null.")); + } + if (msixPackage == null) { + return Mono.error(new IllegalArgumentException("Parameter msixPackage is required and cannot be null.")); + } else { + msixPackage.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + hostPoolName, + msixPackageFullName, + msixPackage, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create or update a MSIX package. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param msixPackageFullName The version specific package full name of the MSIX package within specified hostpool. + * @param msixPackage Object containing MSIX Package definitions. + * @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 schema for MSIX Package properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String hostPoolName, + String msixPackageFullName, + MsixPackageInner msixPackage, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (hostPoolName == null) { + return Mono.error(new IllegalArgumentException("Parameter hostPoolName is required and cannot be null.")); + } + if (msixPackageFullName == null) { + return Mono + .error(new IllegalArgumentException("Parameter msixPackageFullName is required and cannot be null.")); + } + if (msixPackage == null) { + return Mono.error(new IllegalArgumentException("Parameter msixPackage is required and cannot be null.")); + } else { + msixPackage.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + hostPoolName, + msixPackageFullName, + msixPackage, + accept, + context); + } + + /** + * Create or update a MSIX package. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param msixPackageFullName The version specific package full name of the MSIX package within specified hostpool. + * @param msixPackage Object containing MSIX Package definitions. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schema for MSIX Package properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String hostPoolName, String msixPackageFullName, MsixPackageInner msixPackage) { + return createOrUpdateWithResponseAsync(resourceGroupName, hostPoolName, msixPackageFullName, msixPackage) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Create or update a MSIX package. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param msixPackageFullName The version specific package full name of the MSIX package within specified hostpool. + * @param msixPackage Object containing MSIX Package definitions. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schema for MSIX Package properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MsixPackageInner createOrUpdate( + String resourceGroupName, String hostPoolName, String msixPackageFullName, MsixPackageInner msixPackage) { + return createOrUpdateAsync(resourceGroupName, hostPoolName, msixPackageFullName, msixPackage).block(); + } + + /** + * Create or update a MSIX package. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param msixPackageFullName The version specific package full name of the MSIX package within specified hostpool. + * @param msixPackage Object containing MSIX Package definitions. + * @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 schema for MSIX Package properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String hostPoolName, + String msixPackageFullName, + MsixPackageInner msixPackage, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, hostPoolName, msixPackageFullName, msixPackage, context) + .block(); + } + + /** + * Remove an MSIX Package. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param msixPackageFullName The version specific package full name of the MSIX package within specified hostpool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String hostPoolName, String msixPackageFullName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (hostPoolName == null) { + return Mono.error(new IllegalArgumentException("Parameter hostPoolName is required and cannot be null.")); + } + if (msixPackageFullName == null) { + return Mono + .error(new IllegalArgumentException("Parameter msixPackageFullName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + hostPoolName, + msixPackageFullName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Remove an MSIX Package. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param msixPackageFullName The version specific package full name of the MSIX package within specified hostpool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String hostPoolName, String msixPackageFullName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (hostPoolName == null) { + return Mono.error(new IllegalArgumentException("Parameter hostPoolName is required and cannot be null.")); + } + if (msixPackageFullName == null) { + return Mono + .error(new IllegalArgumentException("Parameter msixPackageFullName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + hostPoolName, + msixPackageFullName, + accept, + context); + } + + /** + * Remove an MSIX Package. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param msixPackageFullName The version specific package full name of the MSIX package within specified hostpool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String hostPoolName, String msixPackageFullName) { + return deleteWithResponseAsync(resourceGroupName, hostPoolName, msixPackageFullName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Remove an MSIX Package. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param msixPackageFullName The version specific package full name of the MSIX package within specified hostpool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String hostPoolName, String msixPackageFullName) { + deleteAsync(resourceGroupName, hostPoolName, msixPackageFullName).block(); + } + + /** + * Remove an MSIX Package. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param msixPackageFullName The version specific package full name of the MSIX package within specified hostpool. + * @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 Response deleteWithResponse( + String resourceGroupName, String hostPoolName, String msixPackageFullName, Context context) { + return deleteWithResponseAsync(resourceGroupName, hostPoolName, msixPackageFullName, context).block(); + } + + /** + * Update an MSIX Package. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param msixPackageFullName The version specific package full name of the MSIX package within specified hostpool. + * @param msixPackage Object containing MSIX Package definitions. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schema for MSIX Package properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String hostPoolName, String msixPackageFullName, MsixPackagePatch msixPackage) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (hostPoolName == null) { + return Mono.error(new IllegalArgumentException("Parameter hostPoolName is required and cannot be null.")); + } + if (msixPackageFullName == null) { + return Mono + .error(new IllegalArgumentException("Parameter msixPackageFullName is required and cannot be null.")); + } + if (msixPackage != null) { + msixPackage.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + hostPoolName, + msixPackageFullName, + msixPackage, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Update an MSIX Package. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param msixPackageFullName The version specific package full name of the MSIX package within specified hostpool. + * @param msixPackage Object containing MSIX Package definitions. + * @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 schema for MSIX Package properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String hostPoolName, + String msixPackageFullName, + MsixPackagePatch msixPackage, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (hostPoolName == null) { + return Mono.error(new IllegalArgumentException("Parameter hostPoolName is required and cannot be null.")); + } + if (msixPackageFullName == null) { + return Mono + .error(new IllegalArgumentException("Parameter msixPackageFullName is required and cannot be null.")); + } + if (msixPackage != null) { + msixPackage.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + hostPoolName, + msixPackageFullName, + msixPackage, + accept, + context); + } + + /** + * Update an MSIX Package. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param msixPackageFullName The version specific package full name of the MSIX package within specified hostpool. + * @param msixPackage Object containing MSIX Package definitions. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schema for MSIX Package properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String hostPoolName, String msixPackageFullName, MsixPackagePatch msixPackage) { + return updateWithResponseAsync(resourceGroupName, hostPoolName, msixPackageFullName, msixPackage) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Update an MSIX Package. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param msixPackageFullName The version specific package full name of the MSIX package within specified hostpool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schema for MSIX Package properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String hostPoolName, String msixPackageFullName) { + final MsixPackagePatch msixPackage = null; + return updateWithResponseAsync(resourceGroupName, hostPoolName, msixPackageFullName, msixPackage) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Update an MSIX Package. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param msixPackageFullName The version specific package full name of the MSIX package within specified hostpool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schema for MSIX Package properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MsixPackageInner update(String resourceGroupName, String hostPoolName, String msixPackageFullName) { + final MsixPackagePatch msixPackage = null; + return updateAsync(resourceGroupName, hostPoolName, msixPackageFullName, msixPackage).block(); + } + + /** + * Update an MSIX Package. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param msixPackageFullName The version specific package full name of the MSIX package within specified hostpool. + * @param msixPackage Object containing MSIX Package definitions. + * @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 schema for MSIX Package properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, + String hostPoolName, + String msixPackageFullName, + MsixPackagePatch msixPackage, + Context context) { + return updateWithResponseAsync(resourceGroupName, hostPoolName, msixPackageFullName, msixPackage, context) + .block(); + } + + /** + * List MSIX packages in hostpool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of MSIX Package definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, String hostPoolName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (hostPoolName == null) { + return Mono.error(new IllegalArgumentException("Parameter hostPoolName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + hostPoolName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List MSIX packages in hostpool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of MSIX Package definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String hostPoolName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (hostPoolName == null) { + return Mono.error(new IllegalArgumentException("Parameter hostPoolName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + hostPoolName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List MSIX packages in hostpool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of MSIX Package definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String hostPoolName) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, hostPoolName), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List MSIX packages in hostpool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of MSIX Package definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String hostPoolName, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, hostPoolName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List MSIX packages in hostpool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of MSIX Package definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String hostPoolName) { + return new PagedIterable<>(listAsync(resourceGroupName, hostPoolName)); + } + + /** + * List MSIX packages in hostpool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of MSIX Package definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String hostPoolName, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, hostPoolName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of MSIX Package definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of MSIX Package definitions. + */ + @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/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/MsixPackagesImpl.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/MsixPackagesImpl.java new file mode 100644 index 0000000000000..7793b8289744c --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/MsixPackagesImpl.java @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.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.desktopvirtualization.DesktopVirtualizationManager; +import com.azure.resourcemanager.desktopvirtualization.fluent.MsixPackagesClient; +import com.azure.resourcemanager.desktopvirtualization.fluent.models.MsixPackageInner; +import com.azure.resourcemanager.desktopvirtualization.models.MsixPackage; +import com.azure.resourcemanager.desktopvirtualization.models.MsixPackages; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class MsixPackagesImpl implements MsixPackages { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MsixPackagesImpl.class); + + private final MsixPackagesClient innerClient; + + private final DesktopVirtualizationManager serviceManager; + + public MsixPackagesImpl(MsixPackagesClient innerClient, DesktopVirtualizationManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public MsixPackage get(String resourceGroupName, String hostPoolName, String msixPackageFullName) { + MsixPackageInner inner = this.serviceClient().get(resourceGroupName, hostPoolName, msixPackageFullName); + if (inner != null) { + return new MsixPackageImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String hostPoolName, String msixPackageFullName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, hostPoolName, msixPackageFullName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new MsixPackageImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String hostPoolName, String msixPackageFullName) { + this.serviceClient().delete(resourceGroupName, hostPoolName, msixPackageFullName); + } + + public Response deleteWithResponse( + String resourceGroupName, String hostPoolName, String msixPackageFullName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, hostPoolName, msixPackageFullName, context); + } + + public PagedIterable list(String resourceGroupName, String hostPoolName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, hostPoolName); + return Utils.mapPage(inner, inner1 -> new MsixPackageImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String hostPoolName, Context context) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, hostPoolName, context); + return Utils.mapPage(inner, inner1 -> new MsixPackageImpl(inner1, this.manager())); + } + + public MsixPackage getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourcegroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourcegroups'.", id))); + } + String hostPoolName = Utils.getValueFromIdByName(id, "hostPools"); + if (hostPoolName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'hostPools'.", id))); + } + String msixPackageFullName = Utils.getValueFromIdByName(id, "msixPackages"); + if (msixPackageFullName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'msixPackages'.", id))); + } + return this.getWithResponse(resourceGroupName, hostPoolName, msixPackageFullName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourcegroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourcegroups'.", id))); + } + String hostPoolName = Utils.getValueFromIdByName(id, "hostPools"); + if (hostPoolName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'hostPools'.", id))); + } + String msixPackageFullName = Utils.getValueFromIdByName(id, "msixPackages"); + if (msixPackageFullName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'msixPackages'.", id))); + } + return this.getWithResponse(resourceGroupName, hostPoolName, msixPackageFullName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourcegroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourcegroups'.", id))); + } + String hostPoolName = Utils.getValueFromIdByName(id, "hostPools"); + if (hostPoolName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'hostPools'.", id))); + } + String msixPackageFullName = Utils.getValueFromIdByName(id, "msixPackages"); + if (msixPackageFullName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'msixPackages'.", id))); + } + this.deleteWithResponse(resourceGroupName, hostPoolName, msixPackageFullName, Context.NONE).getValue(); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourcegroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourcegroups'.", id))); + } + String hostPoolName = Utils.getValueFromIdByName(id, "hostPools"); + if (hostPoolName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'hostPools'.", id))); + } + String msixPackageFullName = Utils.getValueFromIdByName(id, "msixPackages"); + if (msixPackageFullName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'msixPackages'.", id))); + } + return this.deleteWithResponse(resourceGroupName, hostPoolName, msixPackageFullName, context); + } + + private MsixPackagesClient serviceClient() { + return this.innerClient; + } + + private DesktopVirtualizationManager manager() { + return this.serviceManager; + } + + public MsixPackageImpl define(String name) { + return new MsixPackageImpl(name, this.manager()); + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/OperationsClientImpl.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/OperationsClientImpl.java new file mode 100644 index 0000000000000..a70bd0e418e41 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/OperationsClientImpl.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.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.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.desktopvirtualization.fluent.OperationsClient; +import com.azure.resourcemanager.desktopvirtualization.fluent.models.ResourceProviderOperationListInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public final class OperationsClientImpl implements OperationsClient { + private final ClientLogger logger = new ClientLogger(OperationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final OperationsService service; + + /** The service client containing this operation class. */ + private final DesktopVirtualizationApiClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(DesktopVirtualizationApiClientImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DesktopVirtualizationApiClientOperations to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DesktopVirtualizatio") + private interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.DesktopVirtualization/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List all of the available operations the Desktop Virtualization resource provider supports. + * + * @throws 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 the request to list operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List all of the available operations the Desktop Virtualization resource provider supports. + * + * @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 the request to list operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context); + } + + /** + * List all of the available operations the Desktop Virtualization resource provider supports. + * + * @throws 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 the request to list operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listAsync() { + return listWithResponseAsync() + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * List all of the available operations the Desktop Virtualization resource provider supports. + * + * @throws 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 the request to list operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResourceProviderOperationListInner list() { + return listAsync().block(); + } + + /** + * List all of the available operations the Desktop Virtualization resource provider supports. + * + * @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 the request to list operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse(Context context) { + return listWithResponseAsync(context).block(); + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/OperationsImpl.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..968867037fe8d --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/OperationsImpl.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.desktopvirtualization.DesktopVirtualizationManager; +import com.azure.resourcemanager.desktopvirtualization.fluent.OperationsClient; +import com.azure.resourcemanager.desktopvirtualization.fluent.models.ResourceProviderOperationListInner; +import com.azure.resourcemanager.desktopvirtualization.models.Operations; +import com.azure.resourcemanager.desktopvirtualization.models.ResourceProviderOperationList; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class OperationsImpl implements Operations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationsImpl.class); + + private final OperationsClient innerClient; + + private final DesktopVirtualizationManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, DesktopVirtualizationManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ResourceProviderOperationList list() { + ResourceProviderOperationListInner inner = this.serviceClient().list(); + if (inner != null) { + return new ResourceProviderOperationListImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listWithResponse(Context context) { + Response inner = this.serviceClient().listWithResponse(context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ResourceProviderOperationListImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private DesktopVirtualizationManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/RegistrationInfoImpl.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/RegistrationInfoImpl.java new file mode 100644 index 0000000000000..34d8730ee7753 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/RegistrationInfoImpl.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.implementation; + +import com.azure.resourcemanager.desktopvirtualization.DesktopVirtualizationManager; +import com.azure.resourcemanager.desktopvirtualization.fluent.models.RegistrationInfoInner; +import com.azure.resourcemanager.desktopvirtualization.models.RegistrationInfo; +import com.azure.resourcemanager.desktopvirtualization.models.RegistrationTokenOperation; +import java.time.OffsetDateTime; + +public final class RegistrationInfoImpl implements RegistrationInfo { + private RegistrationInfoInner innerObject; + + private final DesktopVirtualizationManager serviceManager; + + RegistrationInfoImpl(RegistrationInfoInner innerObject, DesktopVirtualizationManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public OffsetDateTime expirationTime() { + return this.innerModel().expirationTime(); + } + + public String token() { + return this.innerModel().token(); + } + + public RegistrationTokenOperation registrationTokenOperation() { + return this.innerModel().registrationTokenOperation(); + } + + public RegistrationInfoInner innerModel() { + return this.innerObject; + } + + private DesktopVirtualizationManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/ResourceProviderOperationListImpl.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/ResourceProviderOperationListImpl.java new file mode 100644 index 0000000000000..5cc14de067a87 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/ResourceProviderOperationListImpl.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.desktopvirtualization.implementation; + +import com.azure.resourcemanager.desktopvirtualization.DesktopVirtualizationManager; +import com.azure.resourcemanager.desktopvirtualization.fluent.models.ResourceProviderOperationListInner; +import com.azure.resourcemanager.desktopvirtualization.models.ResourceProviderOperation; +import com.azure.resourcemanager.desktopvirtualization.models.ResourceProviderOperationList; +import java.util.Collections; +import java.util.List; + +public final class ResourceProviderOperationListImpl implements ResourceProviderOperationList { + private ResourceProviderOperationListInner innerObject; + + private final DesktopVirtualizationManager serviceManager; + + ResourceProviderOperationListImpl( + ResourceProviderOperationListInner innerObject, DesktopVirtualizationManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List value() { + List inner = this.innerModel().value(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public ResourceProviderOperationListInner innerModel() { + return this.innerObject; + } + + private DesktopVirtualizationManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/ScalingPlanImpl.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/ScalingPlanImpl.java new file mode 100644 index 0000000000000..4988ba9c827a6 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/ScalingPlanImpl.java @@ -0,0 +1,356 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.desktopvirtualization.DesktopVirtualizationManager; +import com.azure.resourcemanager.desktopvirtualization.fluent.models.ScalingPlanInner; +import com.azure.resourcemanager.desktopvirtualization.models.HostPoolType; +import com.azure.resourcemanager.desktopvirtualization.models.Identity; +import com.azure.resourcemanager.desktopvirtualization.models.Plan; +import com.azure.resourcemanager.desktopvirtualization.models.ScalingHostPoolReference; +import com.azure.resourcemanager.desktopvirtualization.models.ScalingPlan; +import com.azure.resourcemanager.desktopvirtualization.models.ScalingPlanPatch; +import com.azure.resourcemanager.desktopvirtualization.models.ScalingSchedule; +import com.azure.resourcemanager.desktopvirtualization.models.Sku; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class ScalingPlanImpl implements ScalingPlan, ScalingPlan.Definition, ScalingPlan.Update { + private ScalingPlanInner innerObject; + + private final DesktopVirtualizationManager 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 String managedBy() { + return this.innerModel().managedBy(); + } + + public String kind() { + return this.innerModel().kind(); + } + + public String etag() { + return this.innerModel().etag(); + } + + public Identity identity() { + return this.innerModel().identity(); + } + + public Sku sku() { + return this.innerModel().sku(); + } + + public Plan plan() { + return this.innerModel().plan(); + } + + public String objectId() { + return this.innerModel().objectId(); + } + + public Integer ring() { + return this.innerModel().ring(); + } + + public String description() { + return this.innerModel().description(); + } + + public String friendlyName() { + return this.innerModel().friendlyName(); + } + + public String timeZone() { + return this.innerModel().timeZone(); + } + + public HostPoolType hostPoolType() { + return this.innerModel().hostPoolType(); + } + + public String exclusionTag() { + return this.innerModel().exclusionTag(); + } + + public List schedules() { + List inner = this.innerModel().schedules(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List hostPoolReferences() { + List inner = this.innerModel().hostPoolReferences(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public ScalingPlanInner innerModel() { + return this.innerObject; + } + + private DesktopVirtualizationManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String scalingPlanName; + + private ScalingPlanPatch updateScalingPlan; + + public ScalingPlanImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public ScalingPlan create() { + this.innerObject = + serviceManager + .serviceClient() + .getScalingPlans() + .createWithResponse(resourceGroupName, scalingPlanName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public ScalingPlan create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getScalingPlans() + .createWithResponse(resourceGroupName, scalingPlanName, this.innerModel(), context) + .getValue(); + return this; + } + + ScalingPlanImpl(String name, DesktopVirtualizationManager serviceManager) { + this.innerObject = new ScalingPlanInner(); + this.serviceManager = serviceManager; + this.scalingPlanName = name; + } + + public ScalingPlanImpl update() { + this.updateScalingPlan = new ScalingPlanPatch(); + return this; + } + + public ScalingPlan apply() { + this.innerObject = + serviceManager + .serviceClient() + .getScalingPlans() + .updateWithResponse(resourceGroupName, scalingPlanName, updateScalingPlan, Context.NONE) + .getValue(); + return this; + } + + public ScalingPlan apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getScalingPlans() + .updateWithResponse(resourceGroupName, scalingPlanName, updateScalingPlan, context) + .getValue(); + return this; + } + + ScalingPlanImpl(ScalingPlanInner innerObject, DesktopVirtualizationManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.scalingPlanName = Utils.getValueFromIdByName(innerObject.id(), "scalingPlans"); + } + + public ScalingPlan refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getScalingPlans() + .getByResourceGroupWithResponse(resourceGroupName, scalingPlanName, Context.NONE) + .getValue(); + return this; + } + + public ScalingPlan refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getScalingPlans() + .getByResourceGroupWithResponse(resourceGroupName, scalingPlanName, context) + .getValue(); + return this; + } + + public ScalingPlanImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public ScalingPlanImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public ScalingPlanImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateScalingPlan.withTags(tags); + return this; + } + } + + public ScalingPlanImpl withManagedBy(String managedBy) { + this.innerModel().withManagedBy(managedBy); + return this; + } + + public ScalingPlanImpl withKind(String kind) { + this.innerModel().withKind(kind); + return this; + } + + public ScalingPlanImpl withIdentity(Identity identity) { + this.innerModel().withIdentity(identity); + return this; + } + + public ScalingPlanImpl withSku(Sku sku) { + this.innerModel().withSku(sku); + return this; + } + + public ScalingPlanImpl withPlan(Plan plan) { + this.innerModel().withPlan(plan); + return this; + } + + public ScalingPlanImpl withRing(Integer ring) { + if (isInCreateMode()) { + this.innerModel().withRing(ring); + return this; + } else { + this.updateScalingPlan.withRing(ring); + return this; + } + } + + public ScalingPlanImpl withDescription(String description) { + if (isInCreateMode()) { + this.innerModel().withDescription(description); + return this; + } else { + this.updateScalingPlan.withDescription(description); + return this; + } + } + + public ScalingPlanImpl withFriendlyName(String friendlyName) { + if (isInCreateMode()) { + this.innerModel().withFriendlyName(friendlyName); + return this; + } else { + this.updateScalingPlan.withFriendlyName(friendlyName); + return this; + } + } + + public ScalingPlanImpl withTimeZone(String timeZone) { + if (isInCreateMode()) { + this.innerModel().withTimeZone(timeZone); + return this; + } else { + this.updateScalingPlan.withTimeZone(timeZone); + return this; + } + } + + public ScalingPlanImpl withHostPoolType(HostPoolType hostPoolType) { + if (isInCreateMode()) { + this.innerModel().withHostPoolType(hostPoolType); + return this; + } else { + this.updateScalingPlan.withHostPoolType(hostPoolType); + return this; + } + } + + public ScalingPlanImpl withExclusionTag(String exclusionTag) { + if (isInCreateMode()) { + this.innerModel().withExclusionTag(exclusionTag); + return this; + } else { + this.updateScalingPlan.withExclusionTag(exclusionTag); + return this; + } + } + + public ScalingPlanImpl withSchedules(List schedules) { + if (isInCreateMode()) { + this.innerModel().withSchedules(schedules); + return this; + } else { + this.updateScalingPlan.withSchedules(schedules); + return this; + } + } + + public ScalingPlanImpl withHostPoolReferences(List hostPoolReferences) { + if (isInCreateMode()) { + this.innerModel().withHostPoolReferences(hostPoolReferences); + return this; + } else { + this.updateScalingPlan.withHostPoolReferences(hostPoolReferences); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/ScalingPlansClientImpl.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/ScalingPlansClientImpl.java new file mode 100644 index 0000000000000..8a5f9242cb3b6 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/ScalingPlansClientImpl.java @@ -0,0 +1,1550 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.desktopvirtualization.fluent.ScalingPlansClient; +import com.azure.resourcemanager.desktopvirtualization.fluent.models.ScalingPlanInner; +import com.azure.resourcemanager.desktopvirtualization.models.ScalingPlanList; +import com.azure.resourcemanager.desktopvirtualization.models.ScalingPlanPatch; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ScalingPlansClient. */ +public final class ScalingPlansClientImpl implements ScalingPlansClient { + private final ClientLogger logger = new ClientLogger(ScalingPlansClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ScalingPlansService service; + + /** The service client containing this operation class. */ + private final DesktopVirtualizationApiClientImpl client; + + /** + * Initializes an instance of ScalingPlansClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ScalingPlansClientImpl(DesktopVirtualizationApiClientImpl client) { + this.service = + RestProxy.create(ScalingPlansService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DesktopVirtualizationApiClientScalingPlans to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DesktopVirtualizatio") + private interface ScalingPlansService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("scalingPlanName") String scalingPlanName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> create( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("scalingPlanName") String scalingPlanName, + @BodyParam("application/json") ScalingPlanInner scalingPlan, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("scalingPlanName") String scalingPlanName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("scalingPlanName") String scalingPlanName, + @BodyParam("application/json") ScalingPlanPatch scalingPlan, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.DesktopVirtualization/scalingPlans") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/scalingPlans") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/scalingPlans") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByHostPool( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("hostPoolName") String hostPoolName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByHostPoolNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get a scaling plan. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scalingPlanName The name of the scaling plan. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 scaling plan. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String scalingPlanName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (scalingPlanName == null) { + return Mono + .error(new IllegalArgumentException("Parameter scalingPlanName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + scalingPlanName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get a scaling plan. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scalingPlanName The name of the scaling plan. + * @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 scaling plan. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String scalingPlanName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (scalingPlanName == null) { + return Mono + .error(new IllegalArgumentException("Parameter scalingPlanName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + scalingPlanName, + accept, + context); + } + + /** + * Get a scaling plan. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scalingPlanName The name of the scaling plan. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 scaling plan. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String scalingPlanName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, scalingPlanName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get a scaling plan. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scalingPlanName The name of the scaling plan. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 scaling plan. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ScalingPlanInner getByResourceGroup(String resourceGroupName, String scalingPlanName) { + return getByResourceGroupAsync(resourceGroupName, scalingPlanName).block(); + } + + /** + * Get a scaling plan. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scalingPlanName The name of the scaling plan. + * @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 scaling plan. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String scalingPlanName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, scalingPlanName, context).block(); + } + + /** + * Create or update a scaling plan. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scalingPlanName The name of the scaling plan. + * @param scalingPlan Object containing scaling plan definitions. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a scaling plan definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String resourceGroupName, String scalingPlanName, ScalingPlanInner scalingPlan) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (scalingPlanName == null) { + return Mono + .error(new IllegalArgumentException("Parameter scalingPlanName is required and cannot be null.")); + } + if (scalingPlan == null) { + return Mono.error(new IllegalArgumentException("Parameter scalingPlan is required and cannot be null.")); + } else { + scalingPlan.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .create( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + scalingPlanName, + scalingPlan, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create or update a scaling plan. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scalingPlanName The name of the scaling plan. + * @param scalingPlan Object containing scaling plan definitions. + * @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 represents a scaling plan definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String resourceGroupName, String scalingPlanName, ScalingPlanInner scalingPlan, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (scalingPlanName == null) { + return Mono + .error(new IllegalArgumentException("Parameter scalingPlanName is required and cannot be null.")); + } + if (scalingPlan == null) { + return Mono.error(new IllegalArgumentException("Parameter scalingPlan is required and cannot be null.")); + } else { + scalingPlan.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .create( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + scalingPlanName, + scalingPlan, + accept, + context); + } + + /** + * Create or update a scaling plan. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scalingPlanName The name of the scaling plan. + * @param scalingPlan Object containing scaling plan definitions. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a scaling plan definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String scalingPlanName, ScalingPlanInner scalingPlan) { + return createWithResponseAsync(resourceGroupName, scalingPlanName, scalingPlan) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Create or update a scaling plan. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scalingPlanName The name of the scaling plan. + * @param scalingPlan Object containing scaling plan definitions. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a scaling plan definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ScalingPlanInner create(String resourceGroupName, String scalingPlanName, ScalingPlanInner scalingPlan) { + return createAsync(resourceGroupName, scalingPlanName, scalingPlan).block(); + } + + /** + * Create or update a scaling plan. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scalingPlanName The name of the scaling plan. + * @param scalingPlan Object containing scaling plan definitions. + * @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 represents a scaling plan definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse( + String resourceGroupName, String scalingPlanName, ScalingPlanInner scalingPlan, Context context) { + return createWithResponseAsync(resourceGroupName, scalingPlanName, scalingPlan, context).block(); + } + + /** + * Remove a scaling plan. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scalingPlanName The name of the scaling plan. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String scalingPlanName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (scalingPlanName == null) { + return Mono + .error(new IllegalArgumentException("Parameter scalingPlanName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + scalingPlanName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Remove a scaling plan. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scalingPlanName The name of the scaling plan. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String scalingPlanName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (scalingPlanName == null) { + return Mono + .error(new IllegalArgumentException("Parameter scalingPlanName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + scalingPlanName, + accept, + context); + } + + /** + * Remove a scaling plan. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scalingPlanName The name of the scaling plan. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String scalingPlanName) { + return deleteWithResponseAsync(resourceGroupName, scalingPlanName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Remove a scaling plan. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scalingPlanName The name of the scaling plan. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String scalingPlanName) { + deleteAsync(resourceGroupName, scalingPlanName).block(); + } + + /** + * Remove a scaling plan. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scalingPlanName The name of the scaling plan. + * @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 Response deleteWithResponse(String resourceGroupName, String scalingPlanName, Context context) { + return deleteWithResponseAsync(resourceGroupName, scalingPlanName, context).block(); + } + + /** + * Update a scaling plan. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scalingPlanName The name of the scaling plan. + * @param scalingPlan Object containing scaling plan definitions. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a scaling plan definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String scalingPlanName, ScalingPlanPatch scalingPlan) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (scalingPlanName == null) { + return Mono + .error(new IllegalArgumentException("Parameter scalingPlanName is required and cannot be null.")); + } + if (scalingPlan != null) { + scalingPlan.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + scalingPlanName, + scalingPlan, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Update a scaling plan. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scalingPlanName The name of the scaling plan. + * @param scalingPlan Object containing scaling plan definitions. + * @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 represents a scaling plan definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String scalingPlanName, ScalingPlanPatch scalingPlan, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (scalingPlanName == null) { + return Mono + .error(new IllegalArgumentException("Parameter scalingPlanName is required and cannot be null.")); + } + if (scalingPlan != null) { + scalingPlan.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + scalingPlanName, + scalingPlan, + accept, + context); + } + + /** + * Update a scaling plan. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scalingPlanName The name of the scaling plan. + * @param scalingPlan Object containing scaling plan definitions. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a scaling plan definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String scalingPlanName, ScalingPlanPatch scalingPlan) { + return updateWithResponseAsync(resourceGroupName, scalingPlanName, scalingPlan) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Update a scaling plan. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scalingPlanName The name of the scaling plan. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a scaling plan definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String scalingPlanName) { + final ScalingPlanPatch scalingPlan = null; + return updateWithResponseAsync(resourceGroupName, scalingPlanName, scalingPlan) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Update a scaling plan. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scalingPlanName The name of the scaling plan. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a scaling plan definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ScalingPlanInner update(String resourceGroupName, String scalingPlanName) { + final ScalingPlanPatch scalingPlan = null; + return updateAsync(resourceGroupName, scalingPlanName, scalingPlan).block(); + } + + /** + * Update a scaling plan. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scalingPlanName The name of the scaling plan. + * @param scalingPlan Object containing scaling plan definitions. + * @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 represents a scaling plan definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, String scalingPlanName, ScalingPlanPatch scalingPlan, Context context) { + return updateWithResponseAsync(resourceGroupName, scalingPlanName, scalingPlan, context).block(); + } + + /** + * List scaling plans. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of scaling plan definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List scaling plans. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of scaling plan definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List scaling plans. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of scaling plan definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List scaling plans. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of scaling plan definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * List scaling plans. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of scaling plan definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * List scaling plans. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of scaling plan definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * List scaling plans in 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 list of scaling plan definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List scaling plans in 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 list of scaling plan definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List scaling plans in 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 list of scaling plan definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>( + () -> listSinglePageAsync(), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List scaling plans in 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 list of scaling plan definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * List scaling plans in 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 list of scaling plan definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List scaling plans in 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 list of scaling plan definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * List scaling plan associated with hostpool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of scaling plan definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByHostPoolSinglePageAsync( + String resourceGroupName, String hostPoolName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (hostPoolName == null) { + return Mono.error(new IllegalArgumentException("Parameter hostPoolName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByHostPool( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + hostPoolName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List scaling plan associated with hostpool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of scaling plan definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByHostPoolSinglePageAsync( + String resourceGroupName, String hostPoolName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (hostPoolName == null) { + return Mono.error(new IllegalArgumentException("Parameter hostPoolName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByHostPool( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + hostPoolName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List scaling plan associated with hostpool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of scaling plan definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByHostPoolAsync(String resourceGroupName, String hostPoolName) { + return new PagedFlux<>( + () -> listByHostPoolSinglePageAsync(resourceGroupName, hostPoolName), + nextLink -> listByHostPoolNextSinglePageAsync(nextLink)); + } + + /** + * List scaling plan associated with hostpool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of scaling plan definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByHostPoolAsync( + String resourceGroupName, String hostPoolName, Context context) { + return new PagedFlux<>( + () -> listByHostPoolSinglePageAsync(resourceGroupName, hostPoolName, context), + nextLink -> listByHostPoolNextSinglePageAsync(nextLink, context)); + } + + /** + * List scaling plan associated with hostpool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of scaling plan definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByHostPool(String resourceGroupName, String hostPoolName) { + return new PagedIterable<>(listByHostPoolAsync(resourceGroupName, hostPoolName)); + } + + /** + * List scaling plan associated with hostpool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of scaling plan definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByHostPool( + String resourceGroupName, String hostPoolName, Context context) { + return new PagedIterable<>(listByHostPoolAsync(resourceGroupName, hostPoolName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of scaling plan definitions. + */ + @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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of scaling plan definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of scaling plan definitions. + */ + @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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of scaling plan definitions. + */ + @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 list of scaling plan definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByHostPoolNextSinglePageAsync(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.listByHostPoolNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of scaling plan definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByHostPoolNextSinglePageAsync(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 + .listByHostPoolNext(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/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/ScalingPlansImpl.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/ScalingPlansImpl.java new file mode 100644 index 0000000000000..0c30417f6a9d2 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/ScalingPlansImpl.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.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.desktopvirtualization.DesktopVirtualizationManager; +import com.azure.resourcemanager.desktopvirtualization.fluent.ScalingPlansClient; +import com.azure.resourcemanager.desktopvirtualization.fluent.models.ScalingPlanInner; +import com.azure.resourcemanager.desktopvirtualization.models.ScalingPlan; +import com.azure.resourcemanager.desktopvirtualization.models.ScalingPlans; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ScalingPlansImpl implements ScalingPlans { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ScalingPlansImpl.class); + + private final ScalingPlansClient innerClient; + + private final DesktopVirtualizationManager serviceManager; + + public ScalingPlansImpl(ScalingPlansClient innerClient, DesktopVirtualizationManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ScalingPlan getByResourceGroup(String resourceGroupName, String scalingPlanName) { + ScalingPlanInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, scalingPlanName); + if (inner != null) { + return new ScalingPlanImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String scalingPlanName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, scalingPlanName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ScalingPlanImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String scalingPlanName) { + this.serviceClient().delete(resourceGroupName, scalingPlanName); + } + + public Response deleteWithResponse(String resourceGroupName, String scalingPlanName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, scalingPlanName, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new ScalingPlanImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new ScalingPlanImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new ScalingPlanImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new ScalingPlanImpl(inner1, this.manager())); + } + + public PagedIterable listByHostPool(String resourceGroupName, String hostPoolName) { + PagedIterable inner = this.serviceClient().listByHostPool(resourceGroupName, hostPoolName); + return Utils.mapPage(inner, inner1 -> new ScalingPlanImpl(inner1, this.manager())); + } + + public PagedIterable listByHostPool(String resourceGroupName, String hostPoolName, Context context) { + PagedIterable inner = + this.serviceClient().listByHostPool(resourceGroupName, hostPoolName, context); + return Utils.mapPage(inner, inner1 -> new ScalingPlanImpl(inner1, this.manager())); + } + + public ScalingPlan getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String scalingPlanName = Utils.getValueFromIdByName(id, "scalingPlans"); + if (scalingPlanName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'scalingPlans'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, scalingPlanName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String scalingPlanName = Utils.getValueFromIdByName(id, "scalingPlans"); + if (scalingPlanName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'scalingPlans'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, scalingPlanName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String scalingPlanName = Utils.getValueFromIdByName(id, "scalingPlans"); + if (scalingPlanName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'scalingPlans'.", id))); + } + this.deleteWithResponse(resourceGroupName, scalingPlanName, Context.NONE).getValue(); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String scalingPlanName = Utils.getValueFromIdByName(id, "scalingPlans"); + if (scalingPlanName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'scalingPlans'.", id))); + } + return this.deleteWithResponse(resourceGroupName, scalingPlanName, context); + } + + private ScalingPlansClient serviceClient() { + return this.innerClient; + } + + private DesktopVirtualizationManager manager() { + return this.serviceManager; + } + + public ScalingPlanImpl define(String name) { + return new ScalingPlanImpl(name, this.manager()); + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/SessionHostImpl.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/SessionHostImpl.java new file mode 100644 index 0000000000000..f27a7acacaead --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/SessionHostImpl.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.implementation; + +import com.azure.resourcemanager.desktopvirtualization.DesktopVirtualizationManager; +import com.azure.resourcemanager.desktopvirtualization.fluent.models.SessionHostInner; +import com.azure.resourcemanager.desktopvirtualization.models.SessionHost; +import com.azure.resourcemanager.desktopvirtualization.models.SessionHostHealthCheckReport; +import com.azure.resourcemanager.desktopvirtualization.models.Status; +import com.azure.resourcemanager.desktopvirtualization.models.UpdateState; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; + +public final class SessionHostImpl implements SessionHost { + private SessionHostInner innerObject; + + private final DesktopVirtualizationManager serviceManager; + + SessionHostImpl(SessionHostInner innerObject, DesktopVirtualizationManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String objectId() { + return this.innerModel().objectId(); + } + + public OffsetDateTime lastHeartBeat() { + return this.innerModel().lastHeartBeat(); + } + + public Integer sessions() { + return this.innerModel().sessions(); + } + + public String agentVersion() { + return this.innerModel().agentVersion(); + } + + public Boolean allowNewSession() { + return this.innerModel().allowNewSession(); + } + + public String virtualMachineId() { + return this.innerModel().virtualMachineId(); + } + + public String resourceId() { + return this.innerModel().resourceId(); + } + + public String assignedUser() { + return this.innerModel().assignedUser(); + } + + public Status status() { + return this.innerModel().status(); + } + + public OffsetDateTime statusTimestamp() { + return this.innerModel().statusTimestamp(); + } + + public String osVersion() { + return this.innerModel().osVersion(); + } + + public String sxSStackVersion() { + return this.innerModel().sxSStackVersion(); + } + + public UpdateState updateState() { + return this.innerModel().updateState(); + } + + public OffsetDateTime lastUpdateTime() { + return this.innerModel().lastUpdateTime(); + } + + public String updateErrorMessage() { + return this.innerModel().updateErrorMessage(); + } + + public List sessionHostHealthCheckResults() { + List inner = this.innerModel().sessionHostHealthCheckResults(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public SessionHostInner innerModel() { + return this.innerObject; + } + + private DesktopVirtualizationManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/SessionHostsClientImpl.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/SessionHostsClientImpl.java new file mode 100644 index 0000000000000..f393bcfd8ca30 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/SessionHostsClientImpl.java @@ -0,0 +1,945 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.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.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.desktopvirtualization.fluent.SessionHostsClient; +import com.azure.resourcemanager.desktopvirtualization.fluent.models.SessionHostInner; +import com.azure.resourcemanager.desktopvirtualization.models.SessionHostList; +import com.azure.resourcemanager.desktopvirtualization.models.SessionHostPatch; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in SessionHostsClient. */ +public final class SessionHostsClientImpl implements SessionHostsClient { + private final ClientLogger logger = new ClientLogger(SessionHostsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final SessionHostsService service; + + /** The service client containing this operation class. */ + private final DesktopVirtualizationApiClientImpl client; + + /** + * Initializes an instance of SessionHostsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SessionHostsClientImpl(DesktopVirtualizationApiClientImpl client) { + this.service = + RestProxy.create(SessionHostsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DesktopVirtualizationApiClientSessionHosts to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DesktopVirtualizatio") + private interface SessionHostsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("hostPoolName") String hostPoolName, + @PathParam("sessionHostName") String sessionHostname, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("hostPoolName") String hostPoolName, + @PathParam("sessionHostName") String sessionHostname, + @QueryParam("force") Boolean force, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("hostPoolName") String hostPoolName, + @PathParam("sessionHostName") String sessionHostname, + @BodyParam("application/json") SessionHostPatch sessionHost, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("hostPoolName") String hostPoolName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get a session host. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 session host. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String hostPoolName, String sessionHostname) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (hostPoolName == null) { + return Mono.error(new IllegalArgumentException("Parameter hostPoolName is required and cannot be null.")); + } + if (sessionHostname == null) { + return Mono + .error(new IllegalArgumentException("Parameter sessionHostname is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + hostPoolName, + sessionHostname, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get a session host. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @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 session host. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String hostPoolName, String sessionHostname, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (hostPoolName == null) { + return Mono.error(new IllegalArgumentException("Parameter hostPoolName is required and cannot be null.")); + } + if (sessionHostname == null) { + return Mono + .error(new IllegalArgumentException("Parameter sessionHostname is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + hostPoolName, + sessionHostname, + accept, + context); + } + + /** + * Get a session host. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 session host. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String hostPoolName, String sessionHostname) { + return getWithResponseAsync(resourceGroupName, hostPoolName, sessionHostname) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get a session host. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 session host. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SessionHostInner get(String resourceGroupName, String hostPoolName, String sessionHostname) { + return getAsync(resourceGroupName, hostPoolName, sessionHostname).block(); + } + + /** + * Get a session host. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @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 session host. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String hostPoolName, String sessionHostname, Context context) { + return getWithResponseAsync(resourceGroupName, hostPoolName, sessionHostname, context).block(); + } + + /** + * Remove a SessionHost. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @param force Force flag to force sessionHost deletion even when userSession exists. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String hostPoolName, String sessionHostname, Boolean force) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (hostPoolName == null) { + return Mono.error(new IllegalArgumentException("Parameter hostPoolName is required and cannot be null.")); + } + if (sessionHostname == null) { + return Mono + .error(new IllegalArgumentException("Parameter sessionHostname is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + hostPoolName, + sessionHostname, + force, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Remove a SessionHost. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @param force Force flag to force sessionHost deletion even when userSession exists. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String hostPoolName, String sessionHostname, Boolean force, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (hostPoolName == null) { + return Mono.error(new IllegalArgumentException("Parameter hostPoolName is required and cannot be null.")); + } + if (sessionHostname == null) { + return Mono + .error(new IllegalArgumentException("Parameter sessionHostname is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + hostPoolName, + sessionHostname, + force, + accept, + context); + } + + /** + * Remove a SessionHost. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @param force Force flag to force sessionHost deletion even when userSession exists. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String hostPoolName, String sessionHostname, Boolean force) { + return deleteWithResponseAsync(resourceGroupName, hostPoolName, sessionHostname, force) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Remove a SessionHost. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String hostPoolName, String sessionHostname) { + final Boolean force = null; + return deleteWithResponseAsync(resourceGroupName, hostPoolName, sessionHostname, force) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Remove a SessionHost. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String hostPoolName, String sessionHostname) { + final Boolean force = null; + deleteAsync(resourceGroupName, hostPoolName, sessionHostname, force).block(); + } + + /** + * Remove a SessionHost. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @param force Force flag to force sessionHost deletion even when userSession exists. + * @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 Response deleteWithResponse( + String resourceGroupName, String hostPoolName, String sessionHostname, Boolean force, Context context) { + return deleteWithResponseAsync(resourceGroupName, hostPoolName, sessionHostname, force, context).block(); + } + + /** + * Update a session host. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @param sessionHost Object containing SessionHost definitions. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a SessionHost definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String hostPoolName, String sessionHostname, SessionHostPatch sessionHost) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (hostPoolName == null) { + return Mono.error(new IllegalArgumentException("Parameter hostPoolName is required and cannot be null.")); + } + if (sessionHostname == null) { + return Mono + .error(new IllegalArgumentException("Parameter sessionHostname is required and cannot be null.")); + } + if (sessionHost != null) { + sessionHost.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + hostPoolName, + sessionHostname, + sessionHost, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Update a session host. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @param sessionHost Object containing SessionHost definitions. + * @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 represents a SessionHost definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String hostPoolName, + String sessionHostname, + SessionHostPatch sessionHost, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (hostPoolName == null) { + return Mono.error(new IllegalArgumentException("Parameter hostPoolName is required and cannot be null.")); + } + if (sessionHostname == null) { + return Mono + .error(new IllegalArgumentException("Parameter sessionHostname is required and cannot be null.")); + } + if (sessionHost != null) { + sessionHost.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + hostPoolName, + sessionHostname, + sessionHost, + accept, + context); + } + + /** + * Update a session host. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @param sessionHost Object containing SessionHost definitions. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a SessionHost definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String hostPoolName, String sessionHostname, SessionHostPatch sessionHost) { + return updateWithResponseAsync(resourceGroupName, hostPoolName, sessionHostname, sessionHost) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Update a session host. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a SessionHost definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String hostPoolName, String sessionHostname) { + final SessionHostPatch sessionHost = null; + return updateWithResponseAsync(resourceGroupName, hostPoolName, sessionHostname, sessionHost) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Update a session host. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a SessionHost definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SessionHostInner update(String resourceGroupName, String hostPoolName, String sessionHostname) { + final SessionHostPatch sessionHost = null; + return updateAsync(resourceGroupName, hostPoolName, sessionHostname, sessionHost).block(); + } + + /** + * Update a session host. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @param sessionHost Object containing SessionHost definitions. + * @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 represents a SessionHost definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, + String hostPoolName, + String sessionHostname, + SessionHostPatch sessionHost, + Context context) { + return updateWithResponseAsync(resourceGroupName, hostPoolName, sessionHostname, sessionHost, context).block(); + } + + /** + * List sessionHosts. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of SessionHost definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, String hostPoolName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (hostPoolName == null) { + return Mono.error(new IllegalArgumentException("Parameter hostPoolName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + hostPoolName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List sessionHosts. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of SessionHost definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String hostPoolName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (hostPoolName == null) { + return Mono.error(new IllegalArgumentException("Parameter hostPoolName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + hostPoolName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List sessionHosts. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of SessionHost definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String hostPoolName) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, hostPoolName), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List sessionHosts. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of SessionHost definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String hostPoolName, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, hostPoolName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List sessionHosts. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of SessionHost definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String hostPoolName) { + return new PagedIterable<>(listAsync(resourceGroupName, hostPoolName)); + } + + /** + * List sessionHosts. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of SessionHost definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String hostPoolName, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, hostPoolName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of SessionHost definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of SessionHost definitions. + */ + @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/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/SessionHostsImpl.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/SessionHostsImpl.java new file mode 100644 index 0000000000000..e3ad54e1839ec --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/SessionHostsImpl.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.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.desktopvirtualization.DesktopVirtualizationManager; +import com.azure.resourcemanager.desktopvirtualization.fluent.SessionHostsClient; +import com.azure.resourcemanager.desktopvirtualization.fluent.models.SessionHostInner; +import com.azure.resourcemanager.desktopvirtualization.models.SessionHost; +import com.azure.resourcemanager.desktopvirtualization.models.SessionHostPatch; +import com.azure.resourcemanager.desktopvirtualization.models.SessionHosts; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class SessionHostsImpl implements SessionHosts { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SessionHostsImpl.class); + + private final SessionHostsClient innerClient; + + private final DesktopVirtualizationManager serviceManager; + + public SessionHostsImpl(SessionHostsClient innerClient, DesktopVirtualizationManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public SessionHost get(String resourceGroupName, String hostPoolName, String sessionHostname) { + SessionHostInner inner = this.serviceClient().get(resourceGroupName, hostPoolName, sessionHostname); + if (inner != null) { + return new SessionHostImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String hostPoolName, String sessionHostname, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, hostPoolName, sessionHostname, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SessionHostImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String hostPoolName, String sessionHostname) { + this.serviceClient().delete(resourceGroupName, hostPoolName, sessionHostname); + } + + public Response deleteWithResponse( + String resourceGroupName, String hostPoolName, String sessionHostname, Boolean force, Context context) { + return this + .serviceClient() + .deleteWithResponse(resourceGroupName, hostPoolName, sessionHostname, force, context); + } + + public SessionHost update(String resourceGroupName, String hostPoolName, String sessionHostname) { + SessionHostInner inner = this.serviceClient().update(resourceGroupName, hostPoolName, sessionHostname); + if (inner != null) { + return new SessionHostImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response updateWithResponse( + String resourceGroupName, + String hostPoolName, + String sessionHostname, + SessionHostPatch sessionHost, + Context context) { + Response inner = + this + .serviceClient() + .updateWithResponse(resourceGroupName, hostPoolName, sessionHostname, sessionHost, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SessionHostImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable list(String resourceGroupName, String hostPoolName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, hostPoolName); + return Utils.mapPage(inner, inner1 -> new SessionHostImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String hostPoolName, Context context) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, hostPoolName, context); + return Utils.mapPage(inner, inner1 -> new SessionHostImpl(inner1, this.manager())); + } + + private SessionHostsClient serviceClient() { + return this.innerClient; + } + + private DesktopVirtualizationManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/StartMenuItemImpl.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/StartMenuItemImpl.java new file mode 100644 index 0000000000000..d6b176224042e --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/StartMenuItemImpl.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.desktopvirtualization.implementation; + +import com.azure.resourcemanager.desktopvirtualization.DesktopVirtualizationManager; +import com.azure.resourcemanager.desktopvirtualization.fluent.models.StartMenuItemInner; +import com.azure.resourcemanager.desktopvirtualization.models.StartMenuItem; + +public final class StartMenuItemImpl implements StartMenuItem { + private StartMenuItemInner innerObject; + + private final DesktopVirtualizationManager serviceManager; + + StartMenuItemImpl(StartMenuItemInner innerObject, DesktopVirtualizationManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String appAlias() { + return this.innerModel().appAlias(); + } + + public String filePath() { + return this.innerModel().filePath(); + } + + public String commandLineArguments() { + return this.innerModel().commandLineArguments(); + } + + public String iconPath() { + return this.innerModel().iconPath(); + } + + public Integer iconIndex() { + return this.innerModel().iconIndex(); + } + + public StartMenuItemInner innerModel() { + return this.innerObject; + } + + private DesktopVirtualizationManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/StartMenuItemsClientImpl.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/StartMenuItemsClientImpl.java new file mode 100644 index 0000000000000..2ff7bfb54025c --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/StartMenuItemsClientImpl.java @@ -0,0 +1,340 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.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.desktopvirtualization.fluent.StartMenuItemsClient; +import com.azure.resourcemanager.desktopvirtualization.fluent.models.StartMenuItemInner; +import com.azure.resourcemanager.desktopvirtualization.models.StartMenuItemList; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in StartMenuItemsClient. */ +public final class StartMenuItemsClientImpl implements StartMenuItemsClient { + private final ClientLogger logger = new ClientLogger(StartMenuItemsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final StartMenuItemsService service; + + /** The service client containing this operation class. */ + private final DesktopVirtualizationApiClientImpl client; + + /** + * Initializes an instance of StartMenuItemsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + StartMenuItemsClientImpl(DesktopVirtualizationApiClientImpl client) { + this.service = + RestProxy.create(StartMenuItemsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DesktopVirtualizationApiClientStartMenuItems to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DesktopVirtualizatio") + private interface StartMenuItemsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/startMenuItems") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("applicationGroupName") String applicationGroupName, + @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 start menu items in the given application group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of StartMenuItem definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String applicationGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (applicationGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + applicationGroupName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List start menu items in the given application group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of StartMenuItem definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String applicationGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (applicationGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter applicationGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + applicationGroupName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List start menu items in the given application group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of StartMenuItem definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String applicationGroupName) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, applicationGroupName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List start menu items in the given application group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of StartMenuItem definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String applicationGroupName, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, applicationGroupName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List start menu items in the given application group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of StartMenuItem definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String applicationGroupName) { + return new PagedIterable<>(listAsync(resourceGroupName, applicationGroupName)); + } + + /** + * List start menu items in the given application group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of StartMenuItem definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, String applicationGroupName, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, applicationGroupName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of StartMenuItem definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of StartMenuItem definitions. + */ + @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/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/StartMenuItemsImpl.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/StartMenuItemsImpl.java new file mode 100644 index 0000000000000..6b516c1c9d17e --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/StartMenuItemsImpl.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.desktopvirtualization.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.desktopvirtualization.DesktopVirtualizationManager; +import com.azure.resourcemanager.desktopvirtualization.fluent.StartMenuItemsClient; +import com.azure.resourcemanager.desktopvirtualization.fluent.models.StartMenuItemInner; +import com.azure.resourcemanager.desktopvirtualization.models.StartMenuItem; +import com.azure.resourcemanager.desktopvirtualization.models.StartMenuItems; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class StartMenuItemsImpl implements StartMenuItems { + @JsonIgnore private final ClientLogger logger = new ClientLogger(StartMenuItemsImpl.class); + + private final StartMenuItemsClient innerClient; + + private final DesktopVirtualizationManager serviceManager; + + public StartMenuItemsImpl(StartMenuItemsClient innerClient, DesktopVirtualizationManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String applicationGroupName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, applicationGroupName); + return Utils.mapPage(inner, inner1 -> new StartMenuItemImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String applicationGroupName, Context context) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, applicationGroupName, context); + return Utils.mapPage(inner, inner1 -> new StartMenuItemImpl(inner1, this.manager())); + } + + private StartMenuItemsClient serviceClient() { + return this.innerClient; + } + + private DesktopVirtualizationManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/UserSessionImpl.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/UserSessionImpl.java new file mode 100644 index 0000000000000..dc5cb0328888f --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/UserSessionImpl.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.implementation; + +import com.azure.resourcemanager.desktopvirtualization.DesktopVirtualizationManager; +import com.azure.resourcemanager.desktopvirtualization.fluent.models.UserSessionInner; +import com.azure.resourcemanager.desktopvirtualization.models.ApplicationType; +import com.azure.resourcemanager.desktopvirtualization.models.SessionState; +import com.azure.resourcemanager.desktopvirtualization.models.UserSession; +import java.time.OffsetDateTime; + +public final class UserSessionImpl implements UserSession { + private UserSessionInner innerObject; + + private final DesktopVirtualizationManager serviceManager; + + UserSessionImpl(UserSessionInner innerObject, DesktopVirtualizationManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String objectId() { + return this.innerModel().objectId(); + } + + public String userPrincipalName() { + return this.innerModel().userPrincipalName(); + } + + public ApplicationType applicationType() { + return this.innerModel().applicationType(); + } + + public SessionState sessionState() { + return this.innerModel().sessionState(); + } + + public String activeDirectoryUsername() { + return this.innerModel().activeDirectoryUsername(); + } + + public OffsetDateTime createTime() { + return this.innerModel().createTime(); + } + + public UserSessionInner innerModel() { + return this.innerObject; + } + + private DesktopVirtualizationManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/UserSessionsClientImpl.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/UserSessionsClientImpl.java new file mode 100644 index 0000000000000..47a915aa057f7 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/UserSessionsClientImpl.java @@ -0,0 +1,1524 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.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.desktopvirtualization.fluent.UserSessionsClient; +import com.azure.resourcemanager.desktopvirtualization.fluent.models.UserSessionInner; +import com.azure.resourcemanager.desktopvirtualization.models.SendMessage; +import com.azure.resourcemanager.desktopvirtualization.models.UserSessionList; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in UserSessionsClient. */ +public final class UserSessionsClientImpl implements UserSessionsClient { + private final ClientLogger logger = new ClientLogger(UserSessionsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final UserSessionsService service; + + /** The service client containing this operation class. */ + private final DesktopVirtualizationApiClientImpl client; + + /** + * Initializes an instance of UserSessionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + UserSessionsClientImpl(DesktopVirtualizationApiClientImpl client) { + this.service = + RestProxy.create(UserSessionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DesktopVirtualizationApiClientUserSessions to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DesktopVirtualizatio") + private interface UserSessionsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/userSessions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByHostPool( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("hostPoolName") String hostPoolName, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}" + + "/userSessions/{userSessionId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("hostPoolName") String hostPoolName, + @PathParam("sessionHostName") String sessionHostname, + @PathParam("userSessionId") String userSessionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}" + + "/userSessions/{userSessionId}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("hostPoolName") String hostPoolName, + @PathParam("sessionHostName") String sessionHostname, + @PathParam("userSessionId") String userSessionId, + @QueryParam("force") Boolean force, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}" + + "/userSessions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("hostPoolName") String hostPoolName, + @PathParam("sessionHostName") String sessionHostname, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}" + + "/userSessions/{userSessionId}/disconnect") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> disconnect( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("hostPoolName") String hostPoolName, + @PathParam("sessionHostName") String sessionHostname, + @PathParam("userSessionId") String userSessionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}" + + "/userSessions/{userSessionId}/sendMessage") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> sendMessage( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("hostPoolName") String hostPoolName, + @PathParam("sessionHostName") String sessionHostname, + @PathParam("userSessionId") String userSessionId, + @BodyParam("application/json") SendMessage sendMessage, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByHostPoolNext( + @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> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List userSessions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param filter OData filter expression. Valid properties for filtering are userprincipalname and sessionstate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of UserSession definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByHostPoolSinglePageAsync( + String resourceGroupName, String hostPoolName, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (hostPoolName == null) { + return Mono.error(new IllegalArgumentException("Parameter hostPoolName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByHostPool( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + hostPoolName, + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List userSessions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param filter OData filter expression. Valid properties for filtering are userprincipalname and sessionstate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of UserSession definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByHostPoolSinglePageAsync( + String resourceGroupName, String hostPoolName, String filter, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (hostPoolName == null) { + return Mono.error(new IllegalArgumentException("Parameter hostPoolName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByHostPool( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + hostPoolName, + filter, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List userSessions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param filter OData filter expression. Valid properties for filtering are userprincipalname and sessionstate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of UserSession definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByHostPoolAsync( + String resourceGroupName, String hostPoolName, String filter) { + return new PagedFlux<>( + () -> listByHostPoolSinglePageAsync(resourceGroupName, hostPoolName, filter), + nextLink -> listByHostPoolNextSinglePageAsync(nextLink)); + } + + /** + * List userSessions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of UserSession definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByHostPoolAsync(String resourceGroupName, String hostPoolName) { + final String filter = null; + return new PagedFlux<>( + () -> listByHostPoolSinglePageAsync(resourceGroupName, hostPoolName, filter), + nextLink -> listByHostPoolNextSinglePageAsync(nextLink)); + } + + /** + * List userSessions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param filter OData filter expression. Valid properties for filtering are userprincipalname and sessionstate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of UserSession definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByHostPoolAsync( + String resourceGroupName, String hostPoolName, String filter, Context context) { + return new PagedFlux<>( + () -> listByHostPoolSinglePageAsync(resourceGroupName, hostPoolName, filter, context), + nextLink -> listByHostPoolNextSinglePageAsync(nextLink, context)); + } + + /** + * List userSessions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of UserSession definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByHostPool(String resourceGroupName, String hostPoolName) { + final String filter = null; + return new PagedIterable<>(listByHostPoolAsync(resourceGroupName, hostPoolName, filter)); + } + + /** + * List userSessions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param filter OData filter expression. Valid properties for filtering are userprincipalname and sessionstate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of UserSession definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByHostPool( + String resourceGroupName, String hostPoolName, String filter, Context context) { + return new PagedIterable<>(listByHostPoolAsync(resourceGroupName, hostPoolName, filter, context)); + } + + /** + * Get a userSession. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @param userSessionId The name of the user session within the specified session host. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 userSession. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String hostPoolName, String sessionHostname, String userSessionId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (hostPoolName == null) { + return Mono.error(new IllegalArgumentException("Parameter hostPoolName is required and cannot be null.")); + } + if (sessionHostname == null) { + return Mono + .error(new IllegalArgumentException("Parameter sessionHostname is required and cannot be null.")); + } + if (userSessionId == null) { + return Mono.error(new IllegalArgumentException("Parameter userSessionId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + hostPoolName, + sessionHostname, + userSessionId, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get a userSession. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @param userSessionId The name of the user session within the specified session host. + * @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 userSession. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String hostPoolName, String sessionHostname, String userSessionId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (hostPoolName == null) { + return Mono.error(new IllegalArgumentException("Parameter hostPoolName is required and cannot be null.")); + } + if (sessionHostname == null) { + return Mono + .error(new IllegalArgumentException("Parameter sessionHostname is required and cannot be null.")); + } + if (userSessionId == null) { + return Mono.error(new IllegalArgumentException("Parameter userSessionId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + hostPoolName, + sessionHostname, + userSessionId, + accept, + context); + } + + /** + * Get a userSession. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @param userSessionId The name of the user session within the specified session host. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 userSession. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String hostPoolName, String sessionHostname, String userSessionId) { + return getWithResponseAsync(resourceGroupName, hostPoolName, sessionHostname, userSessionId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get a userSession. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @param userSessionId The name of the user session within the specified session host. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 userSession. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public UserSessionInner get( + String resourceGroupName, String hostPoolName, String sessionHostname, String userSessionId) { + return getAsync(resourceGroupName, hostPoolName, sessionHostname, userSessionId).block(); + } + + /** + * Get a userSession. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @param userSessionId The name of the user session within the specified session host. + * @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 userSession. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String hostPoolName, String sessionHostname, String userSessionId, Context context) { + return getWithResponseAsync(resourceGroupName, hostPoolName, sessionHostname, userSessionId, context).block(); + } + + /** + * Remove a userSession. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @param userSessionId The name of the user session within the specified session host. + * @param force Force flag to login off userSession. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String hostPoolName, String sessionHostname, String userSessionId, Boolean force) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (hostPoolName == null) { + return Mono.error(new IllegalArgumentException("Parameter hostPoolName is required and cannot be null.")); + } + if (sessionHostname == null) { + return Mono + .error(new IllegalArgumentException("Parameter sessionHostname is required and cannot be null.")); + } + if (userSessionId == null) { + return Mono.error(new IllegalArgumentException("Parameter userSessionId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + hostPoolName, + sessionHostname, + userSessionId, + force, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Remove a userSession. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @param userSessionId The name of the user session within the specified session host. + * @param force Force flag to login off userSession. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, + String hostPoolName, + String sessionHostname, + String userSessionId, + Boolean force, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (hostPoolName == null) { + return Mono.error(new IllegalArgumentException("Parameter hostPoolName is required and cannot be null.")); + } + if (sessionHostname == null) { + return Mono + .error(new IllegalArgumentException("Parameter sessionHostname is required and cannot be null.")); + } + if (userSessionId == null) { + return Mono.error(new IllegalArgumentException("Parameter userSessionId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + hostPoolName, + sessionHostname, + userSessionId, + force, + accept, + context); + } + + /** + * Remove a userSession. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @param userSessionId The name of the user session within the specified session host. + * @param force Force flag to login off userSession. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String hostPoolName, String sessionHostname, String userSessionId, Boolean force) { + return deleteWithResponseAsync(resourceGroupName, hostPoolName, sessionHostname, userSessionId, force) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Remove a userSession. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @param userSessionId The name of the user session within the specified session host. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String hostPoolName, String sessionHostname, String userSessionId) { + final Boolean force = null; + return deleteWithResponseAsync(resourceGroupName, hostPoolName, sessionHostname, userSessionId, force) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Remove a userSession. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @param userSessionId The name of the user session within the specified session host. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String hostPoolName, String sessionHostname, String userSessionId) { + final Boolean force = null; + deleteAsync(resourceGroupName, hostPoolName, sessionHostname, userSessionId, force).block(); + } + + /** + * Remove a userSession. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @param userSessionId The name of the user session within the specified session host. + * @param force Force flag to login off userSession. + * @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 Response deleteWithResponse( + String resourceGroupName, + String hostPoolName, + String sessionHostname, + String userSessionId, + Boolean force, + Context context) { + return deleteWithResponseAsync(resourceGroupName, hostPoolName, sessionHostname, userSessionId, force, context) + .block(); + } + + /** + * List userSessions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of UserSession definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String hostPoolName, String sessionHostname) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (hostPoolName == null) { + return Mono.error(new IllegalArgumentException("Parameter hostPoolName is required and cannot be null.")); + } + if (sessionHostname == null) { + return Mono + .error(new IllegalArgumentException("Parameter sessionHostname is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + hostPoolName, + sessionHostname, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List userSessions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of UserSession definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String hostPoolName, String sessionHostname, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (hostPoolName == null) { + return Mono.error(new IllegalArgumentException("Parameter hostPoolName is required and cannot be null.")); + } + if (sessionHostname == null) { + return Mono + .error(new IllegalArgumentException("Parameter sessionHostname is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + hostPoolName, + sessionHostname, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List userSessions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of UserSession definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String hostPoolName, String sessionHostname) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, hostPoolName, sessionHostname), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List userSessions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of UserSession definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String hostPoolName, String sessionHostname, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, hostPoolName, sessionHostname, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List userSessions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of UserSession definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String hostPoolName, String sessionHostname) { + return new PagedIterable<>(listAsync(resourceGroupName, hostPoolName, sessionHostname)); + } + + /** + * List userSessions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of UserSession definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, String hostPoolName, String sessionHostname, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, hostPoolName, sessionHostname, context)); + } + + /** + * Disconnect a userSession. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @param userSessionId The name of the user session within the specified session host. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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> disconnectWithResponseAsync( + String resourceGroupName, String hostPoolName, String sessionHostname, String userSessionId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (hostPoolName == null) { + return Mono.error(new IllegalArgumentException("Parameter hostPoolName is required and cannot be null.")); + } + if (sessionHostname == null) { + return Mono + .error(new IllegalArgumentException("Parameter sessionHostname is required and cannot be null.")); + } + if (userSessionId == null) { + return Mono.error(new IllegalArgumentException("Parameter userSessionId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .disconnect( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + hostPoolName, + sessionHostname, + userSessionId, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Disconnect a userSession. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @param userSessionId The name of the user session within the specified session host. + * @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> disconnectWithResponseAsync( + String resourceGroupName, String hostPoolName, String sessionHostname, String userSessionId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (hostPoolName == null) { + return Mono.error(new IllegalArgumentException("Parameter hostPoolName is required and cannot be null.")); + } + if (sessionHostname == null) { + return Mono + .error(new IllegalArgumentException("Parameter sessionHostname is required and cannot be null.")); + } + if (userSessionId == null) { + return Mono.error(new IllegalArgumentException("Parameter userSessionId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .disconnect( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + hostPoolName, + sessionHostname, + userSessionId, + accept, + context); + } + + /** + * Disconnect a userSession. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @param userSessionId The name of the user session within the specified session host. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 disconnectAsync( + String resourceGroupName, String hostPoolName, String sessionHostname, String userSessionId) { + return disconnectWithResponseAsync(resourceGroupName, hostPoolName, sessionHostname, userSessionId) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Disconnect a userSession. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @param userSessionId The name of the user session within the specified session host. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 disconnect( + String resourceGroupName, String hostPoolName, String sessionHostname, String userSessionId) { + disconnectAsync(resourceGroupName, hostPoolName, sessionHostname, userSessionId).block(); + } + + /** + * Disconnect a userSession. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @param userSessionId The name of the user session within the specified session host. + * @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 Response disconnectWithResponse( + String resourceGroupName, String hostPoolName, String sessionHostname, String userSessionId, Context context) { + return disconnectWithResponseAsync(resourceGroupName, hostPoolName, sessionHostname, userSessionId, context) + .block(); + } + + /** + * Send a message to a user. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @param userSessionId The name of the user session within the specified session host. + * @param sendMessage Object containing message includes title and message body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> sendMessageWithResponseAsync( + String resourceGroupName, + String hostPoolName, + String sessionHostname, + String userSessionId, + SendMessage sendMessage) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (hostPoolName == null) { + return Mono.error(new IllegalArgumentException("Parameter hostPoolName is required and cannot be null.")); + } + if (sessionHostname == null) { + return Mono + .error(new IllegalArgumentException("Parameter sessionHostname is required and cannot be null.")); + } + if (userSessionId == null) { + return Mono.error(new IllegalArgumentException("Parameter userSessionId is required and cannot be null.")); + } + if (sendMessage != null) { + sendMessage.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .sendMessage( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + hostPoolName, + sessionHostname, + userSessionId, + sendMessage, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Send a message to a user. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @param userSessionId The name of the user session within the specified session host. + * @param sendMessage Object containing message includes title and message body. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> sendMessageWithResponseAsync( + String resourceGroupName, + String hostPoolName, + String sessionHostname, + String userSessionId, + SendMessage sendMessage, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (hostPoolName == null) { + return Mono.error(new IllegalArgumentException("Parameter hostPoolName is required and cannot be null.")); + } + if (sessionHostname == null) { + return Mono + .error(new IllegalArgumentException("Parameter sessionHostname is required and cannot be null.")); + } + if (userSessionId == null) { + return Mono.error(new IllegalArgumentException("Parameter userSessionId is required and cannot be null.")); + } + if (sendMessage != null) { + sendMessage.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .sendMessage( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + hostPoolName, + sessionHostname, + userSessionId, + sendMessage, + accept, + context); + } + + /** + * Send a message to a user. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @param userSessionId The name of the user session within the specified session host. + * @param sendMessage Object containing message includes title and message body. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono sendMessageAsync( + String resourceGroupName, + String hostPoolName, + String sessionHostname, + String userSessionId, + SendMessage sendMessage) { + return sendMessageWithResponseAsync( + resourceGroupName, hostPoolName, sessionHostname, userSessionId, sendMessage) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Send a message to a user. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @param userSessionId The name of the user session within the specified session host. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 sendMessageAsync( + String resourceGroupName, String hostPoolName, String sessionHostname, String userSessionId) { + final SendMessage sendMessage = null; + return sendMessageWithResponseAsync( + resourceGroupName, hostPoolName, sessionHostname, userSessionId, sendMessage) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Send a message to a user. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @param userSessionId The name of the user session within the specified session host. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 sendMessage( + String resourceGroupName, String hostPoolName, String sessionHostname, String userSessionId) { + final SendMessage sendMessage = null; + sendMessageAsync(resourceGroupName, hostPoolName, sessionHostname, userSessionId, sendMessage).block(); + } + + /** + * Send a message to a user. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @param userSessionId The name of the user session within the specified session host. + * @param sendMessage Object containing message includes title and message body. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response sendMessageWithResponse( + String resourceGroupName, + String hostPoolName, + String sessionHostname, + String userSessionId, + SendMessage sendMessage, + Context context) { + return sendMessageWithResponseAsync( + resourceGroupName, hostPoolName, sessionHostname, userSessionId, sendMessage, context) + .block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of UserSession definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByHostPoolNextSinglePageAsync(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.listByHostPoolNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of UserSession definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByHostPoolNextSinglePageAsync(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 + .listByHostPoolNext(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 list of UserSession definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of UserSession definitions. + */ + @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/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/UserSessionsImpl.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/UserSessionsImpl.java new file mode 100644 index 0000000000000..a0da1c58856ca --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/UserSessionsImpl.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.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.desktopvirtualization.DesktopVirtualizationManager; +import com.azure.resourcemanager.desktopvirtualization.fluent.UserSessionsClient; +import com.azure.resourcemanager.desktopvirtualization.fluent.models.UserSessionInner; +import com.azure.resourcemanager.desktopvirtualization.models.SendMessage; +import com.azure.resourcemanager.desktopvirtualization.models.UserSession; +import com.azure.resourcemanager.desktopvirtualization.models.UserSessions; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class UserSessionsImpl implements UserSessions { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UserSessionsImpl.class); + + private final UserSessionsClient innerClient; + + private final DesktopVirtualizationManager serviceManager; + + public UserSessionsImpl(UserSessionsClient innerClient, DesktopVirtualizationManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByHostPool(String resourceGroupName, String hostPoolName) { + PagedIterable inner = this.serviceClient().listByHostPool(resourceGroupName, hostPoolName); + return Utils.mapPage(inner, inner1 -> new UserSessionImpl(inner1, this.manager())); + } + + public PagedIterable listByHostPool( + String resourceGroupName, String hostPoolName, String filter, Context context) { + PagedIterable inner = + this.serviceClient().listByHostPool(resourceGroupName, hostPoolName, filter, context); + return Utils.mapPage(inner, inner1 -> new UserSessionImpl(inner1, this.manager())); + } + + public UserSession get( + String resourceGroupName, String hostPoolName, String sessionHostname, String userSessionId) { + UserSessionInner inner = + this.serviceClient().get(resourceGroupName, hostPoolName, sessionHostname, userSessionId); + if (inner != null) { + return new UserSessionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String hostPoolName, String sessionHostname, String userSessionId, Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, hostPoolName, sessionHostname, userSessionId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new UserSessionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String hostPoolName, String sessionHostname, String userSessionId) { + this.serviceClient().delete(resourceGroupName, hostPoolName, sessionHostname, userSessionId); + } + + public Response deleteWithResponse( + String resourceGroupName, + String hostPoolName, + String sessionHostname, + String userSessionId, + Boolean force, + Context context) { + return this + .serviceClient() + .deleteWithResponse(resourceGroupName, hostPoolName, sessionHostname, userSessionId, force, context); + } + + public PagedIterable list(String resourceGroupName, String hostPoolName, String sessionHostname) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, hostPoolName, sessionHostname); + return Utils.mapPage(inner, inner1 -> new UserSessionImpl(inner1, this.manager())); + } + + public PagedIterable list( + String resourceGroupName, String hostPoolName, String sessionHostname, Context context) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, hostPoolName, sessionHostname, context); + return Utils.mapPage(inner, inner1 -> new UserSessionImpl(inner1, this.manager())); + } + + public void disconnect( + String resourceGroupName, String hostPoolName, String sessionHostname, String userSessionId) { + this.serviceClient().disconnect(resourceGroupName, hostPoolName, sessionHostname, userSessionId); + } + + public Response disconnectWithResponse( + String resourceGroupName, String hostPoolName, String sessionHostname, String userSessionId, Context context) { + return this + .serviceClient() + .disconnectWithResponse(resourceGroupName, hostPoolName, sessionHostname, userSessionId, context); + } + + public void sendMessage( + String resourceGroupName, String hostPoolName, String sessionHostname, String userSessionId) { + this.serviceClient().sendMessage(resourceGroupName, hostPoolName, sessionHostname, userSessionId); + } + + public Response sendMessageWithResponse( + String resourceGroupName, + String hostPoolName, + String sessionHostname, + String userSessionId, + SendMessage sendMessage, + Context context) { + return this + .serviceClient() + .sendMessageWithResponse( + resourceGroupName, hostPoolName, sessionHostname, userSessionId, sendMessage, context); + } + + private UserSessionsClient serviceClient() { + return this.innerClient; + } + + private DesktopVirtualizationManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/Utils.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/Utils.java new file mode 100644 index 0000000000000..ff6fdca893675 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/Utils.java @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.implementation; + +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.util.CoreUtils; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import reactor.core.publisher.Mono; + +final class Utils { + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterator itr = Arrays.stream(id.split("/")).iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && !part.trim().isEmpty()) { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { + if (id == null || pathTemplate == null) { + return null; + } + String parameterNameParentheses = "{" + parameterName + "}"; + List idSegmentsReverted = Arrays.asList(id.split("/")); + List pathSegments = Arrays.asList(pathTemplate.split("/")); + Collections.reverse(idSegmentsReverted); + Iterator idItrReverted = idSegmentsReverted.iterator(); + int pathIndex = pathSegments.size(); + while (idItrReverted.hasNext() && pathIndex > 0) { + String idSegment = idItrReverted.next(); + String pathSegment = pathSegments.get(--pathIndex); + if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { + if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { + if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { + List segments = new ArrayList<>(); + segments.add(idSegment); + idItrReverted.forEachRemaining(segments::add); + Collections.reverse(segments); + if (segments.size() > 0 && segments.get(0).isEmpty()) { + segments.remove(0); + } + return String.join("/", segments); + } else { + return idSegment; + } + } + } + } + return null; + } + + static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { + return new PagedIterableImpl(pageIterable, mapper); + } + + private static final class PagedIterableImpl extends PagedIterable { + + private final PagedIterable pageIterable; + private final Function mapper; + private final Function, PagedResponse> pageMapper; + + private PagedIterableImpl(PagedIterable pageIterable, Function mapper) { + super(new PagedFlux(Mono::empty)); + this.pageIterable = pageIterable; + this.mapper = mapper; + this.pageMapper = + page -> + new PagedResponseBase( + page.getRequest(), + page.getStatusCode(), + page.getHeaders(), + page.getElements().stream().map(mapper).collect(Collectors.toList()), + page.getContinuationToken(), + null); + } + + @Override + public Stream stream() { + return pageIterable.stream().map(mapper); + } + + @Override + public Stream> streamByPage() { + return pageIterable.streamByPage().map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken) { + return pageIterable.streamByPage(continuationToken).map(pageMapper); + } + + @Override + public Stream> streamByPage(int preferredPageSize) { + return pageIterable.streamByPage(preferredPageSize).map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken, int preferredPageSize) { + return pageIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + } + + @Override + public Iterator iterator() { + return new IteratorImpl(pageIterable.iterator(), mapper); + } + + @Override + public Iterable> iterableByPage() { + return new IterableImpl, PagedResponse>(pageIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl, PagedResponse>( + pageIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pageIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pageIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); + } + } + + private static final class IteratorImpl implements Iterator { + + private final Iterator iterator; + private final Function mapper; + + private IteratorImpl(Iterator iterator, Function mapper) { + this.iterator = iterator; + this.mapper = mapper; + } + + @Override + public boolean hasNext() { + return iterator.hasNext(); + } + + @Override + public S next() { + return mapper.apply(iterator.next()); + } + + @Override + public void remove() { + iterator.remove(); + } + } + + private static final class IterableImpl implements Iterable { + + private final Iterable iterable; + private final Function mapper; + + private IterableImpl(Iterable iterable, Function mapper) { + this.iterable = iterable; + this.mapper = mapper; + } + + @Override + public Iterator iterator() { + return new IteratorImpl(iterable.iterator(), mapper); + } + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/WorkspaceImpl.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/WorkspaceImpl.java new file mode 100644 index 0000000000000..8d5e20a574061 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/WorkspaceImpl.java @@ -0,0 +1,282 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.desktopvirtualization.DesktopVirtualizationManager; +import com.azure.resourcemanager.desktopvirtualization.fluent.models.WorkspaceInner; +import com.azure.resourcemanager.desktopvirtualization.models.Identity; +import com.azure.resourcemanager.desktopvirtualization.models.Plan; +import com.azure.resourcemanager.desktopvirtualization.models.Sku; +import com.azure.resourcemanager.desktopvirtualization.models.Workspace; +import com.azure.resourcemanager.desktopvirtualization.models.WorkspacePatch; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class WorkspaceImpl implements Workspace, Workspace.Definition, Workspace.Update { + private WorkspaceInner innerObject; + + private final DesktopVirtualizationManager 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 String managedBy() { + return this.innerModel().managedBy(); + } + + public String kind() { + return this.innerModel().kind(); + } + + public String etag() { + return this.innerModel().etag(); + } + + public Identity identity() { + return this.innerModel().identity(); + } + + public Sku sku() { + return this.innerModel().sku(); + } + + public Plan plan() { + return this.innerModel().plan(); + } + + public String objectId() { + return this.innerModel().objectId(); + } + + public String description() { + return this.innerModel().description(); + } + + public String friendlyName() { + return this.innerModel().friendlyName(); + } + + public List applicationGroupReferences() { + List inner = this.innerModel().applicationGroupReferences(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Boolean cloudPcResource() { + return this.innerModel().cloudPcResource(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public WorkspaceInner innerModel() { + return this.innerObject; + } + + private DesktopVirtualizationManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String workspaceName; + + private WorkspacePatch updateWorkspace; + + public WorkspaceImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public Workspace create() { + this.innerObject = + serviceManager + .serviceClient() + .getWorkspaces() + .createOrUpdateWithResponse(resourceGroupName, workspaceName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public Workspace create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getWorkspaces() + .createOrUpdateWithResponse(resourceGroupName, workspaceName, this.innerModel(), context) + .getValue(); + return this; + } + + WorkspaceImpl(String name, DesktopVirtualizationManager serviceManager) { + this.innerObject = new WorkspaceInner(); + this.serviceManager = serviceManager; + this.workspaceName = name; + } + + public WorkspaceImpl update() { + this.updateWorkspace = new WorkspacePatch(); + return this; + } + + public Workspace apply() { + this.innerObject = + serviceManager + .serviceClient() + .getWorkspaces() + .updateWithResponse(resourceGroupName, workspaceName, updateWorkspace, Context.NONE) + .getValue(); + return this; + } + + public Workspace apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getWorkspaces() + .updateWithResponse(resourceGroupName, workspaceName, updateWorkspace, context) + .getValue(); + return this; + } + + WorkspaceImpl(WorkspaceInner innerObject, DesktopVirtualizationManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.workspaceName = Utils.getValueFromIdByName(innerObject.id(), "workspaces"); + } + + public Workspace refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getWorkspaces() + .getByResourceGroupWithResponse(resourceGroupName, workspaceName, Context.NONE) + .getValue(); + return this; + } + + public Workspace refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getWorkspaces() + .getByResourceGroupWithResponse(resourceGroupName, workspaceName, context) + .getValue(); + return this; + } + + public WorkspaceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public WorkspaceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public WorkspaceImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateWorkspace.withTags(tags); + return this; + } + } + + public WorkspaceImpl withManagedBy(String managedBy) { + this.innerModel().withManagedBy(managedBy); + return this; + } + + public WorkspaceImpl withKind(String kind) { + this.innerModel().withKind(kind); + return this; + } + + public WorkspaceImpl withIdentity(Identity identity) { + this.innerModel().withIdentity(identity); + return this; + } + + public WorkspaceImpl withSku(Sku sku) { + this.innerModel().withSku(sku); + return this; + } + + public WorkspaceImpl withPlan(Plan plan) { + this.innerModel().withPlan(plan); + return this; + } + + public WorkspaceImpl withDescription(String description) { + if (isInCreateMode()) { + this.innerModel().withDescription(description); + return this; + } else { + this.updateWorkspace.withDescription(description); + return this; + } + } + + public WorkspaceImpl withFriendlyName(String friendlyName) { + if (isInCreateMode()) { + this.innerModel().withFriendlyName(friendlyName); + return this; + } else { + this.updateWorkspace.withFriendlyName(friendlyName); + return this; + } + } + + public WorkspaceImpl withApplicationGroupReferences(List applicationGroupReferences) { + if (isInCreateMode()) { + this.innerModel().withApplicationGroupReferences(applicationGroupReferences); + return this; + } else { + this.updateWorkspace.withApplicationGroupReferences(applicationGroupReferences); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/WorkspacesClientImpl.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/WorkspacesClientImpl.java new file mode 100644 index 0000000000000..ff2b6ea36af7b --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/WorkspacesClientImpl.java @@ -0,0 +1,1264 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.desktopvirtualization.fluent.WorkspacesClient; +import com.azure.resourcemanager.desktopvirtualization.fluent.models.WorkspaceInner; +import com.azure.resourcemanager.desktopvirtualization.models.WorkspaceList; +import com.azure.resourcemanager.desktopvirtualization.models.WorkspacePatch; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in WorkspacesClient. */ +public final class WorkspacesClientImpl implements WorkspacesClient { + private final ClientLogger logger = new ClientLogger(WorkspacesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final WorkspacesService service; + + /** The service client containing this operation class. */ + private final DesktopVirtualizationApiClientImpl client; + + /** + * Initializes an instance of WorkspacesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + WorkspacesClientImpl(DesktopVirtualizationApiClientImpl client) { + this.service = + RestProxy.create(WorkspacesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DesktopVirtualizationApiClientWorkspaces to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "DesktopVirtualizatio") + private interface WorkspacesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.DesktopVirtualization/workspaces/{workspaceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("workspaceName") String workspaceName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.DesktopVirtualization/workspaces/{workspaceName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("workspaceName") String workspaceName, + @BodyParam("application/json") WorkspaceInner workspace, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.DesktopVirtualization/workspaces/{workspaceName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("workspaceName") String workspaceName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.DesktopVirtualization/workspaces/{workspaceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("workspaceName") String workspaceName, + @BodyParam("application/json") WorkspacePatch workspace, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.DesktopVirtualization/workspaces") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/workspaces") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String workspaceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + workspaceName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String workspaceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + workspaceName, + accept, + context); + } + + /** + * Get a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String workspaceName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, workspaceName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WorkspaceInner getByResourceGroup(String resourceGroupName, String workspaceName) { + return getByResourceGroupAsync(resourceGroupName, workspaceName).block(); + } + + /** + * Get a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String workspaceName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, workspaceName, context).block(); + } + + /** + * Create or update a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspace Object containing Workspace definitions. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Workspace definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String workspaceName, WorkspaceInner workspace) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (workspace == null) { + return Mono.error(new IllegalArgumentException("Parameter workspace is required and cannot be null.")); + } else { + workspace.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + workspaceName, + workspace, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create or update a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspace Object containing Workspace definitions. + * @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 represents a Workspace definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String workspaceName, WorkspaceInner workspace, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (workspace == null) { + return Mono.error(new IllegalArgumentException("Parameter workspace is required and cannot be null.")); + } else { + workspace.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + workspaceName, + workspace, + accept, + context); + } + + /** + * Create or update a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspace Object containing Workspace definitions. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Workspace definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String workspaceName, WorkspaceInner workspace) { + return createOrUpdateWithResponseAsync(resourceGroupName, workspaceName, workspace) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Create or update a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspace Object containing Workspace definitions. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Workspace definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WorkspaceInner createOrUpdate(String resourceGroupName, String workspaceName, WorkspaceInner workspace) { + return createOrUpdateAsync(resourceGroupName, workspaceName, workspace).block(); + } + + /** + * Create or update a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspace Object containing Workspace definitions. + * @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 represents a Workspace definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, String workspaceName, WorkspaceInner workspace, Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, workspaceName, workspace, context).block(); + } + + /** + * Remove a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String workspaceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + workspaceName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Remove a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String workspaceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + workspaceName, + accept, + context); + } + + /** + * Remove a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String workspaceName) { + return deleteWithResponseAsync(resourceGroupName, workspaceName).flatMap((Response res) -> Mono.empty()); + } + + /** + * Remove a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String workspaceName) { + deleteAsync(resourceGroupName, workspaceName).block(); + } + + /** + * Remove a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 Response deleteWithResponse(String resourceGroupName, String workspaceName, Context context) { + return deleteWithResponseAsync(resourceGroupName, workspaceName, context).block(); + } + + /** + * Update a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspace Object containing Workspace definitions. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Workspace definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String workspaceName, WorkspacePatch workspace) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (workspace != null) { + workspace.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + workspaceName, + workspace, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Update a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspace Object containing Workspace definitions. + * @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 represents a Workspace definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String workspaceName, WorkspacePatch workspace, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (workspaceName == null) { + return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null.")); + } + if (workspace != null) { + workspace.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + workspaceName, + workspace, + accept, + context); + } + + /** + * Update a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspace Object containing Workspace definitions. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Workspace definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String workspaceName, WorkspacePatch workspace) { + return updateWithResponseAsync(resourceGroupName, workspaceName, workspace) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Update a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Workspace definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String workspaceName) { + final WorkspacePatch workspace = null; + return updateWithResponseAsync(resourceGroupName, workspaceName, workspace) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Update a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Workspace definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WorkspaceInner update(String resourceGroupName, String workspaceName) { + final WorkspacePatch workspace = null; + return updateAsync(resourceGroupName, workspaceName, workspace).block(); + } + + /** + * Update a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param workspace Object containing Workspace definitions. + * @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 represents a Workspace definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, String workspaceName, WorkspacePatch workspace, Context context) { + return updateWithResponseAsync(resourceGroupName, workspaceName, workspace, context).block(); + } + + /** + * List workspaces. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Workspace definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List workspaces. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Workspace definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List workspaces. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Workspace definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List workspaces. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Workspace definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * List workspaces. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Workspace definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * List workspaces. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Workspace definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * List workspaces in 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 list of Workspace definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List workspaces in 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 list of Workspace definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List workspaces in 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 list of Workspace definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>( + () -> listSinglePageAsync(), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List workspaces in 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 list of Workspace definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * List workspaces in 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 list of Workspace definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List workspaces in 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 list of Workspace definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Workspace definitions. + */ + @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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Workspace definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Workspace definitions. + */ + @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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Workspace definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/WorkspacesImpl.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/WorkspacesImpl.java new file mode 100644 index 0000000000000..6a380634dad90 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/WorkspacesImpl.java @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.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.desktopvirtualization.DesktopVirtualizationManager; +import com.azure.resourcemanager.desktopvirtualization.fluent.WorkspacesClient; +import com.azure.resourcemanager.desktopvirtualization.fluent.models.WorkspaceInner; +import com.azure.resourcemanager.desktopvirtualization.models.Workspace; +import com.azure.resourcemanager.desktopvirtualization.models.Workspaces; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class WorkspacesImpl implements Workspaces { + @JsonIgnore private final ClientLogger logger = new ClientLogger(WorkspacesImpl.class); + + private final WorkspacesClient innerClient; + + private final DesktopVirtualizationManager serviceManager; + + public WorkspacesImpl(WorkspacesClient innerClient, DesktopVirtualizationManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Workspace getByResourceGroup(String resourceGroupName, String workspaceName) { + WorkspaceInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, workspaceName); + if (inner != null) { + return new WorkspaceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String workspaceName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, workspaceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new WorkspaceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String workspaceName) { + this.serviceClient().delete(resourceGroupName, workspaceName); + } + + public Response deleteWithResponse(String resourceGroupName, String workspaceName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, workspaceName, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new WorkspaceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new WorkspaceImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new WorkspaceImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new WorkspaceImpl(inner1, this.manager())); + } + + public Workspace getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = Utils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, workspaceName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = Utils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, workspaceName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = Utils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + this.deleteWithResponse(resourceGroupName, workspaceName, Context.NONE).getValue(); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = Utils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + return this.deleteWithResponse(resourceGroupName, workspaceName, context); + } + + private WorkspacesClient serviceClient() { + return this.innerClient; + } + + private DesktopVirtualizationManager manager() { + return this.serviceManager; + } + + public WorkspaceImpl define(String name) { + return new WorkspaceImpl(name, this.manager()); + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/package-info.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/implementation/package-info.java new file mode 100644 index 0000000000000..de33399c24a18 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/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 DesktopVirtualizationApiClient. null. */ +package com.azure.resourcemanager.desktopvirtualization.implementation; diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/Application.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/Application.java new file mode 100644 index 0000000000000..ec9c204351ec1 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/Application.java @@ -0,0 +1,490 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.desktopvirtualization.fluent.models.ApplicationInner; +import java.util.Map; + +/** An immutable client-side representation of Application. */ +public interface Application { + /** + * 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 objectId property: ObjectId of Application. (internal use). + * + * @return the objectId value. + */ + String objectId(); + + /** + * Gets the description property: Description of Application. + * + * @return the description value. + */ + String description(); + + /** + * Gets the friendlyName property: Friendly name of Application. + * + * @return the friendlyName value. + */ + String friendlyName(); + + /** + * Gets the filePath property: Specifies a path for the executable file for the application. + * + * @return the filePath value. + */ + String filePath(); + + /** + * Gets the msixPackageFamilyName property: Specifies the package family name for MSIX applications. + * + * @return the msixPackageFamilyName value. + */ + String msixPackageFamilyName(); + + /** + * Gets the msixPackageApplicationId property: Specifies the package application Id for MSIX applications. + * + * @return the msixPackageApplicationId value. + */ + String msixPackageApplicationId(); + + /** + * Gets the applicationType property: Resource Type of Application. + * + * @return the applicationType value. + */ + RemoteApplicationType applicationType(); + + /** + * Gets the commandLineSetting property: Specifies whether this published application can be launched with command + * line arguments provided by the client, command line arguments specified at publish time, or no command line + * arguments at all. + * + * @return the commandLineSetting value. + */ + CommandLineSetting commandLineSetting(); + + /** + * Gets the commandLineArguments property: Command Line Arguments for Application. + * + * @return the commandLineArguments value. + */ + String commandLineArguments(); + + /** + * Gets the showInPortal property: Specifies whether to show the RemoteApp program in the RD Web Access server. + * + * @return the showInPortal value. + */ + Boolean showInPortal(); + + /** + * Gets the iconPath property: Path to icon. + * + * @return the iconPath value. + */ + String iconPath(); + + /** + * Gets the iconIndex property: Index of the icon. + * + * @return the iconIndex value. + */ + Integer iconIndex(); + + /** + * Gets the iconHash property: Hash of the icon. + * + * @return the iconHash value. + */ + String iconHash(); + + /** + * Gets the iconContent property: the icon a 64 bit string as a byte array. + * + * @return the iconContent value. + */ + byte[] iconContent(); + + /** + * Gets the inner com.azure.resourcemanager.desktopvirtualization.fluent.models.ApplicationInner object. + * + * @return the inner object. + */ + ApplicationInner innerModel(); + + /** The entirety of the Application definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithParentResource, + DefinitionStages.WithCommandLineSetting, + DefinitionStages.WithCreate { + } + /** The Application definition stages. */ + interface DefinitionStages { + /** The first stage of the Application definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the Application definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, applicationGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @return the next definition stage. + */ + WithCommandLineSetting withExistingApplicationGroup(String resourceGroupName, String applicationGroupName); + } + /** The stage of the Application definition allowing to specify commandLineSetting. */ + interface WithCommandLineSetting { + /** + * Specifies the commandLineSetting property: Specifies whether this published application can be launched + * with command line arguments provided by the client, command line arguments specified at publish time, or + * no command line arguments at all.. + * + * @param commandLineSetting Specifies whether this published application can be launched with command line + * arguments provided by the client, command line arguments specified at publish time, or no command + * line arguments at all. + * @return the next definition stage. + */ + WithCreate withCommandLineSetting(CommandLineSetting commandLineSetting); + } + /** + * The stage of the Application 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.WithDescription, + DefinitionStages.WithFriendlyName, + DefinitionStages.WithFilePath, + DefinitionStages.WithMsixPackageFamilyName, + DefinitionStages.WithMsixPackageApplicationId, + DefinitionStages.WithApplicationType, + DefinitionStages.WithCommandLineArguments, + DefinitionStages.WithShowInPortal, + DefinitionStages.WithIconPath, + DefinitionStages.WithIconIndex { + /** + * Executes the create request. + * + * @return the created resource. + */ + Application create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Application create(Context context); + } + /** The stage of the Application definition allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: Description of Application.. + * + * @param description Description of Application. + * @return the next definition stage. + */ + WithCreate withDescription(String description); + } + /** The stage of the Application definition allowing to specify friendlyName. */ + interface WithFriendlyName { + /** + * Specifies the friendlyName property: Friendly name of Application.. + * + * @param friendlyName Friendly name of Application. + * @return the next definition stage. + */ + WithCreate withFriendlyName(String friendlyName); + } + /** The stage of the Application definition allowing to specify filePath. */ + interface WithFilePath { + /** + * Specifies the filePath property: Specifies a path for the executable file for the application.. + * + * @param filePath Specifies a path for the executable file for the application. + * @return the next definition stage. + */ + WithCreate withFilePath(String filePath); + } + /** The stage of the Application definition allowing to specify msixPackageFamilyName. */ + interface WithMsixPackageFamilyName { + /** + * Specifies the msixPackageFamilyName property: Specifies the package family name for MSIX applications. + * + * @param msixPackageFamilyName Specifies the package family name for MSIX applications. + * @return the next definition stage. + */ + WithCreate withMsixPackageFamilyName(String msixPackageFamilyName); + } + /** The stage of the Application definition allowing to specify msixPackageApplicationId. */ + interface WithMsixPackageApplicationId { + /** + * Specifies the msixPackageApplicationId property: Specifies the package application Id for MSIX + * applications. + * + * @param msixPackageApplicationId Specifies the package application Id for MSIX applications. + * @return the next definition stage. + */ + WithCreate withMsixPackageApplicationId(String msixPackageApplicationId); + } + /** The stage of the Application definition allowing to specify applicationType. */ + interface WithApplicationType { + /** + * Specifies the applicationType property: Resource Type of Application.. + * + * @param applicationType Resource Type of Application. + * @return the next definition stage. + */ + WithCreate withApplicationType(RemoteApplicationType applicationType); + } + /** The stage of the Application definition allowing to specify commandLineArguments. */ + interface WithCommandLineArguments { + /** + * Specifies the commandLineArguments property: Command Line Arguments for Application.. + * + * @param commandLineArguments Command Line Arguments for Application. + * @return the next definition stage. + */ + WithCreate withCommandLineArguments(String commandLineArguments); + } + /** The stage of the Application definition allowing to specify showInPortal. */ + interface WithShowInPortal { + /** + * Specifies the showInPortal property: Specifies whether to show the RemoteApp program in the RD Web Access + * server.. + * + * @param showInPortal Specifies whether to show the RemoteApp program in the RD Web Access server. + * @return the next definition stage. + */ + WithCreate withShowInPortal(Boolean showInPortal); + } + /** The stage of the Application definition allowing to specify iconPath. */ + interface WithIconPath { + /** + * Specifies the iconPath property: Path to icon.. + * + * @param iconPath Path to icon. + * @return the next definition stage. + */ + WithCreate withIconPath(String iconPath); + } + /** The stage of the Application definition allowing to specify iconIndex. */ + interface WithIconIndex { + /** + * Specifies the iconIndex property: Index of the icon.. + * + * @param iconIndex Index of the icon. + * @return the next definition stage. + */ + WithCreate withIconIndex(Integer iconIndex); + } + } + /** + * Begins update for the Application resource. + * + * @return the stage of resource update. + */ + Application.Update update(); + + /** The template for Application update. */ + interface Update + extends UpdateStages.WithTags, + UpdateStages.WithDescription, + UpdateStages.WithFriendlyName, + UpdateStages.WithFilePath, + UpdateStages.WithCommandLineSetting, + UpdateStages.WithCommandLineArguments, + UpdateStages.WithShowInPortal, + UpdateStages.WithIconPath, + UpdateStages.WithIconIndex, + UpdateStages.WithMsixPackageFamilyName, + UpdateStages.WithMsixPackageApplicationId, + UpdateStages.WithApplicationType { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Application apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Application apply(Context context); + } + /** The Application update stages. */ + interface UpdateStages { + /** The stage of the Application update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: tags to be updated. + * + * @param tags tags to be updated. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the Application update allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: Description of Application.. + * + * @param description Description of Application. + * @return the next definition stage. + */ + Update withDescription(String description); + } + /** The stage of the Application update allowing to specify friendlyName. */ + interface WithFriendlyName { + /** + * Specifies the friendlyName property: Friendly name of Application.. + * + * @param friendlyName Friendly name of Application. + * @return the next definition stage. + */ + Update withFriendlyName(String friendlyName); + } + /** The stage of the Application update allowing to specify filePath. */ + interface WithFilePath { + /** + * Specifies the filePath property: Specifies a path for the executable file for the application.. + * + * @param filePath Specifies a path for the executable file for the application. + * @return the next definition stage. + */ + Update withFilePath(String filePath); + } + /** The stage of the Application update allowing to specify commandLineSetting. */ + interface WithCommandLineSetting { + /** + * Specifies the commandLineSetting property: Specifies whether this published application can be launched + * with command line arguments provided by the client, command line arguments specified at publish time, or + * no command line arguments at all.. + * + * @param commandLineSetting Specifies whether this published application can be launched with command line + * arguments provided by the client, command line arguments specified at publish time, or no command + * line arguments at all. + * @return the next definition stage. + */ + Update withCommandLineSetting(CommandLineSetting commandLineSetting); + } + /** The stage of the Application update allowing to specify commandLineArguments. */ + interface WithCommandLineArguments { + /** + * Specifies the commandLineArguments property: Command Line Arguments for Application.. + * + * @param commandLineArguments Command Line Arguments for Application. + * @return the next definition stage. + */ + Update withCommandLineArguments(String commandLineArguments); + } + /** The stage of the Application update allowing to specify showInPortal. */ + interface WithShowInPortal { + /** + * Specifies the showInPortal property: Specifies whether to show the RemoteApp program in the RD Web Access + * server.. + * + * @param showInPortal Specifies whether to show the RemoteApp program in the RD Web Access server. + * @return the next definition stage. + */ + Update withShowInPortal(Boolean showInPortal); + } + /** The stage of the Application update allowing to specify iconPath. */ + interface WithIconPath { + /** + * Specifies the iconPath property: Path to icon.. + * + * @param iconPath Path to icon. + * @return the next definition stage. + */ + Update withIconPath(String iconPath); + } + /** The stage of the Application update allowing to specify iconIndex. */ + interface WithIconIndex { + /** + * Specifies the iconIndex property: Index of the icon.. + * + * @param iconIndex Index of the icon. + * @return the next definition stage. + */ + Update withIconIndex(Integer iconIndex); + } + /** The stage of the Application update allowing to specify msixPackageFamilyName. */ + interface WithMsixPackageFamilyName { + /** + * Specifies the msixPackageFamilyName property: Specifies the package family name for MSIX applications. + * + * @param msixPackageFamilyName Specifies the package family name for MSIX applications. + * @return the next definition stage. + */ + Update withMsixPackageFamilyName(String msixPackageFamilyName); + } + /** The stage of the Application update allowing to specify msixPackageApplicationId. */ + interface WithMsixPackageApplicationId { + /** + * Specifies the msixPackageApplicationId property: Specifies the package application Id for MSIX + * applications. + * + * @param msixPackageApplicationId Specifies the package application Id for MSIX applications. + * @return the next definition stage. + */ + Update withMsixPackageApplicationId(String msixPackageApplicationId); + } + /** The stage of the Application update allowing to specify applicationType. */ + interface WithApplicationType { + /** + * Specifies the applicationType property: Resource Type of Application.. + * + * @param applicationType Resource Type of Application. + * @return the next definition stage. + */ + Update withApplicationType(RemoteApplicationType applicationType); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Application refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Application refresh(Context context); +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ApplicationGroup.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ApplicationGroup.java new file mode 100644 index 0000000000000..d346480b492f5 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ApplicationGroup.java @@ -0,0 +1,437 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.desktopvirtualization.fluent.models.ApplicationGroupInner; +import java.util.Map; + +/** An immutable client-side representation of ApplicationGroup. */ +public interface ApplicationGroup { + /** + * 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 managedBy property: The fully qualified resource ID of the resource that manages this resource. + * Indicates if this resource is managed by another Azure resource. If this is present, complete mode deployment + * will not delete the resource if it is removed from the template since it is managed by another resource. + * + * @return the managedBy value. + */ + String managedBy(); + + /** + * Gets the kind property: Metadata used by portal/tooling/etc to render different UX experiences for resources of + * the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must + * validate and persist this value. + * + * @return the kind value. + */ + String kind(); + + /** + * Gets the etag property: The etag field is *not* required. If it is provided in the response body, it must also be + * provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from + * the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), + * If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the identity property: Identity for the resource. + * + * @return the identity value. + */ + Identity identity(); + + /** + * Gets the sku property: The resource model definition representing SKU. + * + * @return the sku value. + */ + Sku sku(); + + /** + * Gets the plan property: Plan for the resource. + * + * @return the plan value. + */ + Plan plan(); + + /** + * Gets the objectId property: ObjectId of ApplicationGroup. (internal use). + * + * @return the objectId value. + */ + String objectId(); + + /** + * Gets the description property: Description of ApplicationGroup. + * + * @return the description value. + */ + String description(); + + /** + * Gets the friendlyName property: Friendly name of ApplicationGroup. + * + * @return the friendlyName value. + */ + String friendlyName(); + + /** + * Gets the hostPoolArmPath property: HostPool arm path of ApplicationGroup. + * + * @return the hostPoolArmPath value. + */ + String hostPoolArmPath(); + + /** + * Gets the workspaceArmPath property: Workspace arm path of ApplicationGroup. + * + * @return the workspaceArmPath value. + */ + String workspaceArmPath(); + + /** + * Gets the applicationGroupType property: Resource Type of ApplicationGroup. + * + * @return the applicationGroupType value. + */ + ApplicationGroupType applicationGroupType(); + + /** + * Gets the migrationRequest property: The registration info of HostPool. + * + * @return the migrationRequest value. + */ + MigrationRequestProperties migrationRequest(); + + /** + * Gets the cloudPcResource property: Is cloud pc resource. + * + * @return the cloudPcResource value. + */ + Boolean cloudPcResource(); + + /** + * 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.desktopvirtualization.fluent.models.ApplicationGroupInner object. + * + * @return the inner object. + */ + ApplicationGroupInner innerModel(); + + /** The entirety of the ApplicationGroup definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithHostPoolArmPath, + DefinitionStages.WithApplicationGroupType, + DefinitionStages.WithCreate { + } + /** The ApplicationGroup definition stages. */ + interface DefinitionStages { + /** The first stage of the ApplicationGroup definition. */ + interface Blank extends WithLocation { + } + /** The stage of the ApplicationGroup 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 ApplicationGroup definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithHostPoolArmPath withExistingResourceGroup(String resourceGroupName); + } + /** The stage of the ApplicationGroup definition allowing to specify hostPoolArmPath. */ + interface WithHostPoolArmPath { + /** + * Specifies the hostPoolArmPath property: HostPool arm path of ApplicationGroup.. + * + * @param hostPoolArmPath HostPool arm path of ApplicationGroup. + * @return the next definition stage. + */ + WithApplicationGroupType withHostPoolArmPath(String hostPoolArmPath); + } + /** The stage of the ApplicationGroup definition allowing to specify applicationGroupType. */ + interface WithApplicationGroupType { + /** + * Specifies the applicationGroupType property: Resource Type of ApplicationGroup.. + * + * @param applicationGroupType Resource Type of ApplicationGroup. + * @return the next definition stage. + */ + WithCreate withApplicationGroupType(ApplicationGroupType applicationGroupType); + } + /** + * The stage of the ApplicationGroup 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.WithManagedBy, + DefinitionStages.WithKind, + DefinitionStages.WithIdentity, + DefinitionStages.WithSku, + DefinitionStages.WithPlan, + DefinitionStages.WithDescription, + DefinitionStages.WithFriendlyName, + DefinitionStages.WithMigrationRequest { + /** + * Executes the create request. + * + * @return the created resource. + */ + ApplicationGroup create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ApplicationGroup create(Context context); + } + /** The stage of the ApplicationGroup 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 ApplicationGroup definition allowing to specify managedBy. */ + interface WithManagedBy { + /** + * Specifies the managedBy property: The fully qualified resource ID of the resource that manages this + * resource. Indicates if this resource is managed by another Azure resource. If this is present, complete + * mode deployment will not delete the resource if it is removed from the template since it is managed by + * another resource.. + * + * @param managedBy The fully qualified resource ID of the resource that manages this resource. Indicates if + * this resource is managed by another Azure resource. If this is present, complete mode deployment will + * not delete the resource if it is removed from the template since it is managed by another resource. + * @return the next definition stage. + */ + WithCreate withManagedBy(String managedBy); + } + /** The stage of the ApplicationGroup definition allowing to specify kind. */ + interface WithKind { + /** + * Specifies the kind property: Metadata used by portal/tooling/etc to render different UX experiences for + * resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the + * resource provider must validate and persist this value.. + * + * @param kind Metadata used by portal/tooling/etc to render different UX experiences for resources of the + * same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider + * must validate and persist this value. + * @return the next definition stage. + */ + WithCreate withKind(String kind); + } + /** The stage of the ApplicationGroup definition allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: Identity for the resource.. + * + * @param identity Identity for the resource. + * @return the next definition stage. + */ + WithCreate withIdentity(Identity identity); + } + /** The stage of the ApplicationGroup definition allowing to specify sku. */ + interface WithSku { + /** + * Specifies the sku property: The resource model definition representing SKU. + * + * @param sku The resource model definition representing SKU. + * @return the next definition stage. + */ + WithCreate withSku(Sku sku); + } + /** The stage of the ApplicationGroup definition allowing to specify plan. */ + interface WithPlan { + /** + * Specifies the plan property: Plan for the resource.. + * + * @param plan Plan for the resource. + * @return the next definition stage. + */ + WithCreate withPlan(Plan plan); + } + /** The stage of the ApplicationGroup definition allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: Description of ApplicationGroup.. + * + * @param description Description of ApplicationGroup. + * @return the next definition stage. + */ + WithCreate withDescription(String description); + } + /** The stage of the ApplicationGroup definition allowing to specify friendlyName. */ + interface WithFriendlyName { + /** + * Specifies the friendlyName property: Friendly name of ApplicationGroup.. + * + * @param friendlyName Friendly name of ApplicationGroup. + * @return the next definition stage. + */ + WithCreate withFriendlyName(String friendlyName); + } + /** The stage of the ApplicationGroup definition allowing to specify migrationRequest. */ + interface WithMigrationRequest { + /** + * Specifies the migrationRequest property: The registration info of HostPool.. + * + * @param migrationRequest The registration info of HostPool. + * @return the next definition stage. + */ + WithCreate withMigrationRequest(MigrationRequestProperties migrationRequest); + } + } + /** + * Begins update for the ApplicationGroup resource. + * + * @return the stage of resource update. + */ + ApplicationGroup.Update update(); + + /** The template for ApplicationGroup update. */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithDescription, UpdateStages.WithFriendlyName { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ApplicationGroup apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ApplicationGroup apply(Context context); + } + /** The ApplicationGroup update stages. */ + interface UpdateStages { + /** The stage of the ApplicationGroup update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: tags to be updated. + * + * @param tags tags to be updated. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the ApplicationGroup update allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: Description of ApplicationGroup.. + * + * @param description Description of ApplicationGroup. + * @return the next definition stage. + */ + Update withDescription(String description); + } + /** The stage of the ApplicationGroup update allowing to specify friendlyName. */ + interface WithFriendlyName { + /** + * Specifies the friendlyName property: Friendly name of ApplicationGroup.. + * + * @param friendlyName Friendly name of ApplicationGroup. + * @return the next definition stage. + */ + Update withFriendlyName(String friendlyName); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ApplicationGroup refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ApplicationGroup refresh(Context context); +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ApplicationGroupList.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ApplicationGroupList.java new file mode 100644 index 0000000000000..568b1cc3454f9 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ApplicationGroupList.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.desktopvirtualization.fluent.models.ApplicationGroupInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of ApplicationGroup definitions. */ +@Fluent +public final class ApplicationGroupList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ApplicationGroupList.class); + + /* + * List of ApplicationGroup definitions. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Link to the next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: List of ApplicationGroup definitions. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of ApplicationGroup definitions. + * + * @param value the value value to set. + * @return the ApplicationGroupList object itself. + */ + public ApplicationGroupList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Link to the next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ApplicationGroupPatch.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ApplicationGroupPatch.java new file mode 100644 index 0000000000000..cba1bb4f3910b --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ApplicationGroupPatch.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.desktopvirtualization.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** ApplicationGroup properties that can be patched. */ +@JsonFlatten +@Fluent +public class ApplicationGroupPatch extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ApplicationGroupPatch.class); + + /* + * tags to be updated + */ + @JsonProperty(value = "tags") + private Map tags; + + /* + * Description of ApplicationGroup. + */ + @JsonProperty(value = "properties.description") + private String description; + + /* + * Friendly name of ApplicationGroup. + */ + @JsonProperty(value = "properties.friendlyName") + private String friendlyName; + + /** + * Get the tags property: tags to be updated. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: tags to be updated. + * + * @param tags the tags value to set. + * @return the ApplicationGroupPatch object itself. + */ + public ApplicationGroupPatch withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the description property: Description of ApplicationGroup. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Description of ApplicationGroup. + * + * @param description the description value to set. + * @return the ApplicationGroupPatch object itself. + */ + public ApplicationGroupPatch withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the friendlyName property: Friendly name of ApplicationGroup. + * + * @return the friendlyName value. + */ + public String friendlyName() { + return this.friendlyName; + } + + /** + * Set the friendlyName property: Friendly name of ApplicationGroup. + * + * @param friendlyName the friendlyName value to set. + * @return the ApplicationGroupPatch object itself. + */ + public ApplicationGroupPatch withFriendlyName(String friendlyName) { + this.friendlyName = friendlyName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ApplicationGroupType.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ApplicationGroupType.java new file mode 100644 index 0000000000000..6509c4cb9777d --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ApplicationGroupType.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ApplicationGroupType. */ +public final class ApplicationGroupType extends ExpandableStringEnum { + /** Static value RemoteApp for ApplicationGroupType. */ + public static final ApplicationGroupType REMOTE_APP = fromString("RemoteApp"); + + /** Static value Desktop for ApplicationGroupType. */ + public static final ApplicationGroupType DESKTOP = fromString("Desktop"); + + /** + * Creates or finds a ApplicationGroupType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ApplicationGroupType. + */ + @JsonCreator + public static ApplicationGroupType fromString(String name) { + return fromString(name, ApplicationGroupType.class); + } + + /** @return known ApplicationGroupType values. */ + public static Collection values() { + return values(ApplicationGroupType.class); + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ApplicationGroups.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ApplicationGroups.java new file mode 100644 index 0000000000000..2b2738080b4a8 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ApplicationGroups.java @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.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 ApplicationGroups. */ +public interface ApplicationGroups { + /** + * Get an application group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an application group. + */ + ApplicationGroup getByResourceGroup(String resourceGroupName, String applicationGroupName); + + /** + * Get an application group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an application group. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String applicationGroupName, Context context); + + /** + * Remove an applicationGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String applicationGroupName); + + /** + * Remove an applicationGroup. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @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. + */ + Response deleteWithResponse(String resourceGroupName, String applicationGroupName, Context context); + + /** + * List applicationGroups. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of ApplicationGroup definitions. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List applicationGroups. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param filter OData filter expression. Valid properties for filtering are applicationGroupType. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of ApplicationGroup definitions. + */ + PagedIterable listByResourceGroup(String resourceGroupName, String filter, Context context); + + /** + * List applicationGroups in 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 list of ApplicationGroup definitions. + */ + PagedIterable list(); + + /** + * List applicationGroups in subscription. + * + * @param filter OData filter expression. Valid properties for filtering are applicationGroupType. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of ApplicationGroup definitions. + */ + PagedIterable list(String filter, Context context); + + /** + * Get an application group. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an application group. + */ + ApplicationGroup getById(String id); + + /** + * Get an application group. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an application group. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Remove an applicationGroup. + * + * @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); + + /** + * Remove an applicationGroup. + * + * @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. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ApplicationGroup resource. + * + * @param name resource name. + * @return the first stage of the new ApplicationGroup definition. + */ + ApplicationGroup.DefinitionStages.Blank define(String name); +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ApplicationList.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ApplicationList.java new file mode 100644 index 0000000000000..9fa84240c1739 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ApplicationList.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.desktopvirtualization.fluent.models.ApplicationInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of Application definitions. */ +@Fluent +public final class ApplicationList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ApplicationList.class); + + /* + * List of Application definitions. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Link to the next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: List of Application definitions. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of Application definitions. + * + * @param value the value value to set. + * @return the ApplicationList object itself. + */ + public ApplicationList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Link to the next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ApplicationPatch.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ApplicationPatch.java new file mode 100644 index 0000000000000..b9a0659e9e320 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ApplicationPatch.java @@ -0,0 +1,346 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Application properties that can be patched. */ +@JsonFlatten +@Fluent +public class ApplicationPatch { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ApplicationPatch.class); + + /* + * tags to be updated + */ + @JsonProperty(value = "tags") + private Map tags; + + /* + * Description of Application. + */ + @JsonProperty(value = "properties.description") + private String description; + + /* + * Friendly name of Application. + */ + @JsonProperty(value = "properties.friendlyName") + private String friendlyName; + + /* + * Specifies a path for the executable file for the application. + */ + @JsonProperty(value = "properties.filePath") + private String filePath; + + /* + * Specifies whether this published application can be launched with + * command line arguments provided by the client, command line arguments + * specified at publish time, or no command line arguments at all. + */ + @JsonProperty(value = "properties.commandLineSetting") + private CommandLineSetting commandLineSetting; + + /* + * Command Line Arguments for Application. + */ + @JsonProperty(value = "properties.commandLineArguments") + private String commandLineArguments; + + /* + * Specifies whether to show the RemoteApp program in the RD Web Access + * server. + */ + @JsonProperty(value = "properties.showInPortal") + private Boolean showInPortal; + + /* + * Path to icon. + */ + @JsonProperty(value = "properties.iconPath") + private String iconPath; + + /* + * Index of the icon. + */ + @JsonProperty(value = "properties.iconIndex") + private Integer iconIndex; + + /* + * Specifies the package family name for MSIX applications + */ + @JsonProperty(value = "properties.msixPackageFamilyName") + private String msixPackageFamilyName; + + /* + * Specifies the package application Id for MSIX applications + */ + @JsonProperty(value = "properties.msixPackageApplicationId") + private String msixPackageApplicationId; + + /* + * Resource Type of Application. + */ + @JsonProperty(value = "properties.applicationType") + private RemoteApplicationType applicationType; + + /** + * Get the tags property: tags to be updated. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: tags to be updated. + * + * @param tags the tags value to set. + * @return the ApplicationPatch object itself. + */ + public ApplicationPatch withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the description property: Description of Application. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Description of Application. + * + * @param description the description value to set. + * @return the ApplicationPatch object itself. + */ + public ApplicationPatch withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the friendlyName property: Friendly name of Application. + * + * @return the friendlyName value. + */ + public String friendlyName() { + return this.friendlyName; + } + + /** + * Set the friendlyName property: Friendly name of Application. + * + * @param friendlyName the friendlyName value to set. + * @return the ApplicationPatch object itself. + */ + public ApplicationPatch withFriendlyName(String friendlyName) { + this.friendlyName = friendlyName; + return this; + } + + /** + * Get the filePath property: Specifies a path for the executable file for the application. + * + * @return the filePath value. + */ + public String filePath() { + return this.filePath; + } + + /** + * Set the filePath property: Specifies a path for the executable file for the application. + * + * @param filePath the filePath value to set. + * @return the ApplicationPatch object itself. + */ + public ApplicationPatch withFilePath(String filePath) { + this.filePath = filePath; + return this; + } + + /** + * Get the commandLineSetting property: Specifies whether this published application can be launched with command + * line arguments provided by the client, command line arguments specified at publish time, or no command line + * arguments at all. + * + * @return the commandLineSetting value. + */ + public CommandLineSetting commandLineSetting() { + return this.commandLineSetting; + } + + /** + * Set the commandLineSetting property: Specifies whether this published application can be launched with command + * line arguments provided by the client, command line arguments specified at publish time, or no command line + * arguments at all. + * + * @param commandLineSetting the commandLineSetting value to set. + * @return the ApplicationPatch object itself. + */ + public ApplicationPatch withCommandLineSetting(CommandLineSetting commandLineSetting) { + this.commandLineSetting = commandLineSetting; + return this; + } + + /** + * Get the commandLineArguments property: Command Line Arguments for Application. + * + * @return the commandLineArguments value. + */ + public String commandLineArguments() { + return this.commandLineArguments; + } + + /** + * Set the commandLineArguments property: Command Line Arguments for Application. + * + * @param commandLineArguments the commandLineArguments value to set. + * @return the ApplicationPatch object itself. + */ + public ApplicationPatch withCommandLineArguments(String commandLineArguments) { + this.commandLineArguments = commandLineArguments; + return this; + } + + /** + * Get the showInPortal property: Specifies whether to show the RemoteApp program in the RD Web Access server. + * + * @return the showInPortal value. + */ + public Boolean showInPortal() { + return this.showInPortal; + } + + /** + * Set the showInPortal property: Specifies whether to show the RemoteApp program in the RD Web Access server. + * + * @param showInPortal the showInPortal value to set. + * @return the ApplicationPatch object itself. + */ + public ApplicationPatch withShowInPortal(Boolean showInPortal) { + this.showInPortal = showInPortal; + return this; + } + + /** + * Get the iconPath property: Path to icon. + * + * @return the iconPath value. + */ + public String iconPath() { + return this.iconPath; + } + + /** + * Set the iconPath property: Path to icon. + * + * @param iconPath the iconPath value to set. + * @return the ApplicationPatch object itself. + */ + public ApplicationPatch withIconPath(String iconPath) { + this.iconPath = iconPath; + return this; + } + + /** + * Get the iconIndex property: Index of the icon. + * + * @return the iconIndex value. + */ + public Integer iconIndex() { + return this.iconIndex; + } + + /** + * Set the iconIndex property: Index of the icon. + * + * @param iconIndex the iconIndex value to set. + * @return the ApplicationPatch object itself. + */ + public ApplicationPatch withIconIndex(Integer iconIndex) { + this.iconIndex = iconIndex; + return this; + } + + /** + * Get the msixPackageFamilyName property: Specifies the package family name for MSIX applications. + * + * @return the msixPackageFamilyName value. + */ + public String msixPackageFamilyName() { + return this.msixPackageFamilyName; + } + + /** + * Set the msixPackageFamilyName property: Specifies the package family name for MSIX applications. + * + * @param msixPackageFamilyName the msixPackageFamilyName value to set. + * @return the ApplicationPatch object itself. + */ + public ApplicationPatch withMsixPackageFamilyName(String msixPackageFamilyName) { + this.msixPackageFamilyName = msixPackageFamilyName; + return this; + } + + /** + * Get the msixPackageApplicationId property: Specifies the package application Id for MSIX applications. + * + * @return the msixPackageApplicationId value. + */ + public String msixPackageApplicationId() { + return this.msixPackageApplicationId; + } + + /** + * Set the msixPackageApplicationId property: Specifies the package application Id for MSIX applications. + * + * @param msixPackageApplicationId the msixPackageApplicationId value to set. + * @return the ApplicationPatch object itself. + */ + public ApplicationPatch withMsixPackageApplicationId(String msixPackageApplicationId) { + this.msixPackageApplicationId = msixPackageApplicationId; + return this; + } + + /** + * Get the applicationType property: Resource Type of Application. + * + * @return the applicationType value. + */ + public RemoteApplicationType applicationType() { + return this.applicationType; + } + + /** + * Set the applicationType property: Resource Type of Application. + * + * @param applicationType the applicationType value to set. + * @return the ApplicationPatch object itself. + */ + public ApplicationPatch withApplicationType(RemoteApplicationType applicationType) { + this.applicationType = applicationType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ApplicationType.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ApplicationType.java new file mode 100644 index 0000000000000..767e609506780 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ApplicationType.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ApplicationType. */ +public final class ApplicationType extends ExpandableStringEnum { + /** Static value RemoteApp for ApplicationType. */ + public static final ApplicationType REMOTE_APP = fromString("RemoteApp"); + + /** Static value Desktop for ApplicationType. */ + public static final ApplicationType DESKTOP = fromString("Desktop"); + + /** + * Creates or finds a ApplicationType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ApplicationType. + */ + @JsonCreator + public static ApplicationType fromString(String name) { + return fromString(name, ApplicationType.class); + } + + /** @return known ApplicationType values. */ + public static Collection values() { + return values(ApplicationType.class); + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/Applications.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/Applications.java new file mode 100644 index 0000000000000..c231b487902c2 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/Applications.java @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.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 Applications. */ +public interface Applications { + /** + * Get an application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param applicationName The name of the application within the specified application group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an application. + */ + Application get(String resourceGroupName, String applicationGroupName, String applicationName); + + /** + * Get an application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param applicationName The name of the application within the specified application group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an application. + */ + Response getWithResponse( + String resourceGroupName, String applicationGroupName, String applicationName, Context context); + + /** + * Remove an application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param applicationName The name of the application within the specified application group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String applicationGroupName, String applicationName); + + /** + * Remove an application. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param applicationName The name of the application within the specified application group. + * @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. + */ + Response deleteWithResponse( + String resourceGroupName, String applicationGroupName, String applicationName, Context context); + + /** + * List applications. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Application definitions. + */ + PagedIterable list(String resourceGroupName, String applicationGroupName); + + /** + * List applications. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Application definitions. + */ + PagedIterable list(String resourceGroupName, String applicationGroupName, Context context); + + /** + * Get an application. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an application. + */ + Application getById(String id); + + /** + * Get an application. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an application. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Remove an application. + * + * @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); + + /** + * Remove an application. + * + * @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. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new Application resource. + * + * @param name resource name. + * @return the first stage of the new Application definition. + */ + Application.DefinitionStages.Blank define(String name); +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/CommandLineSetting.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/CommandLineSetting.java new file mode 100644 index 0000000000000..6222fe15c6e83 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/CommandLineSetting.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.desktopvirtualization.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for CommandLineSetting. */ +public final class CommandLineSetting extends ExpandableStringEnum { + /** Static value DoNotAllow for CommandLineSetting. */ + public static final CommandLineSetting DO_NOT_ALLOW = fromString("DoNotAllow"); + + /** Static value Allow for CommandLineSetting. */ + public static final CommandLineSetting ALLOW = fromString("Allow"); + + /** Static value Require for CommandLineSetting. */ + public static final CommandLineSetting REQUIRE = fromString("Require"); + + /** + * Creates or finds a CommandLineSetting from its string representation. + * + * @param name a name to look for. + * @return the corresponding CommandLineSetting. + */ + @JsonCreator + public static CommandLineSetting fromString(String name) { + return fromString(name, CommandLineSetting.class); + } + + /** @return known CommandLineSetting values. */ + public static Collection values() { + return values(CommandLineSetting.class); + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/Desktop.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/Desktop.java new file mode 100644 index 0000000000000..ac9a82f96a95c --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/Desktop.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.models; + +import com.azure.resourcemanager.desktopvirtualization.fluent.models.DesktopInner; + +/** An immutable client-side representation of Desktop. */ +public interface Desktop { + /** + * 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 objectId property: ObjectId of Desktop. (internal use). + * + * @return the objectId value. + */ + String objectId(); + + /** + * Gets the description property: Description of Desktop. + * + * @return the description value. + */ + String description(); + + /** + * Gets the friendlyName property: Friendly name of Desktop. + * + * @return the friendlyName value. + */ + String friendlyName(); + + /** + * Gets the iconHash property: Hash of the icon. + * + * @return the iconHash value. + */ + String iconHash(); + + /** + * Gets the iconContent property: The icon a 64 bit string as a byte array. + * + * @return the iconContent value. + */ + byte[] iconContent(); + + /** + * Gets the inner com.azure.resourcemanager.desktopvirtualization.fluent.models.DesktopInner object. + * + * @return the inner object. + */ + DesktopInner innerModel(); +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/DesktopList.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/DesktopList.java new file mode 100644 index 0000000000000..ed974a0c80457 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/DesktopList.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.models; + +import com.azure.resourcemanager.desktopvirtualization.fluent.models.DesktopListInner; +import java.util.List; + +/** An immutable client-side representation of DesktopList. */ +public interface DesktopList { + /** + * Gets the value property: List of Desktop definitions. + * + * @return the value value. + */ + List value(); + + /** + * Gets the nextLink property: Link to the next page of results. + * + * @return the nextLink value. + */ + String nextLink(); + + /** + * Gets the inner com.azure.resourcemanager.desktopvirtualization.fluent.models.DesktopListInner object. + * + * @return the inner object. + */ + DesktopListInner innerModel(); +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/DesktopPatch.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/DesktopPatch.java new file mode 100644 index 0000000000000..96b04dab78973 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/DesktopPatch.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Desktop properties that can be patched. */ +@JsonFlatten +@Fluent +public class DesktopPatch { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DesktopPatch.class); + + /* + * tags to be updated + */ + @JsonProperty(value = "tags") + private Map tags; + + /* + * Description of Desktop. + */ + @JsonProperty(value = "properties.description") + private String description; + + /* + * Friendly name of Desktop. + */ + @JsonProperty(value = "properties.friendlyName") + private String friendlyName; + + /** + * Get the tags property: tags to be updated. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: tags to be updated. + * + * @param tags the tags value to set. + * @return the DesktopPatch object itself. + */ + public DesktopPatch withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the description property: Description of Desktop. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Description of Desktop. + * + * @param description the description value to set. + * @return the DesktopPatch object itself. + */ + public DesktopPatch withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the friendlyName property: Friendly name of Desktop. + * + * @return the friendlyName value. + */ + public String friendlyName() { + return this.friendlyName; + } + + /** + * Set the friendlyName property: Friendly name of Desktop. + * + * @param friendlyName the friendlyName value to set. + * @return the DesktopPatch object itself. + */ + public DesktopPatch withFriendlyName(String friendlyName) { + this.friendlyName = friendlyName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/Desktops.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/Desktops.java new file mode 100644 index 0000000000000..d9768b783be7f --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/Desktops.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Desktops. */ +public interface Desktops { + /** + * Get a desktop. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param desktopName The name of the desktop within the specified desktop group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a desktop. + */ + Desktop get(String resourceGroupName, String applicationGroupName, String desktopName); + + /** + * Get a desktop. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param desktopName The name of the desktop within the specified desktop group. + * @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 desktop. + */ + Response getWithResponse( + String resourceGroupName, String applicationGroupName, String desktopName, Context context); + + /** + * Update a desktop. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param desktopName The name of the desktop within the specified desktop group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return schema for Desktop properties. + */ + Desktop update(String resourceGroupName, String applicationGroupName, String desktopName); + + /** + * Update a desktop. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param desktopName The name of the desktop within the specified desktop group. + * @param desktop Object containing Desktop definitions. + * @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 schema for Desktop properties. + */ + Response updateWithResponse( + String resourceGroupName, + String applicationGroupName, + String desktopName, + DesktopPatch desktop, + Context context); + + /** + * List desktops. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Desktop definitions. + */ + DesktopList list(String resourceGroupName, String applicationGroupName); + + /** + * List desktops. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Desktop definitions. + */ + Response listWithResponse(String resourceGroupName, String applicationGroupName, Context context); +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ExpandMsixImage.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ExpandMsixImage.java new file mode 100644 index 0000000000000..a70dcd0f08cd0 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ExpandMsixImage.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.models; + +import com.azure.resourcemanager.desktopvirtualization.fluent.models.ExpandMsixImageInner; +import java.time.OffsetDateTime; +import java.util.List; + +/** An immutable client-side representation of ExpandMsixImage. */ +public interface ExpandMsixImage { + /** + * 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 packageAlias property: Alias of MSIX Package. + * + * @return the packageAlias value. + */ + String packageAlias(); + + /** + * Gets the imagePath property: VHD/CIM image path on Network Share. + * + * @return the imagePath value. + */ + String imagePath(); + + /** + * Gets the packageName property: Package Name from appxmanifest.xml. + * + * @return the packageName value. + */ + String packageName(); + + /** + * Gets the packageFamilyName property: Package Family Name from appxmanifest.xml. Contains Package Name and + * Publisher name. + * + * @return the packageFamilyName value. + */ + String packageFamilyName(); + + /** + * Gets the packageFullName property: Package Full Name from appxmanifest.xml. + * + * @return the packageFullName value. + */ + String packageFullName(); + + /** + * Gets the displayName property: User friendly Name to be displayed in the portal. + * + * @return the displayName value. + */ + String displayName(); + + /** + * Gets the packageRelativePath property: Relative Path to the package inside the image. + * + * @return the packageRelativePath value. + */ + String packageRelativePath(); + + /** + * Gets the isRegularRegistration property: Specifies how to register Package in feed. + * + * @return the isRegularRegistration value. + */ + Boolean isRegularRegistration(); + + /** + * Gets the isActive property: Make this version of the package the active one across the hostpool. + * + * @return the isActive value. + */ + Boolean isActive(); + + /** + * Gets the packageDependencies property: List of package dependencies. + * + * @return the packageDependencies value. + */ + List packageDependencies(); + + /** + * Gets the version property: Package Version found in the appxmanifest.xml. + * + * @return the version value. + */ + String version(); + + /** + * Gets the lastUpdated property: Date Package was last updated, found in the appxmanifest.xml. + * + * @return the lastUpdated value. + */ + OffsetDateTime lastUpdated(); + + /** + * Gets the packageApplications property: List of package applications. + * + * @return the packageApplications value. + */ + List packageApplications(); + + /** + * Gets the inner com.azure.resourcemanager.desktopvirtualization.fluent.models.ExpandMsixImageInner object. + * + * @return the inner object. + */ + ExpandMsixImageInner innerModel(); +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ExpandMsixImageList.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ExpandMsixImageList.java new file mode 100644 index 0000000000000..54444272db2c1 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ExpandMsixImageList.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.desktopvirtualization.fluent.models.ExpandMsixImageInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of MSIX package properties retrieved from MSIX Image expansion. */ +@Fluent +public final class ExpandMsixImageList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ExpandMsixImageList.class); + + /* + * List of MSIX package properties from give MSIX Image. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Link to the next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: List of MSIX package properties from give MSIX Image. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of MSIX package properties from give MSIX Image. + * + * @param value the value value to set. + * @return the ExpandMsixImageList object itself. + */ + public ExpandMsixImageList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Link to the next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/HealthCheckName.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/HealthCheckName.java new file mode 100644 index 0000000000000..3dffe71275db7 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/HealthCheckName.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for HealthCheckName. */ +public final class HealthCheckName extends ExpandableStringEnum { + /** Static value DomainJoinedCheck for HealthCheckName. */ + public static final HealthCheckName DOMAIN_JOINED_CHECK = fromString("DomainJoinedCheck"); + + /** Static value DomainTrustCheck for HealthCheckName. */ + public static final HealthCheckName DOMAIN_TRUST_CHECK = fromString("DomainTrustCheck"); + + /** Static value FSLogixHealthCheck for HealthCheckName. */ + public static final HealthCheckName FSLOGIX_HEALTH_CHECK = fromString("FSLogixHealthCheck"); + + /** Static value SxSStackListenerCheck for HealthCheckName. */ + public static final HealthCheckName SX_SSTACK_LISTENER_CHECK = fromString("SxSStackListenerCheck"); + + /** Static value UrlsAccessibleCheck for HealthCheckName. */ + public static final HealthCheckName URLS_ACCESSIBLE_CHECK = fromString("UrlsAccessibleCheck"); + + /** Static value MonitoringAgentCheck for HealthCheckName. */ + public static final HealthCheckName MONITORING_AGENT_CHECK = fromString("MonitoringAgentCheck"); + + /** Static value DomainReachable for HealthCheckName. */ + public static final HealthCheckName DOMAIN_REACHABLE = fromString("DomainReachable"); + + /** Static value WebRTCRedirectorCheck for HealthCheckName. */ + public static final HealthCheckName WEB_RTCREDIRECTOR_CHECK = fromString("WebRTCRedirectorCheck"); + + /** Static value SupportedEncryptionCheck for HealthCheckName. */ + public static final HealthCheckName SUPPORTED_ENCRYPTION_CHECK = fromString("SupportedEncryptionCheck"); + + /** Static value MetaDataServiceCheck for HealthCheckName. */ + public static final HealthCheckName META_DATA_SERVICE_CHECK = fromString("MetaDataServiceCheck"); + + /** Static value AppAttachHealthCheck for HealthCheckName. */ + public static final HealthCheckName APP_ATTACH_HEALTH_CHECK = fromString("AppAttachHealthCheck"); + + /** + * Creates or finds a HealthCheckName from its string representation. + * + * @param name a name to look for. + * @return the corresponding HealthCheckName. + */ + @JsonCreator + public static HealthCheckName fromString(String name) { + return fromString(name, HealthCheckName.class); + } + + /** @return known HealthCheckName values. */ + public static Collection values() { + return values(HealthCheckName.class); + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/HealthCheckResult.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/HealthCheckResult.java new file mode 100644 index 0000000000000..72cb228395a3f --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/HealthCheckResult.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for HealthCheckResult. */ +public final class HealthCheckResult extends ExpandableStringEnum { + /** Static value Unknown for HealthCheckResult. */ + public static final HealthCheckResult UNKNOWN = fromString("Unknown"); + + /** Static value HealthCheckSucceeded for HealthCheckResult. */ + public static final HealthCheckResult HEALTH_CHECK_SUCCEEDED = fromString("HealthCheckSucceeded"); + + /** Static value HealthCheckFailed for HealthCheckResult. */ + public static final HealthCheckResult HEALTH_CHECK_FAILED = fromString("HealthCheckFailed"); + + /** Static value SessionHostShutdown for HealthCheckResult. */ + public static final HealthCheckResult SESSION_HOST_SHUTDOWN = fromString("SessionHostShutdown"); + + /** + * Creates or finds a HealthCheckResult from its string representation. + * + * @param name a name to look for. + * @return the corresponding HealthCheckResult. + */ + @JsonCreator + public static HealthCheckResult fromString(String name) { + return fromString(name, HealthCheckResult.class); + } + + /** @return known HealthCheckResult values. */ + public static Collection values() { + return values(HealthCheckResult.class); + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/HostPool.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/HostPool.java new file mode 100644 index 0000000000000..eff32ca24ded7 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/HostPool.java @@ -0,0 +1,863 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.desktopvirtualization.fluent.models.HostPoolInner; +import com.azure.resourcemanager.desktopvirtualization.fluent.models.RegistrationInfoInner; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of HostPool. */ +public interface HostPool { + /** + * 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 managedBy property: The fully qualified resource ID of the resource that manages this resource. + * Indicates if this resource is managed by another Azure resource. If this is present, complete mode deployment + * will not delete the resource if it is removed from the template since it is managed by another resource. + * + * @return the managedBy value. + */ + String managedBy(); + + /** + * Gets the kind property: Metadata used by portal/tooling/etc to render different UX experiences for resources of + * the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must + * validate and persist this value. + * + * @return the kind value. + */ + String kind(); + + /** + * Gets the etag property: The etag field is *not* required. If it is provided in the response body, it must also be + * provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from + * the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), + * If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the identity property: Identity for the resource. + * + * @return the identity value. + */ + Identity identity(); + + /** + * Gets the sku property: The resource model definition representing SKU. + * + * @return the sku value. + */ + Sku sku(); + + /** + * Gets the plan property: Plan for the resource. + * + * @return the plan value. + */ + Plan plan(); + + /** + * Gets the objectId property: ObjectId of HostPool. (internal use). + * + * @return the objectId value. + */ + String objectId(); + + /** + * Gets the friendlyName property: Friendly name of HostPool. + * + * @return the friendlyName value. + */ + String friendlyName(); + + /** + * Gets the description property: Description of HostPool. + * + * @return the description value. + */ + String description(); + + /** + * Gets the hostPoolType property: HostPool type for desktop. + * + * @return the hostPoolType value. + */ + HostPoolType hostPoolType(); + + /** + * Gets the personalDesktopAssignmentType property: PersonalDesktopAssignment type for HostPool. + * + * @return the personalDesktopAssignmentType value. + */ + PersonalDesktopAssignmentType personalDesktopAssignmentType(); + + /** + * Gets the customRdpProperty property: Custom rdp property of HostPool. + * + * @return the customRdpProperty value. + */ + String customRdpProperty(); + + /** + * Gets the maxSessionLimit property: The max session limit of HostPool. + * + * @return the maxSessionLimit value. + */ + Integer maxSessionLimit(); + + /** + * Gets the loadBalancerType property: The type of the load balancer. + * + * @return the loadBalancerType value. + */ + LoadBalancerType loadBalancerType(); + + /** + * Gets the ring property: The ring number of HostPool. + * + * @return the ring value. + */ + Integer ring(); + + /** + * Gets the validationEnvironment property: Is validation environment. + * + * @return the validationEnvironment value. + */ + Boolean validationEnvironment(); + + /** + * Gets the registrationInfo property: The registration info of HostPool. + * + * @return the registrationInfo value. + */ + RegistrationInfo registrationInfo(); + + /** + * Gets the vmTemplate property: VM template for sessionhosts configuration within hostpool. + * + * @return the vmTemplate value. + */ + String vmTemplate(); + + /** + * Gets the applicationGroupReferences property: List of applicationGroup links. + * + * @return the applicationGroupReferences value. + */ + List applicationGroupReferences(); + + /** + * Gets the ssoadfsAuthority property: URL to customer ADFS server for signing WVD SSO certificates. + * + * @return the ssoadfsAuthority value. + */ + String ssoadfsAuthority(); + + /** + * Gets the ssoClientId property: ClientId for the registered Relying Party used to issue WVD SSO certificates. + * + * @return the ssoClientId value. + */ + String ssoClientId(); + + /** + * Gets the ssoClientSecretKeyVaultPath property: Path to Azure KeyVault storing the secret used for communication + * to ADFS. + * + * @return the ssoClientSecretKeyVaultPath value. + */ + String ssoClientSecretKeyVaultPath(); + + /** + * Gets the ssoSecretType property: The type of single sign on Secret Type. + * + * @return the ssoSecretType value. + */ + SsoSecretType ssoSecretType(); + + /** + * Gets the preferredAppGroupType property: The type of preferred application group type, default to Desktop + * Application Group. + * + * @return the preferredAppGroupType value. + */ + PreferredAppGroupType preferredAppGroupType(); + + /** + * Gets the startVMOnConnect property: The flag to turn on/off StartVMOnConnect feature. + * + * @return the startVMOnConnect value. + */ + Boolean startVMOnConnect(); + + /** + * Gets the migrationRequest property: The registration info of HostPool. + * + * @return the migrationRequest value. + */ + MigrationRequestProperties migrationRequest(); + + /** + * Gets the cloudPcResource property: Is cloud pc resource. + * + * @return the cloudPcResource value. + */ + Boolean cloudPcResource(); + + /** + * 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.desktopvirtualization.fluent.models.HostPoolInner object. + * + * @return the inner object. + */ + HostPoolInner innerModel(); + + /** The entirety of the HostPool definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithHostPoolType, + DefinitionStages.WithLoadBalancerType, + DefinitionStages.WithPreferredAppGroupType, + DefinitionStages.WithCreate { + } + /** The HostPool definition stages. */ + interface DefinitionStages { + /** The first stage of the HostPool definition. */ + interface Blank extends WithLocation { + } + /** The stage of the HostPool 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 HostPool definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithHostPoolType withExistingResourceGroup(String resourceGroupName); + } + /** The stage of the HostPool definition allowing to specify hostPoolType. */ + interface WithHostPoolType { + /** + * Specifies the hostPoolType property: HostPool type for desktop.. + * + * @param hostPoolType HostPool type for desktop. + * @return the next definition stage. + */ + WithLoadBalancerType withHostPoolType(HostPoolType hostPoolType); + } + /** The stage of the HostPool definition allowing to specify loadBalancerType. */ + interface WithLoadBalancerType { + /** + * Specifies the loadBalancerType property: The type of the load balancer.. + * + * @param loadBalancerType The type of the load balancer. + * @return the next definition stage. + */ + WithPreferredAppGroupType withLoadBalancerType(LoadBalancerType loadBalancerType); + } + /** The stage of the HostPool definition allowing to specify preferredAppGroupType. */ + interface WithPreferredAppGroupType { + /** + * Specifies the preferredAppGroupType property: The type of preferred application group type, default to + * Desktop Application Group. + * + * @param preferredAppGroupType The type of preferred application group type, default to Desktop Application + * Group. + * @return the next definition stage. + */ + WithCreate withPreferredAppGroupType(PreferredAppGroupType preferredAppGroupType); + } + /** + * The stage of the HostPool 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.WithManagedBy, + DefinitionStages.WithKind, + DefinitionStages.WithIdentity, + DefinitionStages.WithSku, + DefinitionStages.WithPlan, + DefinitionStages.WithFriendlyName, + DefinitionStages.WithDescription, + DefinitionStages.WithPersonalDesktopAssignmentType, + DefinitionStages.WithCustomRdpProperty, + DefinitionStages.WithMaxSessionLimit, + DefinitionStages.WithRing, + DefinitionStages.WithValidationEnvironment, + DefinitionStages.WithRegistrationInfo, + DefinitionStages.WithVmTemplate, + DefinitionStages.WithSsoadfsAuthority, + DefinitionStages.WithSsoClientId, + DefinitionStages.WithSsoClientSecretKeyVaultPath, + DefinitionStages.WithSsoSecretType, + DefinitionStages.WithStartVMOnConnect, + DefinitionStages.WithMigrationRequest { + /** + * Executes the create request. + * + * @return the created resource. + */ + HostPool create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + HostPool create(Context context); + } + /** The stage of the HostPool 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 HostPool definition allowing to specify managedBy. */ + interface WithManagedBy { + /** + * Specifies the managedBy property: The fully qualified resource ID of the resource that manages this + * resource. Indicates if this resource is managed by another Azure resource. If this is present, complete + * mode deployment will not delete the resource if it is removed from the template since it is managed by + * another resource.. + * + * @param managedBy The fully qualified resource ID of the resource that manages this resource. Indicates if + * this resource is managed by another Azure resource. If this is present, complete mode deployment will + * not delete the resource if it is removed from the template since it is managed by another resource. + * @return the next definition stage. + */ + WithCreate withManagedBy(String managedBy); + } + /** The stage of the HostPool definition allowing to specify kind. */ + interface WithKind { + /** + * Specifies the kind property: Metadata used by portal/tooling/etc to render different UX experiences for + * resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the + * resource provider must validate and persist this value.. + * + * @param kind Metadata used by portal/tooling/etc to render different UX experiences for resources of the + * same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider + * must validate and persist this value. + * @return the next definition stage. + */ + WithCreate withKind(String kind); + } + /** The stage of the HostPool definition allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: Identity for the resource.. + * + * @param identity Identity for the resource. + * @return the next definition stage. + */ + WithCreate withIdentity(Identity identity); + } + /** The stage of the HostPool definition allowing to specify sku. */ + interface WithSku { + /** + * Specifies the sku property: The resource model definition representing SKU. + * + * @param sku The resource model definition representing SKU. + * @return the next definition stage. + */ + WithCreate withSku(Sku sku); + } + /** The stage of the HostPool definition allowing to specify plan. */ + interface WithPlan { + /** + * Specifies the plan property: Plan for the resource.. + * + * @param plan Plan for the resource. + * @return the next definition stage. + */ + WithCreate withPlan(Plan plan); + } + /** The stage of the HostPool definition allowing to specify friendlyName. */ + interface WithFriendlyName { + /** + * Specifies the friendlyName property: Friendly name of HostPool.. + * + * @param friendlyName Friendly name of HostPool. + * @return the next definition stage. + */ + WithCreate withFriendlyName(String friendlyName); + } + /** The stage of the HostPool definition allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: Description of HostPool.. + * + * @param description Description of HostPool. + * @return the next definition stage. + */ + WithCreate withDescription(String description); + } + /** The stage of the HostPool definition allowing to specify personalDesktopAssignmentType. */ + interface WithPersonalDesktopAssignmentType { + /** + * Specifies the personalDesktopAssignmentType property: PersonalDesktopAssignment type for HostPool.. + * + * @param personalDesktopAssignmentType PersonalDesktopAssignment type for HostPool. + * @return the next definition stage. + */ + WithCreate withPersonalDesktopAssignmentType(PersonalDesktopAssignmentType personalDesktopAssignmentType); + } + /** The stage of the HostPool definition allowing to specify customRdpProperty. */ + interface WithCustomRdpProperty { + /** + * Specifies the customRdpProperty property: Custom rdp property of HostPool.. + * + * @param customRdpProperty Custom rdp property of HostPool. + * @return the next definition stage. + */ + WithCreate withCustomRdpProperty(String customRdpProperty); + } + /** The stage of the HostPool definition allowing to specify maxSessionLimit. */ + interface WithMaxSessionLimit { + /** + * Specifies the maxSessionLimit property: The max session limit of HostPool.. + * + * @param maxSessionLimit The max session limit of HostPool. + * @return the next definition stage. + */ + WithCreate withMaxSessionLimit(Integer maxSessionLimit); + } + /** The stage of the HostPool definition allowing to specify ring. */ + interface WithRing { + /** + * Specifies the ring property: The ring number of HostPool.. + * + * @param ring The ring number of HostPool. + * @return the next definition stage. + */ + WithCreate withRing(Integer ring); + } + /** The stage of the HostPool definition allowing to specify validationEnvironment. */ + interface WithValidationEnvironment { + /** + * Specifies the validationEnvironment property: Is validation environment.. + * + * @param validationEnvironment Is validation environment. + * @return the next definition stage. + */ + WithCreate withValidationEnvironment(Boolean validationEnvironment); + } + /** The stage of the HostPool definition allowing to specify registrationInfo. */ + interface WithRegistrationInfo { + /** + * Specifies the registrationInfo property: The registration info of HostPool.. + * + * @param registrationInfo The registration info of HostPool. + * @return the next definition stage. + */ + WithCreate withRegistrationInfo(RegistrationInfoInner registrationInfo); + } + /** The stage of the HostPool definition allowing to specify vmTemplate. */ + interface WithVmTemplate { + /** + * Specifies the vmTemplate property: VM template for sessionhosts configuration within hostpool.. + * + * @param vmTemplate VM template for sessionhosts configuration within hostpool. + * @return the next definition stage. + */ + WithCreate withVmTemplate(String vmTemplate); + } + /** The stage of the HostPool definition allowing to specify ssoadfsAuthority. */ + interface WithSsoadfsAuthority { + /** + * Specifies the ssoadfsAuthority property: URL to customer ADFS server for signing WVD SSO certificates.. + * + * @param ssoadfsAuthority URL to customer ADFS server for signing WVD SSO certificates. + * @return the next definition stage. + */ + WithCreate withSsoadfsAuthority(String ssoadfsAuthority); + } + /** The stage of the HostPool definition allowing to specify ssoClientId. */ + interface WithSsoClientId { + /** + * Specifies the ssoClientId property: ClientId for the registered Relying Party used to issue WVD SSO + * certificates.. + * + * @param ssoClientId ClientId for the registered Relying Party used to issue WVD SSO certificates. + * @return the next definition stage. + */ + WithCreate withSsoClientId(String ssoClientId); + } + /** The stage of the HostPool definition allowing to specify ssoClientSecretKeyVaultPath. */ + interface WithSsoClientSecretKeyVaultPath { + /** + * Specifies the ssoClientSecretKeyVaultPath property: Path to Azure KeyVault storing the secret used for + * communication to ADFS.. + * + * @param ssoClientSecretKeyVaultPath Path to Azure KeyVault storing the secret used for communication to + * ADFS. + * @return the next definition stage. + */ + WithCreate withSsoClientSecretKeyVaultPath(String ssoClientSecretKeyVaultPath); + } + /** The stage of the HostPool definition allowing to specify ssoSecretType. */ + interface WithSsoSecretType { + /** + * Specifies the ssoSecretType property: The type of single sign on Secret Type.. + * + * @param ssoSecretType The type of single sign on Secret Type. + * @return the next definition stage. + */ + WithCreate withSsoSecretType(SsoSecretType ssoSecretType); + } + /** The stage of the HostPool definition allowing to specify startVMOnConnect. */ + interface WithStartVMOnConnect { + /** + * Specifies the startVMOnConnect property: The flag to turn on/off StartVMOnConnect feature.. + * + * @param startVMOnConnect The flag to turn on/off StartVMOnConnect feature. + * @return the next definition stage. + */ + WithCreate withStartVMOnConnect(Boolean startVMOnConnect); + } + /** The stage of the HostPool definition allowing to specify migrationRequest. */ + interface WithMigrationRequest { + /** + * Specifies the migrationRequest property: The registration info of HostPool.. + * + * @param migrationRequest The registration info of HostPool. + * @return the next definition stage. + */ + WithCreate withMigrationRequest(MigrationRequestProperties migrationRequest); + } + } + /** + * Begins update for the HostPool resource. + * + * @return the stage of resource update. + */ + HostPool.Update update(); + + /** The template for HostPool update. */ + interface Update + extends UpdateStages.WithTags, + UpdateStages.WithFriendlyName, + UpdateStages.WithDescription, + UpdateStages.WithCustomRdpProperty, + UpdateStages.WithMaxSessionLimit, + UpdateStages.WithPersonalDesktopAssignmentType, + UpdateStages.WithLoadBalancerType, + UpdateStages.WithRing, + UpdateStages.WithValidationEnvironment, + UpdateStages.WithRegistrationInfo, + UpdateStages.WithVmTemplate, + UpdateStages.WithSsoadfsAuthority, + UpdateStages.WithSsoClientId, + UpdateStages.WithSsoClientSecretKeyVaultPath, + UpdateStages.WithSsoSecretType, + UpdateStages.WithPreferredAppGroupType, + UpdateStages.WithStartVMOnConnect { + /** + * Executes the update request. + * + * @return the updated resource. + */ + HostPool apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + HostPool apply(Context context); + } + /** The HostPool update stages. */ + interface UpdateStages { + /** The stage of the HostPool update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: tags to be updated. + * + * @param tags tags to be updated. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the HostPool update allowing to specify friendlyName. */ + interface WithFriendlyName { + /** + * Specifies the friendlyName property: Friendly name of HostPool.. + * + * @param friendlyName Friendly name of HostPool. + * @return the next definition stage. + */ + Update withFriendlyName(String friendlyName); + } + /** The stage of the HostPool update allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: Description of HostPool.. + * + * @param description Description of HostPool. + * @return the next definition stage. + */ + Update withDescription(String description); + } + /** The stage of the HostPool update allowing to specify customRdpProperty. */ + interface WithCustomRdpProperty { + /** + * Specifies the customRdpProperty property: Custom rdp property of HostPool.. + * + * @param customRdpProperty Custom rdp property of HostPool. + * @return the next definition stage. + */ + Update withCustomRdpProperty(String customRdpProperty); + } + /** The stage of the HostPool update allowing to specify maxSessionLimit. */ + interface WithMaxSessionLimit { + /** + * Specifies the maxSessionLimit property: The max session limit of HostPool.. + * + * @param maxSessionLimit The max session limit of HostPool. + * @return the next definition stage. + */ + Update withMaxSessionLimit(Integer maxSessionLimit); + } + /** The stage of the HostPool update allowing to specify personalDesktopAssignmentType. */ + interface WithPersonalDesktopAssignmentType { + /** + * Specifies the personalDesktopAssignmentType property: PersonalDesktopAssignment type for HostPool.. + * + * @param personalDesktopAssignmentType PersonalDesktopAssignment type for HostPool. + * @return the next definition stage. + */ + Update withPersonalDesktopAssignmentType(PersonalDesktopAssignmentType personalDesktopAssignmentType); + } + /** The stage of the HostPool update allowing to specify loadBalancerType. */ + interface WithLoadBalancerType { + /** + * Specifies the loadBalancerType property: The type of the load balancer.. + * + * @param loadBalancerType The type of the load balancer. + * @return the next definition stage. + */ + Update withLoadBalancerType(LoadBalancerType loadBalancerType); + } + /** The stage of the HostPool update allowing to specify ring. */ + interface WithRing { + /** + * Specifies the ring property: The ring number of HostPool.. + * + * @param ring The ring number of HostPool. + * @return the next definition stage. + */ + Update withRing(Integer ring); + } + /** The stage of the HostPool update allowing to specify validationEnvironment. */ + interface WithValidationEnvironment { + /** + * Specifies the validationEnvironment property: Is validation environment.. + * + * @param validationEnvironment Is validation environment. + * @return the next definition stage. + */ + Update withValidationEnvironment(Boolean validationEnvironment); + } + /** The stage of the HostPool update allowing to specify registrationInfo. */ + interface WithRegistrationInfo { + /** + * Specifies the registrationInfo property: The registration info of HostPool.. + * + * @param registrationInfo The registration info of HostPool. + * @return the next definition stage. + */ + Update withRegistrationInfo(RegistrationInfoPatch registrationInfo); + } + /** The stage of the HostPool update allowing to specify vmTemplate. */ + interface WithVmTemplate { + /** + * Specifies the vmTemplate property: VM template for sessionhosts configuration within hostpool.. + * + * @param vmTemplate VM template for sessionhosts configuration within hostpool. + * @return the next definition stage. + */ + Update withVmTemplate(String vmTemplate); + } + /** The stage of the HostPool update allowing to specify ssoadfsAuthority. */ + interface WithSsoadfsAuthority { + /** + * Specifies the ssoadfsAuthority property: URL to customer ADFS server for signing WVD SSO certificates.. + * + * @param ssoadfsAuthority URL to customer ADFS server for signing WVD SSO certificates. + * @return the next definition stage. + */ + Update withSsoadfsAuthority(String ssoadfsAuthority); + } + /** The stage of the HostPool update allowing to specify ssoClientId. */ + interface WithSsoClientId { + /** + * Specifies the ssoClientId property: ClientId for the registered Relying Party used to issue WVD SSO + * certificates.. + * + * @param ssoClientId ClientId for the registered Relying Party used to issue WVD SSO certificates. + * @return the next definition stage. + */ + Update withSsoClientId(String ssoClientId); + } + /** The stage of the HostPool update allowing to specify ssoClientSecretKeyVaultPath. */ + interface WithSsoClientSecretKeyVaultPath { + /** + * Specifies the ssoClientSecretKeyVaultPath property: Path to Azure KeyVault storing the secret used for + * communication to ADFS.. + * + * @param ssoClientSecretKeyVaultPath Path to Azure KeyVault storing the secret used for communication to + * ADFS. + * @return the next definition stage. + */ + Update withSsoClientSecretKeyVaultPath(String ssoClientSecretKeyVaultPath); + } + /** The stage of the HostPool update allowing to specify ssoSecretType. */ + interface WithSsoSecretType { + /** + * Specifies the ssoSecretType property: The type of single sign on Secret Type.. + * + * @param ssoSecretType The type of single sign on Secret Type. + * @return the next definition stage. + */ + Update withSsoSecretType(SsoSecretType ssoSecretType); + } + /** The stage of the HostPool update allowing to specify preferredAppGroupType. */ + interface WithPreferredAppGroupType { + /** + * Specifies the preferredAppGroupType property: The type of preferred application group type, default to + * Desktop Application Group. + * + * @param preferredAppGroupType The type of preferred application group type, default to Desktop Application + * Group. + * @return the next definition stage. + */ + Update withPreferredAppGroupType(PreferredAppGroupType preferredAppGroupType); + } + /** The stage of the HostPool update allowing to specify startVMOnConnect. */ + interface WithStartVMOnConnect { + /** + * Specifies the startVMOnConnect property: The flag to turn on/off StartVMOnConnect feature.. + * + * @param startVMOnConnect The flag to turn on/off StartVMOnConnect feature. + * @return the next definition stage. + */ + Update withStartVMOnConnect(Boolean startVMOnConnect); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + HostPool refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + HostPool refresh(Context context); + + /** + * Registration token of the host pool. + * + * @throws com.azure.core.management.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 represents a RegistrationInfo definition. + */ + RegistrationInfo retrieveRegistrationToken(); + + /** + * Registration token of the host pool. + * + * @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 represents a RegistrationInfo definition. + */ + Response retrieveRegistrationTokenWithResponse(Context context); +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/HostPoolList.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/HostPoolList.java new file mode 100644 index 0000000000000..1f963f8f108bf --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/HostPoolList.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.desktopvirtualization.fluent.models.HostPoolInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of HostPool definitions. */ +@Fluent +public final class HostPoolList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(HostPoolList.class); + + /* + * List of HostPool definitions. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Link to the next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: List of HostPool definitions. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of HostPool definitions. + * + * @param value the value value to set. + * @return the HostPoolList object itself. + */ + public HostPoolList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Link to the next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/HostPoolPatch.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/HostPoolPatch.java new file mode 100644 index 0000000000000..d0c5631fae86f --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/HostPoolPatch.java @@ -0,0 +1,481 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** HostPool properties that can be patched. */ +@JsonFlatten +@Fluent +public class HostPoolPatch extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(HostPoolPatch.class); + + /* + * tags to be updated + */ + @JsonProperty(value = "tags") + private Map tags; + + /* + * Friendly name of HostPool. + */ + @JsonProperty(value = "properties.friendlyName") + private String friendlyName; + + /* + * Description of HostPool. + */ + @JsonProperty(value = "properties.description") + private String description; + + /* + * Custom rdp property of HostPool. + */ + @JsonProperty(value = "properties.customRdpProperty") + private String customRdpProperty; + + /* + * The max session limit of HostPool. + */ + @JsonProperty(value = "properties.maxSessionLimit") + private Integer maxSessionLimit; + + /* + * PersonalDesktopAssignment type for HostPool. + */ + @JsonProperty(value = "properties.personalDesktopAssignmentType") + private PersonalDesktopAssignmentType personalDesktopAssignmentType; + + /* + * The type of the load balancer. + */ + @JsonProperty(value = "properties.loadBalancerType") + private LoadBalancerType loadBalancerType; + + /* + * The ring number of HostPool. + */ + @JsonProperty(value = "properties.ring") + private Integer ring; + + /* + * Is validation environment. + */ + @JsonProperty(value = "properties.validationEnvironment") + private Boolean validationEnvironment; + + /* + * The registration info of HostPool. + */ + @JsonProperty(value = "properties.registrationInfo") + private RegistrationInfoPatch registrationInfo; + + /* + * VM template for sessionhosts configuration within hostpool. + */ + @JsonProperty(value = "properties.vmTemplate") + private String vmTemplate; + + /* + * URL to customer ADFS server for signing WVD SSO certificates. + */ + @JsonProperty(value = "properties.ssoadfsAuthority") + private String ssoadfsAuthority; + + /* + * ClientId for the registered Relying Party used to issue WVD SSO + * certificates. + */ + @JsonProperty(value = "properties.ssoClientId") + private String ssoClientId; + + /* + * Path to Azure KeyVault storing the secret used for communication to + * ADFS. + */ + @JsonProperty(value = "properties.ssoClientSecretKeyVaultPath") + private String ssoClientSecretKeyVaultPath; + + /* + * The type of single sign on Secret Type. + */ + @JsonProperty(value = "properties.ssoSecretType") + private SsoSecretType ssoSecretType; + + /* + * The type of preferred application group type, default to Desktop + * Application Group + */ + @JsonProperty(value = "properties.preferredAppGroupType") + private PreferredAppGroupType preferredAppGroupType; + + /* + * The flag to turn on/off StartVMOnConnect feature. + */ + @JsonProperty(value = "properties.startVMOnConnect") + private Boolean startVMOnConnect; + + /** + * Get the tags property: tags to be updated. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: tags to be updated. + * + * @param tags the tags value to set. + * @return the HostPoolPatch object itself. + */ + public HostPoolPatch withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the friendlyName property: Friendly name of HostPool. + * + * @return the friendlyName value. + */ + public String friendlyName() { + return this.friendlyName; + } + + /** + * Set the friendlyName property: Friendly name of HostPool. + * + * @param friendlyName the friendlyName value to set. + * @return the HostPoolPatch object itself. + */ + public HostPoolPatch withFriendlyName(String friendlyName) { + this.friendlyName = friendlyName; + return this; + } + + /** + * Get the description property: Description of HostPool. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Description of HostPool. + * + * @param description the description value to set. + * @return the HostPoolPatch object itself. + */ + public HostPoolPatch withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the customRdpProperty property: Custom rdp property of HostPool. + * + * @return the customRdpProperty value. + */ + public String customRdpProperty() { + return this.customRdpProperty; + } + + /** + * Set the customRdpProperty property: Custom rdp property of HostPool. + * + * @param customRdpProperty the customRdpProperty value to set. + * @return the HostPoolPatch object itself. + */ + public HostPoolPatch withCustomRdpProperty(String customRdpProperty) { + this.customRdpProperty = customRdpProperty; + return this; + } + + /** + * Get the maxSessionLimit property: The max session limit of HostPool. + * + * @return the maxSessionLimit value. + */ + public Integer maxSessionLimit() { + return this.maxSessionLimit; + } + + /** + * Set the maxSessionLimit property: The max session limit of HostPool. + * + * @param maxSessionLimit the maxSessionLimit value to set. + * @return the HostPoolPatch object itself. + */ + public HostPoolPatch withMaxSessionLimit(Integer maxSessionLimit) { + this.maxSessionLimit = maxSessionLimit; + return this; + } + + /** + * Get the personalDesktopAssignmentType property: PersonalDesktopAssignment type for HostPool. + * + * @return the personalDesktopAssignmentType value. + */ + public PersonalDesktopAssignmentType personalDesktopAssignmentType() { + return this.personalDesktopAssignmentType; + } + + /** + * Set the personalDesktopAssignmentType property: PersonalDesktopAssignment type for HostPool. + * + * @param personalDesktopAssignmentType the personalDesktopAssignmentType value to set. + * @return the HostPoolPatch object itself. + */ + public HostPoolPatch withPersonalDesktopAssignmentType( + PersonalDesktopAssignmentType personalDesktopAssignmentType) { + this.personalDesktopAssignmentType = personalDesktopAssignmentType; + return this; + } + + /** + * Get the loadBalancerType property: The type of the load balancer. + * + * @return the loadBalancerType value. + */ + public LoadBalancerType loadBalancerType() { + return this.loadBalancerType; + } + + /** + * Set the loadBalancerType property: The type of the load balancer. + * + * @param loadBalancerType the loadBalancerType value to set. + * @return the HostPoolPatch object itself. + */ + public HostPoolPatch withLoadBalancerType(LoadBalancerType loadBalancerType) { + this.loadBalancerType = loadBalancerType; + return this; + } + + /** + * Get the ring property: The ring number of HostPool. + * + * @return the ring value. + */ + public Integer ring() { + return this.ring; + } + + /** + * Set the ring property: The ring number of HostPool. + * + * @param ring the ring value to set. + * @return the HostPoolPatch object itself. + */ + public HostPoolPatch withRing(Integer ring) { + this.ring = ring; + return this; + } + + /** + * Get the validationEnvironment property: Is validation environment. + * + * @return the validationEnvironment value. + */ + public Boolean validationEnvironment() { + return this.validationEnvironment; + } + + /** + * Set the validationEnvironment property: Is validation environment. + * + * @param validationEnvironment the validationEnvironment value to set. + * @return the HostPoolPatch object itself. + */ + public HostPoolPatch withValidationEnvironment(Boolean validationEnvironment) { + this.validationEnvironment = validationEnvironment; + return this; + } + + /** + * Get the registrationInfo property: The registration info of HostPool. + * + * @return the registrationInfo value. + */ + public RegistrationInfoPatch registrationInfo() { + return this.registrationInfo; + } + + /** + * Set the registrationInfo property: The registration info of HostPool. + * + * @param registrationInfo the registrationInfo value to set. + * @return the HostPoolPatch object itself. + */ + public HostPoolPatch withRegistrationInfo(RegistrationInfoPatch registrationInfo) { + this.registrationInfo = registrationInfo; + return this; + } + + /** + * Get the vmTemplate property: VM template for sessionhosts configuration within hostpool. + * + * @return the vmTemplate value. + */ + public String vmTemplate() { + return this.vmTemplate; + } + + /** + * Set the vmTemplate property: VM template for sessionhosts configuration within hostpool. + * + * @param vmTemplate the vmTemplate value to set. + * @return the HostPoolPatch object itself. + */ + public HostPoolPatch withVmTemplate(String vmTemplate) { + this.vmTemplate = vmTemplate; + return this; + } + + /** + * Get the ssoadfsAuthority property: URL to customer ADFS server for signing WVD SSO certificates. + * + * @return the ssoadfsAuthority value. + */ + public String ssoadfsAuthority() { + return this.ssoadfsAuthority; + } + + /** + * Set the ssoadfsAuthority property: URL to customer ADFS server for signing WVD SSO certificates. + * + * @param ssoadfsAuthority the ssoadfsAuthority value to set. + * @return the HostPoolPatch object itself. + */ + public HostPoolPatch withSsoadfsAuthority(String ssoadfsAuthority) { + this.ssoadfsAuthority = ssoadfsAuthority; + return this; + } + + /** + * Get the ssoClientId property: ClientId for the registered Relying Party used to issue WVD SSO certificates. + * + * @return the ssoClientId value. + */ + public String ssoClientId() { + return this.ssoClientId; + } + + /** + * Set the ssoClientId property: ClientId for the registered Relying Party used to issue WVD SSO certificates. + * + * @param ssoClientId the ssoClientId value to set. + * @return the HostPoolPatch object itself. + */ + public HostPoolPatch withSsoClientId(String ssoClientId) { + this.ssoClientId = ssoClientId; + return this; + } + + /** + * Get the ssoClientSecretKeyVaultPath property: Path to Azure KeyVault storing the secret used for communication to + * ADFS. + * + * @return the ssoClientSecretKeyVaultPath value. + */ + public String ssoClientSecretKeyVaultPath() { + return this.ssoClientSecretKeyVaultPath; + } + + /** + * Set the ssoClientSecretKeyVaultPath property: Path to Azure KeyVault storing the secret used for communication to + * ADFS. + * + * @param ssoClientSecretKeyVaultPath the ssoClientSecretKeyVaultPath value to set. + * @return the HostPoolPatch object itself. + */ + public HostPoolPatch withSsoClientSecretKeyVaultPath(String ssoClientSecretKeyVaultPath) { + this.ssoClientSecretKeyVaultPath = ssoClientSecretKeyVaultPath; + return this; + } + + /** + * Get the ssoSecretType property: The type of single sign on Secret Type. + * + * @return the ssoSecretType value. + */ + public SsoSecretType ssoSecretType() { + return this.ssoSecretType; + } + + /** + * Set the ssoSecretType property: The type of single sign on Secret Type. + * + * @param ssoSecretType the ssoSecretType value to set. + * @return the HostPoolPatch object itself. + */ + public HostPoolPatch withSsoSecretType(SsoSecretType ssoSecretType) { + this.ssoSecretType = ssoSecretType; + return this; + } + + /** + * Get the preferredAppGroupType property: The type of preferred application group type, default to Desktop + * Application Group. + * + * @return the preferredAppGroupType value. + */ + public PreferredAppGroupType preferredAppGroupType() { + return this.preferredAppGroupType; + } + + /** + * Set the preferredAppGroupType property: The type of preferred application group type, default to Desktop + * Application Group. + * + * @param preferredAppGroupType the preferredAppGroupType value to set. + * @return the HostPoolPatch object itself. + */ + public HostPoolPatch withPreferredAppGroupType(PreferredAppGroupType preferredAppGroupType) { + this.preferredAppGroupType = preferredAppGroupType; + return this; + } + + /** + * Get the startVMOnConnect property: The flag to turn on/off StartVMOnConnect feature. + * + * @return the startVMOnConnect value. + */ + public Boolean startVMOnConnect() { + return this.startVMOnConnect; + } + + /** + * Set the startVMOnConnect property: The flag to turn on/off StartVMOnConnect feature. + * + * @param startVMOnConnect the startVMOnConnect value to set. + * @return the HostPoolPatch object itself. + */ + public HostPoolPatch withStartVMOnConnect(Boolean startVMOnConnect) { + this.startVMOnConnect = startVMOnConnect; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (registrationInfo() != null) { + registrationInfo().validate(); + } + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/HostPoolType.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/HostPoolType.java new file mode 100644 index 0000000000000..bec1282ef9cb9 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/HostPoolType.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.desktopvirtualization.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for HostPoolType. */ +public final class HostPoolType extends ExpandableStringEnum { + /** Static value Personal for HostPoolType. */ + public static final HostPoolType PERSONAL = fromString("Personal"); + + /** Static value Pooled for HostPoolType. */ + public static final HostPoolType POOLED = fromString("Pooled"); + + /** Static value BYODesktop for HostPoolType. */ + public static final HostPoolType BYODESKTOP = fromString("BYODesktop"); + + /** + * Creates or finds a HostPoolType from its string representation. + * + * @param name a name to look for. + * @return the corresponding HostPoolType. + */ + @JsonCreator + public static HostPoolType fromString(String name) { + return fromString(name, HostPoolType.class); + } + + /** @return known HostPoolType values. */ + public static Collection values() { + return values(HostPoolType.class); + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/HostPools.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/HostPools.java new file mode 100644 index 0000000000000..08f5a4ec91d0a --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/HostPools.java @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.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 HostPools. */ +public interface HostPools { + /** + * Get a host pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a host pool. + */ + HostPool getByResourceGroup(String resourceGroupName, String hostPoolName); + + /** + * Get a host pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @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 host pool. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String hostPoolName, Context context); + + /** + * Remove a host pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String hostPoolName); + + /** + * Remove a host pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param force Force flag to delete sessionHost. + * @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. + */ + Response deleteWithResponse(String resourceGroupName, String hostPoolName, Boolean force, Context context); + + /** + * List hostPools. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of HostPool definitions. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List hostPools. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of HostPool definitions. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List hostPools in 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 list of HostPool definitions. + */ + PagedIterable list(); + + /** + * List hostPools in 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 list of HostPool definitions. + */ + PagedIterable list(Context context); + + /** + * Registration token of the host pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a RegistrationInfo definition. + */ + RegistrationInfo retrieveRegistrationToken(String resourceGroupName, String hostPoolName); + + /** + * Registration token of the host pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @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 represents a RegistrationInfo definition. + */ + Response retrieveRegistrationTokenWithResponse( + String resourceGroupName, String hostPoolName, Context context); + + /** + * Get a host pool. + * + * @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 host pool. + */ + HostPool getById(String id); + + /** + * Get a host pool. + * + * @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 host pool. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Remove a host pool. + * + * @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); + + /** + * Remove a host pool. + * + * @param id the resource ID. + * @param force Force flag to delete sessionHost. + * @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. + */ + Response deleteByIdWithResponse(String id, Boolean force, Context context); + + /** + * Begins definition for a new HostPool resource. + * + * @param name resource name. + * @return the first stage of the new HostPool definition. + */ + HostPool.DefinitionStages.Blank define(String name); +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/Identity.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/Identity.java new file mode 100644 index 0000000000000..7bae246250acb --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/Identity.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.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; + +/** Identity for the resource. */ +@Fluent +public class Identity { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Identity.class); + + /* + * The principal ID of resource identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private String principalId; + + /* + * The tenant ID of resource. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private String tenantId; + + /* + * The identity type. + */ + @JsonProperty(value = "type") + private ResourceIdentityType type; + + /** + * Get the principalId property: The principal ID of resource identity. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the tenantId property: The tenant ID of resource. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Get the type property: The identity type. + * + * @return the type value. + */ + public ResourceIdentityType type() { + return this.type; + } + + /** + * Set the type property: The identity type. + * + * @param type the type value to set. + * @return the Identity object itself. + */ + public Identity withType(ResourceIdentityType type) { + this.type = type; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/LoadBalancerType.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/LoadBalancerType.java new file mode 100644 index 0000000000000..af69375d0ad16 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/LoadBalancerType.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.desktopvirtualization.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for LoadBalancerType. */ +public final class LoadBalancerType extends ExpandableStringEnum { + /** Static value BreadthFirst for LoadBalancerType. */ + public static final LoadBalancerType BREADTH_FIRST = fromString("BreadthFirst"); + + /** Static value DepthFirst for LoadBalancerType. */ + public static final LoadBalancerType DEPTH_FIRST = fromString("DepthFirst"); + + /** Static value Persistent for LoadBalancerType. */ + public static final LoadBalancerType PERSISTENT = fromString("Persistent"); + + /** + * Creates or finds a LoadBalancerType from its string representation. + * + * @param name a name to look for. + * @return the corresponding LoadBalancerType. + */ + @JsonCreator + public static LoadBalancerType fromString(String name) { + return fromString(name, LoadBalancerType.class); + } + + /** @return known LoadBalancerType values. */ + public static Collection values() { + return values(LoadBalancerType.class); + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/LogSpecification.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/LogSpecification.java new file mode 100644 index 0000000000000..f45e6f9123c66 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/LogSpecification.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.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; + +/** Specifications of the Log for Azure Monitoring. */ +@Fluent +public final class LogSpecification { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LogSpecification.class); + + /* + * Name of the log + */ + @JsonProperty(value = "name") + private String name; + + /* + * Localized friendly display name of the log + */ + @JsonProperty(value = "displayName") + private String displayName; + + /* + * Blob duration of the log + */ + @JsonProperty(value = "blobDuration") + private String blobDuration; + + /** + * Get the name property: Name of the log. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the log. + * + * @param name the name value to set. + * @return the LogSpecification object itself. + */ + public LogSpecification withName(String name) { + this.name = name; + return this; + } + + /** + * Get the displayName property: Localized friendly display name of the log. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: Localized friendly display name of the log. + * + * @param displayName the displayName value to set. + * @return the LogSpecification object itself. + */ + public LogSpecification withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the blobDuration property: Blob duration of the log. + * + * @return the blobDuration value. + */ + public String blobDuration() { + return this.blobDuration; + } + + /** + * Set the blobDuration property: Blob duration of the log. + * + * @param blobDuration the blobDuration value to set. + * @return the LogSpecification object itself. + */ + public LogSpecification withBlobDuration(String blobDuration) { + this.blobDuration = blobDuration; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/MigrationRequestProperties.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/MigrationRequestProperties.java new file mode 100644 index 0000000000000..026d4ec684bcf --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/MigrationRequestProperties.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.desktopvirtualization.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; + +/** Properties for arm migration. */ +@Fluent +public final class MigrationRequestProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MigrationRequestProperties.class); + + /* + * The type of operation for migration. + */ + @JsonProperty(value = "operation") + private Operation operation; + + /* + * The path to the legacy object to migrate. + */ + @JsonProperty(value = "migrationPath") + private String migrationPath; + + /** + * Get the operation property: The type of operation for migration. + * + * @return the operation value. + */ + public Operation operation() { + return this.operation; + } + + /** + * Set the operation property: The type of operation for migration. + * + * @param operation the operation value to set. + * @return the MigrationRequestProperties object itself. + */ + public MigrationRequestProperties withOperation(Operation operation) { + this.operation = operation; + return this; + } + + /** + * Get the migrationPath property: The path to the legacy object to migrate. + * + * @return the migrationPath value. + */ + public String migrationPath() { + return this.migrationPath; + } + + /** + * Set the migrationPath property: The path to the legacy object to migrate. + * + * @param migrationPath the migrationPath value to set. + * @return the MigrationRequestProperties object itself. + */ + public MigrationRequestProperties withMigrationPath(String migrationPath) { + this.migrationPath = migrationPath; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/MsixImageUri.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/MsixImageUri.java new file mode 100644 index 0000000000000..eb03881aa54c3 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/MsixImageUri.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.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; + +/** Represents URI referring to MSIX Image. */ +@Fluent +public final class MsixImageUri { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MsixImageUri.class); + + /* + * URI to Image + */ + @JsonProperty(value = "uri") + private String uri; + + /** + * Get the uri property: URI to Image. + * + * @return the uri value. + */ + public String uri() { + return this.uri; + } + + /** + * Set the uri property: URI to Image. + * + * @param uri the uri value to set. + * @return the MsixImageUri object itself. + */ + public MsixImageUri withUri(String uri) { + this.uri = uri; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/MsixImages.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/MsixImages.java new file mode 100644 index 0000000000000..9bbdc0814a904 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/MsixImages.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of MsixImages. */ +public interface MsixImages { + /** + * Expands and Lists MSIX packages in an Image, given the Image Path. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param msixImageUri Object containing URI to MSIX Image. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of MSIX package properties retrieved from MSIX Image expansion. + */ + PagedIterable expand(String resourceGroupName, String hostPoolName, MsixImageUri msixImageUri); + + /** + * Expands and Lists MSIX packages in an Image, given the Image Path. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param msixImageUri Object containing URI to MSIX Image. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of MSIX package properties retrieved from MSIX Image expansion. + */ + PagedIterable expand( + String resourceGroupName, String hostPoolName, MsixImageUri msixImageUri, Context context); +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/MsixPackage.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/MsixPackage.java new file mode 100644 index 0000000000000..7845005769963 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/MsixPackage.java @@ -0,0 +1,356 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.desktopvirtualization.fluent.models.MsixPackageInner; +import java.time.OffsetDateTime; +import java.util.List; + +/** An immutable client-side representation of MsixPackage. */ +public interface MsixPackage { + /** + * 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 imagePath property: VHD/CIM image path on Network Share. + * + * @return the imagePath value. + */ + String imagePath(); + + /** + * Gets the packageName property: Package Name from appxmanifest.xml. + * + * @return the packageName value. + */ + String packageName(); + + /** + * Gets the packageFamilyName property: Package Family Name from appxmanifest.xml. Contains Package Name and + * Publisher name. + * + * @return the packageFamilyName value. + */ + String packageFamilyName(); + + /** + * Gets the displayName property: User friendly Name to be displayed in the portal. + * + * @return the displayName value. + */ + String displayName(); + + /** + * Gets the packageRelativePath property: Relative Path to the package inside the image. + * + * @return the packageRelativePath value. + */ + String packageRelativePath(); + + /** + * Gets the isRegularRegistration property: Specifies how to register Package in feed. + * + * @return the isRegularRegistration value. + */ + Boolean isRegularRegistration(); + + /** + * Gets the isActive property: Make this version of the package the active one across the hostpool. + * + * @return the isActive value. + */ + Boolean isActive(); + + /** + * Gets the packageDependencies property: List of package dependencies. + * + * @return the packageDependencies value. + */ + List packageDependencies(); + + /** + * Gets the version property: Package Version found in the appxmanifest.xml. + * + * @return the version value. + */ + String version(); + + /** + * Gets the lastUpdated property: Date Package was last updated, found in the appxmanifest.xml. + * + * @return the lastUpdated value. + */ + OffsetDateTime lastUpdated(); + + /** + * Gets the packageApplications property: List of package applications. + * + * @return the packageApplications value. + */ + List packageApplications(); + + /** + * Gets the inner com.azure.resourcemanager.desktopvirtualization.fluent.models.MsixPackageInner object. + * + * @return the inner object. + */ + MsixPackageInner innerModel(); + + /** The entirety of the MsixPackage definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The MsixPackage definition stages. */ + interface DefinitionStages { + /** The first stage of the MsixPackage definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the MsixPackage definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, hostPoolName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @return the next definition stage. + */ + WithCreate withExistingHostPool(String resourceGroupName, String hostPoolName); + } + /** + * The stage of the MsixPackage 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.WithImagePath, + DefinitionStages.WithPackageName, + DefinitionStages.WithPackageFamilyName, + DefinitionStages.WithDisplayName, + DefinitionStages.WithPackageRelativePath, + DefinitionStages.WithIsRegularRegistration, + DefinitionStages.WithIsActive, + DefinitionStages.WithPackageDependencies, + DefinitionStages.WithVersion, + DefinitionStages.WithLastUpdated, + DefinitionStages.WithPackageApplications { + /** + * Executes the create request. + * + * @return the created resource. + */ + MsixPackage create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + MsixPackage create(Context context); + } + /** The stage of the MsixPackage definition allowing to specify imagePath. */ + interface WithImagePath { + /** + * Specifies the imagePath property: VHD/CIM image path on Network Share.. + * + * @param imagePath VHD/CIM image path on Network Share. + * @return the next definition stage. + */ + WithCreate withImagePath(String imagePath); + } + /** The stage of the MsixPackage definition allowing to specify packageName. */ + interface WithPackageName { + /** + * Specifies the packageName property: Package Name from appxmanifest.xml. . + * + * @param packageName Package Name from appxmanifest.xml. + * @return the next definition stage. + */ + WithCreate withPackageName(String packageName); + } + /** The stage of the MsixPackage definition allowing to specify packageFamilyName. */ + interface WithPackageFamilyName { + /** + * Specifies the packageFamilyName property: Package Family Name from appxmanifest.xml. Contains Package + * Name and Publisher name. . + * + * @param packageFamilyName Package Family Name from appxmanifest.xml. Contains Package Name and Publisher + * name. + * @return the next definition stage. + */ + WithCreate withPackageFamilyName(String packageFamilyName); + } + /** The stage of the MsixPackage definition allowing to specify displayName. */ + interface WithDisplayName { + /** + * Specifies the displayName property: User friendly Name to be displayed in the portal. . + * + * @param displayName User friendly Name to be displayed in the portal. + * @return the next definition stage. + */ + WithCreate withDisplayName(String displayName); + } + /** The stage of the MsixPackage definition allowing to specify packageRelativePath. */ + interface WithPackageRelativePath { + /** + * Specifies the packageRelativePath property: Relative Path to the package inside the image. . + * + * @param packageRelativePath Relative Path to the package inside the image. + * @return the next definition stage. + */ + WithCreate withPackageRelativePath(String packageRelativePath); + } + /** The stage of the MsixPackage definition allowing to specify isRegularRegistration. */ + interface WithIsRegularRegistration { + /** + * Specifies the isRegularRegistration property: Specifies how to register Package in feed.. + * + * @param isRegularRegistration Specifies how to register Package in feed. + * @return the next definition stage. + */ + WithCreate withIsRegularRegistration(Boolean isRegularRegistration); + } + /** The stage of the MsixPackage definition allowing to specify isActive. */ + interface WithIsActive { + /** + * Specifies the isActive property: Make this version of the package the active one across the hostpool. . + * + * @param isActive Make this version of the package the active one across the hostpool. + * @return the next definition stage. + */ + WithCreate withIsActive(Boolean isActive); + } + /** The stage of the MsixPackage definition allowing to specify packageDependencies. */ + interface WithPackageDependencies { + /** + * Specifies the packageDependencies property: List of package dependencies. . + * + * @param packageDependencies List of package dependencies. + * @return the next definition stage. + */ + WithCreate withPackageDependencies(List packageDependencies); + } + /** The stage of the MsixPackage definition allowing to specify version. */ + interface WithVersion { + /** + * Specifies the version property: Package Version found in the appxmanifest.xml. . + * + * @param version Package Version found in the appxmanifest.xml. + * @return the next definition stage. + */ + WithCreate withVersion(String version); + } + /** The stage of the MsixPackage definition allowing to specify lastUpdated. */ + interface WithLastUpdated { + /** + * Specifies the lastUpdated property: Date Package was last updated, found in the appxmanifest.xml. . + * + * @param lastUpdated Date Package was last updated, found in the appxmanifest.xml. + * @return the next definition stage. + */ + WithCreate withLastUpdated(OffsetDateTime lastUpdated); + } + /** The stage of the MsixPackage definition allowing to specify packageApplications. */ + interface WithPackageApplications { + /** + * Specifies the packageApplications property: List of package applications. . + * + * @param packageApplications List of package applications. + * @return the next definition stage. + */ + WithCreate withPackageApplications(List packageApplications); + } + } + /** + * Begins update for the MsixPackage resource. + * + * @return the stage of resource update. + */ + MsixPackage.Update update(); + + /** The template for MsixPackage update. */ + interface Update + extends UpdateStages.WithIsActive, UpdateStages.WithIsRegularRegistration, UpdateStages.WithDisplayName { + /** + * Executes the update request. + * + * @return the updated resource. + */ + MsixPackage apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + MsixPackage apply(Context context); + } + /** The MsixPackage update stages. */ + interface UpdateStages { + /** The stage of the MsixPackage update allowing to specify isActive. */ + interface WithIsActive { + /** + * Specifies the isActive property: Set a version of the package to be active across hostpool. . + * + * @param isActive Set a version of the package to be active across hostpool. + * @return the next definition stage. + */ + Update withIsActive(Boolean isActive); + } + /** The stage of the MsixPackage update allowing to specify isRegularRegistration. */ + interface WithIsRegularRegistration { + /** + * Specifies the isRegularRegistration property: Set Registration mode. Regular or Delayed.. + * + * @param isRegularRegistration Set Registration mode. Regular or Delayed. + * @return the next definition stage. + */ + Update withIsRegularRegistration(Boolean isRegularRegistration); + } + /** The stage of the MsixPackage update allowing to specify displayName. */ + interface WithDisplayName { + /** + * Specifies the displayName property: Display name for MSIX Package.. + * + * @param displayName Display name for MSIX Package. + * @return the next definition stage. + */ + Update withDisplayName(String displayName); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + MsixPackage refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + MsixPackage refresh(Context context); +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/MsixPackageApplications.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/MsixPackageApplications.java new file mode 100644 index 0000000000000..6b3fcb29a8140 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/MsixPackageApplications.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.desktopvirtualization.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Schema for MSIX Package Application properties. */ +@Fluent +public final class MsixPackageApplications { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MsixPackageApplications.class); + + /* + * Package Application Id, found in appxmanifest.xml. + */ + @JsonProperty(value = "appId") + private String appId; + + /* + * Description of Package Application. + */ + @JsonProperty(value = "description") + private String description; + + /* + * Used to activate Package Application. Consists of Package Name and + * ApplicationID. Found in appxmanifest.xml. + */ + @JsonProperty(value = "appUserModelID") + private String appUserModelId; + + /* + * User friendly name. + */ + @JsonProperty(value = "friendlyName") + private String friendlyName; + + /* + * User friendly name. + */ + @JsonProperty(value = "iconImageName") + private String iconImageName; + + /* + * the icon a 64 bit string as a byte array. + */ + @JsonProperty(value = "rawIcon") + private byte[] rawIcon; + + /* + * the icon a 64 bit string as a byte array. + */ + @JsonProperty(value = "rawPng") + private byte[] rawPng; + + /** + * Get the appId property: Package Application Id, found in appxmanifest.xml. + * + * @return the appId value. + */ + public String appId() { + return this.appId; + } + + /** + * Set the appId property: Package Application Id, found in appxmanifest.xml. + * + * @param appId the appId value to set. + * @return the MsixPackageApplications object itself. + */ + public MsixPackageApplications withAppId(String appId) { + this.appId = appId; + return this; + } + + /** + * Get the description property: Description of Package Application. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Description of Package Application. + * + * @param description the description value to set. + * @return the MsixPackageApplications object itself. + */ + public MsixPackageApplications withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the appUserModelId property: Used to activate Package Application. Consists of Package Name and + * ApplicationID. Found in appxmanifest.xml. + * + * @return the appUserModelId value. + */ + public String appUserModelId() { + return this.appUserModelId; + } + + /** + * Set the appUserModelId property: Used to activate Package Application. Consists of Package Name and + * ApplicationID. Found in appxmanifest.xml. + * + * @param appUserModelId the appUserModelId value to set. + * @return the MsixPackageApplications object itself. + */ + public MsixPackageApplications withAppUserModelId(String appUserModelId) { + this.appUserModelId = appUserModelId; + return this; + } + + /** + * Get the friendlyName property: User friendly name. + * + * @return the friendlyName value. + */ + public String friendlyName() { + return this.friendlyName; + } + + /** + * Set the friendlyName property: User friendly name. + * + * @param friendlyName the friendlyName value to set. + * @return the MsixPackageApplications object itself. + */ + public MsixPackageApplications withFriendlyName(String friendlyName) { + this.friendlyName = friendlyName; + return this; + } + + /** + * Get the iconImageName property: User friendly name. + * + * @return the iconImageName value. + */ + public String iconImageName() { + return this.iconImageName; + } + + /** + * Set the iconImageName property: User friendly name. + * + * @param iconImageName the iconImageName value to set. + * @return the MsixPackageApplications object itself. + */ + public MsixPackageApplications withIconImageName(String iconImageName) { + this.iconImageName = iconImageName; + return this; + } + + /** + * Get the rawIcon property: the icon a 64 bit string as a byte array. + * + * @return the rawIcon value. + */ + public byte[] rawIcon() { + return CoreUtils.clone(this.rawIcon); + } + + /** + * Set the rawIcon property: the icon a 64 bit string as a byte array. + * + * @param rawIcon the rawIcon value to set. + * @return the MsixPackageApplications object itself. + */ + public MsixPackageApplications withRawIcon(byte[] rawIcon) { + this.rawIcon = CoreUtils.clone(rawIcon); + return this; + } + + /** + * Get the rawPng property: the icon a 64 bit string as a byte array. + * + * @return the rawPng value. + */ + public byte[] rawPng() { + return CoreUtils.clone(this.rawPng); + } + + /** + * Set the rawPng property: the icon a 64 bit string as a byte array. + * + * @param rawPng the rawPng value to set. + * @return the MsixPackageApplications object itself. + */ + public MsixPackageApplications withRawPng(byte[] rawPng) { + this.rawPng = CoreUtils.clone(rawPng); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/MsixPackageDependencies.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/MsixPackageDependencies.java new file mode 100644 index 0000000000000..9c756fd2b0069 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/MsixPackageDependencies.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.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; + +/** Schema for MSIX Package Dependencies properties. */ +@Fluent +public final class MsixPackageDependencies { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MsixPackageDependencies.class); + + /* + * Name of package dependency. + */ + @JsonProperty(value = "dependencyName") + private String dependencyName; + + /* + * Name of dependency publisher. + */ + @JsonProperty(value = "publisher") + private String publisher; + + /* + * Dependency version required. + */ + @JsonProperty(value = "minVersion") + private String minVersion; + + /** + * Get the dependencyName property: Name of package dependency. + * + * @return the dependencyName value. + */ + public String dependencyName() { + return this.dependencyName; + } + + /** + * Set the dependencyName property: Name of package dependency. + * + * @param dependencyName the dependencyName value to set. + * @return the MsixPackageDependencies object itself. + */ + public MsixPackageDependencies withDependencyName(String dependencyName) { + this.dependencyName = dependencyName; + return this; + } + + /** + * Get the publisher property: Name of dependency publisher. + * + * @return the publisher value. + */ + public String publisher() { + return this.publisher; + } + + /** + * Set the publisher property: Name of dependency publisher. + * + * @param publisher the publisher value to set. + * @return the MsixPackageDependencies object itself. + */ + public MsixPackageDependencies withPublisher(String publisher) { + this.publisher = publisher; + return this; + } + + /** + * Get the minVersion property: Dependency version required. + * + * @return the minVersion value. + */ + public String minVersion() { + return this.minVersion; + } + + /** + * Set the minVersion property: Dependency version required. + * + * @param minVersion the minVersion value to set. + * @return the MsixPackageDependencies object itself. + */ + public MsixPackageDependencies withMinVersion(String minVersion) { + this.minVersion = minVersion; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/MsixPackageList.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/MsixPackageList.java new file mode 100644 index 0000000000000..b360712518e89 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/MsixPackageList.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.desktopvirtualization.fluent.models.MsixPackageInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of MSIX Package definitions. */ +@Fluent +public final class MsixPackageList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MsixPackageList.class); + + /* + * List of MSIX Package definitions. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Link to the next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: List of MSIX Package definitions. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of MSIX Package definitions. + * + * @param value the value value to set. + * @return the MsixPackageList object itself. + */ + public MsixPackageList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Link to the next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/MsixPackagePatch.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/MsixPackagePatch.java new file mode 100644 index 0000000000000..32e01bfcebf12 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/MsixPackagePatch.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** MSIX Package properties that can be patched. */ +@JsonFlatten +@Fluent +public class MsixPackagePatch extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MsixPackagePatch.class); + + /* + * Set a version of the package to be active across hostpool. + */ + @JsonProperty(value = "properties.isActive") + private Boolean isActive; + + /* + * Set Registration mode. Regular or Delayed. + */ + @JsonProperty(value = "properties.isRegularRegistration") + private Boolean isRegularRegistration; + + /* + * Display name for MSIX Package. + */ + @JsonProperty(value = "properties.displayName") + private String displayName; + + /** + * Get the isActive property: Set a version of the package to be active across hostpool. + * + * @return the isActive value. + */ + public Boolean isActive() { + return this.isActive; + } + + /** + * Set the isActive property: Set a version of the package to be active across hostpool. + * + * @param isActive the isActive value to set. + * @return the MsixPackagePatch object itself. + */ + public MsixPackagePatch withIsActive(Boolean isActive) { + this.isActive = isActive; + return this; + } + + /** + * Get the isRegularRegistration property: Set Registration mode. Regular or Delayed. + * + * @return the isRegularRegistration value. + */ + public Boolean isRegularRegistration() { + return this.isRegularRegistration; + } + + /** + * Set the isRegularRegistration property: Set Registration mode. Regular or Delayed. + * + * @param isRegularRegistration the isRegularRegistration value to set. + * @return the MsixPackagePatch object itself. + */ + public MsixPackagePatch withIsRegularRegistration(Boolean isRegularRegistration) { + this.isRegularRegistration = isRegularRegistration; + return this; + } + + /** + * Get the displayName property: Display name for MSIX Package. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: Display name for MSIX Package. + * + * @param displayName the displayName value to set. + * @return the MsixPackagePatch object itself. + */ + public MsixPackagePatch withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/MsixPackages.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/MsixPackages.java new file mode 100644 index 0000000000000..0928f12752da2 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/MsixPackages.java @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.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 MsixPackages. */ +public interface MsixPackages { + /** + * Get a msixpackage. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param msixPackageFullName The version specific package full name of the MSIX package within specified hostpool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 msixpackage. + */ + MsixPackage get(String resourceGroupName, String hostPoolName, String msixPackageFullName); + + /** + * Get a msixpackage. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param msixPackageFullName The version specific package full name of the MSIX package within specified hostpool. + * @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 msixpackage. + */ + Response getWithResponse( + String resourceGroupName, String hostPoolName, String msixPackageFullName, Context context); + + /** + * Remove an MSIX Package. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param msixPackageFullName The version specific package full name of the MSIX package within specified hostpool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String hostPoolName, String msixPackageFullName); + + /** + * Remove an MSIX Package. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param msixPackageFullName The version specific package full name of the MSIX package within specified hostpool. + * @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. + */ + Response deleteWithResponse( + String resourceGroupName, String hostPoolName, String msixPackageFullName, Context context); + + /** + * List MSIX packages in hostpool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of MSIX Package definitions. + */ + PagedIterable list(String resourceGroupName, String hostPoolName); + + /** + * List MSIX packages in hostpool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of MSIX Package definitions. + */ + PagedIterable list(String resourceGroupName, String hostPoolName, Context context); + + /** + * Get a msixpackage. + * + * @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 msixpackage. + */ + MsixPackage getById(String id); + + /** + * Get a msixpackage. + * + * @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 msixpackage. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Remove an MSIX Package. + * + * @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); + + /** + * Remove an MSIX Package. + * + * @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. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new MsixPackage resource. + * + * @param name resource name. + * @return the first stage of the new MsixPackage definition. + */ + MsixPackage.DefinitionStages.Blank define(String name); +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/Operation.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/Operation.java new file mode 100644 index 0000000000000..46140049d0eb7 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/Operation.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for Operation. */ +public final class Operation extends ExpandableStringEnum { + /** Static value Start for Operation. */ + public static final Operation START = fromString("Start"); + + /** Static value Revoke for Operation. */ + public static final Operation REVOKE = fromString("Revoke"); + + /** Static value Complete for Operation. */ + public static final Operation COMPLETE = fromString("Complete"); + + /** Static value Hide for Operation. */ + public static final Operation HIDE = fromString("Hide"); + + /** Static value Unhide for Operation. */ + public static final Operation UNHIDE = fromString("Unhide"); + + /** + * Creates or finds a Operation from its string representation. + * + * @param name a name to look for. + * @return the corresponding Operation. + */ + @JsonCreator + public static Operation fromString(String name) { + return fromString(name, Operation.class); + } + + /** @return known Operation values. */ + public static Collection values() { + return values(Operation.class); + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/OperationProperties.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/OperationProperties.java new file mode 100644 index 0000000000000..6734d27465805 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/OperationProperties.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.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; + +/** Properties of the operation. */ +@Fluent +public final class OperationProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationProperties.class); + + /* + * Service specification payload + */ + @JsonProperty(value = "serviceSpecification") + private ServiceSpecification serviceSpecification; + + /** + * Get the serviceSpecification property: Service specification payload. + * + * @return the serviceSpecification value. + */ + public ServiceSpecification serviceSpecification() { + return this.serviceSpecification; + } + + /** + * Set the serviceSpecification property: Service specification payload. + * + * @param serviceSpecification the serviceSpecification value to set. + * @return the OperationProperties object itself. + */ + public OperationProperties withServiceSpecification(ServiceSpecification serviceSpecification) { + this.serviceSpecification = serviceSpecification; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (serviceSpecification() != null) { + serviceSpecification().validate(); + } + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/Operations.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/Operations.java new file mode 100644 index 0000000000000..8de37eabe3e1d --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/Operations.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Operations. */ +public interface Operations { + /** + * List all of the available operations the Desktop Virtualization resource provider supports. + * + * @throws com.azure.core.management.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 the request to list operations. + */ + ResourceProviderOperationList list(); + + /** + * List all of the available operations the Desktop Virtualization resource provider supports. + * + * @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 the request to list operations. + */ + Response listWithResponse(Context context); +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/PersonalDesktopAssignmentType.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/PersonalDesktopAssignmentType.java new file mode 100644 index 0000000000000..78ebdf8c23922 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/PersonalDesktopAssignmentType.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for PersonalDesktopAssignmentType. */ +public final class PersonalDesktopAssignmentType extends ExpandableStringEnum { + /** Static value Automatic for PersonalDesktopAssignmentType. */ + public static final PersonalDesktopAssignmentType AUTOMATIC = fromString("Automatic"); + + /** Static value Direct for PersonalDesktopAssignmentType. */ + public static final PersonalDesktopAssignmentType DIRECT = fromString("Direct"); + + /** + * Creates or finds a PersonalDesktopAssignmentType from its string representation. + * + * @param name a name to look for. + * @return the corresponding PersonalDesktopAssignmentType. + */ + @JsonCreator + public static PersonalDesktopAssignmentType fromString(String name) { + return fromString(name, PersonalDesktopAssignmentType.class); + } + + /** @return known PersonalDesktopAssignmentType values. */ + public static Collection values() { + return values(PersonalDesktopAssignmentType.class); + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/Plan.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/Plan.java new file mode 100644 index 0000000000000..7f57e964fc472 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/Plan.java @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.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; + +/** Plan for the resource. */ +@Fluent +public class Plan { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Plan.class); + + /* + * A user defined name of the 3rd Party Artifact that is being procured. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The publisher of the 3rd Party Artifact that is being bought. E.g. + * NewRelic + */ + @JsonProperty(value = "publisher", required = true) + private String publisher; + + /* + * The 3rd Party artifact that is being procured. E.g. NewRelic. Product + * maps to the OfferID specified for the artifact at the time of Data + * Market onboarding. + */ + @JsonProperty(value = "product", required = true) + private String product; + + /* + * A publisher provided promotion code as provisioned in Data Market for + * the said product/artifact. + */ + @JsonProperty(value = "promotionCode") + private String promotionCode; + + /* + * The version of the desired product/artifact. + */ + @JsonProperty(value = "version") + private String version; + + /** + * Get the name property: A user defined name of the 3rd Party Artifact that is being procured. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: A user defined name of the 3rd Party Artifact that is being procured. + * + * @param name the name value to set. + * @return the Plan object itself. + */ + public Plan withName(String name) { + this.name = name; + return this; + } + + /** + * Get the publisher property: The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic. + * + * @return the publisher value. + */ + public String publisher() { + return this.publisher; + } + + /** + * Set the publisher property: The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic. + * + * @param publisher the publisher value to set. + * @return the Plan object itself. + */ + public Plan withPublisher(String publisher) { + this.publisher = publisher; + return this; + } + + /** + * Get the product property: The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to the + * OfferID specified for the artifact at the time of Data Market onboarding. + * + * @return the product value. + */ + public String product() { + return this.product; + } + + /** + * Set the product property: The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to the + * OfferID specified for the artifact at the time of Data Market onboarding. + * + * @param product the product value to set. + * @return the Plan object itself. + */ + public Plan withProduct(String product) { + this.product = product; + return this; + } + + /** + * Get the promotionCode property: A publisher provided promotion code as provisioned in Data Market for the said + * product/artifact. + * + * @return the promotionCode value. + */ + public String promotionCode() { + return this.promotionCode; + } + + /** + * Set the promotionCode property: A publisher provided promotion code as provisioned in Data Market for the said + * product/artifact. + * + * @param promotionCode the promotionCode value to set. + * @return the Plan object itself. + */ + public Plan withPromotionCode(String promotionCode) { + this.promotionCode = promotionCode; + return this; + } + + /** + * Get the version property: The version of the desired product/artifact. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: The version of the desired product/artifact. + * + * @param version the version value to set. + * @return the Plan object itself. + */ + public Plan withVersion(String version) { + this.version = version; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw logger + .logExceptionAsError(new IllegalArgumentException("Missing required property name in model Plan")); + } + if (publisher() == null) { + throw logger + .logExceptionAsError(new IllegalArgumentException("Missing required property publisher in model Plan")); + } + if (product() == null) { + throw logger + .logExceptionAsError(new IllegalArgumentException("Missing required property product in model Plan")); + } + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/PreferredAppGroupType.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/PreferredAppGroupType.java new file mode 100644 index 0000000000000..ee2ac2292dd6b --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/PreferredAppGroupType.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.desktopvirtualization.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for PreferredAppGroupType. */ +public final class PreferredAppGroupType extends ExpandableStringEnum { + /** Static value None for PreferredAppGroupType. */ + public static final PreferredAppGroupType NONE = fromString("None"); + + /** Static value Desktop for PreferredAppGroupType. */ + public static final PreferredAppGroupType DESKTOP = fromString("Desktop"); + + /** Static value RailApplications for PreferredAppGroupType. */ + public static final PreferredAppGroupType RAIL_APPLICATIONS = fromString("RailApplications"); + + /** + * Creates or finds a PreferredAppGroupType from its string representation. + * + * @param name a name to look for. + * @return the corresponding PreferredAppGroupType. + */ + @JsonCreator + public static PreferredAppGroupType fromString(String name) { + return fromString(name, PreferredAppGroupType.class); + } + + /** @return known PreferredAppGroupType values. */ + public static Collection values() { + return values(PreferredAppGroupType.class); + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/RegistrationInfo.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/RegistrationInfo.java new file mode 100644 index 0000000000000..7293faf50f09d --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/RegistrationInfo.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.models; + +import com.azure.resourcemanager.desktopvirtualization.fluent.models.RegistrationInfoInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of RegistrationInfo. */ +public interface RegistrationInfo { + /** + * Gets the expirationTime property: Expiration time of registration token. + * + * @return the expirationTime value. + */ + OffsetDateTime expirationTime(); + + /** + * Gets the token property: The registration token base64 encoded string. + * + * @return the token value. + */ + String token(); + + /** + * Gets the registrationTokenOperation property: The type of resetting the token. + * + * @return the registrationTokenOperation value. + */ + RegistrationTokenOperation registrationTokenOperation(); + + /** + * Gets the inner com.azure.resourcemanager.desktopvirtualization.fluent.models.RegistrationInfoInner object. + * + * @return the inner object. + */ + RegistrationInfoInner innerModel(); +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/RegistrationInfoPatch.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/RegistrationInfoPatch.java new file mode 100644 index 0000000000000..962a207f742d9 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/RegistrationInfoPatch.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Represents a RegistrationInfo definition. */ +@Fluent +public final class RegistrationInfoPatch { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RegistrationInfoPatch.class); + + /* + * Expiration time of registration token. + */ + @JsonProperty(value = "expirationTime") + private OffsetDateTime expirationTime; + + /* + * The type of resetting the token. + */ + @JsonProperty(value = "registrationTokenOperation") + private RegistrationTokenOperation registrationTokenOperation; + + /** + * Get the expirationTime property: Expiration time of registration token. + * + * @return the expirationTime value. + */ + public OffsetDateTime expirationTime() { + return this.expirationTime; + } + + /** + * Set the expirationTime property: Expiration time of registration token. + * + * @param expirationTime the expirationTime value to set. + * @return the RegistrationInfoPatch object itself. + */ + public RegistrationInfoPatch withExpirationTime(OffsetDateTime expirationTime) { + this.expirationTime = expirationTime; + return this; + } + + /** + * Get the registrationTokenOperation property: The type of resetting the token. + * + * @return the registrationTokenOperation value. + */ + public RegistrationTokenOperation registrationTokenOperation() { + return this.registrationTokenOperation; + } + + /** + * Set the registrationTokenOperation property: The type of resetting the token. + * + * @param registrationTokenOperation the registrationTokenOperation value to set. + * @return the RegistrationInfoPatch object itself. + */ + public RegistrationInfoPatch withRegistrationTokenOperation(RegistrationTokenOperation registrationTokenOperation) { + this.registrationTokenOperation = registrationTokenOperation; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/RegistrationTokenOperation.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/RegistrationTokenOperation.java new file mode 100644 index 0000000000000..076ee23b115b9 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/RegistrationTokenOperation.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.desktopvirtualization.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for RegistrationTokenOperation. */ +public final class RegistrationTokenOperation extends ExpandableStringEnum { + /** Static value Delete for RegistrationTokenOperation. */ + public static final RegistrationTokenOperation DELETE = fromString("Delete"); + + /** Static value None for RegistrationTokenOperation. */ + public static final RegistrationTokenOperation NONE = fromString("None"); + + /** Static value Update for RegistrationTokenOperation. */ + public static final RegistrationTokenOperation UPDATE = fromString("Update"); + + /** + * Creates or finds a RegistrationTokenOperation from its string representation. + * + * @param name a name to look for. + * @return the corresponding RegistrationTokenOperation. + */ + @JsonCreator + public static RegistrationTokenOperation fromString(String name) { + return fromString(name, RegistrationTokenOperation.class); + } + + /** @return known RegistrationTokenOperation values. */ + public static Collection values() { + return values(RegistrationTokenOperation.class); + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/RemoteApplicationType.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/RemoteApplicationType.java new file mode 100644 index 0000000000000..e119e62c7caf3 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/RemoteApplicationType.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for RemoteApplicationType. */ +public final class RemoteApplicationType extends ExpandableStringEnum { + /** Static value InBuilt for RemoteApplicationType. */ + public static final RemoteApplicationType IN_BUILT = fromString("InBuilt"); + + /** Static value MsixApplication for RemoteApplicationType. */ + public static final RemoteApplicationType MSIX_APPLICATION = fromString("MsixApplication"); + + /** + * Creates or finds a RemoteApplicationType from its string representation. + * + * @param name a name to look for. + * @return the corresponding RemoteApplicationType. + */ + @JsonCreator + public static RemoteApplicationType fromString(String name) { + return fromString(name, RemoteApplicationType.class); + } + + /** @return known RemoteApplicationType values. */ + public static Collection values() { + return values(RemoteApplicationType.class); + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ResourceIdentityType.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ResourceIdentityType.java new file mode 100644 index 0000000000000..e68e5471002a8 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ResourceIdentityType.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for ResourceIdentityType. */ +public enum ResourceIdentityType { + /** Enum value SystemAssigned. */ + SYSTEM_ASSIGNED("SystemAssigned"); + + /** The actual serialized value for a ResourceIdentityType instance. */ + private final String value; + + ResourceIdentityType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ResourceIdentityType instance. + * + * @param value the serialized value to parse. + * @return the parsed ResourceIdentityType object, or null if unable to parse. + */ + @JsonCreator + public static ResourceIdentityType fromString(String value) { + ResourceIdentityType[] items = ResourceIdentityType.values(); + for (ResourceIdentityType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ResourceModelWithAllowedPropertySet.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ResourceModelWithAllowedPropertySet.java new file mode 100644 index 0000000000000..8b5a84c7dd2c9 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ResourceModelWithAllowedPropertySet.java @@ -0,0 +1,220 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** + * The resource model definition containing the full set of allowed properties for a resource. Except properties bag, + * there cannot be a top level property outside of this set. + */ +@Fluent +public class ResourceModelWithAllowedPropertySet extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceModelWithAllowedPropertySet.class); + + /* + * The fully qualified resource ID of the resource that manages this + * resource. Indicates if this resource is managed by another Azure + * resource. If this is present, complete mode deployment will not delete + * the resource if it is removed from the template since it is managed by + * another resource. + */ + @JsonProperty(value = "managedBy") + private String managedBy; + + /* + * Metadata used by portal/tooling/etc to render different UX experiences + * for resources of the same type; e.g. ApiApps are a kind of + * Microsoft.Web/sites type. If supported, the resource provider must + * validate and persist this value. + */ + @JsonProperty(value = "kind") + private String kind; + + /* + * The etag field is *not* required. If it is provided in the response + * body, it must also be provided as a header per the normal etag + * convention. Entity tags are used for comparing two or more entities + * from the same requested resource. HTTP/1.1 uses entity tags in the etag + * (section 14.19), If-Match (section 14.24), If-None-Match (section + * 14.26), and If-Range (section 14.27) header fields. + */ + @JsonProperty(value = "etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /* + * Identity for the resource. + */ + @JsonProperty(value = "identity") + private Identity identity; + + /* + * The resource model definition representing SKU + */ + @JsonProperty(value = "sku") + private Sku sku; + + /* + * Plan for the resource. + */ + @JsonProperty(value = "plan") + private Plan plan; + + /** + * Get the managedBy property: The fully qualified resource ID of the resource that manages this resource. Indicates + * if this resource is managed by another Azure resource. If this is present, complete mode deployment will not + * delete the resource if it is removed from the template since it is managed by another resource. + * + * @return the managedBy value. + */ + public String managedBy() { + return this.managedBy; + } + + /** + * Set the managedBy property: The fully qualified resource ID of the resource that manages this resource. Indicates + * if this resource is managed by another Azure resource. If this is present, complete mode deployment will not + * delete the resource if it is removed from the template since it is managed by another resource. + * + * @param managedBy the managedBy value to set. + * @return the ResourceModelWithAllowedPropertySet object itself. + */ + public ResourceModelWithAllowedPropertySet withManagedBy(String managedBy) { + this.managedBy = managedBy; + return this; + } + + /** + * Get the kind property: Metadata used by portal/tooling/etc to render different UX experiences for resources of + * the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must + * validate and persist this value. + * + * @return the kind value. + */ + public String kind() { + return this.kind; + } + + /** + * Set the kind property: Metadata used by portal/tooling/etc to render different UX experiences for resources of + * the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must + * validate and persist this value. + * + * @param kind the kind value to set. + * @return the ResourceModelWithAllowedPropertySet object itself. + */ + public ResourceModelWithAllowedPropertySet withKind(String kind) { + this.kind = kind; + return this; + } + + /** + * Get the etag property: The etag field is *not* required. If it is provided in the response body, it must also be + * provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from + * the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), + * If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Get the identity property: Identity for the resource. + * + * @return the identity value. + */ + public Identity identity() { + return this.identity; + } + + /** + * Set the identity property: Identity for the resource. + * + * @param identity the identity value to set. + * @return the ResourceModelWithAllowedPropertySet object itself. + */ + public ResourceModelWithAllowedPropertySet withIdentity(Identity identity) { + this.identity = identity; + return this; + } + + /** + * Get the sku property: The resource model definition representing SKU. + * + * @return the sku value. + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku property: The resource model definition representing SKU. + * + * @param sku the sku value to set. + * @return the ResourceModelWithAllowedPropertySet object itself. + */ + public ResourceModelWithAllowedPropertySet withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get the plan property: Plan for the resource. + * + * @return the plan value. + */ + public Plan plan() { + return this.plan; + } + + /** + * Set the plan property: Plan for the resource. + * + * @param plan the plan value to set. + * @return the ResourceModelWithAllowedPropertySet object itself. + */ + public ResourceModelWithAllowedPropertySet withPlan(Plan plan) { + this.plan = plan; + return this; + } + + /** {@inheritDoc} */ + @Override + public ResourceModelWithAllowedPropertySet withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public ResourceModelWithAllowedPropertySet withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (identity() != null) { + identity().validate(); + } + if (sku() != null) { + sku().validate(); + } + if (plan() != null) { + plan().validate(); + } + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ResourceModelWithAllowedPropertySetIdentity.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ResourceModelWithAllowedPropertySetIdentity.java new file mode 100644 index 0000000000000..67bab170d397a --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ResourceModelWithAllowedPropertySetIdentity.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** The ResourceModelWithAllowedPropertySetIdentity model. */ +@Immutable +public class ResourceModelWithAllowedPropertySetIdentity extends Identity { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceModelWithAllowedPropertySetIdentity.class); + + /** {@inheritDoc} */ + @Override + public ResourceModelWithAllowedPropertySetIdentity withType(ResourceIdentityType type) { + super.withType(type); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ResourceModelWithAllowedPropertySetPlan.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ResourceModelWithAllowedPropertySetPlan.java new file mode 100644 index 0000000000000..e4e4123b6435b --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ResourceModelWithAllowedPropertySetPlan.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.desktopvirtualization.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** The ResourceModelWithAllowedPropertySetPlan model. */ +@Immutable +public final class ResourceModelWithAllowedPropertySetPlan extends Plan { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceModelWithAllowedPropertySetPlan.class); + + /** {@inheritDoc} */ + @Override + public ResourceModelWithAllowedPropertySetPlan withName(String name) { + super.withName(name); + return this; + } + + /** {@inheritDoc} */ + @Override + public ResourceModelWithAllowedPropertySetPlan withPublisher(String publisher) { + super.withPublisher(publisher); + return this; + } + + /** {@inheritDoc} */ + @Override + public ResourceModelWithAllowedPropertySetPlan withProduct(String product) { + super.withProduct(product); + return this; + } + + /** {@inheritDoc} */ + @Override + public ResourceModelWithAllowedPropertySetPlan withPromotionCode(String promotionCode) { + super.withPromotionCode(promotionCode); + return this; + } + + /** {@inheritDoc} */ + @Override + public ResourceModelWithAllowedPropertySetPlan withVersion(String version) { + super.withVersion(version); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ResourceModelWithAllowedPropertySetSku.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ResourceModelWithAllowedPropertySetSku.java new file mode 100644 index 0000000000000..c652726a7cfa0 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ResourceModelWithAllowedPropertySetSku.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.desktopvirtualization.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** The ResourceModelWithAllowedPropertySetSku model. */ +@Immutable +public final class ResourceModelWithAllowedPropertySetSku extends Sku { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceModelWithAllowedPropertySetSku.class); + + /** {@inheritDoc} */ + @Override + public ResourceModelWithAllowedPropertySetSku withName(String name) { + super.withName(name); + return this; + } + + /** {@inheritDoc} */ + @Override + public ResourceModelWithAllowedPropertySetSku withTier(SkuTier tier) { + super.withTier(tier); + return this; + } + + /** {@inheritDoc} */ + @Override + public ResourceModelWithAllowedPropertySetSku withSize(String size) { + super.withSize(size); + return this; + } + + /** {@inheritDoc} */ + @Override + public ResourceModelWithAllowedPropertySetSku withFamily(String family) { + super.withFamily(family); + return this; + } + + /** {@inheritDoc} */ + @Override + public ResourceModelWithAllowedPropertySetSku withCapacity(Integer capacity) { + super.withCapacity(capacity); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ResourceProviderOperation.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ResourceProviderOperation.java new file mode 100644 index 0000000000000..1c5a05cc4dde6 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ResourceProviderOperation.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.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; + +/** Supported operation of this resource provider. */ +@Fluent +public final class ResourceProviderOperation { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceProviderOperation.class); + + /* + * Operation name, in format of {provider}/{resource}/{operation} + */ + @JsonProperty(value = "name") + private String name; + + /* + * Display metadata associated with the operation. + */ + @JsonProperty(value = "display") + private ResourceProviderOperationDisplay display; + + /* + * Is a data action. + */ + @JsonProperty(value = "isDataAction") + private Boolean isDataAction; + + /* + * Properties of the operation + */ + @JsonProperty(value = "properties") + private OperationProperties properties; + + /** + * Get the name property: Operation name, in format of {provider}/{resource}/{operation}. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Operation name, in format of {provider}/{resource}/{operation}. + * + * @param name the name value to set. + * @return the ResourceProviderOperation object itself. + */ + public ResourceProviderOperation withName(String name) { + this.name = name; + return this; + } + + /** + * Get the display property: Display metadata associated with the operation. + * + * @return the display value. + */ + public ResourceProviderOperationDisplay display() { + return this.display; + } + + /** + * Set the display property: Display metadata associated with the operation. + * + * @param display the display value to set. + * @return the ResourceProviderOperation object itself. + */ + public ResourceProviderOperation withDisplay(ResourceProviderOperationDisplay display) { + this.display = display; + return this; + } + + /** + * Get the isDataAction property: Is a data action. + * + * @return the isDataAction value. + */ + public Boolean isDataAction() { + return this.isDataAction; + } + + /** + * Set the isDataAction property: Is a data action. + * + * @param isDataAction the isDataAction value to set. + * @return the ResourceProviderOperation object itself. + */ + public ResourceProviderOperation withIsDataAction(Boolean isDataAction) { + this.isDataAction = isDataAction; + return this; + } + + /** + * Get the properties property: Properties of the operation. + * + * @return the properties value. + */ + public OperationProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Properties of the operation. + * + * @param properties the properties value to set. + * @return the ResourceProviderOperation object itself. + */ + public ResourceProviderOperation withProperties(OperationProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ResourceProviderOperationDisplay.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ResourceProviderOperationDisplay.java new file mode 100644 index 0000000000000..dc420f9eae419 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ResourceProviderOperationDisplay.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.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; + +/** Display metadata associated with the operation. */ +@Fluent +public final class ResourceProviderOperationDisplay { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceProviderOperationDisplay.class); + + /* + * Resource provider: Microsoft Desktop Virtualization. + */ + @JsonProperty(value = "provider") + private String provider; + + /* + * Resource on which the operation is performed. + */ + @JsonProperty(value = "resource") + private String resource; + + /* + * Type of operation: get, read, delete, etc. + */ + @JsonProperty(value = "operation") + private String operation; + + /* + * Description of this operation. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get the provider property: Resource provider: Microsoft Desktop Virtualization. + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Set the provider property: Resource provider: Microsoft Desktop Virtualization. + * + * @param provider the provider value to set. + * @return the ResourceProviderOperationDisplay object itself. + */ + public ResourceProviderOperationDisplay withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get the resource property: Resource on which the operation is performed. + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Set the resource property: Resource on which the operation is performed. + * + * @param resource the resource value to set. + * @return the ResourceProviderOperationDisplay object itself. + */ + public ResourceProviderOperationDisplay withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get the operation property: Type of operation: get, read, delete, etc. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Set the operation property: Type of operation: get, read, delete, etc. + * + * @param operation the operation value to set. + * @return the ResourceProviderOperationDisplay object itself. + */ + public ResourceProviderOperationDisplay withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get the description property: Description of this operation. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Description of this operation. + * + * @param description the description value to set. + * @return the ResourceProviderOperationDisplay object itself. + */ + public ResourceProviderOperationDisplay withDescription(String description) { + this.description = description; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ResourceProviderOperationList.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ResourceProviderOperationList.java new file mode 100644 index 0000000000000..4081f6ba4dfe6 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ResourceProviderOperationList.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.models; + +import com.azure.resourcemanager.desktopvirtualization.fluent.models.ResourceProviderOperationListInner; +import java.util.List; + +/** An immutable client-side representation of ResourceProviderOperationList. */ +public interface ResourceProviderOperationList { + /** + * Gets the value property: List of operations supported by this resource provider. + * + * @return the value value. + */ + List value(); + + /** + * Gets the inner com.azure.resourcemanager.desktopvirtualization.fluent.models.ResourceProviderOperationListInner + * object. + * + * @return the inner object. + */ + ResourceProviderOperationListInner innerModel(); +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ScalingHostPoolReference.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ScalingHostPoolReference.java new file mode 100644 index 0000000000000..2f1c8af24a5dd --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ScalingHostPoolReference.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.desktopvirtualization.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; + +/** Scaling plan reference to hostpool. */ +@Fluent +public final class ScalingHostPoolReference { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ScalingHostPoolReference.class); + + /* + * Arm path of referenced hostpool. + */ + @JsonProperty(value = "hostPoolArmPath") + private String hostPoolArmPath; + + /* + * Is the scaling plan enabled for this hostpool. + */ + @JsonProperty(value = "scalingPlanEnabled") + private Boolean scalingPlanEnabled; + + /** + * Get the hostPoolArmPath property: Arm path of referenced hostpool. + * + * @return the hostPoolArmPath value. + */ + public String hostPoolArmPath() { + return this.hostPoolArmPath; + } + + /** + * Set the hostPoolArmPath property: Arm path of referenced hostpool. + * + * @param hostPoolArmPath the hostPoolArmPath value to set. + * @return the ScalingHostPoolReference object itself. + */ + public ScalingHostPoolReference withHostPoolArmPath(String hostPoolArmPath) { + this.hostPoolArmPath = hostPoolArmPath; + return this; + } + + /** + * Get the scalingPlanEnabled property: Is the scaling plan enabled for this hostpool. + * + * @return the scalingPlanEnabled value. + */ + public Boolean scalingPlanEnabled() { + return this.scalingPlanEnabled; + } + + /** + * Set the scalingPlanEnabled property: Is the scaling plan enabled for this hostpool. + * + * @param scalingPlanEnabled the scalingPlanEnabled value to set. + * @return the ScalingHostPoolReference object itself. + */ + public ScalingHostPoolReference withScalingPlanEnabled(Boolean scalingPlanEnabled) { + this.scalingPlanEnabled = scalingPlanEnabled; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ScalingPlan.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ScalingPlan.java new file mode 100644 index 0000000000000..1cd05d4b03073 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ScalingPlan.java @@ -0,0 +1,547 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.desktopvirtualization.fluent.models.ScalingPlanInner; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of ScalingPlan. */ +public interface ScalingPlan { + /** + * 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 managedBy property: The fully qualified resource ID of the resource that manages this resource. + * Indicates if this resource is managed by another Azure resource. If this is present, complete mode deployment + * will not delete the resource if it is removed from the template since it is managed by another resource. + * + * @return the managedBy value. + */ + String managedBy(); + + /** + * Gets the kind property: Metadata used by portal/tooling/etc to render different UX experiences for resources of + * the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must + * validate and persist this value. + * + * @return the kind value. + */ + String kind(); + + /** + * Gets the etag property: The etag field is *not* required. If it is provided in the response body, it must also be + * provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from + * the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), + * If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the identity property: Identity for the resource. + * + * @return the identity value. + */ + Identity identity(); + + /** + * Gets the sku property: The resource model definition representing SKU. + * + * @return the sku value. + */ + Sku sku(); + + /** + * Gets the plan property: Plan for the resource. + * + * @return the plan value. + */ + Plan plan(); + + /** + * Gets the objectId property: ObjectId of scaling plan. (internal use). + * + * @return the objectId value. + */ + String objectId(); + + /** + * Gets the ring property: The ring number of scaling plan. + * + * @return the ring value. + */ + Integer ring(); + + /** + * Gets the description property: Description of scaling plan. + * + * @return the description value. + */ + String description(); + + /** + * Gets the friendlyName property: User friendly name of scaling plan. + * + * @return the friendlyName value. + */ + String friendlyName(); + + /** + * Gets the timeZone property: Timezone of the scaling plan. + * + * @return the timeZone value. + */ + String timeZone(); + + /** + * Gets the hostPoolType property: HostPool type for desktop. + * + * @return the hostPoolType value. + */ + HostPoolType hostPoolType(); + + /** + * Gets the exclusionTag property: Exclusion tag for scaling plan. + * + * @return the exclusionTag value. + */ + String exclusionTag(); + + /** + * Gets the schedules property: List of ScalingSchedule definitions. + * + * @return the schedules value. + */ + List schedules(); + + /** + * Gets the hostPoolReferences property: List of ScalingHostPoolReference definitions. + * + * @return the hostPoolReferences value. + */ + List hostPoolReferences(); + + /** + * 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.desktopvirtualization.fluent.models.ScalingPlanInner object. + * + * @return the inner object. + */ + ScalingPlanInner innerModel(); + + /** The entirety of the ScalingPlan definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The ScalingPlan definition stages. */ + interface DefinitionStages { + /** The first stage of the ScalingPlan definition. */ + interface Blank extends WithLocation { + } + /** The stage of the ScalingPlan 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 ScalingPlan definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the ScalingPlan 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.WithManagedBy, + DefinitionStages.WithKind, + DefinitionStages.WithIdentity, + DefinitionStages.WithSku, + DefinitionStages.WithPlan, + DefinitionStages.WithRing, + DefinitionStages.WithDescription, + DefinitionStages.WithFriendlyName, + DefinitionStages.WithTimeZone, + DefinitionStages.WithHostPoolType, + DefinitionStages.WithExclusionTag, + DefinitionStages.WithSchedules, + DefinitionStages.WithHostPoolReferences { + /** + * Executes the create request. + * + * @return the created resource. + */ + ScalingPlan create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ScalingPlan create(Context context); + } + /** The stage of the ScalingPlan 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 ScalingPlan definition allowing to specify managedBy. */ + interface WithManagedBy { + /** + * Specifies the managedBy property: The fully qualified resource ID of the resource that manages this + * resource. Indicates if this resource is managed by another Azure resource. If this is present, complete + * mode deployment will not delete the resource if it is removed from the template since it is managed by + * another resource.. + * + * @param managedBy The fully qualified resource ID of the resource that manages this resource. Indicates if + * this resource is managed by another Azure resource. If this is present, complete mode deployment will + * not delete the resource if it is removed from the template since it is managed by another resource. + * @return the next definition stage. + */ + WithCreate withManagedBy(String managedBy); + } + /** The stage of the ScalingPlan definition allowing to specify kind. */ + interface WithKind { + /** + * Specifies the kind property: Metadata used by portal/tooling/etc to render different UX experiences for + * resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the + * resource provider must validate and persist this value.. + * + * @param kind Metadata used by portal/tooling/etc to render different UX experiences for resources of the + * same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider + * must validate and persist this value. + * @return the next definition stage. + */ + WithCreate withKind(String kind); + } + /** The stage of the ScalingPlan definition allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: Identity for the resource.. + * + * @param identity Identity for the resource. + * @return the next definition stage. + */ + WithCreate withIdentity(Identity identity); + } + /** The stage of the ScalingPlan definition allowing to specify sku. */ + interface WithSku { + /** + * Specifies the sku property: The resource model definition representing SKU. + * + * @param sku The resource model definition representing SKU. + * @return the next definition stage. + */ + WithCreate withSku(Sku sku); + } + /** The stage of the ScalingPlan definition allowing to specify plan. */ + interface WithPlan { + /** + * Specifies the plan property: Plan for the resource.. + * + * @param plan Plan for the resource. + * @return the next definition stage. + */ + WithCreate withPlan(Plan plan); + } + /** The stage of the ScalingPlan definition allowing to specify ring. */ + interface WithRing { + /** + * Specifies the ring property: The ring number of scaling plan.. + * + * @param ring The ring number of scaling plan. + * @return the next definition stage. + */ + WithCreate withRing(Integer ring); + } + /** The stage of the ScalingPlan definition allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: Description of scaling plan.. + * + * @param description Description of scaling plan. + * @return the next definition stage. + */ + WithCreate withDescription(String description); + } + /** The stage of the ScalingPlan definition allowing to specify friendlyName. */ + interface WithFriendlyName { + /** + * Specifies the friendlyName property: User friendly name of scaling plan.. + * + * @param friendlyName User friendly name of scaling plan. + * @return the next definition stage. + */ + WithCreate withFriendlyName(String friendlyName); + } + /** The stage of the ScalingPlan definition allowing to specify timeZone. */ + interface WithTimeZone { + /** + * Specifies the timeZone property: Timezone of the scaling plan.. + * + * @param timeZone Timezone of the scaling plan. + * @return the next definition stage. + */ + WithCreate withTimeZone(String timeZone); + } + /** The stage of the ScalingPlan definition allowing to specify hostPoolType. */ + interface WithHostPoolType { + /** + * Specifies the hostPoolType property: HostPool type for desktop.. + * + * @param hostPoolType HostPool type for desktop. + * @return the next definition stage. + */ + WithCreate withHostPoolType(HostPoolType hostPoolType); + } + /** The stage of the ScalingPlan definition allowing to specify exclusionTag. */ + interface WithExclusionTag { + /** + * Specifies the exclusionTag property: Exclusion tag for scaling plan.. + * + * @param exclusionTag Exclusion tag for scaling plan. + * @return the next definition stage. + */ + WithCreate withExclusionTag(String exclusionTag); + } + /** The stage of the ScalingPlan definition allowing to specify schedules. */ + interface WithSchedules { + /** + * Specifies the schedules property: List of ScalingSchedule definitions.. + * + * @param schedules List of ScalingSchedule definitions. + * @return the next definition stage. + */ + WithCreate withSchedules(List schedules); + } + /** The stage of the ScalingPlan definition allowing to specify hostPoolReferences. */ + interface WithHostPoolReferences { + /** + * Specifies the hostPoolReferences property: List of ScalingHostPoolReference definitions.. + * + * @param hostPoolReferences List of ScalingHostPoolReference definitions. + * @return the next definition stage. + */ + WithCreate withHostPoolReferences(List hostPoolReferences); + } + } + /** + * Begins update for the ScalingPlan resource. + * + * @return the stage of resource update. + */ + ScalingPlan.Update update(); + + /** The template for ScalingPlan update. */ + interface Update + extends UpdateStages.WithTags, + UpdateStages.WithRing, + UpdateStages.WithDescription, + UpdateStages.WithFriendlyName, + UpdateStages.WithTimeZone, + UpdateStages.WithHostPoolType, + UpdateStages.WithExclusionTag, + UpdateStages.WithSchedules, + UpdateStages.WithHostPoolReferences { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ScalingPlan apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ScalingPlan apply(Context context); + } + /** The ScalingPlan update stages. */ + interface UpdateStages { + /** The stage of the ScalingPlan update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: tags to be updated. + * + * @param tags tags to be updated. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the ScalingPlan update allowing to specify ring. */ + interface WithRing { + /** + * Specifies the ring property: The ring number of scaling plan.. + * + * @param ring The ring number of scaling plan. + * @return the next definition stage. + */ + Update withRing(Integer ring); + } + /** The stage of the ScalingPlan update allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: Description of scaling plan.. + * + * @param description Description of scaling plan. + * @return the next definition stage. + */ + Update withDescription(String description); + } + /** The stage of the ScalingPlan update allowing to specify friendlyName. */ + interface WithFriendlyName { + /** + * Specifies the friendlyName property: User friendly name of scaling plan.. + * + * @param friendlyName User friendly name of scaling plan. + * @return the next definition stage. + */ + Update withFriendlyName(String friendlyName); + } + /** The stage of the ScalingPlan update allowing to specify timeZone. */ + interface WithTimeZone { + /** + * Specifies the timeZone property: Timezone of the scaling plan.. + * + * @param timeZone Timezone of the scaling plan. + * @return the next definition stage. + */ + Update withTimeZone(String timeZone); + } + /** The stage of the ScalingPlan update allowing to specify hostPoolType. */ + interface WithHostPoolType { + /** + * Specifies the hostPoolType property: HostPool type for desktop.. + * + * @param hostPoolType HostPool type for desktop. + * @return the next definition stage. + */ + Update withHostPoolType(HostPoolType hostPoolType); + } + /** The stage of the ScalingPlan update allowing to specify exclusionTag. */ + interface WithExclusionTag { + /** + * Specifies the exclusionTag property: Exclusion tag for scaling plan.. + * + * @param exclusionTag Exclusion tag for scaling plan. + * @return the next definition stage. + */ + Update withExclusionTag(String exclusionTag); + } + /** The stage of the ScalingPlan update allowing to specify schedules. */ + interface WithSchedules { + /** + * Specifies the schedules property: List of ScalingSchedule definitions.. + * + * @param schedules List of ScalingSchedule definitions. + * @return the next definition stage. + */ + Update withSchedules(List schedules); + } + /** The stage of the ScalingPlan update allowing to specify hostPoolReferences. */ + interface WithHostPoolReferences { + /** + * Specifies the hostPoolReferences property: List of ScalingHostPoolReference definitions.. + * + * @param hostPoolReferences List of ScalingHostPoolReference definitions. + * @return the next definition stage. + */ + Update withHostPoolReferences(List hostPoolReferences); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ScalingPlan refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ScalingPlan refresh(Context context); +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ScalingPlanList.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ScalingPlanList.java new file mode 100644 index 0000000000000..72f2c1a5f19a2 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ScalingPlanList.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.desktopvirtualization.fluent.models.ScalingPlanInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of scaling plan definitions. */ +@Fluent +public final class ScalingPlanList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ScalingPlanList.class); + + /* + * List of scaling plan definitions. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Link to the next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: List of scaling plan definitions. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of scaling plan definitions. + * + * @param value the value value to set. + * @return the ScalingPlanList object itself. + */ + public ScalingPlanList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Link to the next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ScalingPlanPatch.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ScalingPlanPatch.java new file mode 100644 index 0000000000000..86085237b365f --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ScalingPlanPatch.java @@ -0,0 +1,268 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** Scaling plan properties that can be patched. */ +@JsonFlatten +@Fluent +public class ScalingPlanPatch { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ScalingPlanPatch.class); + + /* + * tags to be updated + */ + @JsonProperty(value = "tags") + private Map tags; + + /* + * The ring number of scaling plan. + */ + @JsonProperty(value = "properties.ring") + private Integer ring; + + /* + * Description of scaling plan. + */ + @JsonProperty(value = "properties.description") + private String description; + + /* + * User friendly name of scaling plan. + */ + @JsonProperty(value = "properties.friendlyName") + private String friendlyName; + + /* + * Timezone of the scaling plan. + */ + @JsonProperty(value = "properties.timeZone") + private String timeZone; + + /* + * HostPool type for desktop. + */ + @JsonProperty(value = "properties.hostPoolType") + private HostPoolType hostPoolType; + + /* + * Exclusion tag for scaling plan. + */ + @JsonProperty(value = "properties.exclusionTag") + private String exclusionTag; + + /* + * List of ScalingSchedule definitions. + */ + @JsonProperty(value = "properties.schedules") + private List schedules; + + /* + * List of ScalingHostPoolReference definitions. + */ + @JsonProperty(value = "properties.hostPoolReferences") + private List hostPoolReferences; + + /** + * Get the tags property: tags to be updated. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: tags to be updated. + * + * @param tags the tags value to set. + * @return the ScalingPlanPatch object itself. + */ + public ScalingPlanPatch withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the ring property: The ring number of scaling plan. + * + * @return the ring value. + */ + public Integer ring() { + return this.ring; + } + + /** + * Set the ring property: The ring number of scaling plan. + * + * @param ring the ring value to set. + * @return the ScalingPlanPatch object itself. + */ + public ScalingPlanPatch withRing(Integer ring) { + this.ring = ring; + return this; + } + + /** + * Get the description property: Description of scaling plan. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Description of scaling plan. + * + * @param description the description value to set. + * @return the ScalingPlanPatch object itself. + */ + public ScalingPlanPatch withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the friendlyName property: User friendly name of scaling plan. + * + * @return the friendlyName value. + */ + public String friendlyName() { + return this.friendlyName; + } + + /** + * Set the friendlyName property: User friendly name of scaling plan. + * + * @param friendlyName the friendlyName value to set. + * @return the ScalingPlanPatch object itself. + */ + public ScalingPlanPatch withFriendlyName(String friendlyName) { + this.friendlyName = friendlyName; + return this; + } + + /** + * Get the timeZone property: Timezone of the scaling plan. + * + * @return the timeZone value. + */ + public String timeZone() { + return this.timeZone; + } + + /** + * Set the timeZone property: Timezone of the scaling plan. + * + * @param timeZone the timeZone value to set. + * @return the ScalingPlanPatch object itself. + */ + public ScalingPlanPatch withTimeZone(String timeZone) { + this.timeZone = timeZone; + return this; + } + + /** + * Get the hostPoolType property: HostPool type for desktop. + * + * @return the hostPoolType value. + */ + public HostPoolType hostPoolType() { + return this.hostPoolType; + } + + /** + * Set the hostPoolType property: HostPool type for desktop. + * + * @param hostPoolType the hostPoolType value to set. + * @return the ScalingPlanPatch object itself. + */ + public ScalingPlanPatch withHostPoolType(HostPoolType hostPoolType) { + this.hostPoolType = hostPoolType; + return this; + } + + /** + * Get the exclusionTag property: Exclusion tag for scaling plan. + * + * @return the exclusionTag value. + */ + public String exclusionTag() { + return this.exclusionTag; + } + + /** + * Set the exclusionTag property: Exclusion tag for scaling plan. + * + * @param exclusionTag the exclusionTag value to set. + * @return the ScalingPlanPatch object itself. + */ + public ScalingPlanPatch withExclusionTag(String exclusionTag) { + this.exclusionTag = exclusionTag; + return this; + } + + /** + * Get the schedules property: List of ScalingSchedule definitions. + * + * @return the schedules value. + */ + public List schedules() { + return this.schedules; + } + + /** + * Set the schedules property: List of ScalingSchedule definitions. + * + * @param schedules the schedules value to set. + * @return the ScalingPlanPatch object itself. + */ + public ScalingPlanPatch withSchedules(List schedules) { + this.schedules = schedules; + return this; + } + + /** + * Get the hostPoolReferences property: List of ScalingHostPoolReference definitions. + * + * @return the hostPoolReferences value. + */ + public List hostPoolReferences() { + return this.hostPoolReferences; + } + + /** + * Set the hostPoolReferences property: List of ScalingHostPoolReference definitions. + * + * @param hostPoolReferences the hostPoolReferences value to set. + * @return the ScalingPlanPatch object itself. + */ + public ScalingPlanPatch withHostPoolReferences(List hostPoolReferences) { + this.hostPoolReferences = hostPoolReferences; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (schedules() != null) { + schedules().forEach(e -> e.validate()); + } + if (hostPoolReferences() != null) { + hostPoolReferences().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ScalingPlans.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ScalingPlans.java new file mode 100644 index 0000000000000..bfbc1032e7b44 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ScalingPlans.java @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.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 ScalingPlans. */ +public interface ScalingPlans { + /** + * Get a scaling plan. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scalingPlanName The name of the scaling plan. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 scaling plan. + */ + ScalingPlan getByResourceGroup(String resourceGroupName, String scalingPlanName); + + /** + * Get a scaling plan. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scalingPlanName The name of the scaling plan. + * @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 scaling plan. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String scalingPlanName, Context context); + + /** + * Remove a scaling plan. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scalingPlanName The name of the scaling plan. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String scalingPlanName); + + /** + * Remove a scaling plan. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scalingPlanName The name of the scaling plan. + * @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. + */ + Response deleteWithResponse(String resourceGroupName, String scalingPlanName, Context context); + + /** + * List scaling plans. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of scaling plan definitions. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List scaling plans. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of scaling plan definitions. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List scaling plans in 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 list of scaling plan definitions. + */ + PagedIterable list(); + + /** + * List scaling plans in 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 list of scaling plan definitions. + */ + PagedIterable list(Context context); + + /** + * List scaling plan associated with hostpool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of scaling plan definitions. + */ + PagedIterable listByHostPool(String resourceGroupName, String hostPoolName); + + /** + * List scaling plan associated with hostpool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of scaling plan definitions. + */ + PagedIterable listByHostPool(String resourceGroupName, String hostPoolName, Context context); + + /** + * Get a scaling plan. + * + * @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 scaling plan. + */ + ScalingPlan getById(String id); + + /** + * Get a scaling plan. + * + * @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 scaling plan. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Remove a scaling plan. + * + * @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); + + /** + * Remove a scaling plan. + * + * @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. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ScalingPlan resource. + * + * @param name resource name. + * @return the first stage of the new ScalingPlan definition. + */ + ScalingPlan.DefinitionStages.Blank define(String name); +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ScalingSchedule.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ScalingSchedule.java new file mode 100644 index 0000000000000..f58d3430ae77b --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ScalingSchedule.java @@ -0,0 +1,498 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** Scaling plan schedule. */ +@Fluent +public final class ScalingSchedule { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ScalingSchedule.class); + + /* + * Name of the scaling schedule. + */ + @JsonProperty(value = "name") + private String name; + + /* + * Set of days of the week on which this schedule is active. + */ + @JsonProperty(value = "daysOfWeek") + private List daysOfWeek; + + /* + * Starting time for ramp up period. + */ + @JsonProperty(value = "rampUpStartTime") + private OffsetDateTime rampUpStartTime; + + /* + * Load balancing algorithm for ramp up period. + */ + @JsonProperty(value = "rampUpLoadBalancingAlgorithm") + private SessionHostLoadBalancingAlgorithm rampUpLoadBalancingAlgorithm; + + /* + * Minimum host percentage for ramp up period. + */ + @JsonProperty(value = "rampUpMinimumHostsPct") + private Integer rampUpMinimumHostsPct; + + /* + * Capacity threshold for ramp up period. + */ + @JsonProperty(value = "rampUpCapacityThresholdPct") + private Integer rampUpCapacityThresholdPct; + + /* + * Starting time for peak period. + */ + @JsonProperty(value = "peakStartTime") + private OffsetDateTime peakStartTime; + + /* + * Load balancing algorithm for peak period. + */ + @JsonProperty(value = "peakLoadBalancingAlgorithm") + private SessionHostLoadBalancingAlgorithm peakLoadBalancingAlgorithm; + + /* + * Starting time for ramp down period. + */ + @JsonProperty(value = "rampDownStartTime") + private OffsetDateTime rampDownStartTime; + + /* + * Load balancing algorithm for ramp down period. + */ + @JsonProperty(value = "rampDownLoadBalancingAlgorithm") + private SessionHostLoadBalancingAlgorithm rampDownLoadBalancingAlgorithm; + + /* + * Minimum host percentage for ramp down period. + */ + @JsonProperty(value = "rampDownMinimumHostsPct") + private Integer rampDownMinimumHostsPct; + + /* + * Capacity threshold for ramp down period. + */ + @JsonProperty(value = "rampDownCapacityThresholdPct") + private Integer rampDownCapacityThresholdPct; + + /* + * Should users be logged off forcefully from hosts. + */ + @JsonProperty(value = "rampDownForceLogoffUsers") + private Boolean rampDownForceLogoffUsers; + + /* + * Specifies when to stop hosts during ramp down period. + */ + @JsonProperty(value = "rampDownStopHostsWhen") + private StopHostsWhen rampDownStopHostsWhen; + + /* + * Number of minutes to wait to stop hosts during ramp down period. + */ + @JsonProperty(value = "rampDownWaitTimeMinutes") + private Integer rampDownWaitTimeMinutes; + + /* + * Notification message for users during ramp down period. + */ + @JsonProperty(value = "rampDownNotificationMessage") + private String rampDownNotificationMessage; + + /* + * Starting time for off-peak period. + */ + @JsonProperty(value = "offPeakStartTime") + private OffsetDateTime offPeakStartTime; + + /* + * Load balancing algorithm for off-peak period. + */ + @JsonProperty(value = "offPeakLoadBalancingAlgorithm") + private SessionHostLoadBalancingAlgorithm offPeakLoadBalancingAlgorithm; + + /** + * Get the name property: Name of the scaling schedule. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the scaling schedule. + * + * @param name the name value to set. + * @return the ScalingSchedule object itself. + */ + public ScalingSchedule withName(String name) { + this.name = name; + return this; + } + + /** + * Get the daysOfWeek property: Set of days of the week on which this schedule is active. + * + * @return the daysOfWeek value. + */ + public List daysOfWeek() { + return this.daysOfWeek; + } + + /** + * Set the daysOfWeek property: Set of days of the week on which this schedule is active. + * + * @param daysOfWeek the daysOfWeek value to set. + * @return the ScalingSchedule object itself. + */ + public ScalingSchedule withDaysOfWeek(List daysOfWeek) { + this.daysOfWeek = daysOfWeek; + return this; + } + + /** + * Get the rampUpStartTime property: Starting time for ramp up period. + * + * @return the rampUpStartTime value. + */ + public OffsetDateTime rampUpStartTime() { + return this.rampUpStartTime; + } + + /** + * Set the rampUpStartTime property: Starting time for ramp up period. + * + * @param rampUpStartTime the rampUpStartTime value to set. + * @return the ScalingSchedule object itself. + */ + public ScalingSchedule withRampUpStartTime(OffsetDateTime rampUpStartTime) { + this.rampUpStartTime = rampUpStartTime; + return this; + } + + /** + * Get the rampUpLoadBalancingAlgorithm property: Load balancing algorithm for ramp up period. + * + * @return the rampUpLoadBalancingAlgorithm value. + */ + public SessionHostLoadBalancingAlgorithm rampUpLoadBalancingAlgorithm() { + return this.rampUpLoadBalancingAlgorithm; + } + + /** + * Set the rampUpLoadBalancingAlgorithm property: Load balancing algorithm for ramp up period. + * + * @param rampUpLoadBalancingAlgorithm the rampUpLoadBalancingAlgorithm value to set. + * @return the ScalingSchedule object itself. + */ + public ScalingSchedule withRampUpLoadBalancingAlgorithm( + SessionHostLoadBalancingAlgorithm rampUpLoadBalancingAlgorithm) { + this.rampUpLoadBalancingAlgorithm = rampUpLoadBalancingAlgorithm; + return this; + } + + /** + * Get the rampUpMinimumHostsPct property: Minimum host percentage for ramp up period. + * + * @return the rampUpMinimumHostsPct value. + */ + public Integer rampUpMinimumHostsPct() { + return this.rampUpMinimumHostsPct; + } + + /** + * Set the rampUpMinimumHostsPct property: Minimum host percentage for ramp up period. + * + * @param rampUpMinimumHostsPct the rampUpMinimumHostsPct value to set. + * @return the ScalingSchedule object itself. + */ + public ScalingSchedule withRampUpMinimumHostsPct(Integer rampUpMinimumHostsPct) { + this.rampUpMinimumHostsPct = rampUpMinimumHostsPct; + return this; + } + + /** + * Get the rampUpCapacityThresholdPct property: Capacity threshold for ramp up period. + * + * @return the rampUpCapacityThresholdPct value. + */ + public Integer rampUpCapacityThresholdPct() { + return this.rampUpCapacityThresholdPct; + } + + /** + * Set the rampUpCapacityThresholdPct property: Capacity threshold for ramp up period. + * + * @param rampUpCapacityThresholdPct the rampUpCapacityThresholdPct value to set. + * @return the ScalingSchedule object itself. + */ + public ScalingSchedule withRampUpCapacityThresholdPct(Integer rampUpCapacityThresholdPct) { + this.rampUpCapacityThresholdPct = rampUpCapacityThresholdPct; + return this; + } + + /** + * Get the peakStartTime property: Starting time for peak period. + * + * @return the peakStartTime value. + */ + public OffsetDateTime peakStartTime() { + return this.peakStartTime; + } + + /** + * Set the peakStartTime property: Starting time for peak period. + * + * @param peakStartTime the peakStartTime value to set. + * @return the ScalingSchedule object itself. + */ + public ScalingSchedule withPeakStartTime(OffsetDateTime peakStartTime) { + this.peakStartTime = peakStartTime; + return this; + } + + /** + * Get the peakLoadBalancingAlgorithm property: Load balancing algorithm for peak period. + * + * @return the peakLoadBalancingAlgorithm value. + */ + public SessionHostLoadBalancingAlgorithm peakLoadBalancingAlgorithm() { + return this.peakLoadBalancingAlgorithm; + } + + /** + * Set the peakLoadBalancingAlgorithm property: Load balancing algorithm for peak period. + * + * @param peakLoadBalancingAlgorithm the peakLoadBalancingAlgorithm value to set. + * @return the ScalingSchedule object itself. + */ + public ScalingSchedule withPeakLoadBalancingAlgorithm( + SessionHostLoadBalancingAlgorithm peakLoadBalancingAlgorithm) { + this.peakLoadBalancingAlgorithm = peakLoadBalancingAlgorithm; + return this; + } + + /** + * Get the rampDownStartTime property: Starting time for ramp down period. + * + * @return the rampDownStartTime value. + */ + public OffsetDateTime rampDownStartTime() { + return this.rampDownStartTime; + } + + /** + * Set the rampDownStartTime property: Starting time for ramp down period. + * + * @param rampDownStartTime the rampDownStartTime value to set. + * @return the ScalingSchedule object itself. + */ + public ScalingSchedule withRampDownStartTime(OffsetDateTime rampDownStartTime) { + this.rampDownStartTime = rampDownStartTime; + return this; + } + + /** + * Get the rampDownLoadBalancingAlgorithm property: Load balancing algorithm for ramp down period. + * + * @return the rampDownLoadBalancingAlgorithm value. + */ + public SessionHostLoadBalancingAlgorithm rampDownLoadBalancingAlgorithm() { + return this.rampDownLoadBalancingAlgorithm; + } + + /** + * Set the rampDownLoadBalancingAlgorithm property: Load balancing algorithm for ramp down period. + * + * @param rampDownLoadBalancingAlgorithm the rampDownLoadBalancingAlgorithm value to set. + * @return the ScalingSchedule object itself. + */ + public ScalingSchedule withRampDownLoadBalancingAlgorithm( + SessionHostLoadBalancingAlgorithm rampDownLoadBalancingAlgorithm) { + this.rampDownLoadBalancingAlgorithm = rampDownLoadBalancingAlgorithm; + return this; + } + + /** + * Get the rampDownMinimumHostsPct property: Minimum host percentage for ramp down period. + * + * @return the rampDownMinimumHostsPct value. + */ + public Integer rampDownMinimumHostsPct() { + return this.rampDownMinimumHostsPct; + } + + /** + * Set the rampDownMinimumHostsPct property: Minimum host percentage for ramp down period. + * + * @param rampDownMinimumHostsPct the rampDownMinimumHostsPct value to set. + * @return the ScalingSchedule object itself. + */ + public ScalingSchedule withRampDownMinimumHostsPct(Integer rampDownMinimumHostsPct) { + this.rampDownMinimumHostsPct = rampDownMinimumHostsPct; + return this; + } + + /** + * Get the rampDownCapacityThresholdPct property: Capacity threshold for ramp down period. + * + * @return the rampDownCapacityThresholdPct value. + */ + public Integer rampDownCapacityThresholdPct() { + return this.rampDownCapacityThresholdPct; + } + + /** + * Set the rampDownCapacityThresholdPct property: Capacity threshold for ramp down period. + * + * @param rampDownCapacityThresholdPct the rampDownCapacityThresholdPct value to set. + * @return the ScalingSchedule object itself. + */ + public ScalingSchedule withRampDownCapacityThresholdPct(Integer rampDownCapacityThresholdPct) { + this.rampDownCapacityThresholdPct = rampDownCapacityThresholdPct; + return this; + } + + /** + * Get the rampDownForceLogoffUsers property: Should users be logged off forcefully from hosts. + * + * @return the rampDownForceLogoffUsers value. + */ + public Boolean rampDownForceLogoffUsers() { + return this.rampDownForceLogoffUsers; + } + + /** + * Set the rampDownForceLogoffUsers property: Should users be logged off forcefully from hosts. + * + * @param rampDownForceLogoffUsers the rampDownForceLogoffUsers value to set. + * @return the ScalingSchedule object itself. + */ + public ScalingSchedule withRampDownForceLogoffUsers(Boolean rampDownForceLogoffUsers) { + this.rampDownForceLogoffUsers = rampDownForceLogoffUsers; + return this; + } + + /** + * Get the rampDownStopHostsWhen property: Specifies when to stop hosts during ramp down period. + * + * @return the rampDownStopHostsWhen value. + */ + public StopHostsWhen rampDownStopHostsWhen() { + return this.rampDownStopHostsWhen; + } + + /** + * Set the rampDownStopHostsWhen property: Specifies when to stop hosts during ramp down period. + * + * @param rampDownStopHostsWhen the rampDownStopHostsWhen value to set. + * @return the ScalingSchedule object itself. + */ + public ScalingSchedule withRampDownStopHostsWhen(StopHostsWhen rampDownStopHostsWhen) { + this.rampDownStopHostsWhen = rampDownStopHostsWhen; + return this; + } + + /** + * Get the rampDownWaitTimeMinutes property: Number of minutes to wait to stop hosts during ramp down period. + * + * @return the rampDownWaitTimeMinutes value. + */ + public Integer rampDownWaitTimeMinutes() { + return this.rampDownWaitTimeMinutes; + } + + /** + * Set the rampDownWaitTimeMinutes property: Number of minutes to wait to stop hosts during ramp down period. + * + * @param rampDownWaitTimeMinutes the rampDownWaitTimeMinutes value to set. + * @return the ScalingSchedule object itself. + */ + public ScalingSchedule withRampDownWaitTimeMinutes(Integer rampDownWaitTimeMinutes) { + this.rampDownWaitTimeMinutes = rampDownWaitTimeMinutes; + return this; + } + + /** + * Get the rampDownNotificationMessage property: Notification message for users during ramp down period. + * + * @return the rampDownNotificationMessage value. + */ + public String rampDownNotificationMessage() { + return this.rampDownNotificationMessage; + } + + /** + * Set the rampDownNotificationMessage property: Notification message for users during ramp down period. + * + * @param rampDownNotificationMessage the rampDownNotificationMessage value to set. + * @return the ScalingSchedule object itself. + */ + public ScalingSchedule withRampDownNotificationMessage(String rampDownNotificationMessage) { + this.rampDownNotificationMessage = rampDownNotificationMessage; + return this; + } + + /** + * Get the offPeakStartTime property: Starting time for off-peak period. + * + * @return the offPeakStartTime value. + */ + public OffsetDateTime offPeakStartTime() { + return this.offPeakStartTime; + } + + /** + * Set the offPeakStartTime property: Starting time for off-peak period. + * + * @param offPeakStartTime the offPeakStartTime value to set. + * @return the ScalingSchedule object itself. + */ + public ScalingSchedule withOffPeakStartTime(OffsetDateTime offPeakStartTime) { + this.offPeakStartTime = offPeakStartTime; + return this; + } + + /** + * Get the offPeakLoadBalancingAlgorithm property: Load balancing algorithm for off-peak period. + * + * @return the offPeakLoadBalancingAlgorithm value. + */ + public SessionHostLoadBalancingAlgorithm offPeakLoadBalancingAlgorithm() { + return this.offPeakLoadBalancingAlgorithm; + } + + /** + * Set the offPeakLoadBalancingAlgorithm property: Load balancing algorithm for off-peak period. + * + * @param offPeakLoadBalancingAlgorithm the offPeakLoadBalancingAlgorithm value to set. + * @return the ScalingSchedule object itself. + */ + public ScalingSchedule withOffPeakLoadBalancingAlgorithm( + SessionHostLoadBalancingAlgorithm offPeakLoadBalancingAlgorithm) { + this.offPeakLoadBalancingAlgorithm = offPeakLoadBalancingAlgorithm; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ScalingScheduleDaysOfWeekItem.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ScalingScheduleDaysOfWeekItem.java new file mode 100644 index 0000000000000..8a8647bf8ebf9 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ScalingScheduleDaysOfWeekItem.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ScalingScheduleDaysOfWeekItem. */ +public final class ScalingScheduleDaysOfWeekItem extends ExpandableStringEnum { + /** Static value Sunday for ScalingScheduleDaysOfWeekItem. */ + public static final ScalingScheduleDaysOfWeekItem SUNDAY = fromString("Sunday"); + + /** Static value Monday for ScalingScheduleDaysOfWeekItem. */ + public static final ScalingScheduleDaysOfWeekItem MONDAY = fromString("Monday"); + + /** Static value Tuesday for ScalingScheduleDaysOfWeekItem. */ + public static final ScalingScheduleDaysOfWeekItem TUESDAY = fromString("Tuesday"); + + /** Static value Wednesday for ScalingScheduleDaysOfWeekItem. */ + public static final ScalingScheduleDaysOfWeekItem WEDNESDAY = fromString("Wednesday"); + + /** Static value Thursday for ScalingScheduleDaysOfWeekItem. */ + public static final ScalingScheduleDaysOfWeekItem THURSDAY = fromString("Thursday"); + + /** Static value Friday for ScalingScheduleDaysOfWeekItem. */ + public static final ScalingScheduleDaysOfWeekItem FRIDAY = fromString("Friday"); + + /** Static value Saturday for ScalingScheduleDaysOfWeekItem. */ + public static final ScalingScheduleDaysOfWeekItem SATURDAY = fromString("Saturday"); + + /** + * Creates or finds a ScalingScheduleDaysOfWeekItem from its string representation. + * + * @param name a name to look for. + * @return the corresponding ScalingScheduleDaysOfWeekItem. + */ + @JsonCreator + public static ScalingScheduleDaysOfWeekItem fromString(String name) { + return fromString(name, ScalingScheduleDaysOfWeekItem.class); + } + + /** @return known ScalingScheduleDaysOfWeekItem values. */ + public static Collection values() { + return values(ScalingScheduleDaysOfWeekItem.class); + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/SendMessage.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/SendMessage.java new file mode 100644 index 0000000000000..66c4f6229fc30 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/SendMessage.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.desktopvirtualization.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; + +/** Represents message sent to a UserSession. */ +@Fluent +public final class SendMessage { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SendMessage.class); + + /* + * Title of message. + */ + @JsonProperty(value = "messageTitle") + private String messageTitle; + + /* + * Body of message. + */ + @JsonProperty(value = "messageBody") + private String messageBody; + + /** + * Get the messageTitle property: Title of message. + * + * @return the messageTitle value. + */ + public String messageTitle() { + return this.messageTitle; + } + + /** + * Set the messageTitle property: Title of message. + * + * @param messageTitle the messageTitle value to set. + * @return the SendMessage object itself. + */ + public SendMessage withMessageTitle(String messageTitle) { + this.messageTitle = messageTitle; + return this; + } + + /** + * Get the messageBody property: Body of message. + * + * @return the messageBody value. + */ + public String messageBody() { + return this.messageBody; + } + + /** + * Set the messageBody property: Body of message. + * + * @param messageBody the messageBody value to set. + * @return the SendMessage object itself. + */ + public SendMessage withMessageBody(String messageBody) { + this.messageBody = messageBody; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ServiceSpecification.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ServiceSpecification.java new file mode 100644 index 0000000000000..f6be33af624b9 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/ServiceSpecification.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.desktopvirtualization.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Service specification payload. */ +@Fluent +public final class ServiceSpecification { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServiceSpecification.class); + + /* + * Specifications of the Log for Azure Monitoring + */ + @JsonProperty(value = "logSpecifications") + private List logSpecifications; + + /** + * Get the logSpecifications property: Specifications of the Log for Azure Monitoring. + * + * @return the logSpecifications value. + */ + public List logSpecifications() { + return this.logSpecifications; + } + + /** + * Set the logSpecifications property: Specifications of the Log for Azure Monitoring. + * + * @param logSpecifications the logSpecifications value to set. + * @return the ServiceSpecification object itself. + */ + public ServiceSpecification withLogSpecifications(List logSpecifications) { + this.logSpecifications = logSpecifications; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (logSpecifications() != null) { + logSpecifications().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/SessionHost.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/SessionHost.java new file mode 100644 index 0000000000000..7852602f9f36a --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/SessionHost.java @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.models; + +import com.azure.resourcemanager.desktopvirtualization.fluent.models.SessionHostInner; +import java.time.OffsetDateTime; +import java.util.List; + +/** An immutable client-side representation of SessionHost. */ +public interface SessionHost { + /** + * 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 objectId property: ObjectId of SessionHost. (internal use). + * + * @return the objectId value. + */ + String objectId(); + + /** + * Gets the lastHeartBeat property: Last heart beat from SessionHost. + * + * @return the lastHeartBeat value. + */ + OffsetDateTime lastHeartBeat(); + + /** + * Gets the sessions property: Number of sessions on SessionHost. + * + * @return the sessions value. + */ + Integer sessions(); + + /** + * Gets the agentVersion property: Version of agent on SessionHost. + * + * @return the agentVersion value. + */ + String agentVersion(); + + /** + * Gets the allowNewSession property: Allow a new session. + * + * @return the allowNewSession value. + */ + Boolean allowNewSession(); + + /** + * Gets the virtualMachineId property: Virtual Machine Id of SessionHost's underlying virtual machine. + * + * @return the virtualMachineId value. + */ + String virtualMachineId(); + + /** + * Gets the resourceId property: Resource Id of SessionHost's underlying virtual machine. + * + * @return the resourceId value. + */ + String resourceId(); + + /** + * Gets the assignedUser property: User assigned to SessionHost. + * + * @return the assignedUser value. + */ + String assignedUser(); + + /** + * Gets the status property: Status for a SessionHost. + * + * @return the status value. + */ + Status status(); + + /** + * Gets the statusTimestamp property: The timestamp of the status. + * + * @return the statusTimestamp value. + */ + OffsetDateTime statusTimestamp(); + + /** + * Gets the osVersion property: The version of the OS on the session host. + * + * @return the osVersion value. + */ + String osVersion(); + + /** + * Gets the sxSStackVersion property: The version of the side by side stack on the session host. + * + * @return the sxSStackVersion value. + */ + String sxSStackVersion(); + + /** + * Gets the updateState property: Update state of a SessionHost. + * + * @return the updateState value. + */ + UpdateState updateState(); + + /** + * Gets the lastUpdateTime property: The timestamp of the last update. + * + * @return the lastUpdateTime value. + */ + OffsetDateTime lastUpdateTime(); + + /** + * Gets the updateErrorMessage property: The error message. + * + * @return the updateErrorMessage value. + */ + String updateErrorMessage(); + + /** + * Gets the sessionHostHealthCheckResults property: List of SessionHostHealthCheckReports. + * + * @return the sessionHostHealthCheckResults value. + */ + List sessionHostHealthCheckResults(); + + /** + * Gets the inner com.azure.resourcemanager.desktopvirtualization.fluent.models.SessionHostInner object. + * + * @return the inner object. + */ + SessionHostInner innerModel(); +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/SessionHostHealthCheckFailureDetails.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/SessionHostHealthCheckFailureDetails.java new file mode 100644 index 0000000000000..02b2f6e9f86c2 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/SessionHostHealthCheckFailureDetails.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.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.time.OffsetDateTime; + +/** Contains details on the failure. */ +@Immutable +public final class SessionHostHealthCheckFailureDetails { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SessionHostHealthCheckFailureDetails.class); + + /* + * Failure message: hints on what is wrong and how to recover. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /* + * Error code corresponding for the failure. + */ + @JsonProperty(value = "errorCode", access = JsonProperty.Access.WRITE_ONLY) + private Integer errorCode; + + /* + * The timestamp of the last update. + */ + @JsonProperty(value = "lastHealthCheckDateTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastHealthCheckDateTime; + + /** + * Get the message property: Failure message: hints on what is wrong and how to recover. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Get the errorCode property: Error code corresponding for the failure. + * + * @return the errorCode value. + */ + public Integer errorCode() { + return this.errorCode; + } + + /** + * Get the lastHealthCheckDateTime property: The timestamp of the last update. + * + * @return the lastHealthCheckDateTime value. + */ + public OffsetDateTime lastHealthCheckDateTime() { + return this.lastHealthCheckDateTime; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/SessionHostHealthCheckReport.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/SessionHostHealthCheckReport.java new file mode 100644 index 0000000000000..50c7a9ef3b668 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/SessionHostHealthCheckReport.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.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 report for session host information. */ +@Immutable +public final class SessionHostHealthCheckReport { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SessionHostHealthCheckReport.class); + + /* + * Represents the name of the health check operation performed. + */ + @JsonProperty(value = "healthCheckName", access = JsonProperty.Access.WRITE_ONLY) + private HealthCheckName healthCheckName; + + /* + * Represents the Health state of the health check we performed. + */ + @JsonProperty(value = "healthCheckResult", access = JsonProperty.Access.WRITE_ONLY) + private HealthCheckResult healthCheckResult; + + /* + * Additional detailed information on the failure. + */ + @JsonProperty(value = "additionalFailureDetails", access = JsonProperty.Access.WRITE_ONLY) + private SessionHostHealthCheckFailureDetails additionalFailureDetails; + + /** + * Get the healthCheckName property: Represents the name of the health check operation performed. + * + * @return the healthCheckName value. + */ + public HealthCheckName healthCheckName() { + return this.healthCheckName; + } + + /** + * Get the healthCheckResult property: Represents the Health state of the health check we performed. + * + * @return the healthCheckResult value. + */ + public HealthCheckResult healthCheckResult() { + return this.healthCheckResult; + } + + /** + * Get the additionalFailureDetails property: Additional detailed information on the failure. + * + * @return the additionalFailureDetails value. + */ + public SessionHostHealthCheckFailureDetails additionalFailureDetails() { + return this.additionalFailureDetails; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (additionalFailureDetails() != null) { + additionalFailureDetails().validate(); + } + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/SessionHostList.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/SessionHostList.java new file mode 100644 index 0000000000000..c22a0dcfe8de5 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/SessionHostList.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.desktopvirtualization.fluent.models.SessionHostInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of SessionHost definitions. */ +@Fluent +public final class SessionHostList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SessionHostList.class); + + /* + * List of SessionHost definitions. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Link to the next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: List of SessionHost definitions. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of SessionHost definitions. + * + * @param value the value value to set. + * @return the SessionHostList object itself. + */ + public SessionHostList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Link to the next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/SessionHostLoadBalancingAlgorithm.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/SessionHostLoadBalancingAlgorithm.java new file mode 100644 index 0000000000000..3b0241b65addd --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/SessionHostLoadBalancingAlgorithm.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for SessionHostLoadBalancingAlgorithm. */ +public final class SessionHostLoadBalancingAlgorithm extends ExpandableStringEnum { + /** Static value BreadthFirst for SessionHostLoadBalancingAlgorithm. */ + public static final SessionHostLoadBalancingAlgorithm BREADTH_FIRST = fromString("BreadthFirst"); + + /** Static value DepthFirst for SessionHostLoadBalancingAlgorithm. */ + public static final SessionHostLoadBalancingAlgorithm DEPTH_FIRST = fromString("DepthFirst"); + + /** + * Creates or finds a SessionHostLoadBalancingAlgorithm from its string representation. + * + * @param name a name to look for. + * @return the corresponding SessionHostLoadBalancingAlgorithm. + */ + @JsonCreator + public static SessionHostLoadBalancingAlgorithm fromString(String name) { + return fromString(name, SessionHostLoadBalancingAlgorithm.class); + } + + /** @return known SessionHostLoadBalancingAlgorithm values. */ + public static Collection values() { + return values(SessionHostLoadBalancingAlgorithm.class); + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/SessionHostPatch.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/SessionHostPatch.java new file mode 100644 index 0000000000000..f921baec13a49 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/SessionHostPatch.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** SessionHost properties that can be patched. */ +@JsonFlatten +@Fluent +public class SessionHostPatch extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SessionHostPatch.class); + + /* + * Allow a new session. + */ + @JsonProperty(value = "properties.allowNewSession") + private Boolean allowNewSession; + + /* + * User assigned to SessionHost. + */ + @JsonProperty(value = "properties.assignedUser") + private String assignedUser; + + /** + * Get the allowNewSession property: Allow a new session. + * + * @return the allowNewSession value. + */ + public Boolean allowNewSession() { + return this.allowNewSession; + } + + /** + * Set the allowNewSession property: Allow a new session. + * + * @param allowNewSession the allowNewSession value to set. + * @return the SessionHostPatch object itself. + */ + public SessionHostPatch withAllowNewSession(Boolean allowNewSession) { + this.allowNewSession = allowNewSession; + return this; + } + + /** + * Get the assignedUser property: User assigned to SessionHost. + * + * @return the assignedUser value. + */ + public String assignedUser() { + return this.assignedUser; + } + + /** + * Set the assignedUser property: User assigned to SessionHost. + * + * @param assignedUser the assignedUser value to set. + * @return the SessionHostPatch object itself. + */ + public SessionHostPatch withAssignedUser(String assignedUser) { + this.assignedUser = assignedUser; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/SessionHosts.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/SessionHosts.java new file mode 100644 index 0000000000000..3db297d537aaf --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/SessionHosts.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.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 SessionHosts. */ +public interface SessionHosts { + /** + * Get a session host. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 session host. + */ + SessionHost get(String resourceGroupName, String hostPoolName, String sessionHostname); + + /** + * Get a session host. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @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 session host. + */ + Response getWithResponse( + String resourceGroupName, String hostPoolName, String sessionHostname, Context context); + + /** + * Remove a SessionHost. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String hostPoolName, String sessionHostname); + + /** + * Remove a SessionHost. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @param force Force flag to force sessionHost deletion even when userSession exists. + * @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. + */ + Response deleteWithResponse( + String resourceGroupName, String hostPoolName, String sessionHostname, Boolean force, Context context); + + /** + * Update a session host. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 represents a SessionHost definition. + */ + SessionHost update(String resourceGroupName, String hostPoolName, String sessionHostname); + + /** + * Update a session host. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @param sessionHost Object containing SessionHost definitions. + * @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 represents a SessionHost definition. + */ + Response updateWithResponse( + String resourceGroupName, + String hostPoolName, + String sessionHostname, + SessionHostPatch sessionHost, + Context context); + + /** + * List sessionHosts. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of SessionHost definitions. + */ + PagedIterable list(String resourceGroupName, String hostPoolName); + + /** + * List sessionHosts. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of SessionHost definitions. + */ + PagedIterable list(String resourceGroupName, String hostPoolName, Context context); +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/SessionState.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/SessionState.java new file mode 100644 index 0000000000000..73791043abff2 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/SessionState.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.desktopvirtualization.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for SessionState. */ +public final class SessionState extends ExpandableStringEnum { + /** Static value Unknown for SessionState. */ + public static final SessionState UNKNOWN = fromString("Unknown"); + + /** Static value Active for SessionState. */ + public static final SessionState ACTIVE = fromString("Active"); + + /** Static value Disconnected for SessionState. */ + public static final SessionState DISCONNECTED = fromString("Disconnected"); + + /** Static value Pending for SessionState. */ + public static final SessionState PENDING = fromString("Pending"); + + /** Static value LogOff for SessionState. */ + public static final SessionState LOG_OFF = fromString("LogOff"); + + /** Static value UserProfileDiskMounted for SessionState. */ + public static final SessionState USER_PROFILE_DISK_MOUNTED = fromString("UserProfileDiskMounted"); + + /** + * Creates or finds a SessionState from its string representation. + * + * @param name a name to look for. + * @return the corresponding SessionState. + */ + @JsonCreator + public static SessionState fromString(String name) { + return fromString(name, SessionState.class); + } + + /** @return known SessionState values. */ + public static Collection values() { + return values(SessionState.class); + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/Sku.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/Sku.java new file mode 100644 index 0000000000000..3009e5b3fb21e --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/Sku.java @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.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 resource model definition representing SKU. */ +@Fluent +public class Sku { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Sku.class); + + /* + * The name of the SKU. Ex - P3. It is typically a letter+number code + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * This field is required to be implemented by the Resource Provider if the + * service has more than one tier, but is not required on a PUT. + */ + @JsonProperty(value = "tier") + private SkuTier tier; + + /* + * The SKU size. When the name field is the combination of tier and some + * other value, this would be the standalone code. + */ + @JsonProperty(value = "size") + private String size; + + /* + * If the service has different generations of hardware, for the same SKU, + * then that can be captured here. + */ + @JsonProperty(value = "family") + private String family; + + /* + * If the SKU supports scale out/in then the capacity integer should be + * included. If scale out/in is not possible for the resource this may be + * omitted. + */ + @JsonProperty(value = "capacity") + private Integer capacity; + + /** + * Get the name property: The name of the SKU. Ex - P3. It is typically a letter+number code. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the SKU. Ex - P3. It is typically a letter+number code. + * + * @param name the name value to set. + * @return the Sku object itself. + */ + public Sku withName(String name) { + this.name = name; + return this; + } + + /** + * Get the tier property: This field is required to be implemented by the Resource Provider if the service has more + * than one tier, but is not required on a PUT. + * + * @return the tier value. + */ + public SkuTier tier() { + return this.tier; + } + + /** + * Set the tier property: This field is required to be implemented by the Resource Provider if the service has more + * than one tier, but is not required on a PUT. + * + * @param tier the tier value to set. + * @return the Sku object itself. + */ + public Sku withTier(SkuTier tier) { + this.tier = tier; + return this; + } + + /** + * Get the size property: The SKU size. When the name field is the combination of tier and some other value, this + * would be the standalone code. + * + * @return the size value. + */ + public String size() { + return this.size; + } + + /** + * Set the size property: The SKU size. When the name field is the combination of tier and some other value, this + * would be the standalone code. + * + * @param size the size value to set. + * @return the Sku object itself. + */ + public Sku withSize(String size) { + this.size = size; + return this; + } + + /** + * Get the family property: If the service has different generations of hardware, for the same SKU, then that can be + * captured here. + * + * @return the family value. + */ + public String family() { + return this.family; + } + + /** + * Set the family property: If the service has different generations of hardware, for the same SKU, then that can be + * captured here. + * + * @param family the family value to set. + * @return the Sku object itself. + */ + public Sku withFamily(String family) { + this.family = family; + return this; + } + + /** + * Get the capacity property: If the SKU supports scale out/in then the capacity integer should be included. If + * scale out/in is not possible for the resource this may be omitted. + * + * @return the capacity value. + */ + public Integer capacity() { + return this.capacity; + } + + /** + * Set the capacity property: If the SKU supports scale out/in then the capacity integer should be included. If + * scale out/in is not possible for the resource this may be omitted. + * + * @param capacity the capacity value to set. + * @return the Sku object itself. + */ + public Sku withCapacity(Integer capacity) { + this.capacity = capacity; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw logger + .logExceptionAsError(new IllegalArgumentException("Missing required property name in model Sku")); + } + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/SkuTier.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/SkuTier.java new file mode 100644 index 0000000000000..faace17799574 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/SkuTier.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for SkuTier. */ +public enum SkuTier { + /** Enum value Free. */ + FREE("Free"), + + /** Enum value Basic. */ + BASIC("Basic"), + + /** Enum value Standard. */ + STANDARD("Standard"), + + /** Enum value Premium. */ + PREMIUM("Premium"); + + /** The actual serialized value for a SkuTier instance. */ + private final String value; + + SkuTier(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SkuTier instance. + * + * @param value the serialized value to parse. + * @return the parsed SkuTier object, or null if unable to parse. + */ + @JsonCreator + public static SkuTier fromString(String value) { + SkuTier[] items = SkuTier.values(); + for (SkuTier item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/SsoSecretType.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/SsoSecretType.java new file mode 100644 index 0000000000000..d2a64807aab33 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/SsoSecretType.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for SsoSecretType. */ +public final class SsoSecretType extends ExpandableStringEnum { + /** Static value SharedKey for SsoSecretType. */ + public static final SsoSecretType SHARED_KEY = fromString("SharedKey"); + + /** Static value Certificate for SsoSecretType. */ + public static final SsoSecretType CERTIFICATE = fromString("Certificate"); + + /** Static value SharedKeyInKeyVault for SsoSecretType. */ + public static final SsoSecretType SHARED_KEY_IN_KEY_VAULT = fromString("SharedKeyInKeyVault"); + + /** Static value CertificateInKeyVault for SsoSecretType. */ + public static final SsoSecretType CERTIFICATE_IN_KEY_VAULT = fromString("CertificateInKeyVault"); + + /** + * Creates or finds a SsoSecretType from its string representation. + * + * @param name a name to look for. + * @return the corresponding SsoSecretType. + */ + @JsonCreator + public static SsoSecretType fromString(String name) { + return fromString(name, SsoSecretType.class); + } + + /** @return known SsoSecretType values. */ + public static Collection values() { + return values(SsoSecretType.class); + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/StartMenuItem.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/StartMenuItem.java new file mode 100644 index 0000000000000..45098dfda0be4 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/StartMenuItem.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.models; + +import com.azure.resourcemanager.desktopvirtualization.fluent.models.StartMenuItemInner; + +/** An immutable client-side representation of StartMenuItem. */ +public interface StartMenuItem { + /** + * 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 appAlias property: Alias of StartMenuItem. + * + * @return the appAlias value. + */ + String appAlias(); + + /** + * Gets the filePath property: Path to the file of StartMenuItem. + * + * @return the filePath value. + */ + String filePath(); + + /** + * Gets the commandLineArguments property: Command line arguments for StartMenuItem. + * + * @return the commandLineArguments value. + */ + String commandLineArguments(); + + /** + * Gets the iconPath property: Path to the icon. + * + * @return the iconPath value. + */ + String iconPath(); + + /** + * Gets the iconIndex property: Index of the icon. + * + * @return the iconIndex value. + */ + Integer iconIndex(); + + /** + * Gets the inner com.azure.resourcemanager.desktopvirtualization.fluent.models.StartMenuItemInner object. + * + * @return the inner object. + */ + StartMenuItemInner innerModel(); +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/StartMenuItemList.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/StartMenuItemList.java new file mode 100644 index 0000000000000..c11d811da2b32 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/StartMenuItemList.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.desktopvirtualization.fluent.models.StartMenuItemInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of StartMenuItem definitions. */ +@Fluent +public final class StartMenuItemList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(StartMenuItemList.class); + + /* + * List of StartMenuItem definitions. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Link to the next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: List of StartMenuItem definitions. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of StartMenuItem definitions. + * + * @param value the value value to set. + * @return the StartMenuItemList object itself. + */ + public StartMenuItemList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Link to the next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/StartMenuItems.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/StartMenuItems.java new file mode 100644 index 0000000000000..1ea8843905f8c --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/StartMenuItems.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.desktopvirtualization.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of StartMenuItems. */ +public interface StartMenuItems { + /** + * List start menu items in the given application group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of StartMenuItem definitions. + */ + PagedIterable list(String resourceGroupName, String applicationGroupName); + + /** + * List start menu items in the given application group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param applicationGroupName The name of the application group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of StartMenuItem definitions. + */ + PagedIterable list(String resourceGroupName, String applicationGroupName, Context context); +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/Status.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/Status.java new file mode 100644 index 0000000000000..04a546323cc7a --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/Status.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for Status. */ +public final class Status extends ExpandableStringEnum { + /** Static value Available for Status. */ + public static final Status AVAILABLE = fromString("Available"); + + /** Static value Unavailable for Status. */ + public static final Status UNAVAILABLE = fromString("Unavailable"); + + /** Static value Shutdown for Status. */ + public static final Status SHUTDOWN = fromString("Shutdown"); + + /** Static value Disconnected for Status. */ + public static final Status DISCONNECTED = fromString("Disconnected"); + + /** Static value Upgrading for Status. */ + public static final Status UPGRADING = fromString("Upgrading"); + + /** Static value UpgradeFailed for Status. */ + public static final Status UPGRADE_FAILED = fromString("UpgradeFailed"); + + /** Static value NoHeartbeat for Status. */ + public static final Status NO_HEARTBEAT = fromString("NoHeartbeat"); + + /** Static value NotJoinedToDomain for Status. */ + public static final Status NOT_JOINED_TO_DOMAIN = fromString("NotJoinedToDomain"); + + /** Static value DomainTrustRelationshipLost for Status. */ + public static final Status DOMAIN_TRUST_RELATIONSHIP_LOST = fromString("DomainTrustRelationshipLost"); + + /** Static value SxSStackListenerNotReady for Status. */ + public static final Status SX_SSTACK_LISTENER_NOT_READY = fromString("SxSStackListenerNotReady"); + + /** Static value FSLogixNotHealthy for Status. */ + public static final Status FSLOGIX_NOT_HEALTHY = fromString("FSLogixNotHealthy"); + + /** Static value NeedsAssistance for Status. */ + public static final Status NEEDS_ASSISTANCE = fromString("NeedsAssistance"); + + /** + * Creates or finds a Status from its string representation. + * + * @param name a name to look for. + * @return the corresponding Status. + */ + @JsonCreator + public static Status fromString(String name) { + return fromString(name, Status.class); + } + + /** @return known Status values. */ + public static Collection values() { + return values(Status.class); + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/StopHostsWhen.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/StopHostsWhen.java new file mode 100644 index 0000000000000..b07e85f4fa2f7 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/StopHostsWhen.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for StopHostsWhen. */ +public final class StopHostsWhen extends ExpandableStringEnum { + /** Static value ZeroSessions for StopHostsWhen. */ + public static final StopHostsWhen ZERO_SESSIONS = fromString("ZeroSessions"); + + /** Static value ZeroActiveSessions for StopHostsWhen. */ + public static final StopHostsWhen ZERO_ACTIVE_SESSIONS = fromString("ZeroActiveSessions"); + + /** + * Creates or finds a StopHostsWhen from its string representation. + * + * @param name a name to look for. + * @return the corresponding StopHostsWhen. + */ + @JsonCreator + public static StopHostsWhen fromString(String name) { + return fromString(name, StopHostsWhen.class); + } + + /** @return known StopHostsWhen values. */ + public static Collection values() { + return values(StopHostsWhen.class); + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/UpdateState.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/UpdateState.java new file mode 100644 index 0000000000000..7336705429157 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/UpdateState.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for UpdateState. */ +public final class UpdateState extends ExpandableStringEnum { + /** Static value Initial for UpdateState. */ + public static final UpdateState INITIAL = fromString("Initial"); + + /** Static value Pending for UpdateState. */ + public static final UpdateState PENDING = fromString("Pending"); + + /** Static value Started for UpdateState. */ + public static final UpdateState STARTED = fromString("Started"); + + /** Static value Succeeded for UpdateState. */ + public static final UpdateState SUCCEEDED = fromString("Succeeded"); + + /** Static value Failed for UpdateState. */ + public static final UpdateState FAILED = fromString("Failed"); + + /** + * Creates or finds a UpdateState from its string representation. + * + * @param name a name to look for. + * @return the corresponding UpdateState. + */ + @JsonCreator + public static UpdateState fromString(String name) { + return fromString(name, UpdateState.class); + } + + /** @return known UpdateState values. */ + public static Collection values() { + return values(UpdateState.class); + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/UserSession.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/UserSession.java new file mode 100644 index 0000000000000..d19a4260cf0b0 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/UserSession.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.models; + +import com.azure.resourcemanager.desktopvirtualization.fluent.models.UserSessionInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of UserSession. */ +public interface UserSession { + /** + * 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 objectId property: ObjectId of user session. (internal use). + * + * @return the objectId value. + */ + String objectId(); + + /** + * Gets the userPrincipalName property: The user principal name. + * + * @return the userPrincipalName value. + */ + String userPrincipalName(); + + /** + * Gets the applicationType property: Application type of application. + * + * @return the applicationType value. + */ + ApplicationType applicationType(); + + /** + * Gets the sessionState property: State of user session. + * + * @return the sessionState value. + */ + SessionState sessionState(); + + /** + * Gets the activeDirectoryUsername property: The active directory user name. + * + * @return the activeDirectoryUsername value. + */ + String activeDirectoryUsername(); + + /** + * Gets the createTime property: The timestamp of the user session create. + * + * @return the createTime value. + */ + OffsetDateTime createTime(); + + /** + * Gets the inner com.azure.resourcemanager.desktopvirtualization.fluent.models.UserSessionInner object. + * + * @return the inner object. + */ + UserSessionInner innerModel(); +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/UserSessionList.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/UserSessionList.java new file mode 100644 index 0000000000000..04e605b962010 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/UserSessionList.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.desktopvirtualization.fluent.models.UserSessionInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of UserSession definitions. */ +@Fluent +public final class UserSessionList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UserSessionList.class); + + /* + * List of UserSession definitions. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Link to the next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: List of UserSession definitions. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of UserSession definitions. + * + * @param value the value value to set. + * @return the UserSessionList object itself. + */ + public UserSessionList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Link to the next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/UserSessions.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/UserSessions.java new file mode 100644 index 0000000000000..a38de20b92d8c --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/UserSessions.java @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.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 UserSessions. */ +public interface UserSessions { + /** + * List userSessions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of UserSession definitions. + */ + PagedIterable listByHostPool(String resourceGroupName, String hostPoolName); + + /** + * List userSessions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param filter OData filter expression. Valid properties for filtering are userprincipalname and sessionstate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of UserSession definitions. + */ + PagedIterable listByHostPool( + String resourceGroupName, String hostPoolName, String filter, Context context); + + /** + * Get a userSession. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @param userSessionId The name of the user session within the specified session host. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 userSession. + */ + UserSession get(String resourceGroupName, String hostPoolName, String sessionHostname, String userSessionId); + + /** + * Get a userSession. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @param userSessionId The name of the user session within the specified session host. + * @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 userSession. + */ + Response getWithResponse( + String resourceGroupName, String hostPoolName, String sessionHostname, String userSessionId, Context context); + + /** + * Remove a userSession. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @param userSessionId The name of the user session within the specified session host. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String hostPoolName, String sessionHostname, String userSessionId); + + /** + * Remove a userSession. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @param userSessionId The name of the user session within the specified session host. + * @param force Force flag to login off userSession. + * @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. + */ + Response deleteWithResponse( + String resourceGroupName, + String hostPoolName, + String sessionHostname, + String userSessionId, + Boolean force, + Context context); + + /** + * List userSessions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of UserSession definitions. + */ + PagedIterable list(String resourceGroupName, String hostPoolName, String sessionHostname); + + /** + * List userSessions. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of UserSession definitions. + */ + PagedIterable list( + String resourceGroupName, String hostPoolName, String sessionHostname, Context context); + + /** + * Disconnect a userSession. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @param userSessionId The name of the user session within the specified session host. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 disconnect(String resourceGroupName, String hostPoolName, String sessionHostname, String userSessionId); + + /** + * Disconnect a userSession. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @param userSessionId The name of the user session within the specified session host. + * @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. + */ + Response disconnectWithResponse( + String resourceGroupName, String hostPoolName, String sessionHostname, String userSessionId, Context context); + + /** + * Send a message to a user. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @param userSessionId The name of the user session within the specified session host. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 sendMessage(String resourceGroupName, String hostPoolName, String sessionHostname, String userSessionId); + + /** + * Send a message to a user. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param hostPoolName The name of the host pool within the specified resource group. + * @param sessionHostname The name of the session host within the specified host pool. + * @param userSessionId The name of the user session within the specified session host. + * @param sendMessage Object containing message includes title and message body. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response sendMessageWithResponse( + String resourceGroupName, + String hostPoolName, + String sessionHostname, + String userSessionId, + SendMessage sendMessage, + Context context); +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/Workspace.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/Workspace.java new file mode 100644 index 0000000000000..48a8757b9f0e0 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/Workspace.java @@ -0,0 +1,409 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.desktopvirtualization.fluent.models.WorkspaceInner; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of Workspace. */ +public interface Workspace { + /** + * 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 managedBy property: The fully qualified resource ID of the resource that manages this resource. + * Indicates if this resource is managed by another Azure resource. If this is present, complete mode deployment + * will not delete the resource if it is removed from the template since it is managed by another resource. + * + * @return the managedBy value. + */ + String managedBy(); + + /** + * Gets the kind property: Metadata used by portal/tooling/etc to render different UX experiences for resources of + * the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must + * validate and persist this value. + * + * @return the kind value. + */ + String kind(); + + /** + * Gets the etag property: The etag field is *not* required. If it is provided in the response body, it must also be + * provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from + * the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), + * If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the identity property: Identity for the resource. + * + * @return the identity value. + */ + Identity identity(); + + /** + * Gets the sku property: The resource model definition representing SKU. + * + * @return the sku value. + */ + Sku sku(); + + /** + * Gets the plan property: Plan for the resource. + * + * @return the plan value. + */ + Plan plan(); + + /** + * Gets the objectId property: ObjectId of Workspace. (internal use). + * + * @return the objectId value. + */ + String objectId(); + + /** + * Gets the description property: Description of Workspace. + * + * @return the description value. + */ + String description(); + + /** + * Gets the friendlyName property: Friendly name of Workspace. + * + * @return the friendlyName value. + */ + String friendlyName(); + + /** + * Gets the applicationGroupReferences property: List of applicationGroup resource Ids. + * + * @return the applicationGroupReferences value. + */ + List applicationGroupReferences(); + + /** + * Gets the cloudPcResource property: Is cloud pc resource. + * + * @return the cloudPcResource value. + */ + Boolean cloudPcResource(); + + /** + * 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.desktopvirtualization.fluent.models.WorkspaceInner object. + * + * @return the inner object. + */ + WorkspaceInner innerModel(); + + /** The entirety of the Workspace definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The Workspace definition stages. */ + interface DefinitionStages { + /** The first stage of the Workspace definition. */ + interface Blank extends WithLocation { + } + /** The stage of the Workspace 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 Workspace definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the Workspace 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.WithManagedBy, + DefinitionStages.WithKind, + DefinitionStages.WithIdentity, + DefinitionStages.WithSku, + DefinitionStages.WithPlan, + DefinitionStages.WithDescription, + DefinitionStages.WithFriendlyName, + DefinitionStages.WithApplicationGroupReferences { + /** + * Executes the create request. + * + * @return the created resource. + */ + Workspace create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Workspace create(Context context); + } + /** The stage of the Workspace 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 Workspace definition allowing to specify managedBy. */ + interface WithManagedBy { + /** + * Specifies the managedBy property: The fully qualified resource ID of the resource that manages this + * resource. Indicates if this resource is managed by another Azure resource. If this is present, complete + * mode deployment will not delete the resource if it is removed from the template since it is managed by + * another resource.. + * + * @param managedBy The fully qualified resource ID of the resource that manages this resource. Indicates if + * this resource is managed by another Azure resource. If this is present, complete mode deployment will + * not delete the resource if it is removed from the template since it is managed by another resource. + * @return the next definition stage. + */ + WithCreate withManagedBy(String managedBy); + } + /** The stage of the Workspace definition allowing to specify kind. */ + interface WithKind { + /** + * Specifies the kind property: Metadata used by portal/tooling/etc to render different UX experiences for + * resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the + * resource provider must validate and persist this value.. + * + * @param kind Metadata used by portal/tooling/etc to render different UX experiences for resources of the + * same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider + * must validate and persist this value. + * @return the next definition stage. + */ + WithCreate withKind(String kind); + } + /** The stage of the Workspace definition allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: Identity for the resource.. + * + * @param identity Identity for the resource. + * @return the next definition stage. + */ + WithCreate withIdentity(Identity identity); + } + /** The stage of the Workspace definition allowing to specify sku. */ + interface WithSku { + /** + * Specifies the sku property: The resource model definition representing SKU. + * + * @param sku The resource model definition representing SKU. + * @return the next definition stage. + */ + WithCreate withSku(Sku sku); + } + /** The stage of the Workspace definition allowing to specify plan. */ + interface WithPlan { + /** + * Specifies the plan property: Plan for the resource.. + * + * @param plan Plan for the resource. + * @return the next definition stage. + */ + WithCreate withPlan(Plan plan); + } + /** The stage of the Workspace definition allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: Description of Workspace.. + * + * @param description Description of Workspace. + * @return the next definition stage. + */ + WithCreate withDescription(String description); + } + /** The stage of the Workspace definition allowing to specify friendlyName. */ + interface WithFriendlyName { + /** + * Specifies the friendlyName property: Friendly name of Workspace.. + * + * @param friendlyName Friendly name of Workspace. + * @return the next definition stage. + */ + WithCreate withFriendlyName(String friendlyName); + } + /** The stage of the Workspace definition allowing to specify applicationGroupReferences. */ + interface WithApplicationGroupReferences { + /** + * Specifies the applicationGroupReferences property: List of applicationGroup resource Ids.. + * + * @param applicationGroupReferences List of applicationGroup resource Ids. + * @return the next definition stage. + */ + WithCreate withApplicationGroupReferences(List applicationGroupReferences); + } + } + /** + * Begins update for the Workspace resource. + * + * @return the stage of resource update. + */ + Workspace.Update update(); + + /** The template for Workspace update. */ + interface Update + extends UpdateStages.WithTags, + UpdateStages.WithDescription, + UpdateStages.WithFriendlyName, + UpdateStages.WithApplicationGroupReferences { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Workspace apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Workspace apply(Context context); + } + /** The Workspace update stages. */ + interface UpdateStages { + /** The stage of the Workspace update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: tags to be updated. + * + * @param tags tags to be updated. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the Workspace update allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: Description of Workspace.. + * + * @param description Description of Workspace. + * @return the next definition stage. + */ + Update withDescription(String description); + } + /** The stage of the Workspace update allowing to specify friendlyName. */ + interface WithFriendlyName { + /** + * Specifies the friendlyName property: Friendly name of Workspace.. + * + * @param friendlyName Friendly name of Workspace. + * @return the next definition stage. + */ + Update withFriendlyName(String friendlyName); + } + /** The stage of the Workspace update allowing to specify applicationGroupReferences. */ + interface WithApplicationGroupReferences { + /** + * Specifies the applicationGroupReferences property: List of applicationGroup links.. + * + * @param applicationGroupReferences List of applicationGroup links. + * @return the next definition stage. + */ + Update withApplicationGroupReferences(List applicationGroupReferences); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Workspace refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Workspace refresh(Context context); +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/WorkspaceList.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/WorkspaceList.java new file mode 100644 index 0000000000000..f3ee439b516e1 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/WorkspaceList.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.desktopvirtualization.fluent.models.WorkspaceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of Workspace definitions. */ +@Fluent +public final class WorkspaceList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(WorkspaceList.class); + + /* + * List of Workspace definitions. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Link to the next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: List of Workspace definitions. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of Workspace definitions. + * + * @param value the value value to set. + * @return the WorkspaceList object itself. + */ + public WorkspaceList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Link to the next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/WorkspacePatch.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/WorkspacePatch.java new file mode 100644 index 0000000000000..96bb9ead7835a --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/WorkspacePatch.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** Workspace properties that can be patched. */ +@JsonFlatten +@Fluent +public class WorkspacePatch { + @JsonIgnore private final ClientLogger logger = new ClientLogger(WorkspacePatch.class); + + /* + * tags to be updated + */ + @JsonProperty(value = "tags") + private Map tags; + + /* + * Description of Workspace. + */ + @JsonProperty(value = "properties.description") + private String description; + + /* + * Friendly name of Workspace. + */ + @JsonProperty(value = "properties.friendlyName") + private String friendlyName; + + /* + * List of applicationGroup links. + */ + @JsonProperty(value = "properties.applicationGroupReferences") + private List applicationGroupReferences; + + /** + * Get the tags property: tags to be updated. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: tags to be updated. + * + * @param tags the tags value to set. + * @return the WorkspacePatch object itself. + */ + public WorkspacePatch withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the description property: Description of Workspace. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Description of Workspace. + * + * @param description the description value to set. + * @return the WorkspacePatch object itself. + */ + public WorkspacePatch withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the friendlyName property: Friendly name of Workspace. + * + * @return the friendlyName value. + */ + public String friendlyName() { + return this.friendlyName; + } + + /** + * Set the friendlyName property: Friendly name of Workspace. + * + * @param friendlyName the friendlyName value to set. + * @return the WorkspacePatch object itself. + */ + public WorkspacePatch withFriendlyName(String friendlyName) { + this.friendlyName = friendlyName; + return this; + } + + /** + * Get the applicationGroupReferences property: List of applicationGroup links. + * + * @return the applicationGroupReferences value. + */ + public List applicationGroupReferences() { + return this.applicationGroupReferences; + } + + /** + * Set the applicationGroupReferences property: List of applicationGroup links. + * + * @param applicationGroupReferences the applicationGroupReferences value to set. + * @return the WorkspacePatch object itself. + */ + public WorkspacePatch withApplicationGroupReferences(List applicationGroupReferences) { + this.applicationGroupReferences = applicationGroupReferences; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/Workspaces.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/Workspaces.java new file mode 100644 index 0000000000000..8a4d818d31acc --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/Workspaces.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.desktopvirtualization.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 Workspaces. */ +public interface Workspaces { + /** + * Get a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 workspace. + */ + Workspace getByResourceGroup(String resourceGroupName, String workspaceName); + + /** + * Get a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 workspace. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String workspaceName, Context context); + + /** + * Remove a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String workspaceName); + + /** + * Remove a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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. + */ + Response deleteWithResponse(String resourceGroupName, String workspaceName, Context context); + + /** + * List workspaces. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Workspace definitions. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List workspaces. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of Workspace definitions. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List workspaces in 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 list of Workspace definitions. + */ + PagedIterable list(); + + /** + * List workspaces in 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 list of Workspace definitions. + */ + PagedIterable list(Context context); + + /** + * Get a workspace. + * + * @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 workspace. + */ + Workspace getById(String id); + + /** + * Get a workspace. + * + * @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 workspace. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Remove a workspace. + * + * @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); + + /** + * Remove a workspace. + * + * @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. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new Workspace resource. + * + * @param name resource name. + * @return the first stage of the new Workspace definition. + */ + Workspace.DefinitionStages.Blank define(String name); +} diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/package-info.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/models/package-info.java new file mode 100644 index 0000000000000..e101adf77c19a --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/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 DesktopVirtualizationApiClient. null. */ +package com.azure.resourcemanager.desktopvirtualization.models; diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/package-info.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/package-info.java new file mode 100644 index 0000000000000..50766baf55a68 --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/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 DesktopVirtualizationApiClient. null. */ +package com.azure.resourcemanager.desktopvirtualization; diff --git a/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/module-info.java b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/module-info.java new file mode 100644 index 0000000000000..b9d12db35dc5e --- /dev/null +++ b/sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/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.desktopvirtualization { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.desktopvirtualization; + exports com.azure.resourcemanager.desktopvirtualization.fluent; + exports com.azure.resourcemanager.desktopvirtualization.fluent.models; + exports com.azure.resourcemanager.desktopvirtualization.models; + + opens com.azure.resourcemanager.desktopvirtualization.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.desktopvirtualization.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/desktopvirtualization/ci.yml b/sdk/desktopvirtualization/ci.yml new file mode 100644 index 0000000000000..4019c48c1748e --- /dev/null +++ b/sdk/desktopvirtualization/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/desktopvirtualization/ + +pr: + branches: + include: + - master + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/desktopvirtualization/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: desktopvirtualization + Artifacts: + - name: azure-resourcemanager-desktopvirtualization + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerdesktopvirtualization diff --git a/sdk/desktopvirtualization/pom.xml b/sdk/desktopvirtualization/pom.xml new file mode 100644 index 0000000000000..ce44dc414801e --- /dev/null +++ b/sdk/desktopvirtualization/pom.xml @@ -0,0 +1,53 @@ + + + 4.0.0 + com.azure + azure-desktopvirtualization-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-desktopvirtualization + + + +