diff --git a/eng/versioning/external_dependencies.txt b/eng/versioning/external_dependencies.txt index 62906a566feea..464bc9b7cf1a7 100644 --- a/eng/versioning/external_dependencies.txt +++ b/eng/versioning/external_dependencies.txt @@ -110,6 +110,7 @@ org.springframework.kafka:spring-kafka;2.5.7.RELEASE org.springframework.security:spring-security-config;5.3.5.RELEASE org.springframework.security:spring-security-core;5.3.5.RELEASE org.springframework.security:spring-security-oauth2-client;5.3.5.RELEASE +org.springframework.security:spring-security-oauth2-resource-server;5.3.5.RELEASE org.springframework.security:spring-security-oauth2-core;5.3.5.RELEASE org.springframework.security:spring-security-oauth2-jose;5.3.5.RELEASE org.springframework.security:spring-security-web;5.3.5.RELEASE diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index fa2e6238ee364..59d623aba6f54 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -44,13 +44,13 @@ com.azure:azure-communication-chat;1.0.0-beta.3;1.0.0-beta.4 com.azure:azure-communication-common;1.0.0-beta.3;1.0.0-beta.4 com.azure:azure-communication-administration;1.0.0-beta.3;1.0.0-beta.4 com.azure:azure-communication-sms;1.0.0-beta.3;1.0.0-beta.4 -com.azure:azure-core;1.10.0;1.11.0 -com.azure:azure-core-amqp;1.6.0;1.7.0-beta.3 +com.azure:azure-core;1.11.0;1.12.0-beta.1 +com.azure:azure-core-amqp;2.0.0;2.1.0-beta.1 com.azure:azure-core-amqp-experimental;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-core-experimental;1.0.0-beta.8;1.0.0-beta.9 com.azure:azure-core-http-jdk-httpclient;1.0.0-beta.1;1.0.0-beta.1 -com.azure:azure-core-http-netty;1.6.3;1.7.0 -com.azure:azure-core-http-okhttp;1.3.3;1.4.0 +com.azure:azure-core-http-netty;1.7.0;1.8.0-beta.1 +com.azure:azure-core-http-okhttp;1.4.0;1.5.0-beta.1 com.azure:azure-core-management;1.0.0;1.1.0-beta.1 com.azure:azure-core-serializer-avro-apache;1.0.0-beta.5;1.0.0-beta.6 com.azure:azure-core-serializer-avro-jackson;1.0.0-beta.1;1.0.0-beta.2 @@ -73,7 +73,7 @@ com.azure:azure-identity-perf;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-messaging-eventgrid;2.0.0-beta.3;2.0.0-beta.4 com.azure:azure-messaging-eventhubs;5.3.1;5.4.0-beta.2 com.azure:azure-messaging-eventhubs-checkpointstore-blob;1.3.1;1.4.0-beta.2 -com.azure:azure-messaging-servicebus;7.0.0-beta.7;7.0.0-beta.8 +com.azure:azure-messaging-servicebus;7.0.0;7.1.0-beta.1 com.azure:azure-messaging-servicebus-track1-perf;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-messaging-servicebus-track2-perf;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-search-documents;11.1.2;11.2.0-beta.4 @@ -168,6 +168,7 @@ com.azure.resourcemanager:azure-resourcemanager-sql;2.1.0;2.2.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-storage;2.1.0;2.2.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-trafficmanager;2.1.0;2.2.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-test;2.0.0-beta.1;2.0.0-beta.1 +com.azure.resourcemanager:azure-resourcemanager-hybridcompute;1.0.0-beta.1;1.0.0-beta.1 com.microsoft:microsoft-opentelemetry-exporter-azuremonitor;1.0.0-beta.1;1.0.0-beta.2 @@ -176,9 +177,7 @@ com.microsoft:microsoft-opentelemetry-exporter-azuremonitor;1.0.0-beta.1;1.0.0-b # Format; # unreleased_:;dependency-version # note: The unreleased dependencies will not be manipulated with the automatic PR creation code. -unreleased_com.azure:azure-core;1.11.0 -unreleased_com.azure:azure-core-amqp;1.7.0-beta.3 -unreleased_com.azure:azure-messaging-servicebus;7.0.0-beta.7 +unreleased_com.azure:azure-messaging-servicebus;7.0.0 # Released Beta dependencies: Copy the entry from above, prepend "beta_", remove the current # version and set the version to the released beta. Released beta dependencies are only valid @@ -188,4 +187,3 @@ unreleased_com.azure:azure-messaging-servicebus;7.0.0-beta.7 # beta_:;dependency-version # note: Released beta versions will not be manipulated with the automatic PR creation code. beta_com.azure:azure-security-keyvault-keys;4.3.0-beta.1 -beta_com.azure:azure-core-amqp;1.7.0-beta.2 diff --git a/pom.xml b/pom.xml index d97614e5dba32..834acb44deae8 100644 --- a/pom.xml +++ b/pom.xml @@ -9,35 +9,36 @@ 1.0.0 common/perf-test-core - eng/jacoco-test-coverage eng/code-quality-reports + eng/jacoco-test-coverage sdk/anomalydetector sdk/appconfiguration sdk/authorization sdk/batch sdk/boms - sdk/core - sdk/cosmos sdk/cognitiveservices sdk/communication + sdk/core + sdk/cosmos sdk/digitaltwins sdk/eventgrid sdk/eventhubs sdk/formrecognizer + sdk/hybridcompute sdk/identity sdk/keyvault sdk/loganalytics sdk/mediaservices - sdk/monitor sdk/metricsadvisor + sdk/monitor sdk/resourcemanager sdk/schemaregistry sdk/search sdk/servicebus + sdk/spring sdk/storage sdk/tables sdk/template sdk/textanalytics - sdk/spring diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/CHANGELOG.md b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/CHANGELOG.md new file mode 100644 index 0000000000000..75588eae06294 --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2020-12-07) + +- Azure Resource Manager HybridCompute client library for Java. This package contains Microsoft Azure SDK for HybridCompute Management SDK. The Hybrid Compute Management Client. Package tag package-2020-08-02. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). \ No newline at end of file diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/README.md b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/README.md new file mode 100644 index 0000000000000..9f1945e0b61b0 --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/README.md @@ -0,0 +1,84 @@ +# Azure Resource Manager HybridCompute client library for Java + +Azure Resource Manager HybridCompute client library for Java. + +This package contains Microsoft Azure SDK for HybridCompute Management SDK. The Hybrid Compute Management Client. Package tag package-2020-08-02. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +```xml + + com.azure.resourcemanager + azure-resourcemanager-hybridcompute + 1.0.0-beta.1 + +``` + +### 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: + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-hybridcompute;current}) +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +HybridComputeManager manager = HybridComputeManager + .authenticate(credential, profile); +``` +[//]: # ({x-version-update-end}) + +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 + +If you would like to become an active contributor to this project please follow the instructions provided in [Microsoft +Azure Projects Contribution Guidelines](http://azure.github.io/guidelines.html). + +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 + + +[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/hybridcompute/azure-resourcemanager-hybridcompute/pom.xml b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/pom.xml new file mode 100644 index 0000000000000..310a8da8922bc --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/pom.xml @@ -0,0 +1,62 @@ + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-hybridcompute + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for HybridCompute Management + This package contains Microsoft Azure SDK for HybridCompute Management SDK. The Hybrid Compute Management Client. Package tag package-2020-08-02. 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-management + 1.0.0 + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + true + + + + + diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/HybridComputeManager.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/HybridComputeManager.java new file mode 100644 index 0000000000000..1ea8d17a7f944 --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/HybridComputeManager.java @@ -0,0 +1,224 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcompute; + +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.hybridcompute.fluent.HybridComputeManagementClient; +import com.azure.resourcemanager.hybridcompute.implementation.HybridComputeManagementClientBuilder; +import com.azure.resourcemanager.hybridcompute.implementation.MachineExtensionsImpl; +import com.azure.resourcemanager.hybridcompute.implementation.MachinesImpl; +import com.azure.resourcemanager.hybridcompute.implementation.OperationsImpl; +import com.azure.resourcemanager.hybridcompute.models.MachineExtensions; +import com.azure.resourcemanager.hybridcompute.models.Machines; +import com.azure.resourcemanager.hybridcompute.models.Operations; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** Entry point to HybridComputeManager. The Hybrid Compute Management Client. */ +public final class HybridComputeManager { + private Machines machines; + + private MachineExtensions machineExtensions; + + private Operations operations; + + private final HybridComputeManagementClient clientObject; + + private HybridComputeManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new HybridComputeManagementClientBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of HybridCompute service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the HybridCompute service API instance. + */ + public static HybridComputeManager 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 HybridComputeManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new HybridComputeManager.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 HybridCompute service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the HybridCompute service API instance. + */ + public HybridComputeManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + if (retryPolicy == null) { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + List policies = new ArrayList<>(); + policies + .add( + new UserAgentPolicy( + null, + "com.azure.resourcemanager.hybridcompute", + "1.0.0-beta.1", + Configuration.getGlobalConfiguration())); + 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 HybridComputeManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** @return Resource collection API of Machines. */ + public Machines machines() { + if (this.machines == null) { + this.machines = new MachinesImpl(clientObject.getMachines(), this); + } + return machines; + } + + /** @return Resource collection API of MachineExtensions. */ + public MachineExtensions machineExtensions() { + if (this.machineExtensions == null) { + this.machineExtensions = new MachineExtensionsImpl(clientObject.getMachineExtensions(), this); + } + return machineExtensions; + } + + /** @return Resource collection API of Operations. */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** + * @return Wrapped service client HybridComputeManagementClient providing direct access to the underlying + * auto-generated API implementation, based on Azure REST API. + */ + public HybridComputeManagementClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/fluent/HybridComputeManagementClient.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/fluent/HybridComputeManagementClient.java new file mode 100644 index 0000000000000..0e41d4f3cd775 --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/fluent/HybridComputeManagementClient.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcompute.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for HybridComputeManagementClient class. */ +public interface HybridComputeManagementClient { + /** + * Gets Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms + * part of the URI for every service call. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the MachinesClient object to access its operations. + * + * @return the MachinesClient object. + */ + MachinesClient getMachines(); + + /** + * Gets the MachineExtensionsClient object to access its operations. + * + * @return the MachineExtensionsClient object. + */ + MachineExtensionsClient getMachineExtensions(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/fluent/MachineExtensionsClient.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/fluent/MachineExtensionsClient.java new file mode 100644 index 0000000000000..c87f0cf0cbead --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/fluent/MachineExtensionsClient.java @@ -0,0 +1,281 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcompute.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.hybridcompute.fluent.models.MachineExtensionInner; +import com.azure.resourcemanager.hybridcompute.models.MachineExtensionUpdate; + +/** An instance of this class provides access to all the operations defined in MachineExtensionsClient. */ +public interface MachineExtensionsClient { + /** + * The operation to create or update the extension. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the machine where the extension should be created or updated. + * @param extensionName The name of the machine extension. + * @param extensionParameters Describes a Machine Extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Machine Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, MachineExtensionInner> beginCreateOrUpdate( + String resourceGroupName, String name, String extensionName, MachineExtensionInner extensionParameters); + + /** + * The operation to create or update the extension. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the machine where the extension should be created or updated. + * @param extensionName The name of the machine extension. + * @param extensionParameters Describes a Machine Extension. + * @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 describes a Machine Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, MachineExtensionInner> beginCreateOrUpdate( + String resourceGroupName, + String name, + String extensionName, + MachineExtensionInner extensionParameters, + Context context); + + /** + * The operation to create or update the extension. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the machine where the extension should be created or updated. + * @param extensionName The name of the machine extension. + * @param extensionParameters Describes a Machine Extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Machine Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MachineExtensionInner createOrUpdate( + String resourceGroupName, String name, String extensionName, MachineExtensionInner extensionParameters); + + /** + * The operation to create or update the extension. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the machine where the extension should be created or updated. + * @param extensionName The name of the machine extension. + * @param extensionParameters Describes a Machine Extension. + * @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 describes a Machine Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MachineExtensionInner createOrUpdate( + String resourceGroupName, + String name, + String extensionName, + MachineExtensionInner extensionParameters, + Context context); + + /** + * The operation to update the extension. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the machine where the extension should be created or updated. + * @param extensionName The name of the machine extension. + * @param extensionParameters Describes a Machine Extension Update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Machine Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, MachineExtensionInner> beginUpdate( + String resourceGroupName, String name, String extensionName, MachineExtensionUpdate extensionParameters); + + /** + * The operation to update the extension. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the machine where the extension should be created or updated. + * @param extensionName The name of the machine extension. + * @param extensionParameters Describes a Machine Extension Update. + * @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 describes a Machine Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, MachineExtensionInner> beginUpdate( + String resourceGroupName, + String name, + String extensionName, + MachineExtensionUpdate extensionParameters, + Context context); + + /** + * The operation to update the extension. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the machine where the extension should be created or updated. + * @param extensionName The name of the machine extension. + * @param extensionParameters Describes a Machine Extension Update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Machine Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MachineExtensionInner update( + String resourceGroupName, String name, String extensionName, MachineExtensionUpdate extensionParameters); + + /** + * The operation to update the extension. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the machine where the extension should be created or updated. + * @param extensionName The name of the machine extension. + * @param extensionParameters Describes a Machine Extension Update. + * @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 describes a Machine Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MachineExtensionInner update( + String resourceGroupName, + String name, + String extensionName, + MachineExtensionUpdate extensionParameters, + Context context); + + /** + * The operation to delete the extension. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the machine where the extension should be deleted. + * @param extensionName The name of the machine extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete(String resourceGroupName, String name, String extensionName); + + /** + * The operation to delete the extension. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the machine where the extension should be deleted. + * @param extensionName The name of the machine extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String name, String extensionName, Context context); + + /** + * The operation to delete the extension. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the machine where the extension should be deleted. + * @param extensionName The name of the machine extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 name, String extensionName); + + /** + * The operation to delete the extension. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the machine where the extension should be deleted. + * @param extensionName The name of the machine extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String name, String extensionName, Context context); + + /** + * The operation to get the extension. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the machine containing the extension. + * @param extensionName The name of the machine extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Machine Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MachineExtensionInner get(String resourceGroupName, String name, String extensionName); + + /** + * The operation to get the extension. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the machine containing the extension. + * @param extensionName The name of the machine extension. + * @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 describes a Machine Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String name, String extensionName, Context context); + + /** + * The operation to get all extensions of a non-Azure machine. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the machine containing the extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the Machine Extensions List Result. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String name); + + /** + * The operation to get all extensions of a non-Azure machine. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the machine containing the extension. + * @param expand The expand expression to apply on the operation. + * @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 describes the Machine Extensions List Result. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String name, String expand, Context context); +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/fluent/MachinesClient.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/fluent/MachinesClient.java new file mode 100644 index 0000000000000..90f0e8de2c0d4 --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/fluent/MachinesClient.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.hybridcompute.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.hybridcompute.fluent.models.MachineInner; +import com.azure.resourcemanager.hybridcompute.models.InstanceViewTypes; + +/** An instance of this class provides access to all the operations defined in MachinesClient. */ +public interface MachinesClient { + /** + * The operation to remove a hybrid machine identity in Azure. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the hybrid machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 name); + + /** + * The operation to remove a hybrid machine identity in Azure. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the hybrid machine. + * @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 name, Context context); + + /** + * Retrieves information about the model view or the instance view of a hybrid machine. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the hybrid machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a hybrid machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MachineInner getByResourceGroup(String resourceGroupName, String name); + + /** + * Retrieves information about the model view or the instance view of a hybrid machine. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the hybrid machine. + * @param expand The expand expression to apply on the operation. + * @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 describes a hybrid machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String name, InstanceViewTypes expand, Context context); + + /** + * Lists all the hybrid machines in the specified resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List hybrid machine operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists all the hybrid machines in the specified resource group. + * + * @param resourceGroupName The name of the 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 the List hybrid machine operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Lists all the hybrid machines in the specified 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 the List hybrid machine operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all the hybrid machines in the specified 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 the List hybrid machine operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/fluent/OperationsClient.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/fluent/OperationsClient.java new file mode 100644 index 0000000000000..67bf2dff630e8 --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/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.hybridcompute.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.hybridcompute.fluent.models.OperationValueInner; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public interface OperationsClient { + /** + * Gets a list of hybrid compute operations. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of hybrid compute operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Gets a list of hybrid compute operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of hybrid compute operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/fluent/models/MachineExtensionInner.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/fluent/models/MachineExtensionInner.java new file mode 100644 index 0000000000000..7e9fc424f5dec --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/fluent/models/MachineExtensionInner.java @@ -0,0 +1,283 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcompute.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.hybridcompute.models.MachineExtensionInstanceView; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Describes a Machine Extension. */ +@JsonFlatten +@Fluent +public class MachineExtensionInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MachineExtensionInner.class); + + /* + * How the extension handler should be forced to update even if the + * extension configuration has not changed. + */ + @JsonProperty(value = "properties.forceUpdateTag") + private String forceUpdateTag; + + /* + * The name of the extension handler publisher. + */ + @JsonProperty(value = "properties.publisher") + private String publisher; + + /* + * Specifies the type of the extension; an example is + * "CustomScriptExtension". + */ + @JsonProperty(value = "properties.type") + private String typePropertiesType; + + /* + * Specifies the version of the script handler. + */ + @JsonProperty(value = "properties.typeHandlerVersion") + private String typeHandlerVersion; + + /* + * Indicates whether the extension should use a newer minor version if one + * is available at deployment time. Once deployed, however, the extension + * will not upgrade minor versions unless redeployed, even with this + * property set to true. + */ + @JsonProperty(value = "properties.autoUpgradeMinorVersion") + private Boolean autoUpgradeMinorVersion; + + /* + * Json formatted public settings for the extension. + */ + @JsonProperty(value = "properties.settings") + private Object settings; + + /* + * The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all. + */ + @JsonProperty(value = "properties.protectedSettings") + private Object protectedSettings; + + /* + * The provisioning state, which only appears in the response. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * The machine extension instance view. + */ + @JsonProperty(value = "properties.instanceView") + private MachineExtensionInstanceView instanceView; + + /** + * Get the forceUpdateTag property: How the extension handler should be forced to update even if the extension + * configuration has not changed. + * + * @return the forceUpdateTag value. + */ + public String forceUpdateTag() { + return this.forceUpdateTag; + } + + /** + * Set the forceUpdateTag property: How the extension handler should be forced to update even if the extension + * configuration has not changed. + * + * @param forceUpdateTag the forceUpdateTag value to set. + * @return the MachineExtensionInner object itself. + */ + public MachineExtensionInner withForceUpdateTag(String forceUpdateTag) { + this.forceUpdateTag = forceUpdateTag; + return this; + } + + /** + * Get the publisher property: The name of the extension handler publisher. + * + * @return the publisher value. + */ + public String publisher() { + return this.publisher; + } + + /** + * Set the publisher property: The name of the extension handler publisher. + * + * @param publisher the publisher value to set. + * @return the MachineExtensionInner object itself. + */ + public MachineExtensionInner withPublisher(String publisher) { + this.publisher = publisher; + return this; + } + + /** + * Get the typePropertiesType property: Specifies the type of the extension; an example is "CustomScriptExtension". + * + * @return the typePropertiesType value. + */ + public String typePropertiesType() { + return this.typePropertiesType; + } + + /** + * Set the typePropertiesType property: Specifies the type of the extension; an example is "CustomScriptExtension". + * + * @param typePropertiesType the typePropertiesType value to set. + * @return the MachineExtensionInner object itself. + */ + public MachineExtensionInner withTypePropertiesType(String typePropertiesType) { + this.typePropertiesType = typePropertiesType; + return this; + } + + /** + * Get the typeHandlerVersion property: Specifies the version of the script handler. + * + * @return the typeHandlerVersion value. + */ + public String typeHandlerVersion() { + return this.typeHandlerVersion; + } + + /** + * Set the typeHandlerVersion property: Specifies the version of the script handler. + * + * @param typeHandlerVersion the typeHandlerVersion value to set. + * @return the MachineExtensionInner object itself. + */ + public MachineExtensionInner withTypeHandlerVersion(String typeHandlerVersion) { + this.typeHandlerVersion = typeHandlerVersion; + return this; + } + + /** + * Get the autoUpgradeMinorVersion property: Indicates whether the extension should use a newer minor version if one + * is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless + * redeployed, even with this property set to true. + * + * @return the autoUpgradeMinorVersion value. + */ + public Boolean autoUpgradeMinorVersion() { + return this.autoUpgradeMinorVersion; + } + + /** + * Set the autoUpgradeMinorVersion property: Indicates whether the extension should use a newer minor version if one + * is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless + * redeployed, even with this property set to true. + * + * @param autoUpgradeMinorVersion the autoUpgradeMinorVersion value to set. + * @return the MachineExtensionInner object itself. + */ + public MachineExtensionInner withAutoUpgradeMinorVersion(Boolean autoUpgradeMinorVersion) { + this.autoUpgradeMinorVersion = autoUpgradeMinorVersion; + return this; + } + + /** + * Get the settings property: Json formatted public settings for the extension. + * + * @return the settings value. + */ + public Object settings() { + return this.settings; + } + + /** + * Set the settings property: Json formatted public settings for the extension. + * + * @param settings the settings value to set. + * @return the MachineExtensionInner object itself. + */ + public MachineExtensionInner withSettings(Object settings) { + this.settings = settings; + return this; + } + + /** + * Get the protectedSettings property: The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all. + * + * @return the protectedSettings value. + */ + public Object protectedSettings() { + return this.protectedSettings; + } + + /** + * Set the protectedSettings property: The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all. + * + * @param protectedSettings the protectedSettings value to set. + * @return the MachineExtensionInner object itself. + */ + public MachineExtensionInner withProtectedSettings(Object protectedSettings) { + this.protectedSettings = protectedSettings; + return this; + } + + /** + * Get the provisioningState property: The provisioning state, which only appears in the response. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the instanceView property: The machine extension instance view. + * + * @return the instanceView value. + */ + public MachineExtensionInstanceView instanceView() { + return this.instanceView; + } + + /** + * Set the instanceView property: The machine extension instance view. + * + * @param instanceView the instanceView value to set. + * @return the MachineExtensionInner object itself. + */ + public MachineExtensionInner withInstanceView(MachineExtensionInstanceView instanceView) { + this.instanceView = instanceView; + return this; + } + + /** {@inheritDoc} */ + @Override + public MachineExtensionInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public MachineExtensionInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (instanceView() != null) { + instanceView().validate(); + } + } +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/fluent/models/MachineInner.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/fluent/models/MachineInner.java new file mode 100644 index 0000000000000..78f412e9d0b26 --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/fluent/models/MachineInner.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.hybridcompute.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.Resource; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.hybridcompute.models.Identity; +import com.azure.resourcemanager.hybridcompute.models.LocationData; +import com.azure.resourcemanager.hybridcompute.models.MachineExtensionInstanceView; +import com.azure.resourcemanager.hybridcompute.models.OSProfile; +import com.azure.resourcemanager.hybridcompute.models.StatusTypes; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** Describes a hybrid machine. */ +@JsonFlatten +@Fluent +public class MachineInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MachineInner.class); + + /* + * Managed Identity. + */ + @JsonProperty(value = "identity") + private Identity identity; + + /* + * Metadata pertaining to the geographic location of the resource. + */ + @JsonProperty(value = "properties.locationData") + private LocationData locationData; + + /* + * Specifies the operating system settings for the hybrid machine. + */ + @JsonProperty(value = "properties.osProfile", access = JsonProperty.Access.WRITE_ONLY) + private OSProfile osProfile; + + /* + * The provisioning state, which only appears in the response. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * The status of the hybrid machine agent. + */ + @JsonProperty(value = "properties.status", access = JsonProperty.Access.WRITE_ONLY) + private StatusTypes status; + + /* + * The time of the last status change. + */ + @JsonProperty(value = "properties.lastStatusChange", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastStatusChange; + + /* + * Details about the error state. + */ + @JsonProperty(value = "properties.errorDetails", access = JsonProperty.Access.WRITE_ONLY) + private List errorDetails; + + /* + * The hybrid machine agent full version. + */ + @JsonProperty(value = "properties.agentVersion", access = JsonProperty.Access.WRITE_ONLY) + private String agentVersion; + + /* + * Specifies the hybrid machine unique ID. + */ + @JsonProperty(value = "properties.vmId") + private String vmId; + + /* + * Specifies the hybrid machine display name. + */ + @JsonProperty(value = "properties.displayName", access = JsonProperty.Access.WRITE_ONLY) + private String displayName; + + /* + * Specifies the hybrid machine FQDN. + */ + @JsonProperty(value = "properties.machineFqdn", access = JsonProperty.Access.WRITE_ONLY) + private String machineFqdn; + + /* + * Public Key that the client provides to be used during initial resource + * onboarding + */ + @JsonProperty(value = "properties.clientPublicKey") + private String clientPublicKey; + + /* + * The Operating System running on the hybrid machine. + */ + @JsonProperty(value = "properties.osName", access = JsonProperty.Access.WRITE_ONLY) + private String osName; + + /* + * The version of Operating System running on the hybrid machine. + */ + @JsonProperty(value = "properties.osVersion", access = JsonProperty.Access.WRITE_ONLY) + private String osVersion; + + /* + * Specifies the Arc Machine's unique SMBIOS ID + */ + @JsonProperty(value = "properties.vmUuid", access = JsonProperty.Access.WRITE_ONLY) + private String vmUuid; + + /* + * Machine Extensions information + */ + @JsonProperty(value = "properties.extensions", access = JsonProperty.Access.WRITE_ONLY) + private List extensions; + + /* + * Specifies the Operating System product SKU. + */ + @JsonProperty(value = "properties.osSku", access = JsonProperty.Access.WRITE_ONLY) + private String osSku; + + /* + * Specifies the Windows domain name. + */ + @JsonProperty(value = "properties.domainName", access = JsonProperty.Access.WRITE_ONLY) + private String domainName; + + /* + * Specifies the AD fully qualified display name. + */ + @JsonProperty(value = "properties.adFqdn", access = JsonProperty.Access.WRITE_ONLY) + private String adFqdn; + + /* + * Specifies the DNS fully qualified display name. + */ + @JsonProperty(value = "properties.dnsFqdn", access = JsonProperty.Access.WRITE_ONLY) + private String dnsFqdn; + + /** + * Get the identity property: Managed Identity. + * + * @return the identity value. + */ + public Identity identity() { + return this.identity; + } + + /** + * Set the identity property: Managed Identity. + * + * @param identity the identity value to set. + * @return the MachineInner object itself. + */ + public MachineInner withIdentity(Identity identity) { + this.identity = identity; + return this; + } + + /** + * Get the locationData property: Metadata pertaining to the geographic location of the resource. + * + * @return the locationData value. + */ + public LocationData locationData() { + return this.locationData; + } + + /** + * Set the locationData property: Metadata pertaining to the geographic location of the resource. + * + * @param locationData the locationData value to set. + * @return the MachineInner object itself. + */ + public MachineInner withLocationData(LocationData locationData) { + this.locationData = locationData; + return this; + } + + /** + * Get the osProfile property: Specifies the operating system settings for the hybrid machine. + * + * @return the osProfile value. + */ + public OSProfile osProfile() { + return this.osProfile; + } + + /** + * Get the provisioningState property: The provisioning state, which only appears in the response. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the status property: The status of the hybrid machine agent. + * + * @return the status value. + */ + public StatusTypes status() { + return this.status; + } + + /** + * Get the lastStatusChange property: The time of the last status change. + * + * @return the lastStatusChange value. + */ + public OffsetDateTime lastStatusChange() { + return this.lastStatusChange; + } + + /** + * Get the errorDetails property: Details about the error state. + * + * @return the errorDetails value. + */ + public List errorDetails() { + return this.errorDetails; + } + + /** + * Get the agentVersion property: The hybrid machine agent full version. + * + * @return the agentVersion value. + */ + public String agentVersion() { + return this.agentVersion; + } + + /** + * Get the vmId property: Specifies the hybrid machine unique ID. + * + * @return the vmId value. + */ + public String vmId() { + return this.vmId; + } + + /** + * Set the vmId property: Specifies the hybrid machine unique ID. + * + * @param vmId the vmId value to set. + * @return the MachineInner object itself. + */ + public MachineInner withVmId(String vmId) { + this.vmId = vmId; + return this; + } + + /** + * Get the displayName property: Specifies the hybrid machine display name. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Get the machineFqdn property: Specifies the hybrid machine FQDN. + * + * @return the machineFqdn value. + */ + public String machineFqdn() { + return this.machineFqdn; + } + + /** + * Get the clientPublicKey property: Public Key that the client provides to be used during initial resource + * onboarding. + * + * @return the clientPublicKey value. + */ + public String clientPublicKey() { + return this.clientPublicKey; + } + + /** + * Set the clientPublicKey property: Public Key that the client provides to be used during initial resource + * onboarding. + * + * @param clientPublicKey the clientPublicKey value to set. + * @return the MachineInner object itself. + */ + public MachineInner withClientPublicKey(String clientPublicKey) { + this.clientPublicKey = clientPublicKey; + return this; + } + + /** + * Get the osName property: The Operating System running on the hybrid machine. + * + * @return the osName value. + */ + public String osName() { + return this.osName; + } + + /** + * Get the osVersion property: The version of Operating System running on the hybrid machine. + * + * @return the osVersion value. + */ + public String osVersion() { + return this.osVersion; + } + + /** + * Get the vmUuid property: Specifies the Arc Machine's unique SMBIOS ID. + * + * @return the vmUuid value. + */ + public String vmUuid() { + return this.vmUuid; + } + + /** + * Get the extensions property: Machine Extensions information. + * + * @return the extensions value. + */ + public List extensions() { + return this.extensions; + } + + /** + * Get the osSku property: Specifies the Operating System product SKU. + * + * @return the osSku value. + */ + public String osSku() { + return this.osSku; + } + + /** + * Get the domainName property: Specifies the Windows domain name. + * + * @return the domainName value. + */ + public String domainName() { + return this.domainName; + } + + /** + * Get the adFqdn property: Specifies the AD fully qualified display name. + * + * @return the adFqdn value. + */ + public String adFqdn() { + return this.adFqdn; + } + + /** + * Get the dnsFqdn property: Specifies the DNS fully qualified display name. + * + * @return the dnsFqdn value. + */ + public String dnsFqdn() { + return this.dnsFqdn; + } + + /** {@inheritDoc} */ + @Override + public MachineInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public MachineInner 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 (locationData() != null) { + locationData().validate(); + } + if (osProfile() != null) { + osProfile().validate(); + } + if (extensions() != null) { + extensions().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/fluent/models/OperationValueInner.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/fluent/models/OperationValueInner.java new file mode 100644 index 0000000000000..ed9143add19df --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/fluent/models/OperationValueInner.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcompute.fluent.models; + +import com.azure.core.annotation.Immutable; +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; + +/** Describes the properties of a Compute Operation value. */ +@JsonFlatten +@Immutable +public class OperationValueInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationValueInner.class); + + /* + * The origin of the compute operation. + */ + @JsonProperty(value = "origin", access = JsonProperty.Access.WRITE_ONLY) + private String origin; + + /* + * The name of the compute operation. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The display name of the compute operation. + */ + @JsonProperty(value = "display.operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /* + * The display name of the resource the operation applies to. + */ + @JsonProperty(value = "display.resource", access = JsonProperty.Access.WRITE_ONLY) + private String resource; + + /* + * The description of the operation. + */ + @JsonProperty(value = "display.description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /* + * The resource provider for the operation. + */ + @JsonProperty(value = "display.provider", access = JsonProperty.Access.WRITE_ONLY) + private String provider; + + /** + * Get the origin property: The origin of the compute operation. + * + * @return the origin value. + */ + public String origin() { + return this.origin; + } + + /** + * Get the name property: The name of the compute operation. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the operation property: The display name of the compute operation. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Get the resource property: The display name of the resource the operation applies to. + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Get the description property: The description of the operation. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Get the provider property: The resource provider for the operation. + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/fluent/models/package-info.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/fluent/models/package-info.java new file mode 100644 index 0000000000000..fe3ee2f349a18 --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/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 HybridComputeManagementClient. The Hybrid Compute Management Client. */ +package com.azure.resourcemanager.hybridcompute.fluent.models; diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/fluent/package-info.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/fluent/package-info.java new file mode 100644 index 0000000000000..78815434aed54 --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/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 HybridComputeManagementClient. The Hybrid Compute Management Client. */ +package com.azure.resourcemanager.hybridcompute.fluent; diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/implementation/HybridComputeManagementClientBuilder.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/implementation/HybridComputeManagementClientBuilder.java new file mode 100644 index 0000000000000..e03f2dfd6dd6d --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/implementation/HybridComputeManagementClientBuilder.java @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcompute.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 HybridComputeManagementClientImpl type. */ +@ServiceClientBuilder(serviceClients = {HybridComputeManagementClientImpl.class}) +public final class HybridComputeManagementClientBuilder { + /* + * Subscription credentials which uniquely identify Microsoft Azure + * subscription. The subscription ID forms part of the URI for every + * service call. + */ + private String subscriptionId; + + /** + * Sets Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms + * part of the URI for every service call. + * + * @param subscriptionId the subscriptionId value. + * @return the HybridComputeManagementClientBuilder. + */ + public HybridComputeManagementClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the HybridComputeManagementClientBuilder. + */ + public HybridComputeManagementClientBuilder 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 HybridComputeManagementClientBuilder. + */ + public HybridComputeManagementClientBuilder 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 HybridComputeManagementClientBuilder. + */ + public HybridComputeManagementClientBuilder 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 HybridComputeManagementClientBuilder. + */ + public HybridComputeManagementClientBuilder 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 HybridComputeManagementClientBuilder. + */ + public HybridComputeManagementClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of HybridComputeManagementClientImpl with the provided parameters. + * + * @return an instance of HybridComputeManagementClientImpl. + */ + public HybridComputeManagementClientImpl 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(); + } + HybridComputeManagementClientImpl client = + new HybridComputeManagementClientImpl( + pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + return client; + } +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/implementation/HybridComputeManagementClientImpl.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/implementation/HybridComputeManagementClientImpl.java new file mode 100644 index 0000000000000..c5aba70333e20 --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/implementation/HybridComputeManagementClientImpl.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.hybridcompute.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.hybridcompute.fluent.HybridComputeManagementClient; +import com.azure.resourcemanager.hybridcompute.fluent.MachineExtensionsClient; +import com.azure.resourcemanager.hybridcompute.fluent.MachinesClient; +import com.azure.resourcemanager.hybridcompute.fluent.OperationsClient; +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 HybridComputeManagementClientImpl type. */ +@ServiceClient(builder = HybridComputeManagementClientBuilder.class) +public final class HybridComputeManagementClientImpl implements HybridComputeManagementClient { + private final ClientLogger logger = new ClientLogger(HybridComputeManagementClientImpl.class); + + /** + * Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of + * the URI for every service call. + */ + private final String subscriptionId; + + /** + * Gets Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms + * part of the URI for every service call. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** server parameter. */ + private final String endpoint; + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** Api Version. */ + private final String apiVersion; + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** The HTTP pipeline to send requests through. */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** The serializer to serialize an object into a string. */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** The default poll interval for long-running operation. */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** The MachinesClient object to access its operations. */ + private final MachinesClient machines; + + /** + * Gets the MachinesClient object to access its operations. + * + * @return the MachinesClient object. + */ + public MachinesClient getMachines() { + return this.machines; + } + + /** The MachineExtensionsClient object to access its operations. */ + private final MachineExtensionsClient machineExtensions; + + /** + * Gets the MachineExtensionsClient object to access its operations. + * + * @return the MachineExtensionsClient object. + */ + public MachineExtensionsClient getMachineExtensions() { + return this.machineExtensions; + } + + /** 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; + } + + /** + * Initializes an instance of HybridComputeManagementClient 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 Subscription credentials which uniquely identify Microsoft Azure subscription. The + * subscription ID forms part of the URI for every service call. + * @param endpoint server parameter. + */ + HybridComputeManagementClientImpl( + 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 = "2020-08-02"; + this.machines = new MachinesClientImpl(this); + this.machineExtensions = new MachineExtensionsClientImpl(this); + this.operations = new OperationsClientImpl(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 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.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/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/implementation/MachineExtensionImpl.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/implementation/MachineExtensionImpl.java new file mode 100644 index 0000000000000..f465e9b9e3626 --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/implementation/MachineExtensionImpl.java @@ -0,0 +1,287 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcompute.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.hybridcompute.HybridComputeManager; +import com.azure.resourcemanager.hybridcompute.fluent.models.MachineExtensionInner; +import com.azure.resourcemanager.hybridcompute.models.MachineExtension; +import com.azure.resourcemanager.hybridcompute.models.MachineExtensionInstanceView; +import com.azure.resourcemanager.hybridcompute.models.MachineExtensionUpdate; +import java.util.Collections; +import java.util.Map; + +public final class MachineExtensionImpl + implements MachineExtension, MachineExtension.Definition, MachineExtension.Update { + private MachineExtensionInner innerObject; + + private final HybridComputeManager 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 forceUpdateTag() { + return this.innerModel().forceUpdateTag(); + } + + public String publisher() { + return this.innerModel().publisher(); + } + + public String typePropertiesType() { + return this.innerModel().typePropertiesType(); + } + + public String typeHandlerVersion() { + return this.innerModel().typeHandlerVersion(); + } + + public Boolean autoUpgradeMinorVersion() { + return this.innerModel().autoUpgradeMinorVersion(); + } + + public Object settings() { + return this.innerModel().settings(); + } + + public Object protectedSettings() { + return this.innerModel().protectedSettings(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public MachineExtensionInstanceView instanceView() { + return this.innerModel().instanceView(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public MachineExtensionInner innerModel() { + return this.innerObject; + } + + private HybridComputeManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String name; + + private String extensionName; + + private MachineExtensionUpdate updateExtensionParameters; + + public MachineExtensionImpl withExistingMachine(String resourceGroupName, String name) { + this.resourceGroupName = resourceGroupName; + this.name = name; + return this; + } + + public MachineExtension create() { + this.innerObject = + serviceManager + .serviceClient() + .getMachineExtensions() + .createOrUpdate(resourceGroupName, name, extensionName, this.innerModel(), Context.NONE); + return this; + } + + public MachineExtension create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getMachineExtensions() + .createOrUpdate(resourceGroupName, name, extensionName, this.innerModel(), context); + return this; + } + + public MachineExtensionImpl(String name, HybridComputeManager serviceManager) { + this.innerObject = new MachineExtensionInner(); + this.serviceManager = serviceManager; + this.extensionName = name; + } + + public MachineExtensionImpl update() { + this.updateExtensionParameters = new MachineExtensionUpdate(); + return this; + } + + public MachineExtension apply() { + this.innerObject = + serviceManager + .serviceClient() + .getMachineExtensions() + .update(resourceGroupName, name, extensionName, updateExtensionParameters, Context.NONE); + return this; + } + + public MachineExtension apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getMachineExtensions() + .update(resourceGroupName, name, extensionName, updateExtensionParameters, context); + return this; + } + + public MachineExtensionImpl(MachineExtensionInner innerObject, HybridComputeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.name = Utils.getValueFromIdByName(innerObject.id(), "machines"); + this.extensionName = Utils.getValueFromIdByName(innerObject.id(), "extensions"); + } + + public MachineExtension refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getMachineExtensions() + .getWithResponse(resourceGroupName, name, extensionName, Context.NONE) + .getValue(); + return this; + } + + public MachineExtension refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getMachineExtensions() + .getWithResponse(resourceGroupName, name, extensionName, context) + .getValue(); + return this; + } + + public MachineExtensionImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public MachineExtensionImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public MachineExtensionImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateExtensionParameters.withTags(tags); + return this; + } + } + + public MachineExtensionImpl withForceUpdateTag(String forceUpdateTag) { + if (isInCreateMode()) { + this.innerModel().withForceUpdateTag(forceUpdateTag); + return this; + } else { + this.updateExtensionParameters.withForceUpdateTag(forceUpdateTag); + return this; + } + } + + public MachineExtensionImpl withPublisher(String publisher) { + if (isInCreateMode()) { + this.innerModel().withPublisher(publisher); + return this; + } else { + this.updateExtensionParameters.withPublisher(publisher); + return this; + } + } + + public MachineExtensionImpl withTypePropertiesType(String typePropertiesType) { + this.innerModel().withTypePropertiesType(typePropertiesType); + return this; + } + + public MachineExtensionImpl withTypeHandlerVersion(String typeHandlerVersion) { + if (isInCreateMode()) { + this.innerModel().withTypeHandlerVersion(typeHandlerVersion); + return this; + } else { + this.updateExtensionParameters.withTypeHandlerVersion(typeHandlerVersion); + return this; + } + } + + public MachineExtensionImpl withAutoUpgradeMinorVersion(Boolean autoUpgradeMinorVersion) { + if (isInCreateMode()) { + this.innerModel().withAutoUpgradeMinorVersion(autoUpgradeMinorVersion); + return this; + } else { + this.updateExtensionParameters.withAutoUpgradeMinorVersion(autoUpgradeMinorVersion); + return this; + } + } + + public MachineExtensionImpl withSettings(Object settings) { + if (isInCreateMode()) { + this.innerModel().withSettings(settings); + return this; + } else { + this.updateExtensionParameters.withSettings(settings); + return this; + } + } + + public MachineExtensionImpl withProtectedSettings(Object protectedSettings) { + if (isInCreateMode()) { + this.innerModel().withProtectedSettings(protectedSettings); + return this; + } else { + this.updateExtensionParameters.withProtectedSettings(protectedSettings); + return this; + } + } + + public MachineExtensionImpl withInstanceView(MachineExtensionInstanceView instanceView) { + this.innerModel().withInstanceView(instanceView); + return this; + } + + public MachineExtensionImpl withType(String type) { + this.updateExtensionParameters.withType(type); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/implementation/MachineExtensionsClientImpl.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/implementation/MachineExtensionsClientImpl.java new file mode 100644 index 0000000000000..4006579e7cb18 --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/implementation/MachineExtensionsClientImpl.java @@ -0,0 +1,1460 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcompute.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.hybridcompute.fluent.MachineExtensionsClient; +import com.azure.resourcemanager.hybridcompute.fluent.models.MachineExtensionInner; +import com.azure.resourcemanager.hybridcompute.models.MachineExtensionUpdate; +import com.azure.resourcemanager.hybridcompute.models.MachineExtensionsListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in MachineExtensionsClient. */ +public final class MachineExtensionsClientImpl implements MachineExtensionsClient { + private final ClientLogger logger = new ClientLogger(MachineExtensionsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final MachineExtensionsService service; + + /** The service client containing this operation class. */ + private final HybridComputeManagementClientImpl client; + + /** + * Initializes an instance of MachineExtensionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + MachineExtensionsClientImpl(HybridComputeManagementClientImpl client) { + this.service = + RestProxy.create(MachineExtensionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for HybridComputeManagementClientMachineExtensions to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "HybridComputeManagem") + private interface MachineExtensionsService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute" + + "/machines/{name}/extensions/{extensionName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("name") String name, + @PathParam("extensionName") String extensionName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") MachineExtensionInner extensionParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute" + + "/machines/{name}/extensions/{extensionName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("name") String name, + @PathParam("extensionName") String extensionName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") MachineExtensionUpdate extensionParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute" + + "/machines/{name}/extensions/{extensionName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("name") String name, + @PathParam("extensionName") String extensionName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute" + + "/machines/{name}/extensions/{extensionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("name") String name, + @PathParam("extensionName") String extensionName, + @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.HybridCompute" + + "/machines/{name}/extensions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("name") String name, + @QueryParam("$expand") String expand, + @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> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * The operation to create or update the extension. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the machine where the extension should be created or updated. + * @param extensionName The name of the machine extension. + * @param extensionParameters Describes a Machine Extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Machine Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String name, String extensionName, MachineExtensionInner extensionParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (extensionName == null) { + return Mono.error(new IllegalArgumentException("Parameter extensionName 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 (extensionParameters == null) { + return Mono + .error(new IllegalArgumentException("Parameter extensionParameters is required and cannot be null.")); + } else { + extensionParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + name, + extensionName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + extensionParameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * The operation to create or update the extension. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the machine where the extension should be created or updated. + * @param extensionName The name of the machine extension. + * @param extensionParameters Describes a Machine Extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Machine Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String name, + String extensionName, + MachineExtensionInner extensionParameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (extensionName == null) { + return Mono.error(new IllegalArgumentException("Parameter extensionName 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 (extensionParameters == null) { + return Mono + .error(new IllegalArgumentException("Parameter extensionParameters is required and cannot be null.")); + } else { + extensionParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + name, + extensionName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + extensionParameters, + accept, + context); + } + + /** + * The operation to create or update the extension. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the machine where the extension should be created or updated. + * @param extensionName The name of the machine extension. + * @param extensionParameters Describes a Machine Extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Machine Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, MachineExtensionInner> beginCreateOrUpdateAsync( + String resourceGroupName, String name, String extensionName, MachineExtensionInner extensionParameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, name, extensionName, extensionParameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + MachineExtensionInner.class, + MachineExtensionInner.class, + Context.NONE); + } + + /** + * The operation to create or update the extension. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the machine where the extension should be created or updated. + * @param extensionName The name of the machine extension. + * @param extensionParameters Describes a Machine Extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Machine Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, MachineExtensionInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String name, + String extensionName, + MachineExtensionInner extensionParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, name, extensionName, extensionParameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), MachineExtensionInner.class, MachineExtensionInner.class, context); + } + + /** + * The operation to create or update the extension. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the machine where the extension should be created or updated. + * @param extensionName The name of the machine extension. + * @param extensionParameters Describes a Machine Extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Machine Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, MachineExtensionInner> beginCreateOrUpdate( + String resourceGroupName, String name, String extensionName, MachineExtensionInner extensionParameters) { + return beginCreateOrUpdateAsync(resourceGroupName, name, extensionName, extensionParameters).getSyncPoller(); + } + + /** + * The operation to create or update the extension. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the machine where the extension should be created or updated. + * @param extensionName The name of the machine extension. + * @param extensionParameters Describes a Machine Extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Machine Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, MachineExtensionInner> beginCreateOrUpdate( + String resourceGroupName, + String name, + String extensionName, + MachineExtensionInner extensionParameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, name, extensionName, extensionParameters, context) + .getSyncPoller(); + } + + /** + * The operation to create or update the extension. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the machine where the extension should be created or updated. + * @param extensionName The name of the machine extension. + * @param extensionParameters Describes a Machine Extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Machine Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String name, String extensionName, MachineExtensionInner extensionParameters) { + return beginCreateOrUpdateAsync(resourceGroupName, name, extensionName, extensionParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to create or update the extension. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the machine where the extension should be created or updated. + * @param extensionName The name of the machine extension. + * @param extensionParameters Describes a Machine Extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Machine Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String name, + String extensionName, + MachineExtensionInner extensionParameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, name, extensionName, extensionParameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to create or update the extension. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the machine where the extension should be created or updated. + * @param extensionName The name of the machine extension. + * @param extensionParameters Describes a Machine Extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Machine Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MachineExtensionInner createOrUpdate( + String resourceGroupName, String name, String extensionName, MachineExtensionInner extensionParameters) { + return createOrUpdateAsync(resourceGroupName, name, extensionName, extensionParameters).block(); + } + + /** + * The operation to create or update the extension. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the machine where the extension should be created or updated. + * @param extensionName The name of the machine extension. + * @param extensionParameters Describes a Machine Extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Machine Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MachineExtensionInner createOrUpdate( + String resourceGroupName, + String name, + String extensionName, + MachineExtensionInner extensionParameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, name, extensionName, extensionParameters, context).block(); + } + + /** + * The operation to update the extension. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the machine where the extension should be created or updated. + * @param extensionName The name of the machine extension. + * @param extensionParameters Describes a Machine Extension Update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Machine Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String name, String extensionName, MachineExtensionUpdate extensionParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (extensionName == null) { + return Mono.error(new IllegalArgumentException("Parameter extensionName 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 (extensionParameters == null) { + return Mono + .error(new IllegalArgumentException("Parameter extensionParameters is required and cannot be null.")); + } else { + extensionParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + resourceGroupName, + name, + extensionName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + extensionParameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * The operation to update the extension. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the machine where the extension should be created or updated. + * @param extensionName The name of the machine extension. + * @param extensionParameters Describes a Machine Extension Update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Machine Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String name, + String extensionName, + MachineExtensionUpdate extensionParameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (extensionName == null) { + return Mono.error(new IllegalArgumentException("Parameter extensionName 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 (extensionParameters == null) { + return Mono + .error(new IllegalArgumentException("Parameter extensionParameters is required and cannot be null.")); + } else { + extensionParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + resourceGroupName, + name, + extensionName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + extensionParameters, + accept, + context); + } + + /** + * The operation to update the extension. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the machine where the extension should be created or updated. + * @param extensionName The name of the machine extension. + * @param extensionParameters Describes a Machine Extension Update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Machine Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, MachineExtensionInner> beginUpdateAsync( + String resourceGroupName, String name, String extensionName, MachineExtensionUpdate extensionParameters) { + Mono>> mono = + updateWithResponseAsync(resourceGroupName, name, extensionName, extensionParameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + MachineExtensionInner.class, + MachineExtensionInner.class, + Context.NONE); + } + + /** + * The operation to update the extension. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the machine where the extension should be created or updated. + * @param extensionName The name of the machine extension. + * @param extensionParameters Describes a Machine Extension Update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Machine Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, MachineExtensionInner> beginUpdateAsync( + String resourceGroupName, + String name, + String extensionName, + MachineExtensionUpdate extensionParameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, name, extensionName, extensionParameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), MachineExtensionInner.class, MachineExtensionInner.class, context); + } + + /** + * The operation to update the extension. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the machine where the extension should be created or updated. + * @param extensionName The name of the machine extension. + * @param extensionParameters Describes a Machine Extension Update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Machine Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, MachineExtensionInner> beginUpdate( + String resourceGroupName, String name, String extensionName, MachineExtensionUpdate extensionParameters) { + return beginUpdateAsync(resourceGroupName, name, extensionName, extensionParameters).getSyncPoller(); + } + + /** + * The operation to update the extension. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the machine where the extension should be created or updated. + * @param extensionName The name of the machine extension. + * @param extensionParameters Describes a Machine Extension Update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Machine Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, MachineExtensionInner> beginUpdate( + String resourceGroupName, + String name, + String extensionName, + MachineExtensionUpdate extensionParameters, + Context context) { + return beginUpdateAsync(resourceGroupName, name, extensionName, extensionParameters, context).getSyncPoller(); + } + + /** + * The operation to update the extension. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the machine where the extension should be created or updated. + * @param extensionName The name of the machine extension. + * @param extensionParameters Describes a Machine Extension Update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Machine Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String name, String extensionName, MachineExtensionUpdate extensionParameters) { + return beginUpdateAsync(resourceGroupName, name, extensionName, extensionParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to update the extension. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the machine where the extension should be created or updated. + * @param extensionName The name of the machine extension. + * @param extensionParameters Describes a Machine Extension Update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Machine Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String name, + String extensionName, + MachineExtensionUpdate extensionParameters, + Context context) { + return beginUpdateAsync(resourceGroupName, name, extensionName, extensionParameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to update the extension. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the machine where the extension should be created or updated. + * @param extensionName The name of the machine extension. + * @param extensionParameters Describes a Machine Extension Update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Machine Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MachineExtensionInner update( + String resourceGroupName, String name, String extensionName, MachineExtensionUpdate extensionParameters) { + return updateAsync(resourceGroupName, name, extensionName, extensionParameters).block(); + } + + /** + * The operation to update the extension. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the machine where the extension should be created or updated. + * @param extensionName The name of the machine extension. + * @param extensionParameters Describes a Machine Extension Update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Machine Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MachineExtensionInner update( + String resourceGroupName, + String name, + String extensionName, + MachineExtensionUpdate extensionParameters, + Context context) { + return updateAsync(resourceGroupName, name, extensionName, extensionParameters, context).block(); + } + + /** + * The operation to delete the extension. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the machine where the extension should be deleted. + * @param extensionName The name of the machine extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 name, String extensionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (extensionName == null) { + return Mono.error(new IllegalArgumentException("Parameter extensionName 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.")); + } + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + name, + extensionName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * The operation to delete the extension. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the machine where the extension should be deleted. + * @param extensionName The name of the machine extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 name, String extensionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (extensionName == null) { + return Mono.error(new IllegalArgumentException("Parameter extensionName 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.")); + } + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + name, + extensionName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + context); + } + + /** + * The operation to delete the extension. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the machine where the extension should be deleted. + * @param extensionName The name of the machine extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String name, String extensionName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, name, extensionName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * The operation to delete the extension. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the machine where the extension should be deleted. + * @param extensionName The name of the machine extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String name, String extensionName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, name, extensionName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * The operation to delete the extension. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the machine where the extension should be deleted. + * @param extensionName The name of the machine extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete(String resourceGroupName, String name, String extensionName) { + return beginDeleteAsync(resourceGroupName, name, extensionName).getSyncPoller(); + } + + /** + * The operation to delete the extension. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the machine where the extension should be deleted. + * @param extensionName The name of the machine extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String name, String extensionName, Context context) { + return beginDeleteAsync(resourceGroupName, name, extensionName, context).getSyncPoller(); + } + + /** + * The operation to delete the extension. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the machine where the extension should be deleted. + * @param extensionName The name of the machine extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 name, String extensionName) { + return beginDeleteAsync(resourceGroupName, name, extensionName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to delete the extension. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the machine where the extension should be deleted. + * @param extensionName The name of the machine extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 name, String extensionName, Context context) { + return beginDeleteAsync(resourceGroupName, name, extensionName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * The operation to delete the extension. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the machine where the extension should be deleted. + * @param extensionName The name of the machine extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 name, String extensionName) { + deleteAsync(resourceGroupName, name, extensionName).block(); + } + + /** + * The operation to delete the extension. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the machine where the extension should be deleted. + * @param extensionName The name of the machine extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 name, String extensionName, Context context) { + deleteAsync(resourceGroupName, name, extensionName, context).block(); + } + + /** + * The operation to get the extension. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the machine containing the extension. + * @param extensionName The name of the machine extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Machine Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String name, String extensionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (extensionName == null) { + return Mono.error(new IllegalArgumentException("Parameter extensionName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + name, + extensionName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * The operation to get the extension. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the machine containing the extension. + * @param extensionName The name of the machine extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Machine Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String name, String extensionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (extensionName == null) { + return Mono.error(new IllegalArgumentException("Parameter extensionName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + name, + extensionName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * The operation to get the extension. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the machine containing the extension. + * @param extensionName The name of the machine extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Machine Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String name, String extensionName) { + return getWithResponseAsync(resourceGroupName, name, extensionName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * The operation to get the extension. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the machine containing the extension. + * @param extensionName The name of the machine extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Machine Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MachineExtensionInner get(String resourceGroupName, String name, String extensionName) { + return getAsync(resourceGroupName, name, extensionName).block(); + } + + /** + * The operation to get the extension. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the machine containing the extension. + * @param extensionName The name of the machine extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Machine Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String name, String extensionName, Context context) { + return getWithResponseAsync(resourceGroupName, name, extensionName, context).block(); + } + + /** + * The operation to get all extensions of a non-Azure machine. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the machine containing the extension. + * @param expand The expand expression to apply on the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the Machine Extensions List Result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String name, String expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name 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(), + resourceGroupName, + name, + expand, + 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()))); + } + + /** + * The operation to get all extensions of a non-Azure machine. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the machine containing the extension. + * @param expand The expand expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the Machine Extensions List Result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String name, String expand, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name 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(), + resourceGroupName, + name, + expand, + 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)); + } + + /** + * The operation to get all extensions of a non-Azure machine. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the machine containing the extension. + * @param expand The expand expression to apply on the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the Machine Extensions List Result. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String name, String expand) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, name, expand), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * The operation to get all extensions of a non-Azure machine. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the machine containing the extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the Machine Extensions List Result. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String name) { + final String expand = null; + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, name, expand), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * The operation to get all extensions of a non-Azure machine. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the machine containing the extension. + * @param expand The expand expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the Machine Extensions List Result. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String name, String expand, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, name, expand, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * The operation to get all extensions of a non-Azure machine. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the machine containing the extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the Machine Extensions List Result. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String name) { + final String expand = null; + return new PagedIterable<>(listAsync(resourceGroupName, name, expand)); + } + + /** + * The operation to get all extensions of a non-Azure machine. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the machine containing the extension. + * @param expand The expand expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the Machine Extensions List Result. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, String name, String expand, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, name, expand, 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 describes the Machine Extensions List Result. + */ + @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 describes the Machine Extensions List Result. + */ + @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/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/implementation/MachineExtensionsImpl.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/implementation/MachineExtensionsImpl.java new file mode 100644 index 0000000000000..0ab65f6a575ae --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/implementation/MachineExtensionsImpl.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.hybridcompute.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.hybridcompute.HybridComputeManager; +import com.azure.resourcemanager.hybridcompute.fluent.MachineExtensionsClient; +import com.azure.resourcemanager.hybridcompute.fluent.models.MachineExtensionInner; +import com.azure.resourcemanager.hybridcompute.models.MachineExtension; +import com.azure.resourcemanager.hybridcompute.models.MachineExtensions; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class MachineExtensionsImpl implements MachineExtensions { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MachineExtensionsImpl.class); + + private final MachineExtensionsClient innerClient; + + private final HybridComputeManager serviceManager; + + public MachineExtensionsImpl(MachineExtensionsClient innerClient, HybridComputeManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void delete(String resourceGroupName, String name, String extensionName) { + this.serviceClient().delete(resourceGroupName, name, extensionName); + } + + public void delete(String resourceGroupName, String name, String extensionName, Context context) { + this.serviceClient().delete(resourceGroupName, name, extensionName, context); + } + + public MachineExtension get(String resourceGroupName, String name, String extensionName) { + MachineExtensionInner inner = this.serviceClient().get(resourceGroupName, name, extensionName); + if (inner != null) { + return new MachineExtensionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String name, String extensionName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, name, extensionName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new MachineExtensionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable list(String resourceGroupName, String name) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, name); + return inner.mapPage(inner1 -> new MachineExtensionImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String name, String expand, Context context) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, name, expand, context); + return inner.mapPage(inner1 -> new MachineExtensionImpl(inner1, this.manager())); + } + + public MachineExtension 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 name = Utils.getValueFromIdByName(id, "machines"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'machines'.", id))); + } + String extensionName = Utils.getValueFromIdByName(id, "extensions"); + if (extensionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'extensions'.", id))); + } + return this.getWithResponse(resourceGroupName, name, extensionName, 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 name = Utils.getValueFromIdByName(id, "machines"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'machines'.", id))); + } + String extensionName = Utils.getValueFromIdByName(id, "extensions"); + if (extensionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'extensions'.", id))); + } + return this.getWithResponse(resourceGroupName, name, extensionName, 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 name = Utils.getValueFromIdByName(id, "machines"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'machines'.", id))); + } + String extensionName = Utils.getValueFromIdByName(id, "extensions"); + if (extensionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'extensions'.", id))); + } + this.delete(resourceGroupName, name, extensionName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String name = Utils.getValueFromIdByName(id, "machines"); + if (name == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'machines'.", id))); + } + String extensionName = Utils.getValueFromIdByName(id, "extensions"); + if (extensionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'extensions'.", id))); + } + this.delete(resourceGroupName, name, extensionName, context); + } + + private MachineExtensionsClient serviceClient() { + return this.innerClient; + } + + private HybridComputeManager manager() { + return this.serviceManager; + } + + public MachineExtensionImpl define(String name) { + return new MachineExtensionImpl(name, this.manager()); + } +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/implementation/MachineImpl.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/implementation/MachineImpl.java new file mode 100644 index 0000000000000..a8144a361aa41 --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/implementation/MachineImpl.java @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcompute.implementation; + +import com.azure.core.management.exception.ManagementError; +import com.azure.resourcemanager.hybridcompute.HybridComputeManager; +import com.azure.resourcemanager.hybridcompute.fluent.models.MachineInner; +import com.azure.resourcemanager.hybridcompute.models.Identity; +import com.azure.resourcemanager.hybridcompute.models.LocationData; +import com.azure.resourcemanager.hybridcompute.models.Machine; +import com.azure.resourcemanager.hybridcompute.models.MachineExtensionInstanceView; +import com.azure.resourcemanager.hybridcompute.models.OSProfile; +import com.azure.resourcemanager.hybridcompute.models.StatusTypes; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class MachineImpl implements Machine { + private MachineInner innerObject; + + private final HybridComputeManager serviceManager; + + public MachineImpl(MachineInner innerObject, HybridComputeManager 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 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 Identity identity() { + return this.innerModel().identity(); + } + + public LocationData locationData() { + return this.innerModel().locationData(); + } + + public OSProfile osProfile() { + return this.innerModel().osProfile(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public StatusTypes status() { + return this.innerModel().status(); + } + + public OffsetDateTime lastStatusChange() { + return this.innerModel().lastStatusChange(); + } + + public List errorDetails() { + List inner = this.innerModel().errorDetails(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String agentVersion() { + return this.innerModel().agentVersion(); + } + + public String vmId() { + return this.innerModel().vmId(); + } + + public String displayName() { + return this.innerModel().displayName(); + } + + public String machineFqdn() { + return this.innerModel().machineFqdn(); + } + + public String clientPublicKey() { + return this.innerModel().clientPublicKey(); + } + + public String osName() { + return this.innerModel().osName(); + } + + public String osVersion() { + return this.innerModel().osVersion(); + } + + public String vmUuid() { + return this.innerModel().vmUuid(); + } + + public List extensions() { + List inner = this.innerModel().extensions(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String osSku() { + return this.innerModel().osSku(); + } + + public String domainName() { + return this.innerModel().domainName(); + } + + public String adFqdn() { + return this.innerModel().adFqdn(); + } + + public String dnsFqdn() { + return this.innerModel().dnsFqdn(); + } + + public MachineInner innerModel() { + return this.innerObject; + } + + private HybridComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/implementation/MachinesClientImpl.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/implementation/MachinesClientImpl.java new file mode 100644 index 0000000000000..9c34e3727e6e9 --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/implementation/MachinesClientImpl.java @@ -0,0 +1,905 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcompute.implementation; + +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.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.hybridcompute.fluent.MachinesClient; +import com.azure.resourcemanager.hybridcompute.fluent.models.MachineInner; +import com.azure.resourcemanager.hybridcompute.models.InstanceViewTypes; +import com.azure.resourcemanager.hybridcompute.models.MachineListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in MachinesClient. */ +public final class MachinesClientImpl implements MachinesClient { + private final ClientLogger logger = new ClientLogger(MachinesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final MachinesService service; + + /** The service client containing this operation class. */ + private final HybridComputeManagementClientImpl client; + + /** + * Initializes an instance of MachinesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + MachinesClientImpl(HybridComputeManagementClientImpl client) { + this.service = RestProxy.create(MachinesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for HybridComputeManagementClientMachines to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "HybridComputeManagem") + private interface MachinesService { + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute" + + "/machines/{name}") + @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("name") String name, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute" + + "/machines/{name}") + @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("name") String name, + @QueryParam("$expand") InstanceViewTypes expand, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute" + + "/machines") + @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.HybridCompute/machines") + @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); + } + + /** + * The operation to remove a hybrid machine identity in Azure. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the hybrid machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 name) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + name, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * The operation to remove a hybrid machine identity in Azure. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the hybrid machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 name, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + name, + accept, + context); + } + + /** + * The operation to remove a hybrid machine identity in Azure. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the hybrid machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 name) { + return deleteWithResponseAsync(resourceGroupName, name).flatMap((Response res) -> Mono.empty()); + } + + /** + * The operation to remove a hybrid machine identity in Azure. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the hybrid machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 name) { + deleteAsync(resourceGroupName, name).block(); + } + + /** + * The operation to remove a hybrid machine identity in Azure. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the hybrid machine. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 name, Context context) { + return deleteWithResponseAsync(resourceGroupName, name, context).block(); + } + + /** + * Retrieves information about the model view or the instance view of a hybrid machine. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the hybrid machine. + * @param expand The expand expression to apply on the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a hybrid machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String name, InstanceViewTypes expand) { + 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 (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + name, + expand, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Retrieves information about the model view or the instance view of a hybrid machine. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the hybrid machine. + * @param expand The expand expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a hybrid machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String name, InstanceViewTypes expand, 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 (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + name, + expand, + accept, + context); + } + + /** + * Retrieves information about the model view or the instance view of a hybrid machine. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the hybrid machine. + * @param expand The expand expression to apply on the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a hybrid machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync( + String resourceGroupName, String name, InstanceViewTypes expand) { + return getByResourceGroupWithResponseAsync(resourceGroupName, name, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Retrieves information about the model view or the instance view of a hybrid machine. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the hybrid machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a hybrid machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String name) { + final InstanceViewTypes expand = null; + return getByResourceGroupWithResponseAsync(resourceGroupName, name, expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Retrieves information about the model view or the instance view of a hybrid machine. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the hybrid machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a hybrid machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MachineInner getByResourceGroup(String resourceGroupName, String name) { + final InstanceViewTypes expand = null; + return getByResourceGroupAsync(resourceGroupName, name, expand).block(); + } + + /** + * Retrieves information about the model view or the instance view of a hybrid machine. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the hybrid machine. + * @param expand The expand expression to apply on the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a hybrid machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String name, InstanceViewTypes expand, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, name, expand, context).block(); + } + + /** + * Lists all the hybrid machines in the specified resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List hybrid machine operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Lists all the hybrid machines in the specified resource group. + * + * @param resourceGroupName The name of the 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 the List hybrid machine operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all the hybrid machines in the specified resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List hybrid machine operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Lists all the hybrid machines in the specified resource group. + * + * @param resourceGroupName The name of the 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 the List hybrid machine operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all the hybrid machines in the specified resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List hybrid machine operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Lists all the hybrid machines in the specified resource group. + * + * @param resourceGroupName The name of the 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 the List hybrid machine operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Lists all the hybrid machines in the specified 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 the List hybrid machine operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Lists all the hybrid machines in the specified 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 the List hybrid machine operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all the hybrid machines in the specified 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 the List hybrid machine operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>( + () -> listSinglePageAsync(), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Lists all the hybrid machines in the specified 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 the List hybrid machine operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all the hybrid machines in the specified 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 the List hybrid machine operation response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists all the hybrid machines in the specified 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 the List hybrid machine operation response. + */ + @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 the List hybrid machine operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .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 the List hybrid machine operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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 the List hybrid machine operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .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 the List hybrid machine operation response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/implementation/MachinesImpl.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/implementation/MachinesImpl.java new file mode 100644 index 0000000000000..335e0bd5e9a05 --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/implementation/MachinesImpl.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcompute.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.hybridcompute.HybridComputeManager; +import com.azure.resourcemanager.hybridcompute.fluent.MachinesClient; +import com.azure.resourcemanager.hybridcompute.fluent.models.MachineInner; +import com.azure.resourcemanager.hybridcompute.models.InstanceViewTypes; +import com.azure.resourcemanager.hybridcompute.models.Machine; +import com.azure.resourcemanager.hybridcompute.models.Machines; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class MachinesImpl implements Machines { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MachinesImpl.class); + + private final MachinesClient innerClient; + + private final HybridComputeManager serviceManager; + + public MachinesImpl(MachinesClient innerClient, HybridComputeManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void delete(String resourceGroupName, String name) { + this.serviceClient().delete(resourceGroupName, name); + } + + public Response deleteWithResponse(String resourceGroupName, String name, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, name, context); + } + + public Machine getByResourceGroup(String resourceGroupName, String name) { + MachineInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, name); + if (inner != null) { + return new MachineImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String name, InstanceViewTypes expand, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, name, expand, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new MachineImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return inner.mapPage(inner1 -> new MachineImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return inner.mapPage(inner1 -> new MachineImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return inner.mapPage(inner1 -> new MachineImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return inner.mapPage(inner1 -> new MachineImpl(inner1, this.manager())); + } + + private MachinesClient serviceClient() { + return this.innerClient; + } + + private HybridComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/implementation/OperationValueImpl.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/implementation/OperationValueImpl.java new file mode 100644 index 0000000000000..15ad9129c5f01 --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/implementation/OperationValueImpl.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcompute.implementation; + +import com.azure.resourcemanager.hybridcompute.HybridComputeManager; +import com.azure.resourcemanager.hybridcompute.fluent.models.OperationValueInner; +import com.azure.resourcemanager.hybridcompute.models.OperationValue; + +public final class OperationValueImpl implements OperationValue { + private OperationValueInner innerObject; + + private final HybridComputeManager serviceManager; + + public OperationValueImpl(OperationValueInner innerObject, HybridComputeManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String origin() { + return this.innerModel().origin(); + } + + public String name() { + return this.innerModel().name(); + } + + public String operation() { + return this.innerModel().operation(); + } + + public String resource() { + return this.innerModel().resource(); + } + + public String description() { + return this.innerModel().description(); + } + + public String provider() { + return this.innerModel().provider(); + } + + public OperationValueInner innerModel() { + return this.innerObject; + } + + private HybridComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/implementation/OperationsClientImpl.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/implementation/OperationsClientImpl.java new file mode 100644 index 0000000000000..12a3612903b3b --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/implementation/OperationsClientImpl.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.hybridcompute.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.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.hybridcompute.fluent.OperationsClient; +import com.azure.resourcemanager.hybridcompute.fluent.models.OperationValueInner; +import com.azure.resourcemanager.hybridcompute.models.OperationListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public final class OperationsClientImpl implements OperationsClient { + 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 HybridComputeManagementClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(HybridComputeManagementClientImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for HybridComputeManagementClientOperations to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "HybridComputeManagem") + private interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.HybridCompute/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a list of hybrid compute operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of hybrid compute operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets a list of hybrid compute operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of hybrid compute operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Gets a list of hybrid compute operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of hybrid compute operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync()); + } + + /** + * Gets a list of hybrid compute operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of hybrid compute operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context)); + } + + /** + * Gets a list of hybrid compute operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of hybrid compute operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Gets a list of hybrid compute operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of hybrid compute operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/implementation/OperationsImpl.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..5e638178e01b0 --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/implementation/OperationsImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcompute.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.hybridcompute.HybridComputeManager; +import com.azure.resourcemanager.hybridcompute.fluent.OperationsClient; +import com.azure.resourcemanager.hybridcompute.fluent.models.OperationValueInner; +import com.azure.resourcemanager.hybridcompute.models.OperationValue; +import com.azure.resourcemanager.hybridcompute.models.Operations; +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 HybridComputeManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, HybridComputeManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return inner.mapPage(inner1 -> new OperationValueImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return inner.mapPage(inner1 -> new OperationValueImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private HybridComputeManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/implementation/Utils.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/implementation/Utils.java new file mode 100644 index 0000000000000..da65f7b68a01f --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/implementation/Utils.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.hybridcompute.implementation; + +import java.util.Arrays; +import java.util.Iterator; + +final class Utils { + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.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; + } +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/implementation/package-info.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/implementation/package-info.java new file mode 100644 index 0000000000000..dcca713ae6c8f --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/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 HybridComputeManagementClient. The Hybrid Compute Management Client. */ +package com.azure.resourcemanager.hybridcompute.implementation; diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/Identity.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/Identity.java new file mode 100644 index 0000000000000..0794177d8bdb7 --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/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.hybridcompute.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; + +/** Managed Identity. */ +@Fluent +public class Identity { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Identity.class); + + /* + * The identity type. + */ + @JsonProperty(value = "type") + private String type; + + /* + * The identity's principal id. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private String principalId; + + /* + * The identity's tenant id. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private String tenantId; + + /** + * Get the type property: The identity type. + * + * @return the type value. + */ + public String 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(String type) { + this.type = type; + return this; + } + + /** + * Get the principalId property: The identity's principal id. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the tenantId property: The identity's tenant id. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/InstanceViewTypes.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/InstanceViewTypes.java new file mode 100644 index 0000000000000..bd5a2020e37b5 --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/InstanceViewTypes.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.hybridcompute.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for InstanceViewTypes. */ +public final class InstanceViewTypes extends ExpandableStringEnum { + /** Static value instanceView for InstanceViewTypes. */ + public static final InstanceViewTypes INSTANCE_VIEW = fromString("instanceView"); + + /** + * Creates or finds a InstanceViewTypes from its string representation. + * + * @param name a name to look for. + * @return the corresponding InstanceViewTypes. + */ + @JsonCreator + public static InstanceViewTypes fromString(String name) { + return fromString(name, InstanceViewTypes.class); + } + + /** @return known InstanceViewTypes values. */ + public static Collection values() { + return values(InstanceViewTypes.class); + } +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/LocationData.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/LocationData.java new file mode 100644 index 0000000000000..85af50954bd03 --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/LocationData.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcompute.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; + +/** Metadata pertaining to the geographic location of the resource. */ +@Fluent +public final class LocationData { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LocationData.class); + + /* + * A canonical name for the geographic or physical location. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The city or locality where the resource is located. + */ + @JsonProperty(value = "city") + private String city; + + /* + * The district, state, or province where the resource is located. + */ + @JsonProperty(value = "district") + private String district; + + /* + * The country or region where the resource is located + */ + @JsonProperty(value = "countryOrRegion") + private String countryOrRegion; + + /** + * Get the name property: A canonical name for the geographic or physical location. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: A canonical name for the geographic or physical location. + * + * @param name the name value to set. + * @return the LocationData object itself. + */ + public LocationData withName(String name) { + this.name = name; + return this; + } + + /** + * Get the city property: The city or locality where the resource is located. + * + * @return the city value. + */ + public String city() { + return this.city; + } + + /** + * Set the city property: The city or locality where the resource is located. + * + * @param city the city value to set. + * @return the LocationData object itself. + */ + public LocationData withCity(String city) { + this.city = city; + return this; + } + + /** + * Get the district property: The district, state, or province where the resource is located. + * + * @return the district value. + */ + public String district() { + return this.district; + } + + /** + * Set the district property: The district, state, or province where the resource is located. + * + * @param district the district value to set. + * @return the LocationData object itself. + */ + public LocationData withDistrict(String district) { + this.district = district; + return this; + } + + /** + * Get the countryOrRegion property: The country or region where the resource is located. + * + * @return the countryOrRegion value. + */ + public String countryOrRegion() { + return this.countryOrRegion; + } + + /** + * Set the countryOrRegion property: The country or region where the resource is located. + * + * @param countryOrRegion the countryOrRegion value to set. + * @return the LocationData object itself. + */ + public LocationData withCountryOrRegion(String countryOrRegion) { + this.countryOrRegion = countryOrRegion; + 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 LocationData")); + } + } +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/Machine.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/Machine.java new file mode 100644 index 0000000000000..41e7bdc2cf1ae --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/Machine.java @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcompute.models; + +import com.azure.core.management.exception.ManagementError; +import com.azure.resourcemanager.hybridcompute.fluent.models.MachineInner; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of Machine. */ +public interface Machine { + /** + * 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 identity property: Managed Identity. + * + * @return the identity value. + */ + Identity identity(); + + /** + * Gets the locationData property: Metadata pertaining to the geographic location of the resource. + * + * @return the locationData value. + */ + LocationData locationData(); + + /** + * Gets the osProfile property: Specifies the operating system settings for the hybrid machine. + * + * @return the osProfile value. + */ + OSProfile osProfile(); + + /** + * Gets the provisioningState property: The provisioning state, which only appears in the response. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the status property: The status of the hybrid machine agent. + * + * @return the status value. + */ + StatusTypes status(); + + /** + * Gets the lastStatusChange property: The time of the last status change. + * + * @return the lastStatusChange value. + */ + OffsetDateTime lastStatusChange(); + + /** + * Gets the errorDetails property: Details about the error state. + * + * @return the errorDetails value. + */ + List errorDetails(); + + /** + * Gets the agentVersion property: The hybrid machine agent full version. + * + * @return the agentVersion value. + */ + String agentVersion(); + + /** + * Gets the vmId property: Specifies the hybrid machine unique ID. + * + * @return the vmId value. + */ + String vmId(); + + /** + * Gets the displayName property: Specifies the hybrid machine display name. + * + * @return the displayName value. + */ + String displayName(); + + /** + * Gets the machineFqdn property: Specifies the hybrid machine FQDN. + * + * @return the machineFqdn value. + */ + String machineFqdn(); + + /** + * Gets the clientPublicKey property: Public Key that the client provides to be used during initial resource + * onboarding. + * + * @return the clientPublicKey value. + */ + String clientPublicKey(); + + /** + * Gets the osName property: The Operating System running on the hybrid machine. + * + * @return the osName value. + */ + String osName(); + + /** + * Gets the osVersion property: The version of Operating System running on the hybrid machine. + * + * @return the osVersion value. + */ + String osVersion(); + + /** + * Gets the vmUuid property: Specifies the Arc Machine's unique SMBIOS ID. + * + * @return the vmUuid value. + */ + String vmUuid(); + + /** + * Gets the extensions property: Machine Extensions information. + * + * @return the extensions value. + */ + List extensions(); + + /** + * Gets the osSku property: Specifies the Operating System product SKU. + * + * @return the osSku value. + */ + String osSku(); + + /** + * Gets the domainName property: Specifies the Windows domain name. + * + * @return the domainName value. + */ + String domainName(); + + /** + * Gets the adFqdn property: Specifies the AD fully qualified display name. + * + * @return the adFqdn value. + */ + String adFqdn(); + + /** + * Gets the dnsFqdn property: Specifies the DNS fully qualified display name. + * + * @return the dnsFqdn value. + */ + String dnsFqdn(); + + /** + * Gets the inner com.azure.resourcemanager.hybridcompute.fluent.models.MachineInner object. + * + * @return the inner object. + */ + MachineInner innerModel(); +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachineExtension.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachineExtension.java new file mode 100644 index 0000000000000..4ad4eea736b52 --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachineExtension.java @@ -0,0 +1,444 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcompute.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.hybridcompute.fluent.models.MachineExtensionInner; +import java.util.Map; + +/** An immutable client-side representation of MachineExtension. */ +public interface MachineExtension { + /** + * 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 forceUpdateTag property: How the extension handler should be forced to update even if the extension + * configuration has not changed. + * + * @return the forceUpdateTag value. + */ + String forceUpdateTag(); + + /** + * Gets the publisher property: The name of the extension handler publisher. + * + * @return the publisher value. + */ + String publisher(); + + /** + * Gets the typePropertiesType property: Specifies the type of the extension; an example is "CustomScriptExtension". + * + * @return the typePropertiesType value. + */ + String typePropertiesType(); + + /** + * Gets the typeHandlerVersion property: Specifies the version of the script handler. + * + * @return the typeHandlerVersion value. + */ + String typeHandlerVersion(); + + /** + * Gets the autoUpgradeMinorVersion property: Indicates whether the extension should use a newer minor version if + * one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless + * redeployed, even with this property set to true. + * + * @return the autoUpgradeMinorVersion value. + */ + Boolean autoUpgradeMinorVersion(); + + /** + * Gets the settings property: Json formatted public settings for the extension. + * + * @return the settings value. + */ + Object settings(); + + /** + * Gets the protectedSettings property: The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all. + * + * @return the protectedSettings value. + */ + Object protectedSettings(); + + /** + * Gets the provisioningState property: The provisioning state, which only appears in the response. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the instanceView property: The machine extension instance view. + * + * @return the instanceView value. + */ + MachineExtensionInstanceView instanceView(); + + /** + * 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.hybridcompute.fluent.models.MachineExtensionInner object. + * + * @return the inner object. + */ + MachineExtensionInner innerModel(); + + /** The entirety of the MachineExtension definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, + DefinitionStages.WithCreate { + } + /** The MachineExtension definition stages. */ + interface DefinitionStages { + /** The first stage of the MachineExtension definition. */ + interface Blank extends WithLocation { + } + /** The stage of the MachineExtension definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + /** The stage of the MachineExtension definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, name. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the machine where the extension should be created or updated. + * @return the next definition stage. + */ + WithCreate withExistingMachine(String resourceGroupName, String name); + } + /** + * The stage of the MachineExtension 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.WithForceUpdateTag, + DefinitionStages.WithPublisher, + DefinitionStages.WithTypePropertiesType, + DefinitionStages.WithTypeHandlerVersion, + DefinitionStages.WithAutoUpgradeMinorVersion, + DefinitionStages.WithSettings, + DefinitionStages.WithProtectedSettings, + DefinitionStages.WithInstanceView { + /** + * Executes the create request. + * + * @return the created resource. + */ + MachineExtension create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + MachineExtension create(Context context); + } + /** The stage of the MachineExtension 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 MachineExtension definition allowing to specify forceUpdateTag. */ + interface WithForceUpdateTag { + /** + * Specifies the forceUpdateTag property: How the extension handler should be forced to update even if the + * extension configuration has not changed.. + * + * @param forceUpdateTag How the extension handler should be forced to update even if the extension + * configuration has not changed. + * @return the next definition stage. + */ + WithCreate withForceUpdateTag(String forceUpdateTag); + } + /** The stage of the MachineExtension definition allowing to specify publisher. */ + interface WithPublisher { + /** + * Specifies the publisher property: The name of the extension handler publisher.. + * + * @param publisher The name of the extension handler publisher. + * @return the next definition stage. + */ + WithCreate withPublisher(String publisher); + } + /** The stage of the MachineExtension definition allowing to specify typePropertiesType. */ + interface WithTypePropertiesType { + /** + * Specifies the typePropertiesType property: Specifies the type of the extension; an example is + * "CustomScriptExtension".. + * + * @param typePropertiesType Specifies the type of the extension; an example is "CustomScriptExtension". + * @return the next definition stage. + */ + WithCreate withTypePropertiesType(String typePropertiesType); + } + /** The stage of the MachineExtension definition allowing to specify typeHandlerVersion. */ + interface WithTypeHandlerVersion { + /** + * Specifies the typeHandlerVersion property: Specifies the version of the script handler.. + * + * @param typeHandlerVersion Specifies the version of the script handler. + * @return the next definition stage. + */ + WithCreate withTypeHandlerVersion(String typeHandlerVersion); + } + /** The stage of the MachineExtension definition allowing to specify autoUpgradeMinorVersion. */ + interface WithAutoUpgradeMinorVersion { + /** + * Specifies the autoUpgradeMinorVersion property: Indicates whether the extension should use a newer minor + * version if one is available at deployment time. Once deployed, however, the extension will not upgrade + * minor versions unless redeployed, even with this property set to true.. + * + * @param autoUpgradeMinorVersion Indicates whether the extension should use a newer minor version if one is + * available at deployment time. Once deployed, however, the extension will not upgrade minor versions + * unless redeployed, even with this property set to true. + * @return the next definition stage. + */ + WithCreate withAutoUpgradeMinorVersion(Boolean autoUpgradeMinorVersion); + } + /** The stage of the MachineExtension definition allowing to specify settings. */ + interface WithSettings { + /** + * Specifies the settings property: Json formatted public settings for the extension.. + * + * @param settings Json formatted public settings for the extension. + * @return the next definition stage. + */ + WithCreate withSettings(Object settings); + } + /** The stage of the MachineExtension definition allowing to specify protectedSettings. */ + interface WithProtectedSettings { + /** + * Specifies the protectedSettings property: The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all.. + * + * @param protectedSettings The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all. + * @return the next definition stage. + */ + WithCreate withProtectedSettings(Object protectedSettings); + } + /** The stage of the MachineExtension definition allowing to specify instanceView. */ + interface WithInstanceView { + /** + * Specifies the instanceView property: The machine extension instance view.. + * + * @param instanceView The machine extension instance view. + * @return the next definition stage. + */ + WithCreate withInstanceView(MachineExtensionInstanceView instanceView); + } + } + /** + * Begins update for the MachineExtension resource. + * + * @return the stage of resource update. + */ + MachineExtension.Update update(); + + /** The template for MachineExtension update. */ + interface Update + extends UpdateStages.WithTags, + UpdateStages.WithForceUpdateTag, + UpdateStages.WithPublisher, + UpdateStages.WithType, + UpdateStages.WithTypeHandlerVersion, + UpdateStages.WithAutoUpgradeMinorVersion, + UpdateStages.WithSettings, + UpdateStages.WithProtectedSettings { + /** + * Executes the update request. + * + * @return the updated resource. + */ + MachineExtension apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + MachineExtension apply(Context context); + } + /** The MachineExtension update stages. */ + interface UpdateStages { + /** The stage of the MachineExtension update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the MachineExtension update allowing to specify forceUpdateTag. */ + interface WithForceUpdateTag { + /** + * Specifies the forceUpdateTag property: How the extension handler should be forced to update even if the + * extension configuration has not changed.. + * + * @param forceUpdateTag How the extension handler should be forced to update even if the extension + * configuration has not changed. + * @return the next definition stage. + */ + Update withForceUpdateTag(String forceUpdateTag); + } + /** The stage of the MachineExtension update allowing to specify publisher. */ + interface WithPublisher { + /** + * Specifies the publisher property: The name of the extension handler publisher.. + * + * @param publisher The name of the extension handler publisher. + * @return the next definition stage. + */ + Update withPublisher(String publisher); + } + /** The stage of the MachineExtension update allowing to specify type. */ + interface WithType { + /** + * Specifies the type property: Specifies the type of the extension; an example is "CustomScriptExtension".. + * + * @param type Specifies the type of the extension; an example is "CustomScriptExtension". + * @return the next definition stage. + */ + Update withType(String type); + } + /** The stage of the MachineExtension update allowing to specify typeHandlerVersion. */ + interface WithTypeHandlerVersion { + /** + * Specifies the typeHandlerVersion property: Specifies the version of the script handler.. + * + * @param typeHandlerVersion Specifies the version of the script handler. + * @return the next definition stage. + */ + Update withTypeHandlerVersion(String typeHandlerVersion); + } + /** The stage of the MachineExtension update allowing to specify autoUpgradeMinorVersion. */ + interface WithAutoUpgradeMinorVersion { + /** + * Specifies the autoUpgradeMinorVersion property: Indicates whether the extension should use a newer minor + * version if one is available at deployment time. Once deployed, however, the extension will not upgrade + * minor versions unless redeployed, even with this property set to true.. + * + * @param autoUpgradeMinorVersion Indicates whether the extension should use a newer minor version if one is + * available at deployment time. Once deployed, however, the extension will not upgrade minor versions + * unless redeployed, even with this property set to true. + * @return the next definition stage. + */ + Update withAutoUpgradeMinorVersion(Boolean autoUpgradeMinorVersion); + } + /** The stage of the MachineExtension update allowing to specify settings. */ + interface WithSettings { + /** + * Specifies the settings property: Json formatted public settings for the extension.. + * + * @param settings Json formatted public settings for the extension. + * @return the next definition stage. + */ + Update withSettings(Object settings); + } + /** The stage of the MachineExtension update allowing to specify protectedSettings. */ + interface WithProtectedSettings { + /** + * Specifies the protectedSettings property: The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all.. + * + * @param protectedSettings The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all. + * @return the next definition stage. + */ + Update withProtectedSettings(Object protectedSettings); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + MachineExtension refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + MachineExtension refresh(Context context); +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachineExtensionInstanceView.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachineExtensionInstanceView.java new file mode 100644 index 0000000000000..0f72f87e93ad2 --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachineExtensionInstanceView.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcompute.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes the Machine Extension Instance View. */ +@Fluent +public class MachineExtensionInstanceView { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MachineExtensionInstanceView.class); + + /* + * The machine extension name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * Specifies the type of the extension; an example is + * "CustomScriptExtension". + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /* + * Specifies the version of the script handler. + */ + @JsonProperty(value = "typeHandlerVersion", access = JsonProperty.Access.WRITE_ONLY) + private String typeHandlerVersion; + + /* + * Instance view status. + */ + @JsonProperty(value = "status") + private MachineExtensionInstanceViewStatus status; + + /** + * Get the name property: The machine extension name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the type property: Specifies the type of the extension; an example is "CustomScriptExtension". + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the typeHandlerVersion property: Specifies the version of the script handler. + * + * @return the typeHandlerVersion value. + */ + public String typeHandlerVersion() { + return this.typeHandlerVersion; + } + + /** + * Get the status property: Instance view status. + * + * @return the status value. + */ + public MachineExtensionInstanceViewStatus status() { + return this.status; + } + + /** + * Set the status property: Instance view status. + * + * @param status the status value to set. + * @return the MachineExtensionInstanceView object itself. + */ + public MachineExtensionInstanceView withStatus(MachineExtensionInstanceViewStatus status) { + this.status = status; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (status() != null) { + status().validate(); + } + } +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachineExtensionInstanceViewStatus.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachineExtensionInstanceViewStatus.java new file mode 100644 index 0000000000000..cb1efaa822d9c --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachineExtensionInstanceViewStatus.java @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcompute.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; + +/** Instance view status. */ +@Immutable +public final class MachineExtensionInstanceViewStatus { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MachineExtensionInstanceViewStatus.class); + + /* + * The status code. + */ + @JsonProperty(value = "code", access = JsonProperty.Access.WRITE_ONLY) + private String code; + + /* + * The level code. + */ + @JsonProperty(value = "level", access = JsonProperty.Access.WRITE_ONLY) + private StatusLevelTypes level; + + /* + * The short localizable label for the status. + */ + @JsonProperty(value = "displayStatus", access = JsonProperty.Access.WRITE_ONLY) + private String displayStatus; + + /* + * The detailed status message, including for alerts and error messages. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /* + * The time of the status. + */ + @JsonProperty(value = "time", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime time; + + /** + * Get the code property: The status code. + * + * @return the code value. + */ + public String code() { + return this.code; + } + + /** + * Get the level property: The level code. + * + * @return the level value. + */ + public StatusLevelTypes level() { + return this.level; + } + + /** + * Get the displayStatus property: The short localizable label for the status. + * + * @return the displayStatus value. + */ + public String displayStatus() { + return this.displayStatus; + } + + /** + * Get the message property: The detailed status message, including for alerts and error messages. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Get the time property: The time of the status. + * + * @return the time value. + */ + public OffsetDateTime time() { + return this.time; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachineExtensionProperties.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachineExtensionProperties.java new file mode 100644 index 0000000000000..7c0d47ced5727 --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachineExtensionProperties.java @@ -0,0 +1,264 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcompute.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes the properties of a Machine Extension. */ +@Fluent +public class MachineExtensionProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MachineExtensionProperties.class); + + /* + * How the extension handler should be forced to update even if the + * extension configuration has not changed. + */ + @JsonProperty(value = "forceUpdateTag") + private String forceUpdateTag; + + /* + * The name of the extension handler publisher. + */ + @JsonProperty(value = "publisher") + private String publisher; + + /* + * Specifies the type of the extension; an example is + * "CustomScriptExtension". + */ + @JsonProperty(value = "type") + private String type; + + /* + * Specifies the version of the script handler. + */ + @JsonProperty(value = "typeHandlerVersion") + private String typeHandlerVersion; + + /* + * Indicates whether the extension should use a newer minor version if one + * is available at deployment time. Once deployed, however, the extension + * will not upgrade minor versions unless redeployed, even with this + * property set to true. + */ + @JsonProperty(value = "autoUpgradeMinorVersion") + private Boolean autoUpgradeMinorVersion; + + /* + * Json formatted public settings for the extension. + */ + @JsonProperty(value = "settings") + private Object settings; + + /* + * The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all. + */ + @JsonProperty(value = "protectedSettings") + private Object protectedSettings; + + /* + * The provisioning state, which only appears in the response. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * The machine extension instance view. + */ + @JsonProperty(value = "instanceView") + private MachineExtensionInstanceView instanceView; + + /** + * Get the forceUpdateTag property: How the extension handler should be forced to update even if the extension + * configuration has not changed. + * + * @return the forceUpdateTag value. + */ + public String forceUpdateTag() { + return this.forceUpdateTag; + } + + /** + * Set the forceUpdateTag property: How the extension handler should be forced to update even if the extension + * configuration has not changed. + * + * @param forceUpdateTag the forceUpdateTag value to set. + * @return the MachineExtensionProperties object itself. + */ + public MachineExtensionProperties withForceUpdateTag(String forceUpdateTag) { + this.forceUpdateTag = forceUpdateTag; + return this; + } + + /** + * Get the publisher property: The name of the extension handler publisher. + * + * @return the publisher value. + */ + public String publisher() { + return this.publisher; + } + + /** + * Set the publisher property: The name of the extension handler publisher. + * + * @param publisher the publisher value to set. + * @return the MachineExtensionProperties object itself. + */ + public MachineExtensionProperties withPublisher(String publisher) { + this.publisher = publisher; + return this; + } + + /** + * Get the type property: Specifies the type of the extension; an example is "CustomScriptExtension". + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: Specifies the type of the extension; an example is "CustomScriptExtension". + * + * @param type the type value to set. + * @return the MachineExtensionProperties object itself. + */ + public MachineExtensionProperties withType(String type) { + this.type = type; + return this; + } + + /** + * Get the typeHandlerVersion property: Specifies the version of the script handler. + * + * @return the typeHandlerVersion value. + */ + public String typeHandlerVersion() { + return this.typeHandlerVersion; + } + + /** + * Set the typeHandlerVersion property: Specifies the version of the script handler. + * + * @param typeHandlerVersion the typeHandlerVersion value to set. + * @return the MachineExtensionProperties object itself. + */ + public MachineExtensionProperties withTypeHandlerVersion(String typeHandlerVersion) { + this.typeHandlerVersion = typeHandlerVersion; + return this; + } + + /** + * Get the autoUpgradeMinorVersion property: Indicates whether the extension should use a newer minor version if one + * is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless + * redeployed, even with this property set to true. + * + * @return the autoUpgradeMinorVersion value. + */ + public Boolean autoUpgradeMinorVersion() { + return this.autoUpgradeMinorVersion; + } + + /** + * Set the autoUpgradeMinorVersion property: Indicates whether the extension should use a newer minor version if one + * is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless + * redeployed, even with this property set to true. + * + * @param autoUpgradeMinorVersion the autoUpgradeMinorVersion value to set. + * @return the MachineExtensionProperties object itself. + */ + public MachineExtensionProperties withAutoUpgradeMinorVersion(Boolean autoUpgradeMinorVersion) { + this.autoUpgradeMinorVersion = autoUpgradeMinorVersion; + return this; + } + + /** + * Get the settings property: Json formatted public settings for the extension. + * + * @return the settings value. + */ + public Object settings() { + return this.settings; + } + + /** + * Set the settings property: Json formatted public settings for the extension. + * + * @param settings the settings value to set. + * @return the MachineExtensionProperties object itself. + */ + public MachineExtensionProperties withSettings(Object settings) { + this.settings = settings; + return this; + } + + /** + * Get the protectedSettings property: The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all. + * + * @return the protectedSettings value. + */ + public Object protectedSettings() { + return this.protectedSettings; + } + + /** + * Set the protectedSettings property: The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all. + * + * @param protectedSettings the protectedSettings value to set. + * @return the MachineExtensionProperties object itself. + */ + public MachineExtensionProperties withProtectedSettings(Object protectedSettings) { + this.protectedSettings = protectedSettings; + return this; + } + + /** + * Get the provisioningState property: The provisioning state, which only appears in the response. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the instanceView property: The machine extension instance view. + * + * @return the instanceView value. + */ + public MachineExtensionInstanceView instanceView() { + return this.instanceView; + } + + /** + * Set the instanceView property: The machine extension instance view. + * + * @param instanceView the instanceView value to set. + * @return the MachineExtensionProperties object itself. + */ + public MachineExtensionProperties withInstanceView(MachineExtensionInstanceView instanceView) { + this.instanceView = instanceView; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (instanceView() != null) { + instanceView().validate(); + } + } +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachineExtensionPropertiesAutoGenerated.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachineExtensionPropertiesAutoGenerated.java new file mode 100644 index 0000000000000..bd4c347c47701 --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachineExtensionPropertiesAutoGenerated.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.hybridcompute.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** Describes Machine Extension Properties. */ +@Immutable +public final class MachineExtensionPropertiesAutoGenerated extends MachineExtensionProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MachineExtensionPropertiesAutoGenerated.class); + + /** {@inheritDoc} */ + @Override + public MachineExtensionPropertiesAutoGenerated withForceUpdateTag(String forceUpdateTag) { + super.withForceUpdateTag(forceUpdateTag); + return this; + } + + /** {@inheritDoc} */ + @Override + public MachineExtensionPropertiesAutoGenerated withPublisher(String publisher) { + super.withPublisher(publisher); + return this; + } + + /** {@inheritDoc} */ + @Override + public MachineExtensionPropertiesAutoGenerated withType(String type) { + super.withType(type); + return this; + } + + /** {@inheritDoc} */ + @Override + public MachineExtensionPropertiesAutoGenerated withTypeHandlerVersion(String typeHandlerVersion) { + super.withTypeHandlerVersion(typeHandlerVersion); + return this; + } + + /** {@inheritDoc} */ + @Override + public MachineExtensionPropertiesAutoGenerated withAutoUpgradeMinorVersion(Boolean autoUpgradeMinorVersion) { + super.withAutoUpgradeMinorVersion(autoUpgradeMinorVersion); + return this; + } + + /** {@inheritDoc} */ + @Override + public MachineExtensionPropertiesAutoGenerated withSettings(Object settings) { + super.withSettings(settings); + return this; + } + + /** {@inheritDoc} */ + @Override + public MachineExtensionPropertiesAutoGenerated withProtectedSettings(Object protectedSettings) { + super.withProtectedSettings(protectedSettings); + return this; + } + + /** {@inheritDoc} */ + @Override + public MachineExtensionPropertiesAutoGenerated withInstanceView(MachineExtensionInstanceView instanceView) { + super.withInstanceView(instanceView); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachineExtensionPropertiesInstanceView.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachineExtensionPropertiesInstanceView.java new file mode 100644 index 0000000000000..d4d6d5a33796f --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachineExtensionPropertiesInstanceView.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.hybridcompute.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** The machine extension instance view. */ +@Immutable +public final class MachineExtensionPropertiesInstanceView extends MachineExtensionInstanceView { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MachineExtensionPropertiesInstanceView.class); + + /** {@inheritDoc} */ + @Override + public MachineExtensionPropertiesInstanceView withStatus(MachineExtensionInstanceViewStatus status) { + super.withStatus(status); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachineExtensionUpdate.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachineExtensionUpdate.java new file mode 100644 index 0000000000000..b37ba8a1c5957 --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachineExtensionUpdate.java @@ -0,0 +1,232 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcompute.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; + +/** Describes a Machine Extension Update. */ +@JsonFlatten +@Fluent +public class MachineExtensionUpdate extends UpdateResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MachineExtensionUpdate.class); + + /* + * How the extension handler should be forced to update even if the + * extension configuration has not changed. + */ + @JsonProperty(value = "properties.forceUpdateTag") + private String forceUpdateTag; + + /* + * The name of the extension handler publisher. + */ + @JsonProperty(value = "properties.publisher") + private String publisher; + + /* + * Specifies the type of the extension; an example is + * "CustomScriptExtension". + */ + @JsonProperty(value = "properties.type") + private String type; + + /* + * Specifies the version of the script handler. + */ + @JsonProperty(value = "properties.typeHandlerVersion") + private String typeHandlerVersion; + + /* + * Indicates whether the extension should use a newer minor version if one + * is available at deployment time. Once deployed, however, the extension + * will not upgrade minor versions unless redeployed, even with this + * property set to true. + */ + @JsonProperty(value = "properties.autoUpgradeMinorVersion") + private Boolean autoUpgradeMinorVersion; + + /* + * Json formatted public settings for the extension. + */ + @JsonProperty(value = "properties.settings") + private Object settings; + + /* + * The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all. + */ + @JsonProperty(value = "properties.protectedSettings") + private Object protectedSettings; + + /** + * Get the forceUpdateTag property: How the extension handler should be forced to update even if the extension + * configuration has not changed. + * + * @return the forceUpdateTag value. + */ + public String forceUpdateTag() { + return this.forceUpdateTag; + } + + /** + * Set the forceUpdateTag property: How the extension handler should be forced to update even if the extension + * configuration has not changed. + * + * @param forceUpdateTag the forceUpdateTag value to set. + * @return the MachineExtensionUpdate object itself. + */ + public MachineExtensionUpdate withForceUpdateTag(String forceUpdateTag) { + this.forceUpdateTag = forceUpdateTag; + return this; + } + + /** + * Get the publisher property: The name of the extension handler publisher. + * + * @return the publisher value. + */ + public String publisher() { + return this.publisher; + } + + /** + * Set the publisher property: The name of the extension handler publisher. + * + * @param publisher the publisher value to set. + * @return the MachineExtensionUpdate object itself. + */ + public MachineExtensionUpdate withPublisher(String publisher) { + this.publisher = publisher; + return this; + } + + /** + * Get the type property: Specifies the type of the extension; an example is "CustomScriptExtension". + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: Specifies the type of the extension; an example is "CustomScriptExtension". + * + * @param type the type value to set. + * @return the MachineExtensionUpdate object itself. + */ + public MachineExtensionUpdate withType(String type) { + this.type = type; + return this; + } + + /** + * Get the typeHandlerVersion property: Specifies the version of the script handler. + * + * @return the typeHandlerVersion value. + */ + public String typeHandlerVersion() { + return this.typeHandlerVersion; + } + + /** + * Set the typeHandlerVersion property: Specifies the version of the script handler. + * + * @param typeHandlerVersion the typeHandlerVersion value to set. + * @return the MachineExtensionUpdate object itself. + */ + public MachineExtensionUpdate withTypeHandlerVersion(String typeHandlerVersion) { + this.typeHandlerVersion = typeHandlerVersion; + return this; + } + + /** + * Get the autoUpgradeMinorVersion property: Indicates whether the extension should use a newer minor version if one + * is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless + * redeployed, even with this property set to true. + * + * @return the autoUpgradeMinorVersion value. + */ + public Boolean autoUpgradeMinorVersion() { + return this.autoUpgradeMinorVersion; + } + + /** + * Set the autoUpgradeMinorVersion property: Indicates whether the extension should use a newer minor version if one + * is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless + * redeployed, even with this property set to true. + * + * @param autoUpgradeMinorVersion the autoUpgradeMinorVersion value to set. + * @return the MachineExtensionUpdate object itself. + */ + public MachineExtensionUpdate withAutoUpgradeMinorVersion(Boolean autoUpgradeMinorVersion) { + this.autoUpgradeMinorVersion = autoUpgradeMinorVersion; + return this; + } + + /** + * Get the settings property: Json formatted public settings for the extension. + * + * @return the settings value. + */ + public Object settings() { + return this.settings; + } + + /** + * Set the settings property: Json formatted public settings for the extension. + * + * @param settings the settings value to set. + * @return the MachineExtensionUpdate object itself. + */ + public MachineExtensionUpdate withSettings(Object settings) { + this.settings = settings; + return this; + } + + /** + * Get the protectedSettings property: The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all. + * + * @return the protectedSettings value. + */ + public Object protectedSettings() { + return this.protectedSettings; + } + + /** + * Set the protectedSettings property: The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all. + * + * @param protectedSettings the protectedSettings value to set. + * @return the MachineExtensionUpdate object itself. + */ + public MachineExtensionUpdate withProtectedSettings(Object protectedSettings) { + this.protectedSettings = protectedSettings; + return this; + } + + /** {@inheritDoc} */ + @Override + public MachineExtensionUpdate 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/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachineExtensionUpdateProperties.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachineExtensionUpdateProperties.java new file mode 100644 index 0000000000000..06dd46655a642 --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachineExtensionUpdateProperties.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.hybridcompute.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes the properties of a Machine Extension. */ +@Fluent +public class MachineExtensionUpdateProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MachineExtensionUpdateProperties.class); + + /* + * How the extension handler should be forced to update even if the + * extension configuration has not changed. + */ + @JsonProperty(value = "forceUpdateTag") + private String forceUpdateTag; + + /* + * The name of the extension handler publisher. + */ + @JsonProperty(value = "publisher") + private String publisher; + + /* + * Specifies the type of the extension; an example is + * "CustomScriptExtension". + */ + @JsonProperty(value = "type") + private String type; + + /* + * Specifies the version of the script handler. + */ + @JsonProperty(value = "typeHandlerVersion") + private String typeHandlerVersion; + + /* + * Indicates whether the extension should use a newer minor version if one + * is available at deployment time. Once deployed, however, the extension + * will not upgrade minor versions unless redeployed, even with this + * property set to true. + */ + @JsonProperty(value = "autoUpgradeMinorVersion") + private Boolean autoUpgradeMinorVersion; + + /* + * Json formatted public settings for the extension. + */ + @JsonProperty(value = "settings") + private Object settings; + + /* + * The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all. + */ + @JsonProperty(value = "protectedSettings") + private Object protectedSettings; + + /** + * Get the forceUpdateTag property: How the extension handler should be forced to update even if the extension + * configuration has not changed. + * + * @return the forceUpdateTag value. + */ + public String forceUpdateTag() { + return this.forceUpdateTag; + } + + /** + * Set the forceUpdateTag property: How the extension handler should be forced to update even if the extension + * configuration has not changed. + * + * @param forceUpdateTag the forceUpdateTag value to set. + * @return the MachineExtensionUpdateProperties object itself. + */ + public MachineExtensionUpdateProperties withForceUpdateTag(String forceUpdateTag) { + this.forceUpdateTag = forceUpdateTag; + return this; + } + + /** + * Get the publisher property: The name of the extension handler publisher. + * + * @return the publisher value. + */ + public String publisher() { + return this.publisher; + } + + /** + * Set the publisher property: The name of the extension handler publisher. + * + * @param publisher the publisher value to set. + * @return the MachineExtensionUpdateProperties object itself. + */ + public MachineExtensionUpdateProperties withPublisher(String publisher) { + this.publisher = publisher; + return this; + } + + /** + * Get the type property: Specifies the type of the extension; an example is "CustomScriptExtension". + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: Specifies the type of the extension; an example is "CustomScriptExtension". + * + * @param type the type value to set. + * @return the MachineExtensionUpdateProperties object itself. + */ + public MachineExtensionUpdateProperties withType(String type) { + this.type = type; + return this; + } + + /** + * Get the typeHandlerVersion property: Specifies the version of the script handler. + * + * @return the typeHandlerVersion value. + */ + public String typeHandlerVersion() { + return this.typeHandlerVersion; + } + + /** + * Set the typeHandlerVersion property: Specifies the version of the script handler. + * + * @param typeHandlerVersion the typeHandlerVersion value to set. + * @return the MachineExtensionUpdateProperties object itself. + */ + public MachineExtensionUpdateProperties withTypeHandlerVersion(String typeHandlerVersion) { + this.typeHandlerVersion = typeHandlerVersion; + return this; + } + + /** + * Get the autoUpgradeMinorVersion property: Indicates whether the extension should use a newer minor version if one + * is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless + * redeployed, even with this property set to true. + * + * @return the autoUpgradeMinorVersion value. + */ + public Boolean autoUpgradeMinorVersion() { + return this.autoUpgradeMinorVersion; + } + + /** + * Set the autoUpgradeMinorVersion property: Indicates whether the extension should use a newer minor version if one + * is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless + * redeployed, even with this property set to true. + * + * @param autoUpgradeMinorVersion the autoUpgradeMinorVersion value to set. + * @return the MachineExtensionUpdateProperties object itself. + */ + public MachineExtensionUpdateProperties withAutoUpgradeMinorVersion(Boolean autoUpgradeMinorVersion) { + this.autoUpgradeMinorVersion = autoUpgradeMinorVersion; + return this; + } + + /** + * Get the settings property: Json formatted public settings for the extension. + * + * @return the settings value. + */ + public Object settings() { + return this.settings; + } + + /** + * Set the settings property: Json formatted public settings for the extension. + * + * @param settings the settings value to set. + * @return the MachineExtensionUpdateProperties object itself. + */ + public MachineExtensionUpdateProperties withSettings(Object settings) { + this.settings = settings; + return this; + } + + /** + * Get the protectedSettings property: The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all. + * + * @return the protectedSettings value. + */ + public Object protectedSettings() { + return this.protectedSettings; + } + + /** + * Set the protectedSettings property: The extension can contain either protectedSettings or + * protectedSettingsFromKeyVault or no protected settings at all. + * + * @param protectedSettings the protectedSettings value to set. + * @return the MachineExtensionUpdateProperties object itself. + */ + public MachineExtensionUpdateProperties withProtectedSettings(Object protectedSettings) { + this.protectedSettings = protectedSettings; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachineExtensionUpdatePropertiesAutoGenerated.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachineExtensionUpdatePropertiesAutoGenerated.java new file mode 100644 index 0000000000000..81e3ae142cb56 --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachineExtensionUpdatePropertiesAutoGenerated.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcompute.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** Describes Machine Extension Update Properties. */ +@Immutable +public final class MachineExtensionUpdatePropertiesAutoGenerated extends MachineExtensionUpdateProperties { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(MachineExtensionUpdatePropertiesAutoGenerated.class); + + /** {@inheritDoc} */ + @Override + public MachineExtensionUpdatePropertiesAutoGenerated withForceUpdateTag(String forceUpdateTag) { + super.withForceUpdateTag(forceUpdateTag); + return this; + } + + /** {@inheritDoc} */ + @Override + public MachineExtensionUpdatePropertiesAutoGenerated withPublisher(String publisher) { + super.withPublisher(publisher); + return this; + } + + /** {@inheritDoc} */ + @Override + public MachineExtensionUpdatePropertiesAutoGenerated withType(String type) { + super.withType(type); + return this; + } + + /** {@inheritDoc} */ + @Override + public MachineExtensionUpdatePropertiesAutoGenerated withTypeHandlerVersion(String typeHandlerVersion) { + super.withTypeHandlerVersion(typeHandlerVersion); + return this; + } + + /** {@inheritDoc} */ + @Override + public MachineExtensionUpdatePropertiesAutoGenerated withAutoUpgradeMinorVersion(Boolean autoUpgradeMinorVersion) { + super.withAutoUpgradeMinorVersion(autoUpgradeMinorVersion); + return this; + } + + /** {@inheritDoc} */ + @Override + public MachineExtensionUpdatePropertiesAutoGenerated withSettings(Object settings) { + super.withSettings(settings); + return this; + } + + /** {@inheritDoc} */ + @Override + public MachineExtensionUpdatePropertiesAutoGenerated withProtectedSettings(Object protectedSettings) { + super.withProtectedSettings(protectedSettings); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachineExtensions.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachineExtensions.java new file mode 100644 index 0000000000000..41cc0bda25f1a --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachineExtensions.java @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcompute.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 MachineExtensions. */ +public interface MachineExtensions { + /** + * The operation to delete the extension. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the machine where the extension should be deleted. + * @param extensionName The name of the machine extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 name, String extensionName); + + /** + * The operation to delete the extension. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the machine where the extension should be deleted. + * @param extensionName The name of the machine extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String name, String extensionName, Context context); + + /** + * The operation to get the extension. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the machine containing the extension. + * @param extensionName The name of the machine extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a Machine Extension. + */ + MachineExtension get(String resourceGroupName, String name, String extensionName); + + /** + * The operation to get the extension. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the machine containing the extension. + * @param extensionName The name of the machine extension. + * @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 describes a Machine Extension. + */ + Response getWithResponse( + String resourceGroupName, String name, String extensionName, Context context); + + /** + * The operation to get all extensions of a non-Azure machine. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the machine containing the extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the Machine Extensions List Result. + */ + PagedIterable list(String resourceGroupName, String name); + + /** + * The operation to get all extensions of a non-Azure machine. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the machine containing the extension. + * @param expand The expand expression to apply on the operation. + * @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 describes the Machine Extensions List Result. + */ + PagedIterable list(String resourceGroupName, String name, String expand, Context context); + + /** + * The operation to get the extension. + * + * @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 describes a Machine Extension. + */ + MachineExtension getById(String id); + + /** + * The operation to get the extension. + * + * @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 describes a Machine Extension. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * The operation to delete the extension. + * + * @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); + + /** + * The operation to delete the extension. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new MachineExtension resource. + * + * @param name resource name. + * @return the first stage of the new MachineExtension definition. + */ + MachineExtension.DefinitionStages.Blank define(String name); +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachineExtensionsListResult.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachineExtensionsListResult.java new file mode 100644 index 0000000000000..93ece78747ea8 --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachineExtensionsListResult.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcompute.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.hybridcompute.fluent.models.MachineExtensionInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes the Machine Extensions List Result. */ +@Fluent +public final class MachineExtensionsListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MachineExtensionsListResult.class); + + /* + * The list of extensions + */ + @JsonProperty(value = "value") + private List value; + + /* + * The uri to fetch the next page of machine extensions. Call ListNext() + * with this to fetch the next page of extensions. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The list of extensions. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of extensions. + * + * @param value the value value to set. + * @return the MachineExtensionsListResult object itself. + */ + public MachineExtensionsListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The uri to fetch the next page of machine extensions. Call ListNext() with this to + * fetch the next page of extensions. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The uri to fetch the next page of machine extensions. Call ListNext() with this to + * fetch the next page of extensions. + * + * @param nextLink the nextLink value to set. + * @return the MachineExtensionsListResult object itself. + */ + public MachineExtensionsListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachineIdentity.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachineIdentity.java new file mode 100644 index 0000000000000..a5f46e7f8e625 --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachineIdentity.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.hybridcompute.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** The MachineIdentity model. */ +@Immutable +public class MachineIdentity extends Identity { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MachineIdentity.class); + + /** {@inheritDoc} */ + @Override + public MachineIdentity withType(String 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/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachineListResult.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachineListResult.java new file mode 100644 index 0000000000000..ca1354b8031cd --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachineListResult.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcompute.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.hybridcompute.fluent.models.MachineInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List hybrid machine operation response. */ +@Fluent +public final class MachineListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MachineListResult.class); + + /* + * The list of hybrid machines. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The URI to fetch the next page of Machines. Call ListNext() with this + * URI to fetch the next page of hybrid machines. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The list of hybrid machines. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of hybrid machines. + * + * @param value the value value to set. + * @return the MachineListResult object itself. + */ + public MachineListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URI to fetch the next page of Machines. Call ListNext() with this URI to fetch the + * next page of hybrid machines. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The URI to fetch the next page of Machines. Call ListNext() with this URI to fetch the + * next page of hybrid machines. + * + * @param nextLink the nextLink value to set. + * @return the MachineListResult object itself. + */ + public MachineListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model MachineListResult")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachineProperties.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachineProperties.java new file mode 100644 index 0000000000000..91a0370296c62 --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachineProperties.java @@ -0,0 +1,357 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcompute.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.exception.ManagementError; +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; + +/** Describes the properties of a hybrid machine. */ +@Fluent +public class MachineProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MachineProperties.class); + + /* + * Metadata pertaining to the geographic location of the resource. + */ + @JsonProperty(value = "locationData") + private LocationData locationData; + + /* + * Specifies the operating system settings for the hybrid machine. + */ + @JsonProperty(value = "osProfile", access = JsonProperty.Access.WRITE_ONLY) + private OSProfile osProfile; + + /* + * The provisioning state, which only appears in the response. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * The status of the hybrid machine agent. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private StatusTypes status; + + /* + * The time of the last status change. + */ + @JsonProperty(value = "lastStatusChange", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastStatusChange; + + /* + * Details about the error state. + */ + @JsonProperty(value = "errorDetails", access = JsonProperty.Access.WRITE_ONLY) + private List errorDetails; + + /* + * The hybrid machine agent full version. + */ + @JsonProperty(value = "agentVersion", access = JsonProperty.Access.WRITE_ONLY) + private String agentVersion; + + /* + * Specifies the hybrid machine unique ID. + */ + @JsonProperty(value = "vmId") + private String vmId; + + /* + * Specifies the hybrid machine display name. + */ + @JsonProperty(value = "displayName", access = JsonProperty.Access.WRITE_ONLY) + private String displayName; + + /* + * Specifies the hybrid machine FQDN. + */ + @JsonProperty(value = "machineFqdn", access = JsonProperty.Access.WRITE_ONLY) + private String machineFqdn; + + /* + * Public Key that the client provides to be used during initial resource + * onboarding + */ + @JsonProperty(value = "clientPublicKey") + private String clientPublicKey; + + /* + * The Operating System running on the hybrid machine. + */ + @JsonProperty(value = "osName", access = JsonProperty.Access.WRITE_ONLY) + private String osName; + + /* + * The version of Operating System running on the hybrid machine. + */ + @JsonProperty(value = "osVersion", access = JsonProperty.Access.WRITE_ONLY) + private String osVersion; + + /* + * Specifies the Arc Machine's unique SMBIOS ID + */ + @JsonProperty(value = "vmUuid", access = JsonProperty.Access.WRITE_ONLY) + private String vmUuid; + + /* + * Machine Extensions information + */ + @JsonProperty(value = "extensions", access = JsonProperty.Access.WRITE_ONLY) + private List extensions; + + /* + * Specifies the Operating System product SKU. + */ + @JsonProperty(value = "osSku", access = JsonProperty.Access.WRITE_ONLY) + private String osSku; + + /* + * Specifies the Windows domain name. + */ + @JsonProperty(value = "domainName", access = JsonProperty.Access.WRITE_ONLY) + private String domainName; + + /* + * Specifies the AD fully qualified display name. + */ + @JsonProperty(value = "adFqdn", access = JsonProperty.Access.WRITE_ONLY) + private String adFqdn; + + /* + * Specifies the DNS fully qualified display name. + */ + @JsonProperty(value = "dnsFqdn", access = JsonProperty.Access.WRITE_ONLY) + private String dnsFqdn; + + /** + * Get the locationData property: Metadata pertaining to the geographic location of the resource. + * + * @return the locationData value. + */ + public LocationData locationData() { + return this.locationData; + } + + /** + * Set the locationData property: Metadata pertaining to the geographic location of the resource. + * + * @param locationData the locationData value to set. + * @return the MachineProperties object itself. + */ + public MachineProperties withLocationData(LocationData locationData) { + this.locationData = locationData; + return this; + } + + /** + * Get the osProfile property: Specifies the operating system settings for the hybrid machine. + * + * @return the osProfile value. + */ + public OSProfile osProfile() { + return this.osProfile; + } + + /** + * Get the provisioningState property: The provisioning state, which only appears in the response. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the status property: The status of the hybrid machine agent. + * + * @return the status value. + */ + public StatusTypes status() { + return this.status; + } + + /** + * Get the lastStatusChange property: The time of the last status change. + * + * @return the lastStatusChange value. + */ + public OffsetDateTime lastStatusChange() { + return this.lastStatusChange; + } + + /** + * Get the errorDetails property: Details about the error state. + * + * @return the errorDetails value. + */ + public List errorDetails() { + return this.errorDetails; + } + + /** + * Get the agentVersion property: The hybrid machine agent full version. + * + * @return the agentVersion value. + */ + public String agentVersion() { + return this.agentVersion; + } + + /** + * Get the vmId property: Specifies the hybrid machine unique ID. + * + * @return the vmId value. + */ + public String vmId() { + return this.vmId; + } + + /** + * Set the vmId property: Specifies the hybrid machine unique ID. + * + * @param vmId the vmId value to set. + * @return the MachineProperties object itself. + */ + public MachineProperties withVmId(String vmId) { + this.vmId = vmId; + return this; + } + + /** + * Get the displayName property: Specifies the hybrid machine display name. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Get the machineFqdn property: Specifies the hybrid machine FQDN. + * + * @return the machineFqdn value. + */ + public String machineFqdn() { + return this.machineFqdn; + } + + /** + * Get the clientPublicKey property: Public Key that the client provides to be used during initial resource + * onboarding. + * + * @return the clientPublicKey value. + */ + public String clientPublicKey() { + return this.clientPublicKey; + } + + /** + * Set the clientPublicKey property: Public Key that the client provides to be used during initial resource + * onboarding. + * + * @param clientPublicKey the clientPublicKey value to set. + * @return the MachineProperties object itself. + */ + public MachineProperties withClientPublicKey(String clientPublicKey) { + this.clientPublicKey = clientPublicKey; + return this; + } + + /** + * Get the osName property: The Operating System running on the hybrid machine. + * + * @return the osName value. + */ + public String osName() { + return this.osName; + } + + /** + * Get the osVersion property: The version of Operating System running on the hybrid machine. + * + * @return the osVersion value. + */ + public String osVersion() { + return this.osVersion; + } + + /** + * Get the vmUuid property: Specifies the Arc Machine's unique SMBIOS ID. + * + * @return the vmUuid value. + */ + public String vmUuid() { + return this.vmUuid; + } + + /** + * Get the extensions property: Machine Extensions information. + * + * @return the extensions value. + */ + public List extensions() { + return this.extensions; + } + + /** + * Get the osSku property: Specifies the Operating System product SKU. + * + * @return the osSku value. + */ + public String osSku() { + return this.osSku; + } + + /** + * Get the domainName property: Specifies the Windows domain name. + * + * @return the domainName value. + */ + public String domainName() { + return this.domainName; + } + + /** + * Get the adFqdn property: Specifies the AD fully qualified display name. + * + * @return the adFqdn value. + */ + public String adFqdn() { + return this.adFqdn; + } + + /** + * Get the dnsFqdn property: Specifies the DNS fully qualified display name. + * + * @return the dnsFqdn value. + */ + public String dnsFqdn() { + return this.dnsFqdn; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (locationData() != null) { + locationData().validate(); + } + if (osProfile() != null) { + osProfile().validate(); + } + if (extensions() != null) { + extensions().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachinePropertiesAutoGenerated.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachinePropertiesAutoGenerated.java new file mode 100644 index 0000000000000..9fd0b9a88f6b3 --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachinePropertiesAutoGenerated.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.hybridcompute.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** Hybrid Compute Machine properties. */ +@Immutable +public final class MachinePropertiesAutoGenerated extends MachineProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MachinePropertiesAutoGenerated.class); + + /** {@inheritDoc} */ + @Override + public MachinePropertiesAutoGenerated withLocationData(LocationData locationData) { + super.withLocationData(locationData); + return this; + } + + /** {@inheritDoc} */ + @Override + public MachinePropertiesAutoGenerated withVmId(String vmId) { + super.withVmId(vmId); + return this; + } + + /** {@inheritDoc} */ + @Override + public MachinePropertiesAutoGenerated withClientPublicKey(String clientPublicKey) { + super.withClientPublicKey(clientPublicKey); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachinePropertiesOsProfile.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachinePropertiesOsProfile.java new file mode 100644 index 0000000000000..e8f92411a1792 --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachinePropertiesOsProfile.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcompute.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** Specifies the operating system settings for the hybrid machine. */ +@Immutable +public final class MachinePropertiesOsProfile extends OSProfile { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MachinePropertiesOsProfile.class); + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachineUpdate.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachineUpdate.java new file mode 100644 index 0000000000000..a6392d2e23294 --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachineUpdate.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcompute.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; + +/** Describes a hybrid machine Update. */ +@JsonFlatten +@Fluent +public class MachineUpdate extends UpdateResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MachineUpdate.class); + + /* + * Metadata pertaining to the geographic location of the resource. + */ + @JsonProperty(value = "properties.locationData") + private LocationData locationData; + + /* + * The identity type. + */ + @JsonProperty(value = "identity.type") + private String type; + + /* + * The identity's principal id. + */ + @JsonProperty(value = "identity.principalId", access = JsonProperty.Access.WRITE_ONLY) + private String principalId; + + /* + * The identity's tenant id. + */ + @JsonProperty(value = "identity.tenantId", access = JsonProperty.Access.WRITE_ONLY) + private String tenantId; + + /** + * Get the locationData property: Metadata pertaining to the geographic location of the resource. + * + * @return the locationData value. + */ + public LocationData locationData() { + return this.locationData; + } + + /** + * Set the locationData property: Metadata pertaining to the geographic location of the resource. + * + * @param locationData the locationData value to set. + * @return the MachineUpdate object itself. + */ + public MachineUpdate withLocationData(LocationData locationData) { + this.locationData = locationData; + return this; + } + + /** + * Get the type property: The identity type. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: The identity type. + * + * @param type the type value to set. + * @return the MachineUpdate object itself. + */ + public MachineUpdate withType(String type) { + this.type = type; + return this; + } + + /** + * Get the principalId property: The identity's principal id. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the tenantId property: The identity's tenant id. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** {@inheritDoc} */ + @Override + public MachineUpdate 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 (locationData() != null) { + locationData().validate(); + } + } +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachineUpdateIdentity.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachineUpdateIdentity.java new file mode 100644 index 0000000000000..9465f89c6d650 --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachineUpdateIdentity.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.hybridcompute.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** Hybrid Compute Machine Managed Identity. */ +@Immutable +public class MachineUpdateIdentity extends Identity { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MachineUpdateIdentity.class); + + /** {@inheritDoc} */ + @Override + public MachineUpdateIdentity withType(String 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/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachineUpdateProperties.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachineUpdateProperties.java new file mode 100644 index 0000000000000..a74b38d955de2 --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachineUpdateProperties.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.hybridcompute.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes the ARM updatable properties of a hybrid machine. */ +@Fluent +public class MachineUpdateProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MachineUpdateProperties.class); + + /* + * Metadata pertaining to the geographic location of the resource. + */ + @JsonProperty(value = "locationData") + private LocationData locationData; + + /** + * Get the locationData property: Metadata pertaining to the geographic location of the resource. + * + * @return the locationData value. + */ + public LocationData locationData() { + return this.locationData; + } + + /** + * Set the locationData property: Metadata pertaining to the geographic location of the resource. + * + * @param locationData the locationData value to set. + * @return the MachineUpdateProperties object itself. + */ + public MachineUpdateProperties withLocationData(LocationData locationData) { + this.locationData = locationData; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (locationData() != null) { + locationData().validate(); + } + } +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachineUpdatePropertiesAutoGenerated.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachineUpdatePropertiesAutoGenerated.java new file mode 100644 index 0000000000000..98fec3974d61d --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/MachineUpdatePropertiesAutoGenerated.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.hybridcompute.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** Hybrid Compute Machine properties. */ +@Immutable +public final class MachineUpdatePropertiesAutoGenerated extends MachineUpdateProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MachineUpdatePropertiesAutoGenerated.class); + + /** {@inheritDoc} */ + @Override + public MachineUpdatePropertiesAutoGenerated withLocationData(LocationData locationData) { + super.withLocationData(locationData); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/Machines.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/Machines.java new file mode 100644 index 0000000000000..a0159f7d48150 --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/Machines.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.hybridcompute.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 Machines. */ +public interface Machines { + /** + * The operation to remove a hybrid machine identity in Azure. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the hybrid machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 name); + + /** + * The operation to remove a hybrid machine identity in Azure. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the hybrid machine. + * @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 name, Context context); + + /** + * Retrieves information about the model view or the instance view of a hybrid machine. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the hybrid machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes a hybrid machine. + */ + Machine getByResourceGroup(String resourceGroupName, String name); + + /** + * Retrieves information about the model view or the instance view of a hybrid machine. + * + * @param resourceGroupName The name of the resource group. + * @param name The name of the hybrid machine. + * @param expand The expand expression to apply on the operation. + * @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 describes a hybrid machine. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String name, InstanceViewTypes expand, Context context); + + /** + * Lists all the hybrid machines in the specified resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List hybrid machine operation response. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists all the hybrid machines in the specified resource group. + * + * @param resourceGroupName The name of the 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 the List hybrid machine operation response. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Lists all the hybrid machines in the specified 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 the List hybrid machine operation response. + */ + PagedIterable list(); + + /** + * Lists all the hybrid machines in the specified 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 the List hybrid machine operation response. + */ + PagedIterable list(Context context); +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/OSProfile.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/OSProfile.java new file mode 100644 index 0000000000000..452d5a3617e09 --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/OSProfile.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.hybridcompute.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; + +/** Specifies the operating system settings for the hybrid machine. */ +@Immutable +public class OSProfile { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OSProfile.class); + + /* + * Specifies the host OS name of the hybrid machine. + */ + @JsonProperty(value = "computerName", access = JsonProperty.Access.WRITE_ONLY) + private String computerName; + + /** + * Get the computerName property: Specifies the host OS name of the hybrid machine. + * + * @return the computerName value. + */ + public String computerName() { + return this.computerName; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/OperationListResult.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/OperationListResult.java new file mode 100644 index 0000000000000..9e073c279c1d9 --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/OperationListResult.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.hybridcompute.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.hybridcompute.fluent.models.OperationValueInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List Compute Operation operation response. */ +@Immutable +public final class OperationListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationListResult.class); + + /* + * The list of compute operations + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: The list of compute operations. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * 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/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/OperationValue.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/OperationValue.java new file mode 100644 index 0000000000000..e1424e23d9f18 --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/OperationValue.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.hybridcompute.models; + +import com.azure.resourcemanager.hybridcompute.fluent.models.OperationValueInner; + +/** An immutable client-side representation of OperationValue. */ +public interface OperationValue { + /** + * Gets the origin property: The origin of the compute operation. + * + * @return the origin value. + */ + String origin(); + + /** + * Gets the name property: The name of the compute operation. + * + * @return the name value. + */ + String name(); + + /** + * Gets the operation property: The display name of the compute operation. + * + * @return the operation value. + */ + String operation(); + + /** + * Gets the resource property: The display name of the resource the operation applies to. + * + * @return the resource value. + */ + String resource(); + + /** + * Gets the description property: The description of the operation. + * + * @return the description value. + */ + String description(); + + /** + * Gets the provider property: The resource provider for the operation. + * + * @return the provider value. + */ + String provider(); + + /** + * Gets the inner com.azure.resourcemanager.hybridcompute.fluent.models.OperationValueInner object. + * + * @return the inner object. + */ + OperationValueInner innerModel(); +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/OperationValueDisplay.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/OperationValueDisplay.java new file mode 100644 index 0000000000000..84d3668a3c1ef --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/OperationValueDisplay.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcompute.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; + +/** Describes the properties of a Hybrid Compute Operation Value Display. */ +@Immutable +public class OperationValueDisplay { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationValueDisplay.class); + + /* + * The display name of the compute operation. + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /* + * The display name of the resource the operation applies to. + */ + @JsonProperty(value = "resource", access = JsonProperty.Access.WRITE_ONLY) + private String resource; + + /* + * The description of the operation. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /* + * The resource provider for the operation. + */ + @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY) + private String provider; + + /** + * Get the operation property: The display name of the compute operation. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Get the resource property: The display name of the resource the operation applies to. + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Get the description property: The description of the operation. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Get the provider property: The resource provider for the operation. + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/OperationValueDisplayAutoGenerated.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/OperationValueDisplayAutoGenerated.java new file mode 100644 index 0000000000000..5773cf48f80f7 --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/OperationValueDisplayAutoGenerated.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.hybridcompute.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** Display properties. */ +@Immutable +public final class OperationValueDisplayAutoGenerated extends OperationValueDisplay { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationValueDisplayAutoGenerated.class); + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/Operations.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/Operations.java new file mode 100644 index 0000000000000..9808ce441289d --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/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.hybridcompute.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Operations. */ +public interface Operations { + /** + * Gets a list of hybrid compute operations. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of hybrid compute operations. + */ + PagedIterable list(); + + /** + * Gets a list of hybrid compute operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of hybrid compute operations. + */ + PagedIterable list(Context context); +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/StatusLevelTypes.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/StatusLevelTypes.java new file mode 100644 index 0000000000000..c6998030f7e3e --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/StatusLevelTypes.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.hybridcompute.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for StatusLevelTypes. */ +public final class StatusLevelTypes extends ExpandableStringEnum { + /** Static value Info for StatusLevelTypes. */ + public static final StatusLevelTypes INFO = fromString("Info"); + + /** Static value Warning for StatusLevelTypes. */ + public static final StatusLevelTypes WARNING = fromString("Warning"); + + /** Static value Error for StatusLevelTypes. */ + public static final StatusLevelTypes ERROR = fromString("Error"); + + /** + * Creates or finds a StatusLevelTypes from its string representation. + * + * @param name a name to look for. + * @return the corresponding StatusLevelTypes. + */ + @JsonCreator + public static StatusLevelTypes fromString(String name) { + return fromString(name, StatusLevelTypes.class); + } + + /** @return known StatusLevelTypes values. */ + public static Collection values() { + return values(StatusLevelTypes.class); + } +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/StatusTypes.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/StatusTypes.java new file mode 100644 index 0000000000000..b56ff0418db2d --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/StatusTypes.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.hybridcompute.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for StatusTypes. */ +public final class StatusTypes extends ExpandableStringEnum { + /** Static value Connected for StatusTypes. */ + public static final StatusTypes CONNECTED = fromString("Connected"); + + /** Static value Disconnected for StatusTypes. */ + public static final StatusTypes DISCONNECTED = fromString("Disconnected"); + + /** Static value Error for StatusTypes. */ + public static final StatusTypes ERROR = fromString("Error"); + + /** + * Creates or finds a StatusTypes from its string representation. + * + * @param name a name to look for. + * @return the corresponding StatusTypes. + */ + @JsonCreator + public static StatusTypes fromString(String name) { + return fromString(name, StatusTypes.class); + } + + /** @return known StatusTypes values. */ + public static Collection values() { + return values(StatusTypes.class); + } +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/UpdateResource.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/UpdateResource.java new file mode 100644 index 0000000000000..af2978c579965 --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/UpdateResource.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.hybridcompute.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The Update Resource model definition. */ +@Fluent +public class UpdateResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UpdateResource.class); + + /* + * Resource tags + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the UpdateResource object itself. + */ + public UpdateResource withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/package-info.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/models/package-info.java new file mode 100644 index 0000000000000..f357d6d5dad91 --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/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 HybridComputeManagementClient. The Hybrid Compute Management Client. */ +package com.azure.resourcemanager.hybridcompute.models; diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/package-info.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/package-info.java new file mode 100644 index 0000000000000..cf9356d1989ea --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/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 HybridComputeManagementClient. The Hybrid Compute Management Client. */ +package com.azure.resourcemanager.hybridcompute; diff --git a/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/module-info.java b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/module-info.java new file mode 100644 index 0000000000000..74ba0990ceadf --- /dev/null +++ b/sdk/hybridcompute/azure-resourcemanager-hybridcompute/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.hybridcompute { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.hybridcompute; + exports com.azure.resourcemanager.hybridcompute.fluent; + exports com.azure.resourcemanager.hybridcompute.fluent.models; + exports com.azure.resourcemanager.hybridcompute.models; + + opens com.azure.resourcemanager.hybridcompute.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.hybridcompute.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/hybridcompute/ci.yml b/sdk/hybridcompute/ci.yml new file mode 100644 index 0000000000000..b7b8a8a9e6216 --- /dev/null +++ b/sdk/hybridcompute/ci.yml @@ -0,0 +1,31 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - master + - hotfix/* + - release/* + paths: + include: + - sdk/hybridcompute/ + +pr: + branches: + include: + - master + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/hybridcompute/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: hybridcompute + Artifacts: + - name: azure-resourcemanager-hybridcompute + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerhybridcompute diff --git a/sdk/hybridcompute/pom.xml b/sdk/hybridcompute/pom.xml new file mode 100644 index 0000000000000..2f67ef184773a --- /dev/null +++ b/sdk/hybridcompute/pom.xml @@ -0,0 +1,14 @@ + + + 4.0.0 + com.azure + azure-hybridcompute-service + pom + 1.0.0 + + azure-resourcemanager-hybridcompute + +