diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index f8f923e6600eb..e6673bd564751 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -321,6 +321,7 @@ com.azure.resourcemanager:azure-resourcemanager-quota;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-extendedlocation;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-logz;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-storagepool;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-resourceconnector;1.0.0-beta.1;1.0.0-beta.1 # Unreleased dependencies: Copy the entry from above, prepend "unreleased_" and remove the current # version. Unreleased dependencies are only valid for dependency versions. diff --git a/pom.xml b/pom.xml index c48350b9b8372..6c95cd5865710 100644 --- a/pom.xml +++ b/pom.xml @@ -811,6 +811,7 @@ sdk/redisenterprise sdk/relay sdk/remoterendering + sdk/resourceconnector sdk/resourcegraph sdk/resourcehealth sdk/resourcemanager diff --git a/sdk/resourceconnector/azure-resourcemanager-resourceconnector/CHANGELOG.md b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/CHANGELOG.md new file mode 100644 index 0000000000000..532045e4250d6 --- /dev/null +++ b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2021-10-22) + +- Azure Resource Manager Appliances client library for Java. This package contains Microsoft Azure SDK for Appliances Management SDK. The appliances Rest API spec. Package tag package-2021-10-31-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). diff --git a/sdk/resourceconnector/azure-resourcemanager-resourceconnector/README.md b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/README.md new file mode 100644 index 0000000000000..0c53d05a32ee6 --- /dev/null +++ b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/README.md @@ -0,0 +1,102 @@ +# Azure Resource Manager Appliances client library for Java + +Azure Resource Manager Appliances client library for Java. + +This package contains Microsoft Azure SDK for Appliances Management SDK. The appliances Rest API spec. Package tag package-2021-10-31-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +## We'd love to hear your feedback + +We're always working on improving our products and the way we communicate with our users. So we'd love to learn what's working and how we can do better. + +If you haven't already, please take a few minutes to [complete this short survey][survey] we have put together. + +Thank you in advance for your collaboration. We really appreciate your time! + +## Documentation + +Various documentation is available to help you get started + +- [API reference documentation][docs] + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-resourceconnector;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-resourceconnector + 1.0.0-beta.1 + +``` +[//]: # ({x-version-update-end}) + +### Include the recommended packages + +Azure Management Libraries require a `TokenCredential` implementation for authentication and an `HttpClient` implementation for HTTP client. + +[Azure Identity][azure_identity] package and [Azure Core Netty HTTP][azure_core_http_netty] package provide the default implementation. + +### Authentication + +By default, Azure Active Directory token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, `azure` client can be authenticated by following code: + +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +AppliancesManager manager = AppliancesManager + .authenticate(credential, profile); +``` + +The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise. + +See [Authentication][authenticate] for more options. + +## Key concepts + +See [API design][design] for general introduction on design and key concepts on Azure Management Libraries. + +## Examples + +[Code snippets and samples](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourceconnector/azure-resourcemanager-resourceconnector/SAMPLE.md) + + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md). + +1. Fork it +1. Create your feature branch (`git checkout -b my-new-feature`) +1. Commit your changes (`git commit -am 'Add some feature'`) +1. Push to the branch (`git push origin my-new-feature`) +1. Create new Pull Request + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://docs.microsoft.com/java/azure/jdk/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/DESIGN.md diff --git a/sdk/resourceconnector/azure-resourcemanager-resourceconnector/SAMPLE.md b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/SAMPLE.md new file mode 100644 index 0000000000000..fed00ad6a964e --- /dev/null +++ b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/SAMPLE.md @@ -0,0 +1,214 @@ +# Code snippets and samples + + +## Appliances + +- [CreateOrUpdate](#appliances_createorupdate) +- [Delete](#appliances_delete) +- [GetByResourceGroup](#appliances_getbyresourcegroup) +- [List](#appliances_list) +- [ListByResourceGroup](#appliances_listbyresourcegroup) +- [ListClusterUserCredential](#appliances_listclusterusercredential) +- [ListOperations](#appliances_listoperations) +- [Update](#appliances_update) +### Appliances_CreateOrUpdate + +```java +import com.azure.resourcemanager.resourceconnector.models.AppliancePropertiesInfrastructureConfig; +import com.azure.resourcemanager.resourceconnector.models.Distro; +import com.azure.resourcemanager.resourceconnector.models.Provider; + +/** Samples for Appliances CreateOrUpdate. */ +public final class AppliancesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/preview/2021-10-31-preview/examples/AppliancesCreate_Update.json + */ + /** + * Sample code: Create/Update Appliance. + * + * @param manager Entry point to AppliancesManager. + */ + public static void createUpdateAppliance(com.azure.resourcemanager.resourceconnector.AppliancesManager manager) { + manager + .appliances() + .define("appliance01") + .withRegion("West US") + .withExistingResourceGroup("testresourcegroup") + .withDistro(Distro.AKSEDGE) + .withInfrastructureConfig(new AppliancePropertiesInfrastructureConfig().withProvider(Provider.VMWARE)) + .create(); + } +} +``` + +### Appliances_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for Appliances Delete. */ +public final class AppliancesDeleteSamples { + /* + * x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/preview/2021-10-31-preview/examples/AppliancesDelete.json + */ + /** + * Sample code: Delete Appliance. + * + * @param manager Entry point to AppliancesManager. + */ + public static void deleteAppliance(com.azure.resourcemanager.resourceconnector.AppliancesManager manager) { + manager.appliances().delete("testresourcegroup", "appliance01", Context.NONE); + } +} +``` + +### Appliances_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for Appliances GetByResourceGroup. */ +public final class AppliancesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/preview/2021-10-31-preview/examples/AppliancesGet.json + */ + /** + * Sample code: Get Appliance. + * + * @param manager Entry point to AppliancesManager. + */ + public static void getAppliance(com.azure.resourcemanager.resourceconnector.AppliancesManager manager) { + manager.appliances().getByResourceGroupWithResponse("testresourcegroup", "appliance01", Context.NONE); + } +} +``` + +### Appliances_List + +```java +import com.azure.core.util.Context; + +/** Samples for Appliances List. */ +public final class AppliancesListSamples { + /* + * x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/preview/2021-10-31-preview/examples/AppliancesListBySubscription.json + */ + /** + * Sample code: List Appliances by subscription. + * + * @param manager Entry point to AppliancesManager. + */ + public static void listAppliancesBySubscription( + com.azure.resourcemanager.resourceconnector.AppliancesManager manager) { + manager.appliances().list(Context.NONE); + } +} +``` + +### Appliances_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for Appliances ListByResourceGroup. */ +public final class AppliancesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/preview/2021-10-31-preview/examples/AppliancesListByResourceGroup.json + */ + /** + * Sample code: List Appliances by resource group. + * + * @param manager Entry point to AppliancesManager. + */ + public static void listAppliancesByResourceGroup( + com.azure.resourcemanager.resourceconnector.AppliancesManager manager) { + manager.appliances().listByResourceGroup("testresourcegroup", Context.NONE); + } +} +``` + +### Appliances_ListClusterUserCredential + +```java +import com.azure.core.util.Context; + +/** Samples for Appliances ListClusterUserCredential. */ +public final class AppliancesListClusterUserCredentialSamples { + /* + * x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/preview/2021-10-31-preview/examples/AppliancesListClusterUserCredential.json + */ + /** + * Sample code: ListClusterUserCredentialAppliance. + * + * @param manager Entry point to AppliancesManager. + */ + public static void listClusterUserCredentialAppliance( + com.azure.resourcemanager.resourceconnector.AppliancesManager manager) { + manager + .appliances() + .listClusterUserCredentialWithResponse("testresourcegroup", "testresourcename", Context.NONE); + } +} +``` + +### Appliances_ListOperations + +```java +import com.azure.core.util.Context; + +/** Samples for Appliances ListOperations. */ +public final class AppliancesListOperationsSamples { + /* + * x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/preview/2021-10-31-preview/examples/AppliancesListOperations.json + */ + /** + * Sample code: List Appliances operations. + * + * @param manager Entry point to AppliancesManager. + */ + public static void listAppliancesOperations(com.azure.resourcemanager.resourceconnector.AppliancesManager manager) { + manager.appliances().listOperations(Context.NONE); + } +} +``` + +### Appliances_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.resourceconnector.models.Appliance; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Appliances Update. */ +public final class AppliancesUpdateSamples { + /* + * x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/preview/2021-10-31-preview/examples/AppliancesPatch.json + */ + /** + * Sample code: Update Appliance. + * + * @param manager Entry point to AppliancesManager. + */ + public static void updateAppliance(com.azure.resourcemanager.resourceconnector.AppliancesManager manager) { + Appliance resource = + manager + .appliances() + .getByResourceGroupWithResponse("testresourcegroup", "appliance01", Context.NONE) + .getValue(); + resource.update().withTags(mapOf("key", "value")).apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + diff --git a/sdk/resourceconnector/azure-resourcemanager-resourceconnector/pom.xml b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/pom.xml new file mode 100644 index 0000000000000..08c7d2083e171 --- /dev/null +++ b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/pom.xml @@ -0,0 +1,86 @@ + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-resourceconnector + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for Appliances Management + This package contains Microsoft Azure SDK for Appliances Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. The appliances Rest API spec. Package tag package-2021-10-31-preview. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + + + + + com.azure + azure-core + 1.21.0 + + + com.azure + azure-core-management + 1.4.2 + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.7 + + true + + + + org.revapi + revapi-maven-plugin + 0.11.2 + + + + + java.method.addedToInterface + + + true + .* + com\.azure\.resourcemanager(\.[^.]+)+\.fluent(\.[^.]+)* + + + + + + + + diff --git a/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/AppliancesManager.java b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/AppliancesManager.java new file mode 100644 index 0000000000000..13500c636d654 --- /dev/null +++ b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/AppliancesManager.java @@ -0,0 +1,227 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourceconnector; + +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.http.policy.ArmChallengeAuthenticationPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.resourceconnector.fluent.AppliancesManagementClient; +import com.azure.resourcemanager.resourceconnector.implementation.AppliancesImpl; +import com.azure.resourcemanager.resourceconnector.implementation.AppliancesManagementClientBuilder; +import com.azure.resourcemanager.resourceconnector.models.Appliances; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** Entry point to AppliancesManager. The appliances Rest API spec. */ +public final class AppliancesManager { + private Appliances appliances; + + private final AppliancesManagementClient clientObject; + + private AppliancesManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new AppliancesManagementClientBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of Appliances service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Appliances service API instance. + */ + public static AppliancesManager 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 AppliancesManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new AppliancesManager.Configurable(); + } + + /** The Configurable allowing configurations to be set. */ + public static final class Configurable { + private final ClientLogger logger = new ClientLogger(Configurable.class); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); + private RetryPolicy retryPolicy; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = Objects.requireNonNull(defaultPollInterval, "'retryPolicy' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw logger.logExceptionAsError(new IllegalArgumentException("'httpPipeline' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of Appliances service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Appliances service API instance. + */ + public AppliancesManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder + .append("azsdk-java") + .append("-") + .append("com.azure.resourcemanager.resourceconnector") + .append("/") + .append("1.0.0-beta.1"); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder + .append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } + if (retryPolicy == null) { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new RequestIdPolicy()); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies.addAll(this.policies); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new AppliancesManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** @return Resource collection API of Appliances. */ + public Appliances appliances() { + if (this.appliances == null) { + this.appliances = new AppliancesImpl(clientObject.getAppliances(), this); + } + return appliances; + } + + /** + * @return Wrapped service client AppliancesManagementClient providing direct access to the underlying + * auto-generated API implementation, based on Azure REST API. + */ + public AppliancesManagementClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/fluent/AppliancesClient.java b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/fluent/AppliancesClient.java new file mode 100644 index 0000000000000..8e8867338cbfa --- /dev/null +++ b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/fluent/AppliancesClient.java @@ -0,0 +1,290 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourceconnector.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.resourceconnector.fluent.models.ApplianceInner; +import com.azure.resourcemanager.resourceconnector.fluent.models.ApplianceListCredentialResultsInner; +import com.azure.resourcemanager.resourceconnector.fluent.models.ApplianceOperationInner; +import com.azure.resourcemanager.resourceconnector.models.PatchableAppliance; + +/** An instance of this class provides access to all the operations defined in AppliancesClient. */ +public interface AppliancesClient { + /** + * Lists all available Appliances 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 lists of Appliances operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listOperations(); + + /** + * Lists all available Appliances 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 lists of Appliances operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listOperations(Context context); + + /** + * Gets a list of Appliances in the specified subscription. The operation returns properties of each Appliance. + * + * @throws com.azure.core.management.exception.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 Appliances in the specified subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Gets a list of Appliances in the specified subscription. The operation returns properties of each Appliance. + * + * @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 Appliances in the specified subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Gets a list of Appliances in the specified subscription and resource group. The operation returns properties of + * each Appliance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Appliances in the specified subscription and resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets a list of Appliances in the specified subscription and resource group. The operation returns properties of + * each Appliance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Appliances in the specified subscription and resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets the details of an Appliance with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of an Appliance with a specified resource group and name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApplianceInner getByResourceGroup(String resourceGroupName, String resourceName); + + /** + * Gets the details of an Appliance with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of an Appliance with a specified resource group and name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String resourceName, Context context); + + /** + * Creates or updates an Appliance in the specified Subscription and Resource Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @param parameters Parameters supplied to create or update an Appliance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return appliances definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ApplianceInner> beginCreateOrUpdate( + String resourceGroupName, String resourceName, ApplianceInner parameters); + + /** + * Creates or updates an Appliance in the specified Subscription and Resource Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @param parameters Parameters supplied to create or update an Appliance. + * @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 appliances definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ApplianceInner> beginCreateOrUpdate( + String resourceGroupName, String resourceName, ApplianceInner parameters, Context context); + + /** + * Creates or updates an Appliance in the specified Subscription and Resource Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @param parameters Parameters supplied to create or update an Appliance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return appliances definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApplianceInner createOrUpdate(String resourceGroupName, String resourceName, ApplianceInner parameters); + + /** + * Creates or updates an Appliance in the specified Subscription and Resource Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @param parameters Parameters supplied to create or update an Appliance. + * @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 appliances definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApplianceInner createOrUpdate( + String resourceGroupName, String resourceName, ApplianceInner parameters, Context context); + + /** + * Deletes an Appliance with the specified Resource Name, Resource Group, and Subscription Id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String resourceName); + + /** + * Deletes an Appliance with the specified Resource Name, Resource Group, and Subscription Id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String resourceName, Context context); + + /** + * Deletes an Appliance with the specified Resource Name, Resource Group, and Subscription Id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String resourceName); + + /** + * Deletes an Appliance with the specified Resource Name, Resource Group, and Subscription Id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String resourceName, Context context); + + /** + * Updates an Appliance with the specified Resource Name in the specified Resource Group and Subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @param parameters The updatable fields of an existing Appliance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return appliances definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApplianceInner update(String resourceGroupName, String resourceName, PatchableAppliance parameters); + + /** + * Updates an Appliance with the specified Resource Name in the specified Resource Group and Subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @param parameters The updatable fields of an existing Appliance. + * @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 appliances definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, String resourceName, PatchableAppliance parameters, Context context); + + /** + * Returns the cluster user credentials for the dedicated appliance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Cluster User Credential appliance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ApplianceListCredentialResultsInner listClusterUserCredential(String resourceGroupName, String resourceName); + + /** + * Returns the cluster user credentials for the dedicated appliance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Cluster User Credential appliance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listClusterUserCredentialWithResponse( + String resourceGroupName, String resourceName, Context context); +} diff --git a/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/fluent/AppliancesManagementClient.java b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/fluent/AppliancesManagementClient.java new file mode 100644 index 0000000000000..fab74b0241881 --- /dev/null +++ b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/fluent/AppliancesManagementClient.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.resourceconnector.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for AppliancesManagementClient class. */ +public interface AppliancesManagementClient { + /** + * Gets The ID of the target subscription. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the AppliancesClient object to access its operations. + * + * @return the AppliancesClient object. + */ + AppliancesClient getAppliances(); +} diff --git a/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/fluent/models/ApplianceInner.java b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/fluent/models/ApplianceInner.java new file mode 100644 index 0000000000000..8d7fb161fbd32 --- /dev/null +++ b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/fluent/models/ApplianceInner.java @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourceconnector.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.resourceconnector.models.AppliancePropertiesInfrastructureConfig; +import com.azure.resourcemanager.resourceconnector.models.Distro; +import com.azure.resourcemanager.resourceconnector.models.Identity; +import com.azure.resourcemanager.resourceconnector.models.Status; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Appliances definition. */ +@Fluent +public final class ApplianceInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ApplianceInner.class); + + /* + * Identity for the resource. + */ + @JsonProperty(value = "identity") + private Identity identity; + + /* + * The set of properties specific to an Appliance + */ + @JsonProperty(value = "properties") + private ApplianceProperties innerProperties; + + /* + * Metadata pertaining to creation and last modification of the resource + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** + * Get the identity property: Identity for the resource. + * + * @return the identity value. + */ + public Identity identity() { + return this.identity; + } + + /** + * Set the identity property: Identity for the resource. + * + * @param identity the identity value to set. + * @return the ApplianceInner object itself. + */ + public ApplianceInner withIdentity(Identity identity) { + this.identity = identity; + return this; + } + + /** + * Get the innerProperties property: The set of properties specific to an Appliance. + * + * @return the innerProperties value. + */ + private ApplianceProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** {@inheritDoc} */ + @Override + public ApplianceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public ApplianceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the distro property: Represents a supported Fabric/Infra. (AKSEdge etc...). + * + * @return the distro value. + */ + public Distro distro() { + return this.innerProperties() == null ? null : this.innerProperties().distro(); + } + + /** + * Set the distro property: Represents a supported Fabric/Infra. (AKSEdge etc...). + * + * @param distro the distro value to set. + * @return the ApplianceInner object itself. + */ + public ApplianceInner withDistro(Distro distro) { + if (this.innerProperties() == null) { + this.innerProperties = new ApplianceProperties(); + } + this.innerProperties().withDistro(distro); + return this; + } + + /** + * Get the infrastructureConfig property: Contains infrastructure information about the Appliance. + * + * @return the infrastructureConfig value. + */ + public AppliancePropertiesInfrastructureConfig infrastructureConfig() { + return this.innerProperties() == null ? null : this.innerProperties().infrastructureConfig(); + } + + /** + * Set the infrastructureConfig property: Contains infrastructure information about the Appliance. + * + * @param infrastructureConfig the infrastructureConfig value to set. + * @return the ApplianceInner object itself. + */ + public ApplianceInner withInfrastructureConfig(AppliancePropertiesInfrastructureConfig infrastructureConfig) { + if (this.innerProperties() == null) { + this.innerProperties = new ApplianceProperties(); + } + this.innerProperties().withInfrastructureConfig(infrastructureConfig); + return this; + } + + /** + * Get the provisioningState property: The current deployment or provisioning state, which only appears in the + * response. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the publicKey property: Certificates pair used to download MSI certificate from HIS. + * + * @return the publicKey value. + */ + public String publicKey() { + return this.innerProperties() == null ? null : this.innerProperties().publicKey(); + } + + /** + * Set the publicKey property: Certificates pair used to download MSI certificate from HIS. + * + * @param publicKey the publicKey value to set. + * @return the ApplianceInner object itself. + */ + public ApplianceInner withPublicKey(String publicKey) { + if (this.innerProperties() == null) { + this.innerProperties = new ApplianceProperties(); + } + this.innerProperties().withPublicKey(publicKey); + return this; + } + + /** + * Get the status property: Appliance’s health and state of connection to on-prem. + * + * @return the status value. + */ + public Status status() { + return this.innerProperties() == null ? null : this.innerProperties().status(); + } + + /** + * Get the version property: Version of the Appliance. + * + * @return the version value. + */ + public String version() { + return this.innerProperties() == null ? null : this.innerProperties().version(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (identity() != null) { + identity().validate(); + } + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/fluent/models/ApplianceListCredentialResultsInner.java b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/fluent/models/ApplianceListCredentialResultsInner.java new file mode 100644 index 0000000000000..6d27ae6b95e39 --- /dev/null +++ b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/fluent/models/ApplianceListCredentialResultsInner.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourceconnector.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.resourceconnector.models.ApplianceCredentialKubeconfig; +import com.azure.resourcemanager.resourceconnector.models.HybridConnectionConfig; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List Cluster User Credential appliance. */ +@Immutable +public final class ApplianceListCredentialResultsInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ApplianceListCredentialResultsInner.class); + + /* + * Contains the REP (rendezvous endpoint) and “Listener” access token from + * notification service (NS). + */ + @JsonProperty(value = "hybridConnectionConfig", access = JsonProperty.Access.WRITE_ONLY) + private HybridConnectionConfig hybridConnectionConfig; + + /* + * The list of appliance kubeconfigs. + */ + @JsonProperty(value = "kubeconfigs", access = JsonProperty.Access.WRITE_ONLY) + private List kubeconfigs; + + /** + * Get the hybridConnectionConfig property: Contains the REP (rendezvous endpoint) and “Listener” access token from + * notification service (NS). + * + * @return the hybridConnectionConfig value. + */ + public HybridConnectionConfig hybridConnectionConfig() { + return this.hybridConnectionConfig; + } + + /** + * Get the kubeconfigs property: The list of appliance kubeconfigs. + * + * @return the kubeconfigs value. + */ + public List kubeconfigs() { + return this.kubeconfigs; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (hybridConnectionConfig() != null) { + hybridConnectionConfig().validate(); + } + if (kubeconfigs() != null) { + kubeconfigs().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/fluent/models/ApplianceOperationInner.java b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/fluent/models/ApplianceOperationInner.java new file mode 100644 index 0000000000000..223762e664c1d --- /dev/null +++ b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/fluent/models/ApplianceOperationInner.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourceconnector.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Appliances operation. */ +@Fluent +public final class ApplianceOperationInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ApplianceOperationInner.class); + + /* + * Describes the properties of an Appliances Operation Value Display. + */ + @JsonProperty(value = "display") + private ApplianceOperationValueDisplay innerDisplay; + + /* + * Is this Operation a data plane operation + */ + @JsonProperty(value = "isDataAction", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isDataAction; + + /* + * The name of the compute operation. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The origin of the compute operation. + */ + @JsonProperty(value = "origin", access = JsonProperty.Access.WRITE_ONLY) + private String origin; + + /** + * Get the innerDisplay property: Describes the properties of an Appliances Operation Value Display. + * + * @return the innerDisplay value. + */ + private ApplianceOperationValueDisplay innerDisplay() { + return this.innerDisplay; + } + + /** + * Get the isDataAction property: Is this Operation a data plane operation. + * + * @return the isDataAction value. + */ + public Boolean isDataAction() { + return this.isDataAction; + } + + /** + * Get the name property: The name of the compute operation. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the origin property: The origin of the compute operation. + * + * @return the origin value. + */ + public String origin() { + return this.origin; + } + + /** + * Get the description property: The description of the operation. + * + * @return the description value. + */ + public String description() { + return this.innerDisplay() == null ? null : this.innerDisplay().description(); + } + + /** + * Get the operation property: The display name of the compute operation. + * + * @return the operation value. + */ + public String operation() { + return this.innerDisplay() == null ? null : this.innerDisplay().operation(); + } + + /** + * Get the provider property: The resource provider for the operation. + * + * @return the provider value. + */ + public String provider() { + return this.innerDisplay() == null ? null : this.innerDisplay().provider(); + } + + /** + * Get the resource property: The display name of the resource the operation applies to. + * + * @return the resource value. + */ + public String resource() { + return this.innerDisplay() == null ? null : this.innerDisplay().resource(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerDisplay() != null) { + innerDisplay().validate(); + } + } +} diff --git a/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/fluent/models/ApplianceOperationValueDisplay.java b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/fluent/models/ApplianceOperationValueDisplay.java new file mode 100644 index 0000000000000..81159d9fdd794 --- /dev/null +++ b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/fluent/models/ApplianceOperationValueDisplay.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.resourceconnector.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes the properties of an Appliances Operation Value Display. */ +@Immutable +public final class ApplianceOperationValueDisplay { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ApplianceOperationValueDisplay.class); + + /* + * The description of the operation. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /* + * The display name of the compute operation. + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /* + * The resource provider for the operation. + */ + @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY) + private String provider; + + /* + * The display name of the resource the operation applies to. + */ + @JsonProperty(value = "resource", access = JsonProperty.Access.WRITE_ONLY) + private String resource; + + /** + * Get the description property: The description of the operation. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Get the operation property: The display name of the compute operation. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Get the provider property: The resource provider for the operation. + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Get the resource property: The display name of the resource the operation applies to. + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/fluent/models/ApplianceProperties.java b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/fluent/models/ApplianceProperties.java new file mode 100644 index 0000000000000..23ae684e40ded --- /dev/null +++ b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/fluent/models/ApplianceProperties.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourceconnector.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.resourceconnector.models.AppliancePropertiesInfrastructureConfig; +import com.azure.resourcemanager.resourceconnector.models.Distro; +import com.azure.resourcemanager.resourceconnector.models.Status; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties for an appliance. */ +@Fluent +public final class ApplianceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ApplianceProperties.class); + + /* + * Represents a supported Fabric/Infra. (AKSEdge etc...). + */ + @JsonProperty(value = "distro") + private Distro distro; + + /* + * Contains infrastructure information about the Appliance + */ + @JsonProperty(value = "infrastructureConfig") + private AppliancePropertiesInfrastructureConfig infrastructureConfig; + + /* + * The current deployment or provisioning state, which only appears in the + * response. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * Certificates pair used to download MSI certificate from HIS + */ + @JsonProperty(value = "publicKey") + private String publicKey; + + /* + * Appliance’s health and state of connection to on-prem + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private Status status; + + /* + * Version of the Appliance + */ + @JsonProperty(value = "version", access = JsonProperty.Access.WRITE_ONLY) + private String version; + + /** + * Get the distro property: Represents a supported Fabric/Infra. (AKSEdge etc...). + * + * @return the distro value. + */ + public Distro distro() { + return this.distro; + } + + /** + * Set the distro property: Represents a supported Fabric/Infra. (AKSEdge etc...). + * + * @param distro the distro value to set. + * @return the ApplianceProperties object itself. + */ + public ApplianceProperties withDistro(Distro distro) { + this.distro = distro; + return this; + } + + /** + * Get the infrastructureConfig property: Contains infrastructure information about the Appliance. + * + * @return the infrastructureConfig value. + */ + public AppliancePropertiesInfrastructureConfig infrastructureConfig() { + return this.infrastructureConfig; + } + + /** + * Set the infrastructureConfig property: Contains infrastructure information about the Appliance. + * + * @param infrastructureConfig the infrastructureConfig value to set. + * @return the ApplianceProperties object itself. + */ + public ApplianceProperties withInfrastructureConfig(AppliancePropertiesInfrastructureConfig infrastructureConfig) { + this.infrastructureConfig = infrastructureConfig; + return this; + } + + /** + * Get the provisioningState property: The current deployment or provisioning state, which only appears in the + * response. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the publicKey property: Certificates pair used to download MSI certificate from HIS. + * + * @return the publicKey value. + */ + public String publicKey() { + return this.publicKey; + } + + /** + * Set the publicKey property: Certificates pair used to download MSI certificate from HIS. + * + * @param publicKey the publicKey value to set. + * @return the ApplianceProperties object itself. + */ + public ApplianceProperties withPublicKey(String publicKey) { + this.publicKey = publicKey; + return this; + } + + /** + * Get the status property: Appliance’s health and state of connection to on-prem. + * + * @return the status value. + */ + public Status status() { + return this.status; + } + + /** + * Get the version property: Version of the Appliance. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (infrastructureConfig() != null) { + infrastructureConfig().validate(); + } + } +} diff --git a/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/fluent/models/package-info.java b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/fluent/models/package-info.java new file mode 100644 index 0000000000000..e550769bd6f2c --- /dev/null +++ b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/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 AppliancesManagementClient. The appliances Rest API spec. */ +package com.azure.resourcemanager.resourceconnector.fluent.models; diff --git a/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/fluent/package-info.java b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/fluent/package-info.java new file mode 100644 index 0000000000000..7cddcc84f8f85 --- /dev/null +++ b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/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 AppliancesManagementClient. The appliances Rest API spec. */ +package com.azure.resourcemanager.resourceconnector.fluent; diff --git a/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/implementation/ApplianceImpl.java b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/implementation/ApplianceImpl.java new file mode 100644 index 0000000000000..deec4a888d338 --- /dev/null +++ b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/implementation/ApplianceImpl.java @@ -0,0 +1,241 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourceconnector.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.resourceconnector.fluent.models.ApplianceInner; +import com.azure.resourcemanager.resourceconnector.models.Appliance; +import com.azure.resourcemanager.resourceconnector.models.ApplianceListCredentialResults; +import com.azure.resourcemanager.resourceconnector.models.AppliancePropertiesInfrastructureConfig; +import com.azure.resourcemanager.resourceconnector.models.Distro; +import com.azure.resourcemanager.resourceconnector.models.Identity; +import com.azure.resourcemanager.resourceconnector.models.PatchableAppliance; +import com.azure.resourcemanager.resourceconnector.models.Status; +import java.util.Collections; +import java.util.Map; + +public final class ApplianceImpl implements Appliance, Appliance.Definition, Appliance.Update { + private ApplianceInner innerObject; + + private final com.azure.resourcemanager.resourceconnector.AppliancesManager 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 SystemData systemData() { + return this.innerModel().systemData(); + } + + public Distro distro() { + return this.innerModel().distro(); + } + + public AppliancePropertiesInfrastructureConfig infrastructureConfig() { + return this.innerModel().infrastructureConfig(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public String publicKey() { + return this.innerModel().publicKey(); + } + + public Status status() { + return this.innerModel().status(); + } + + public String version() { + return this.innerModel().version(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public ApplianceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.resourceconnector.AppliancesManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String resourceName; + + private PatchableAppliance updateParameters; + + public ApplianceImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public Appliance create() { + this.innerObject = + serviceManager + .serviceClient() + .getAppliances() + .createOrUpdate(resourceGroupName, resourceName, this.innerModel(), Context.NONE); + return this; + } + + public Appliance create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getAppliances() + .createOrUpdate(resourceGroupName, resourceName, this.innerModel(), context); + return this; + } + + ApplianceImpl(String name, com.azure.resourcemanager.resourceconnector.AppliancesManager serviceManager) { + this.innerObject = new ApplianceInner(); + this.serviceManager = serviceManager; + this.resourceName = name; + } + + public ApplianceImpl update() { + this.updateParameters = new PatchableAppliance(); + return this; + } + + public Appliance apply() { + this.innerObject = + serviceManager + .serviceClient() + .getAppliances() + .updateWithResponse(resourceGroupName, resourceName, updateParameters, Context.NONE) + .getValue(); + return this; + } + + public Appliance apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getAppliances() + .updateWithResponse(resourceGroupName, resourceName, updateParameters, context) + .getValue(); + return this; + } + + ApplianceImpl( + ApplianceInner innerObject, com.azure.resourcemanager.resourceconnector.AppliancesManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.resourceName = Utils.getValueFromIdByName(innerObject.id(), "appliances"); + } + + public Appliance refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getAppliances() + .getByResourceGroupWithResponse(resourceGroupName, resourceName, Context.NONE) + .getValue(); + return this; + } + + public Appliance refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getAppliances() + .getByResourceGroupWithResponse(resourceGroupName, resourceName, context) + .getValue(); + return this; + } + + public ApplianceListCredentialResults listClusterUserCredential() { + return serviceManager.appliances().listClusterUserCredential(resourceGroupName, resourceName); + } + + public Response listClusterUserCredentialWithResponse(Context context) { + return serviceManager + .appliances() + .listClusterUserCredentialWithResponse(resourceGroupName, resourceName, context); + } + + public ApplianceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public ApplianceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public ApplianceImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public ApplianceImpl withIdentity(Identity identity) { + this.innerModel().withIdentity(identity); + return this; + } + + public ApplianceImpl withDistro(Distro distro) { + this.innerModel().withDistro(distro); + return this; + } + + public ApplianceImpl withInfrastructureConfig(AppliancePropertiesInfrastructureConfig infrastructureConfig) { + this.innerModel().withInfrastructureConfig(infrastructureConfig); + return this; + } + + public ApplianceImpl withPublicKey(String publicKey) { + this.innerModel().withPublicKey(publicKey); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/implementation/ApplianceListCredentialResultsImpl.java b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/implementation/ApplianceListCredentialResultsImpl.java new file mode 100644 index 0000000000000..59f46b745efe0 --- /dev/null +++ b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/implementation/ApplianceListCredentialResultsImpl.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.resourceconnector.implementation; + +import com.azure.resourcemanager.resourceconnector.fluent.models.ApplianceListCredentialResultsInner; +import com.azure.resourcemanager.resourceconnector.models.ApplianceCredentialKubeconfig; +import com.azure.resourcemanager.resourceconnector.models.ApplianceListCredentialResults; +import com.azure.resourcemanager.resourceconnector.models.HybridConnectionConfig; +import java.util.Collections; +import java.util.List; + +public final class ApplianceListCredentialResultsImpl implements ApplianceListCredentialResults { + private ApplianceListCredentialResultsInner innerObject; + + private final com.azure.resourcemanager.resourceconnector.AppliancesManager serviceManager; + + ApplianceListCredentialResultsImpl( + ApplianceListCredentialResultsInner innerObject, + com.azure.resourcemanager.resourceconnector.AppliancesManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public HybridConnectionConfig hybridConnectionConfig() { + return this.innerModel().hybridConnectionConfig(); + } + + public List kubeconfigs() { + List inner = this.innerModel().kubeconfigs(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public ApplianceListCredentialResultsInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.resourceconnector.AppliancesManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/implementation/ApplianceOperationImpl.java b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/implementation/ApplianceOperationImpl.java new file mode 100644 index 0000000000000..b5e8edaf49a3a --- /dev/null +++ b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/implementation/ApplianceOperationImpl.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourceconnector.implementation; + +import com.azure.resourcemanager.resourceconnector.fluent.models.ApplianceOperationInner; +import com.azure.resourcemanager.resourceconnector.models.ApplianceOperation; + +public final class ApplianceOperationImpl implements ApplianceOperation { + private ApplianceOperationInner innerObject; + + private final com.azure.resourcemanager.resourceconnector.AppliancesManager serviceManager; + + ApplianceOperationImpl( + ApplianceOperationInner innerObject, + com.azure.resourcemanager.resourceconnector.AppliancesManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public Boolean isDataAction() { + return this.innerModel().isDataAction(); + } + + public String name() { + return this.innerModel().name(); + } + + public String origin() { + return this.innerModel().origin(); + } + + public String description() { + return this.innerModel().description(); + } + + public String operation() { + return this.innerModel().operation(); + } + + public String provider() { + return this.innerModel().provider(); + } + + public String resource() { + return this.innerModel().resource(); + } + + public ApplianceOperationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.resourceconnector.AppliancesManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/implementation/AppliancesClientImpl.java b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/implementation/AppliancesClientImpl.java new file mode 100644 index 0000000000000..2a2be6a23e7f0 --- /dev/null +++ b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/implementation/AppliancesClientImpl.java @@ -0,0 +1,1820 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourceconnector.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.resourceconnector.fluent.AppliancesClient; +import com.azure.resourcemanager.resourceconnector.fluent.models.ApplianceInner; +import com.azure.resourcemanager.resourceconnector.fluent.models.ApplianceListCredentialResultsInner; +import com.azure.resourcemanager.resourceconnector.fluent.models.ApplianceOperationInner; +import com.azure.resourcemanager.resourceconnector.models.ApplianceListResult; +import com.azure.resourcemanager.resourceconnector.models.ApplianceOperationsList; +import com.azure.resourcemanager.resourceconnector.models.PatchableAppliance; +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 AppliancesClient. */ +public final class AppliancesClientImpl implements AppliancesClient { + private final ClientLogger logger = new ClientLogger(AppliancesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final AppliancesService service; + + /** The service client containing this operation class. */ + private final AppliancesManagementClientImpl client; + + /** + * Initializes an instance of AppliancesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AppliancesClientImpl(AppliancesManagementClientImpl client) { + this.service = + RestProxy.create(AppliancesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AppliancesManagementClientAppliances to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AppliancesManagement") + private interface AppliancesService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.ResourceConnector/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listOperations( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.ResourceConnector/appliances") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceConnector" + + "/appliances") + @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}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceConnector" + + "/appliances/{resourceName}") + @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("resourceName") String resourceName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceConnector" + + "/appliances/{resourceName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceName") String resourceName, + @BodyParam("application/json") ApplianceInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceConnector" + + "/appliances/{resourceName}") + @ExpectedResponses({202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceName") String resourceName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceConnector" + + "/appliances/{resourceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceName") String resourceName, + @BodyParam("application/json") PatchableAppliance parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ResourceConnector" + + "/appliances/{resourceName}/listClusterUserCredential") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listClusterUserCredential( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceName") String resourceName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listOperationsNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists all available Appliances 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 lists of Appliances operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listOperationsSinglePageAsync() { + 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.listOperations(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all available Appliances 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 lists of Appliances operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listOperationsSinglePageAsync(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 + .listOperations(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all available Appliances 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 lists of Appliances operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listOperationsAsync() { + return new PagedFlux<>( + () -> listOperationsSinglePageAsync(), nextLink -> listOperationsNextSinglePageAsync(nextLink)); + } + + /** + * Lists all available Appliances 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 lists of Appliances operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listOperationsAsync(Context context) { + return new PagedFlux<>( + () -> listOperationsSinglePageAsync(context), + nextLink -> listOperationsNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all available Appliances 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 lists of Appliances operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listOperations() { + return new PagedIterable<>(listOperationsAsync()); + } + + /** + * Lists all available Appliances 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 lists of Appliances operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listOperations(Context context) { + return new PagedIterable<>(listOperationsAsync(context)); + } + + /** + * Gets a list of Appliances in the specified subscription. The operation returns properties of each Appliance. + * + * @throws 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 Appliances in the specified subscription. + */ + @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)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of Appliances in the specified subscription. The operation returns properties of each Appliance. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Appliances in the specified subscription. + */ + @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)); + } + + /** + * Gets a list of Appliances in the specified subscription. The operation returns properties of each Appliance. + * + * @throws 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 Appliances in the specified subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>( + () -> listSinglePageAsync(), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of Appliances in the specified subscription. The operation returns properties of each Appliance. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Appliances in the specified subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of Appliances in the specified subscription. The operation returns properties of each Appliance. + * + * @throws 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 Appliances in the specified subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Gets a list of Appliances in the specified subscription. The operation returns properties of each Appliance. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Appliances in the specified subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Gets a list of Appliances in the specified subscription and resource group. The operation returns properties of + * each Appliance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Appliances in the specified subscription and resource group. + */ + @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)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of Appliances in the specified subscription and resource group. The operation returns properties of + * each Appliance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Appliances in the specified subscription and resource group. + */ + @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)); + } + + /** + * Gets a list of Appliances in the specified subscription and resource group. The operation returns properties of + * each Appliance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Appliances in the specified subscription and resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of Appliances in the specified subscription and resource group. The operation returns properties of + * each Appliance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Appliances in the specified subscription and resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of Appliances in the specified subscription and resource group. The operation returns properties of + * each Appliance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Appliances in the specified subscription and resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Gets a list of Appliances in the specified subscription and resource group. The operation returns properties of + * each Appliance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Appliances in the specified subscription and resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Gets the details of an Appliance with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of an Appliance with a specified resource group and name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String resourceName) { + 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 (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName 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, + resourceName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the details of an Appliance with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of an Appliance with a specified resource group and name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String resourceName, 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 (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName 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, + resourceName, + accept, + context); + } + + /** + * Gets the details of an Appliance with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of an Appliance with a specified resource group and name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String resourceName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, resourceName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the details of an Appliance with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of an Appliance with a specified resource group and name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApplianceInner getByResourceGroup(String resourceGroupName, String resourceName) { + return getByResourceGroupAsync(resourceGroupName, resourceName).block(); + } + + /** + * Gets the details of an Appliance with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of an Appliance with a specified resource group and name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String resourceName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, resourceName, context).block(); + } + + /** + * Creates or updates an Appliance in the specified Subscription and Resource Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @param parameters Parameters supplied to create or update an Appliance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return appliances definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String resourceName, ApplianceInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates an Appliance in the specified Subscription and Resource Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @param parameters Parameters supplied to create or update an Appliance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return appliances definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String resourceName, ApplianceInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + parameters, + accept, + context); + } + + /** + * Creates or updates an Appliance in the specified Subscription and Resource Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @param parameters Parameters supplied to create or update an Appliance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return appliances definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ApplianceInner> beginCreateOrUpdateAsync( + String resourceGroupName, String resourceName, ApplianceInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, resourceName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ApplianceInner.class, ApplianceInner.class, Context.NONE); + } + + /** + * Creates or updates an Appliance in the specified Subscription and Resource Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @param parameters Parameters supplied to create or update an Appliance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return appliances definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ApplianceInner> beginCreateOrUpdateAsync( + String resourceGroupName, String resourceName, ApplianceInner parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, resourceName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ApplianceInner.class, ApplianceInner.class, context); + } + + /** + * Creates or updates an Appliance in the specified Subscription and Resource Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @param parameters Parameters supplied to create or update an Appliance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return appliances definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ApplianceInner> beginCreateOrUpdate( + String resourceGroupName, String resourceName, ApplianceInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, resourceName, parameters).getSyncPoller(); + } + + /** + * Creates or updates an Appliance in the specified Subscription and Resource Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @param parameters Parameters supplied to create or update an Appliance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return appliances definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ApplianceInner> beginCreateOrUpdate( + String resourceGroupName, String resourceName, ApplianceInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, resourceName, parameters, context).getSyncPoller(); + } + + /** + * Creates or updates an Appliance in the specified Subscription and Resource Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @param parameters Parameters supplied to create or update an Appliance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return appliances definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String resourceName, ApplianceInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, resourceName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates an Appliance in the specified Subscription and Resource Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @param parameters Parameters supplied to create or update an Appliance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return appliances definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String resourceName, ApplianceInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, resourceName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates an Appliance in the specified Subscription and Resource Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @param parameters Parameters supplied to create or update an Appliance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return appliances definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApplianceInner createOrUpdate(String resourceGroupName, String resourceName, ApplianceInner parameters) { + return createOrUpdateAsync(resourceGroupName, resourceName, parameters).block(); + } + + /** + * Creates or updates an Appliance in the specified Subscription and Resource Group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @param parameters Parameters supplied to create or update an Appliance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return appliances definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApplianceInner createOrUpdate( + String resourceGroupName, String resourceName, ApplianceInner parameters, Context context) { + return createOrUpdateAsync(resourceGroupName, resourceName, parameters, context).block(); + } + + /** + * Deletes an Appliance with the specified Resource Name, Resource Group, and Subscription Id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, String resourceName) { + 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 (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName 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, + resourceName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes an Appliance with the specified Resource Name, Resource Group, and Subscription Id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String resourceName, 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 (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName 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, + resourceName, + accept, + context); + } + + /** + * Deletes an Appliance with the specified Resource Name, Resource Group, and Subscription Id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String resourceName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, resourceName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes an Appliance with the specified Resource Name, Resource Group, and Subscription Id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String resourceName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, resourceName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes an Appliance with the specified Resource Name, Resource Group, and Subscription Id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String resourceName) { + return beginDeleteAsync(resourceGroupName, resourceName).getSyncPoller(); + } + + /** + * Deletes an Appliance with the specified Resource Name, Resource Group, and Subscription Id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String resourceName, Context context) { + return beginDeleteAsync(resourceGroupName, resourceName, context).getSyncPoller(); + } + + /** + * Deletes an Appliance with the specified Resource Name, Resource Group, and Subscription Id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String resourceName) { + return beginDeleteAsync(resourceGroupName, resourceName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an Appliance with the specified Resource Name, Resource Group, and Subscription Id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String resourceName, Context context) { + return beginDeleteAsync(resourceGroupName, resourceName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an Appliance with the specified Resource Name, Resource Group, and Subscription Id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String resourceName) { + deleteAsync(resourceGroupName, resourceName).block(); + } + + /** + * Deletes an Appliance with the specified Resource Name, Resource Group, and Subscription Id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String resourceName, Context context) { + deleteAsync(resourceGroupName, resourceName, context).block(); + } + + /** + * Updates an Appliance with the specified Resource Name in the specified Resource Group and Subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @param parameters The updatable fields of an existing Appliance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return appliances definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String resourceName, PatchableAppliance parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates an Appliance with the specified Resource Name in the specified Resource Group and Subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @param parameters The updatable fields of an existing Appliance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return appliances definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String resourceName, PatchableAppliance parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + parameters, + accept, + context); + } + + /** + * Updates an Appliance with the specified Resource Name in the specified Resource Group and Subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @param parameters The updatable fields of an existing Appliance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return appliances definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String resourceName, PatchableAppliance parameters) { + return updateWithResponseAsync(resourceGroupName, resourceName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Updates an Appliance with the specified Resource Name in the specified Resource Group and Subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @param parameters The updatable fields of an existing Appliance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return appliances definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApplianceInner update(String resourceGroupName, String resourceName, PatchableAppliance parameters) { + return updateAsync(resourceGroupName, resourceName, parameters).block(); + } + + /** + * Updates an Appliance with the specified Resource Name in the specified Resource Group and Subscription. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @param parameters The updatable fields of an existing Appliance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return appliances definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, String resourceName, PatchableAppliance parameters, Context context) { + return updateWithResponseAsync(resourceGroupName, resourceName, parameters, context).block(); + } + + /** + * Returns the cluster user credentials for the dedicated appliance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Cluster User Credential appliance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listClusterUserCredentialWithResponseAsync( + String resourceGroupName, String resourceName) { + 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 (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listClusterUserCredential( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns the cluster user credentials for the dedicated appliance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Cluster User Credential appliance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listClusterUserCredentialWithResponseAsync( + String resourceGroupName, String resourceName, 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 (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listClusterUserCredential( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + accept, + context); + } + + /** + * Returns the cluster user credentials for the dedicated appliance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Cluster User Credential appliance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listClusterUserCredentialAsync( + String resourceGroupName, String resourceName) { + return listClusterUserCredentialWithResponseAsync(resourceGroupName, resourceName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Returns the cluster user credentials for the dedicated appliance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Cluster User Credential appliance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ApplianceListCredentialResultsInner listClusterUserCredential( + String resourceGroupName, String resourceName) { + return listClusterUserCredentialAsync(resourceGroupName, resourceName).block(); + } + + /** + * Returns the cluster user credentials for the dedicated appliance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Cluster User Credential appliance. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listClusterUserCredentialWithResponse( + String resourceGroupName, String resourceName, Context context) { + return listClusterUserCredentialWithResponseAsync(resourceGroupName, resourceName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return lists of Appliances operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listOperationsNextSinglePageAsync(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.listOperationsNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return lists of Appliances operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listOperationsNextSinglePageAsync( + 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 + .listOperationsNext(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 Appliances 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)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Appliances 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)); + } + + /** + * 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 Appliances 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)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Appliances 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)); + } +} diff --git a/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/implementation/AppliancesImpl.java b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/implementation/AppliancesImpl.java new file mode 100644 index 0000000000000..b721631956c0b --- /dev/null +++ b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/implementation/AppliancesImpl.java @@ -0,0 +1,209 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourceconnector.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.resourceconnector.fluent.AppliancesClient; +import com.azure.resourcemanager.resourceconnector.fluent.models.ApplianceInner; +import com.azure.resourcemanager.resourceconnector.fluent.models.ApplianceListCredentialResultsInner; +import com.azure.resourcemanager.resourceconnector.fluent.models.ApplianceOperationInner; +import com.azure.resourcemanager.resourceconnector.models.Appliance; +import com.azure.resourcemanager.resourceconnector.models.ApplianceListCredentialResults; +import com.azure.resourcemanager.resourceconnector.models.ApplianceOperation; +import com.azure.resourcemanager.resourceconnector.models.Appliances; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class AppliancesImpl implements Appliances { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AppliancesImpl.class); + + private final AppliancesClient innerClient; + + private final com.azure.resourcemanager.resourceconnector.AppliancesManager serviceManager; + + public AppliancesImpl( + AppliancesClient innerClient, com.azure.resourcemanager.resourceconnector.AppliancesManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listOperations() { + PagedIterable inner = this.serviceClient().listOperations(); + return Utils.mapPage(inner, inner1 -> new ApplianceOperationImpl(inner1, this.manager())); + } + + public PagedIterable listOperations(Context context) { + PagedIterable inner = this.serviceClient().listOperations(context); + return Utils.mapPage(inner, inner1 -> new ApplianceOperationImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new ApplianceImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new ApplianceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new ApplianceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new ApplianceImpl(inner1, this.manager())); + } + + public Appliance getByResourceGroup(String resourceGroupName, String resourceName) { + ApplianceInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, resourceName); + if (inner != null) { + return new ApplianceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String resourceName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, resourceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ApplianceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String resourceName) { + this.serviceClient().delete(resourceGroupName, resourceName); + } + + public void delete(String resourceGroupName, String resourceName, Context context) { + this.serviceClient().delete(resourceGroupName, resourceName, context); + } + + public ApplianceListCredentialResults listClusterUserCredential(String resourceGroupName, String resourceName) { + ApplianceListCredentialResultsInner inner = + this.serviceClient().listClusterUserCredential(resourceGroupName, resourceName); + if (inner != null) { + return new ApplianceListCredentialResultsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listClusterUserCredentialWithResponse( + String resourceGroupName, String resourceName, Context context) { + Response inner = + this.serviceClient().listClusterUserCredentialWithResponse(resourceGroupName, resourceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ApplianceListCredentialResultsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Appliance 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 resourceName = Utils.getValueFromIdByName(id, "appliances"); + if (resourceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'appliances'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, resourceName, 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 resourceName = Utils.getValueFromIdByName(id, "appliances"); + if (resourceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'appliances'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, resourceName, 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 resourceName = Utils.getValueFromIdByName(id, "appliances"); + if (resourceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'appliances'.", id))); + } + this.delete(resourceGroupName, resourceName, 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 resourceName = Utils.getValueFromIdByName(id, "appliances"); + if (resourceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'appliances'.", id))); + } + this.delete(resourceGroupName, resourceName, context); + } + + private AppliancesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.resourceconnector.AppliancesManager manager() { + return this.serviceManager; + } + + public ApplianceImpl define(String name) { + return new ApplianceImpl(name, this.manager()); + } +} diff --git a/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/implementation/AppliancesManagementClientBuilder.java b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/implementation/AppliancesManagementClientBuilder.java new file mode 100644 index 0000000000000..2d655b1a45f81 --- /dev/null +++ b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/implementation/AppliancesManagementClientBuilder.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourceconnector.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 AppliancesManagementClientImpl type. */ +@ServiceClientBuilder(serviceClients = {AppliancesManagementClientImpl.class}) +public final class AppliancesManagementClientBuilder { + /* + * The ID of the target subscription. + */ + private String subscriptionId; + + /** + * Sets The ID of the target subscription. + * + * @param subscriptionId the subscriptionId value. + * @return the AppliancesManagementClientBuilder. + */ + public AppliancesManagementClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the AppliancesManagementClientBuilder. + */ + public AppliancesManagementClientBuilder 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 AppliancesManagementClientBuilder. + */ + public AppliancesManagementClientBuilder 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 AppliancesManagementClientBuilder. + */ + public AppliancesManagementClientBuilder 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 AppliancesManagementClientBuilder. + */ + public AppliancesManagementClientBuilder 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 AppliancesManagementClientBuilder. + */ + public AppliancesManagementClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of AppliancesManagementClientImpl with the provided parameters. + * + * @return an instance of AppliancesManagementClientImpl. + */ + public AppliancesManagementClientImpl 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(); + } + AppliancesManagementClientImpl client = + new AppliancesManagementClientImpl( + pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + return client; + } +} diff --git a/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/implementation/AppliancesManagementClientImpl.java b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/implementation/AppliancesManagementClientImpl.java new file mode 100644 index 0000000000000..f35e04dc9ea3b --- /dev/null +++ b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/implementation/AppliancesManagementClientImpl.java @@ -0,0 +1,293 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourceconnector.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.resourceconnector.fluent.AppliancesClient; +import com.azure.resourcemanager.resourceconnector.fluent.AppliancesManagementClient; +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 AppliancesManagementClientImpl type. */ +@ServiceClient(builder = AppliancesManagementClientBuilder.class) +public final class AppliancesManagementClientImpl implements AppliancesManagementClient { + private final ClientLogger logger = new ClientLogger(AppliancesManagementClientImpl.class); + + /** The ID of the target subscription. */ + private final String subscriptionId; + + /** + * Gets The ID of the target subscription. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** server parameter. */ + private final String endpoint; + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** Api Version. */ + private final String apiVersion; + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** The HTTP pipeline to send requests through. */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** The serializer to serialize an object into a string. */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** The default poll interval for long-running operation. */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** The AppliancesClient object to access its operations. */ + private final AppliancesClient appliances; + + /** + * Gets the AppliancesClient object to access its operations. + * + * @return the AppliancesClient object. + */ + public AppliancesClient getAppliances() { + return this.appliances; + } + + /** + * Initializes an instance of AppliancesManagementClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param subscriptionId The ID of the target subscription. + * @param endpoint server parameter. + */ + AppliancesManagementClientImpl( + HttpPipeline httpPipeline, + SerializerAdapter serializerAdapter, + Duration defaultPollInterval, + AzureEnvironment environment, + String subscriptionId, + String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + this.apiVersion = "2021-10-31-preview"; + this.appliances = new AppliancesClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + for (Map.Entry entry : this.getContext().getValues().entrySet()) { + context = context.addData(entry.getKey(), entry.getValue()); + } + return context; + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult( + Mono>> activationResponse, + HttpPipeline httpPipeline, + Type pollResultType, + Type finalResultType, + Context context) { + return PollerFactory + .create( + serializerAdapter, + httpPipeline, + pollResultType, + finalResultType, + defaultPollInterval, + activationResponse, + context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = + new HttpResponseImpl( + lroError.getResponseStatusCode(), lroError.getResponseHeaders(), lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = + this + .getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + logger.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(s); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } +} diff --git a/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/implementation/Utils.java b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/implementation/Utils.java new file mode 100644 index 0000000000000..2bd9fb9160dc9 --- /dev/null +++ b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/implementation/Utils.java @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourceconnector.implementation; + +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.util.CoreUtils; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import reactor.core.publisher.Flux; + +final class Utils { + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterator itr = Arrays.stream(id.split("/")).iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && !part.trim().isEmpty()) { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { + if (id == null || pathTemplate == null) { + return null; + } + String parameterNameParentheses = "{" + parameterName + "}"; + List idSegmentsReverted = Arrays.asList(id.split("/")); + List pathSegments = Arrays.asList(pathTemplate.split("/")); + Collections.reverse(idSegmentsReverted); + Iterator idItrReverted = idSegmentsReverted.iterator(); + int pathIndex = pathSegments.size(); + while (idItrReverted.hasNext() && pathIndex > 0) { + String idSegment = idItrReverted.next(); + String pathSegment = pathSegments.get(--pathIndex); + if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { + if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { + if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { + List segments = new ArrayList<>(); + segments.add(idSegment); + idItrReverted.forEachRemaining(segments::add); + Collections.reverse(segments); + if (segments.size() > 0 && segments.get(0).isEmpty()) { + segments.remove(0); + } + return String.join("/", segments); + } else { + return idSegment; + } + } + } + } + return null; + } + + static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { + return new PagedIterableImpl(pageIterable, mapper); + } + + private static final class PagedIterableImpl extends PagedIterable { + + private final PagedIterable pagedIterable; + private final Function mapper; + private final Function, PagedResponse> pageMapper; + + private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { + super( + PagedFlux + .create( + () -> + (continuationToken, pageSize) -> + Flux.fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); + this.pagedIterable = pagedIterable; + this.mapper = mapper; + this.pageMapper = getPageMapper(mapper); + } + + private static Function, PagedResponse> getPageMapper(Function mapper) { + return page -> + new PagedResponseBase( + page.getRequest(), + page.getStatusCode(), + page.getHeaders(), + page.getElements().stream().map(mapper).collect(Collectors.toList()), + page.getContinuationToken(), + null); + } + + @Override + public Stream stream() { + return pagedIterable.stream().map(mapper); + } + + @Override + public Stream> streamByPage() { + return pagedIterable.streamByPage().map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken) { + return pagedIterable.streamByPage(continuationToken).map(pageMapper); + } + + @Override + public Stream> streamByPage(int preferredPageSize) { + return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken, int preferredPageSize) { + return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + } + + @Override + public Iterator iterator() { + return new IteratorImpl(pagedIterable.iterator(), mapper); + } + + @Override + public Iterable> iterableByPage() { + return new IterableImpl, PagedResponse>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); + } + } + + private static final class IteratorImpl implements Iterator { + + private final Iterator iterator; + private final Function mapper; + + private IteratorImpl(Iterator iterator, Function mapper) { + this.iterator = iterator; + this.mapper = mapper; + } + + @Override + public boolean hasNext() { + return iterator.hasNext(); + } + + @Override + public S next() { + return mapper.apply(iterator.next()); + } + + @Override + public void remove() { + iterator.remove(); + } + } + + private static final class IterableImpl implements Iterable { + + private final Iterable iterable; + private final Function mapper; + + private IterableImpl(Iterable iterable, Function mapper) { + this.iterable = iterable; + this.mapper = mapper; + } + + @Override + public Iterator iterator() { + return new IteratorImpl(iterable.iterator(), mapper); + } + } +} diff --git a/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/implementation/package-info.java b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/implementation/package-info.java new file mode 100644 index 0000000000000..28464e7c6540c --- /dev/null +++ b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/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 AppliancesManagementClient. The appliances Rest API spec. */ +package com.azure.resourcemanager.resourceconnector.implementation; diff --git a/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/models/AccessProfileType.java b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/models/AccessProfileType.java new file mode 100644 index 0000000000000..25ca9d1d4c480 --- /dev/null +++ b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/models/AccessProfileType.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.resourceconnector.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for AccessProfileType. */ +public final class AccessProfileType extends ExpandableStringEnum { + /** Static value clusterUser for AccessProfileType. */ + public static final AccessProfileType CLUSTER_USER = fromString("clusterUser"); + + /** + * Creates or finds a AccessProfileType from its string representation. + * + * @param name a name to look for. + * @return the corresponding AccessProfileType. + */ + @JsonCreator + public static AccessProfileType fromString(String name) { + return fromString(name, AccessProfileType.class); + } + + /** @return known AccessProfileType values. */ + public static Collection values() { + return values(AccessProfileType.class); + } +} diff --git a/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/models/Appliance.java b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/models/Appliance.java new file mode 100644 index 0000000000000..34f7efd5f0afb --- /dev/null +++ b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/models/Appliance.java @@ -0,0 +1,316 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourceconnector.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.resourceconnector.fluent.models.ApplianceInner; +import java.util.Map; + +/** An immutable client-side representation of Appliance. */ +public interface Appliance { + /** + * 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: Identity for the resource. + * + * @return the identity value. + */ + Identity identity(); + + /** + * Gets the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the distro property: Represents a supported Fabric/Infra. (AKSEdge etc...). + * + * @return the distro value. + */ + Distro distro(); + + /** + * Gets the infrastructureConfig property: Contains infrastructure information about the Appliance. + * + * @return the infrastructureConfig value. + */ + AppliancePropertiesInfrastructureConfig infrastructureConfig(); + + /** + * Gets the provisioningState property: The current deployment or provisioning state, which only appears in the + * response. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the publicKey property: Certificates pair used to download MSI certificate from HIS. + * + * @return the publicKey value. + */ + String publicKey(); + + /** + * Gets the status property: Appliance’s health and state of connection to on-prem. + * + * @return the status value. + */ + Status status(); + + /** + * Gets the version property: Version of the Appliance. + * + * @return the version value. + */ + String version(); + + /** + * 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.resourceconnector.fluent.models.ApplianceInner object. + * + * @return the inner object. + */ + ApplianceInner innerModel(); + + /** The entirety of the Appliance definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The Appliance definition stages. */ + interface DefinitionStages { + /** The first stage of the Appliance definition. */ + interface Blank extends WithLocation { + } + /** The stage of the Appliance definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + /** The stage of the Appliance definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the Appliance 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.WithIdentity, + DefinitionStages.WithDistro, + DefinitionStages.WithInfrastructureConfig, + DefinitionStages.WithPublicKey { + /** + * Executes the create request. + * + * @return the created resource. + */ + Appliance create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Appliance create(Context context); + } + /** The stage of the Appliance 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 Appliance definition allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: Identity for the resource.. + * + * @param identity Identity for the resource. + * @return the next definition stage. + */ + WithCreate withIdentity(Identity identity); + } + /** The stage of the Appliance definition allowing to specify distro. */ + interface WithDistro { + /** + * Specifies the distro property: Represents a supported Fabric/Infra. (AKSEdge etc...).. + * + * @param distro Represents a supported Fabric/Infra. (AKSEdge etc...). + * @return the next definition stage. + */ + WithCreate withDistro(Distro distro); + } + /** The stage of the Appliance definition allowing to specify infrastructureConfig. */ + interface WithInfrastructureConfig { + /** + * Specifies the infrastructureConfig property: Contains infrastructure information about the Appliance. + * + * @param infrastructureConfig Contains infrastructure information about the Appliance. + * @return the next definition stage. + */ + WithCreate withInfrastructureConfig(AppliancePropertiesInfrastructureConfig infrastructureConfig); + } + /** The stage of the Appliance definition allowing to specify publicKey. */ + interface WithPublicKey { + /** + * Specifies the publicKey property: Certificates pair used to download MSI certificate from HIS. + * + * @param publicKey Certificates pair used to download MSI certificate from HIS. + * @return the next definition stage. + */ + WithCreate withPublicKey(String publicKey); + } + } + /** + * Begins update for the Appliance resource. + * + * @return the stage of resource update. + */ + Appliance.Update update(); + + /** The template for Appliance update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Appliance apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Appliance apply(Context context); + } + /** The Appliance update stages. */ + interface UpdateStages { + /** The stage of the Appliance update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Appliance refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Appliance refresh(Context context); + + /** + * Returns the cluster user credentials for the dedicated appliance. + * + * @throws com.azure.core.management.exception.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 Cluster User Credential appliance. + */ + ApplianceListCredentialResults listClusterUserCredential(); + + /** + * Returns the cluster user credentials for the dedicated appliance. + * + * @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 Cluster User Credential appliance. + */ + Response listClusterUserCredentialWithResponse(Context context); +} diff --git a/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/models/ApplianceCredentialKubeconfig.java b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/models/ApplianceCredentialKubeconfig.java new file mode 100644 index 0000000000000..642974b6c04d9 --- /dev/null +++ b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/models/ApplianceCredentialKubeconfig.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourceconnector.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; + +/** Cluster User Credential appliance. */ +@Immutable +public final class ApplianceCredentialKubeconfig { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ApplianceCredentialKubeconfig.class); + + /* + * Name which contains the role of the kubeconfig. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private AccessProfileType name; + + /* + * Contains the kubeconfig value. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private String value; + + /** + * Get the name property: Name which contains the role of the kubeconfig. + * + * @return the name value. + */ + public AccessProfileType name() { + return this.name; + } + + /** + * Get the value property: Contains the kubeconfig value. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/models/ApplianceListCredentialResults.java b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/models/ApplianceListCredentialResults.java new file mode 100644 index 0000000000000..d88826884d4d1 --- /dev/null +++ b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/models/ApplianceListCredentialResults.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourceconnector.models; + +import com.azure.resourcemanager.resourceconnector.fluent.models.ApplianceListCredentialResultsInner; +import java.util.List; + +/** An immutable client-side representation of ApplianceListCredentialResults. */ +public interface ApplianceListCredentialResults { + /** + * Gets the hybridConnectionConfig property: Contains the REP (rendezvous endpoint) and “Listener” access token from + * notification service (NS). + * + * @return the hybridConnectionConfig value. + */ + HybridConnectionConfig hybridConnectionConfig(); + + /** + * Gets the kubeconfigs property: The list of appliance kubeconfigs. + * + * @return the kubeconfigs value. + */ + List kubeconfigs(); + + /** + * Gets the inner com.azure.resourcemanager.resourceconnector.fluent.models.ApplianceListCredentialResultsInner + * object. + * + * @return the inner object. + */ + ApplianceListCredentialResultsInner innerModel(); +} diff --git a/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/models/ApplianceListResult.java b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/models/ApplianceListResult.java new file mode 100644 index 0000000000000..fd07df9210efa --- /dev/null +++ b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/models/ApplianceListResult.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.resourceconnector.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.resourceconnector.fluent.models.ApplianceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List Appliances operation response. */ +@Immutable +public final class ApplianceListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ApplianceListResult.class); + + /* + * The URL to use for getting the next set of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /* + * The list of Appliances. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the nextLink property: The URL to use for getting the next set of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Get the value property: The list of Appliances. + * + * @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/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/models/ApplianceOperation.java b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/models/ApplianceOperation.java new file mode 100644 index 0000000000000..6b5dd3933316c --- /dev/null +++ b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/models/ApplianceOperation.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourceconnector.models; + +import com.azure.resourcemanager.resourceconnector.fluent.models.ApplianceOperationInner; + +/** An immutable client-side representation of ApplianceOperation. */ +public interface ApplianceOperation { + /** + * Gets the isDataAction property: Is this Operation a data plane operation. + * + * @return the isDataAction value. + */ + Boolean isDataAction(); + + /** + * Gets the name property: The name of the compute operation. + * + * @return the name value. + */ + String name(); + + /** + * Gets the origin property: The origin of the compute operation. + * + * @return the origin value. + */ + String origin(); + + /** + * Gets the description property: The description of the operation. + * + * @return the description value. + */ + String description(); + + /** + * Gets the operation property: The display name of the compute operation. + * + * @return the operation value. + */ + String operation(); + + /** + * Gets the provider property: The resource provider for the operation. + * + * @return the provider value. + */ + String provider(); + + /** + * Gets the resource property: The display name of the resource the operation applies to. + * + * @return the resource value. + */ + String resource(); + + /** + * Gets the inner com.azure.resourcemanager.resourceconnector.fluent.models.ApplianceOperationInner object. + * + * @return the inner object. + */ + ApplianceOperationInner innerModel(); +} diff --git a/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/models/ApplianceOperationsList.java b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/models/ApplianceOperationsList.java new file mode 100644 index 0000000000000..58f06ca7c6efa --- /dev/null +++ b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/models/ApplianceOperationsList.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourceconnector.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.resourceconnector.fluent.models.ApplianceOperationInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Lists of Appliances operations. */ +@Fluent +public final class ApplianceOperationsList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ApplianceOperationsList.class); + + /* + * Next page of operations. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /* + * Array of applianceOperation + */ + @JsonProperty(value = "value", required = true) + private List value; + + /** + * Get the nextLink property: Next page of operations. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Next page of operations. + * + * @param nextLink the nextLink value to set. + * @return the ApplianceOperationsList object itself. + */ + public ApplianceOperationsList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Get the value property: Array of applianceOperation. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Array of applianceOperation. + * + * @param value the value value to set. + * @return the ApplianceOperationsList object itself. + */ + public ApplianceOperationsList withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model ApplianceOperationsList")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/models/AppliancePropertiesInfrastructureConfig.java b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/models/AppliancePropertiesInfrastructureConfig.java new file mode 100644 index 0000000000000..752856b4e7c61 --- /dev/null +++ b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/models/AppliancePropertiesInfrastructureConfig.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourceconnector.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; + +/** Contains infrastructure information about the Appliance. */ +@Fluent +public final class AppliancePropertiesInfrastructureConfig { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AppliancePropertiesInfrastructureConfig.class); + + /* + * Information about the connected appliance. + */ + @JsonProperty(value = "provider") + private Provider provider; + + /** + * Get the provider property: Information about the connected appliance. + * + * @return the provider value. + */ + public Provider provider() { + return this.provider; + } + + /** + * Set the provider property: Information about the connected appliance. + * + * @param provider the provider value to set. + * @return the AppliancePropertiesInfrastructureConfig object itself. + */ + public AppliancePropertiesInfrastructureConfig withProvider(Provider provider) { + this.provider = provider; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/models/Appliances.java b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/models/Appliances.java new file mode 100644 index 0000000000000..47d0fcd9a4ccc --- /dev/null +++ b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/models/Appliances.java @@ -0,0 +1,203 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourceconnector.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 Appliances. */ +public interface Appliances { + /** + * Lists all available Appliances 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 lists of Appliances operations. + */ + PagedIterable listOperations(); + + /** + * Lists all available Appliances 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 lists of Appliances operations. + */ + PagedIterable listOperations(Context context); + + /** + * Gets a list of Appliances in the specified subscription. The operation returns properties of each Appliance. + * + * @throws com.azure.core.management.exception.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 Appliances in the specified subscription. + */ + PagedIterable list(); + + /** + * Gets a list of Appliances in the specified subscription. The operation returns properties of each Appliance. + * + * @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 Appliances in the specified subscription. + */ + PagedIterable list(Context context); + + /** + * Gets a list of Appliances in the specified subscription and resource group. The operation returns properties of + * each Appliance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Appliances in the specified subscription and resource group. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets a list of Appliances in the specified subscription and resource group. The operation returns properties of + * each Appliance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Appliances in the specified subscription and resource group. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets the details of an Appliance with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of an Appliance with a specified resource group and name. + */ + Appliance getByResourceGroup(String resourceGroupName, String resourceName); + + /** + * Gets the details of an Appliance with a specified resource group and name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of an Appliance with a specified resource group and name. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String resourceName, Context context); + + /** + * Deletes an Appliance with the specified Resource Name, Resource Group, and Subscription Id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String resourceName); + + /** + * Deletes an Appliance with the specified Resource Name, Resource Group, and Subscription Id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String resourceName, Context context); + + /** + * Returns the cluster user credentials for the dedicated appliance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Cluster User Credential appliance. + */ + ApplianceListCredentialResults listClusterUserCredential(String resourceGroupName, String resourceName); + + /** + * Returns the cluster user credentials for the dedicated appliance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName Appliances name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the List Cluster User Credential appliance. + */ + Response listClusterUserCredentialWithResponse( + String resourceGroupName, String resourceName, Context context); + + /** + * Gets the details of an Appliance with a specified resource group and name. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of an Appliance with a specified resource group and name. + */ + Appliance getById(String id); + + /** + * Gets the details of an Appliance with a specified resource group and name. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of an Appliance with a specified resource group and name. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes an Appliance with the specified Resource Name, Resource Group, and Subscription Id. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes an Appliance with the specified Resource Name, Resource Group, and Subscription Id. + * + * @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 Appliance resource. + * + * @param name resource name. + * @return the first stage of the new Appliance definition. + */ + Appliance.DefinitionStages.Blank define(String name); +} diff --git a/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/models/Distro.java b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/models/Distro.java new file mode 100644 index 0000000000000..e1ec6a2f4ad1d --- /dev/null +++ b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/models/Distro.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.resourceconnector.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for Distro. */ +public final class Distro extends ExpandableStringEnum { + /** Static value AKSEdge for Distro. */ + public static final Distro AKSEDGE = fromString("AKSEdge"); + + /** + * Creates or finds a Distro from its string representation. + * + * @param name a name to look for. + * @return the corresponding Distro. + */ + @JsonCreator + public static Distro fromString(String name) { + return fromString(name, Distro.class); + } + + /** @return known Distro values. */ + public static Collection values() { + return values(Distro.class); + } +} diff --git a/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/models/HybridConnectionConfig.java b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/models/HybridConnectionConfig.java new file mode 100644 index 0000000000000..f255aa3cd2e54 --- /dev/null +++ b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/models/HybridConnectionConfig.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.resourceconnector.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; + +/** Contains the REP (rendezvous endpoint) and “Listener” access token from notification service (NS). */ +@Immutable +public final class HybridConnectionConfig { + @JsonIgnore private final ClientLogger logger = new ClientLogger(HybridConnectionConfig.class); + + /* + * Timestamp when this token will be expired. + */ + @JsonProperty(value = "expirationTime", access = JsonProperty.Access.WRITE_ONLY) + private Long expirationTime; + + /* + * Name of the connection + */ + @JsonProperty(value = "hybridConnectionName", access = JsonProperty.Access.WRITE_ONLY) + private String hybridConnectionName; + + /* + * Name of the notification service. + */ + @JsonProperty(value = "relay", access = JsonProperty.Access.WRITE_ONLY) + private String relay; + + /* + * Listener access token + */ + @JsonProperty(value = "token", access = JsonProperty.Access.WRITE_ONLY) + private String token; + + /** + * Get the expirationTime property: Timestamp when this token will be expired. + * + * @return the expirationTime value. + */ + public Long expirationTime() { + return this.expirationTime; + } + + /** + * Get the hybridConnectionName property: Name of the connection. + * + * @return the hybridConnectionName value. + */ + public String hybridConnectionName() { + return this.hybridConnectionName; + } + + /** + * Get the relay property: Name of the notification service. + * + * @return the relay value. + */ + public String relay() { + return this.relay; + } + + /** + * Get the token property: Listener access token. + * + * @return the token value. + */ + public String token() { + return this.token; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/models/Identity.java b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/models/Identity.java new file mode 100644 index 0000000000000..7ab82469dccc6 --- /dev/null +++ b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/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.resourceconnector.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Identity for the resource. */ +@Fluent +public class Identity { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Identity.class); + + /* + * The principal ID of resource identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private String principalId; + + /* + * The tenant ID of resource. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private String tenantId; + + /* + * The identity type. + */ + @JsonProperty(value = "type") + private ResourceIdentityType type; + + /** + * Get the principalId property: The principal ID of resource identity. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the tenantId property: The tenant ID of resource. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Get the type property: The identity type. + * + * @return the type value. + */ + public ResourceIdentityType type() { + return this.type; + } + + /** + * Set the type property: The identity type. + * + * @param type the type value to set. + * @return the Identity object itself. + */ + public Identity withType(ResourceIdentityType type) { + this.type = type; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/models/PatchableAppliance.java b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/models/PatchableAppliance.java new file mode 100644 index 0000000000000..ebf8ec3ec9313 --- /dev/null +++ b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/models/PatchableAppliance.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.resourceconnector.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.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The Appliances patchable resource definition. */ +@Fluent +public final class PatchableAppliance { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PatchableAppliance.class); + + /* + * Resource tags + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + 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 PatchableAppliance object itself. + */ + public PatchableAppliance 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/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/models/Provider.java b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/models/Provider.java new file mode 100644 index 0000000000000..4e0fee6fc5663 --- /dev/null +++ b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/models/Provider.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.resourceconnector.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for Provider. */ +public final class Provider extends ExpandableStringEnum { + /** Static value VMWare for Provider. */ + public static final Provider VMWARE = fromString("VMWare"); + + /** Static value HCI for Provider. */ + public static final Provider HCI = fromString("HCI"); + + /** Static value SCVMM for Provider. */ + public static final Provider SCVMM = fromString("SCVMM"); + + /** + * Creates or finds a Provider from its string representation. + * + * @param name a name to look for. + * @return the corresponding Provider. + */ + @JsonCreator + public static Provider fromString(String name) { + return fromString(name, Provider.class); + } + + /** @return known Provider values. */ + public static Collection values() { + return values(Provider.class); + } +} diff --git a/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/models/ResourceIdentityType.java b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/models/ResourceIdentityType.java new file mode 100644 index 0000000000000..9c2bfab4b90c2 --- /dev/null +++ b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/models/ResourceIdentityType.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourceconnector.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ResourceIdentityType. */ +public final class ResourceIdentityType extends ExpandableStringEnum { + /** Static value SystemAssigned for ResourceIdentityType. */ + public static final ResourceIdentityType SYSTEM_ASSIGNED = fromString("SystemAssigned"); + + /** Static value None for ResourceIdentityType. */ + public static final ResourceIdentityType NONE = fromString("None"); + + /** + * Creates or finds a ResourceIdentityType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ResourceIdentityType. + */ + @JsonCreator + public static ResourceIdentityType fromString(String name) { + return fromString(name, ResourceIdentityType.class); + } + + /** @return known ResourceIdentityType values. */ + public static Collection values() { + return values(ResourceIdentityType.class); + } +} diff --git a/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/models/Status.java b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/models/Status.java new file mode 100644 index 0000000000000..4f77c5f6deab5 --- /dev/null +++ b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/models/Status.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourceconnector.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for Status. */ +public final class Status extends ExpandableStringEnum { + /** Static value WaitingForHeartbeat for Status. */ + public static final Status WAITING_FOR_HEARTBEAT = fromString("WaitingForHeartbeat"); + + /** Static value Validating for Status. */ + public static final Status VALIDATING = fromString("Validating"); + + /** Static value Connected for Status. */ + public static final Status CONNECTED = fromString("Connected"); + + /** Static value Running for Status. */ + public static final Status RUNNING = fromString("Running"); + + /** + * Creates or finds a Status from its string representation. + * + * @param name a name to look for. + * @return the corresponding Status. + */ + @JsonCreator + public static Status fromString(String name) { + return fromString(name, Status.class); + } + + /** @return known Status values. */ + public static Collection values() { + return values(Status.class); + } +} diff --git a/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/models/package-info.java b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/models/package-info.java new file mode 100644 index 0000000000000..be3c9e91a5df1 --- /dev/null +++ b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/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 AppliancesManagementClient. The appliances Rest API spec. */ +package com.azure.resourcemanager.resourceconnector.models; diff --git a/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/package-info.java b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/package-info.java new file mode 100644 index 0000000000000..3ec1843a0e7de --- /dev/null +++ b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/com/azure/resourcemanager/resourceconnector/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 AppliancesManagementClient. The appliances Rest API spec. */ +package com.azure.resourcemanager.resourceconnector; diff --git a/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/module-info.java b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/main/java/module-info.java new file mode 100644 index 0000000000000..d6db277e2f13f --- /dev/null +++ b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/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.resourceconnector { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.resourceconnector; + exports com.azure.resourcemanager.resourceconnector.fluent; + exports com.azure.resourcemanager.resourceconnector.fluent.models; + exports com.azure.resourcemanager.resourceconnector.models; + + opens com.azure.resourcemanager.resourceconnector.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.resourceconnector.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/samples/java/com/azure/resourcemanager/resourceconnector/generated/AppliancesCreateOrUpdateSamples.java b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/samples/java/com/azure/resourcemanager/resourceconnector/generated/AppliancesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..ac7f6d3f70371 --- /dev/null +++ b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/samples/java/com/azure/resourcemanager/resourceconnector/generated/AppliancesCreateOrUpdateSamples.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.resourceconnector.generated; + +import com.azure.resourcemanager.resourceconnector.models.AppliancePropertiesInfrastructureConfig; +import com.azure.resourcemanager.resourceconnector.models.Distro; +import com.azure.resourcemanager.resourceconnector.models.Provider; + +/** Samples for Appliances CreateOrUpdate. */ +public final class AppliancesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/preview/2021-10-31-preview/examples/AppliancesCreate_Update.json + */ + /** + * Sample code: Create/Update Appliance. + * + * @param manager Entry point to AppliancesManager. + */ + public static void createUpdateAppliance(com.azure.resourcemanager.resourceconnector.AppliancesManager manager) { + manager + .appliances() + .define("appliance01") + .withRegion("West US") + .withExistingResourceGroup("testresourcegroup") + .withDistro(Distro.AKSEDGE) + .withInfrastructureConfig(new AppliancePropertiesInfrastructureConfig().withProvider(Provider.VMWARE)) + .create(); + } +} diff --git a/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/samples/java/com/azure/resourcemanager/resourceconnector/generated/AppliancesDeleteSamples.java b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/samples/java/com/azure/resourcemanager/resourceconnector/generated/AppliancesDeleteSamples.java new file mode 100644 index 0000000000000..14cff4a625866 --- /dev/null +++ b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/samples/java/com/azure/resourcemanager/resourceconnector/generated/AppliancesDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourceconnector.generated; + +import com.azure.core.util.Context; + +/** Samples for Appliances Delete. */ +public final class AppliancesDeleteSamples { + /* + * x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/preview/2021-10-31-preview/examples/AppliancesDelete.json + */ + /** + * Sample code: Delete Appliance. + * + * @param manager Entry point to AppliancesManager. + */ + public static void deleteAppliance(com.azure.resourcemanager.resourceconnector.AppliancesManager manager) { + manager.appliances().delete("testresourcegroup", "appliance01", Context.NONE); + } +} diff --git a/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/samples/java/com/azure/resourcemanager/resourceconnector/generated/AppliancesGetByResourceGroupSamples.java b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/samples/java/com/azure/resourcemanager/resourceconnector/generated/AppliancesGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..78d8c0a25f1c6 --- /dev/null +++ b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/samples/java/com/azure/resourcemanager/resourceconnector/generated/AppliancesGetByResourceGroupSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourceconnector.generated; + +import com.azure.core.util.Context; + +/** Samples for Appliances GetByResourceGroup. */ +public final class AppliancesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/preview/2021-10-31-preview/examples/AppliancesGet.json + */ + /** + * Sample code: Get Appliance. + * + * @param manager Entry point to AppliancesManager. + */ + public static void getAppliance(com.azure.resourcemanager.resourceconnector.AppliancesManager manager) { + manager.appliances().getByResourceGroupWithResponse("testresourcegroup", "appliance01", Context.NONE); + } +} diff --git a/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/samples/java/com/azure/resourcemanager/resourceconnector/generated/AppliancesListByResourceGroupSamples.java b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/samples/java/com/azure/resourcemanager/resourceconnector/generated/AppliancesListByResourceGroupSamples.java new file mode 100644 index 0000000000000..9471992275023 --- /dev/null +++ b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/samples/java/com/azure/resourcemanager/resourceconnector/generated/AppliancesListByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourceconnector.generated; + +import com.azure.core.util.Context; + +/** Samples for Appliances ListByResourceGroup. */ +public final class AppliancesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/preview/2021-10-31-preview/examples/AppliancesListByResourceGroup.json + */ + /** + * Sample code: List Appliances by resource group. + * + * @param manager Entry point to AppliancesManager. + */ + public static void listAppliancesByResourceGroup( + com.azure.resourcemanager.resourceconnector.AppliancesManager manager) { + manager.appliances().listByResourceGroup("testresourcegroup", Context.NONE); + } +} diff --git a/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/samples/java/com/azure/resourcemanager/resourceconnector/generated/AppliancesListClusterUserCredentialSamples.java b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/samples/java/com/azure/resourcemanager/resourceconnector/generated/AppliancesListClusterUserCredentialSamples.java new file mode 100644 index 0000000000000..5d5a77f621fe0 --- /dev/null +++ b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/samples/java/com/azure/resourcemanager/resourceconnector/generated/AppliancesListClusterUserCredentialSamples.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.resourceconnector.generated; + +import com.azure.core.util.Context; + +/** Samples for Appliances ListClusterUserCredential. */ +public final class AppliancesListClusterUserCredentialSamples { + /* + * x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/preview/2021-10-31-preview/examples/AppliancesListClusterUserCredential.json + */ + /** + * Sample code: ListClusterUserCredentialAppliance. + * + * @param manager Entry point to AppliancesManager. + */ + public static void listClusterUserCredentialAppliance( + com.azure.resourcemanager.resourceconnector.AppliancesManager manager) { + manager + .appliances() + .listClusterUserCredentialWithResponse("testresourcegroup", "testresourcename", Context.NONE); + } +} diff --git a/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/samples/java/com/azure/resourcemanager/resourceconnector/generated/AppliancesListOperationsSamples.java b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/samples/java/com/azure/resourcemanager/resourceconnector/generated/AppliancesListOperationsSamples.java new file mode 100644 index 0000000000000..ae2f028e115b2 --- /dev/null +++ b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/samples/java/com/azure/resourcemanager/resourceconnector/generated/AppliancesListOperationsSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourceconnector.generated; + +import com.azure.core.util.Context; + +/** Samples for Appliances ListOperations. */ +public final class AppliancesListOperationsSamples { + /* + * x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/preview/2021-10-31-preview/examples/AppliancesListOperations.json + */ + /** + * Sample code: List Appliances operations. + * + * @param manager Entry point to AppliancesManager. + */ + public static void listAppliancesOperations(com.azure.resourcemanager.resourceconnector.AppliancesManager manager) { + manager.appliances().listOperations(Context.NONE); + } +} diff --git a/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/samples/java/com/azure/resourcemanager/resourceconnector/generated/AppliancesListSamples.java b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/samples/java/com/azure/resourcemanager/resourceconnector/generated/AppliancesListSamples.java new file mode 100644 index 0000000000000..a572808f928f2 --- /dev/null +++ b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/samples/java/com/azure/resourcemanager/resourceconnector/generated/AppliancesListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourceconnector.generated; + +import com.azure.core.util.Context; + +/** Samples for Appliances List. */ +public final class AppliancesListSamples { + /* + * x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/preview/2021-10-31-preview/examples/AppliancesListBySubscription.json + */ + /** + * Sample code: List Appliances by subscription. + * + * @param manager Entry point to AppliancesManager. + */ + public static void listAppliancesBySubscription( + com.azure.resourcemanager.resourceconnector.AppliancesManager manager) { + manager.appliances().list(Context.NONE); + } +} diff --git a/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/samples/java/com/azure/resourcemanager/resourceconnector/generated/AppliancesUpdateSamples.java b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/samples/java/com/azure/resourcemanager/resourceconnector/generated/AppliancesUpdateSamples.java new file mode 100644 index 0000000000000..3d1b01ba85d06 --- /dev/null +++ b/sdk/resourceconnector/azure-resourcemanager-resourceconnector/src/samples/java/com/azure/resourcemanager/resourceconnector/generated/AppliancesUpdateSamples.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.resourceconnector.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.resourceconnector.models.Appliance; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Appliances Update. */ +public final class AppliancesUpdateSamples { + /* + * x-ms-original-file: specification/resourceconnector/resource-manager/Microsoft.ResourceConnector/preview/2021-10-31-preview/examples/AppliancesPatch.json + */ + /** + * Sample code: Update Appliance. + * + * @param manager Entry point to AppliancesManager. + */ + public static void updateAppliance(com.azure.resourcemanager.resourceconnector.AppliancesManager manager) { + Appliance resource = + manager + .appliances() + .getByResourceGroupWithResponse("testresourcegroup", "appliance01", Context.NONE) + .getValue(); + resource.update().withTags(mapOf("key", "value")).apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/resourceconnector/ci.yml b/sdk/resourceconnector/ci.yml new file mode 100644 index 0000000000000..b25b57c83b8bb --- /dev/null +++ b/sdk/resourceconnector/ci.yml @@ -0,0 +1,39 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + paths: + include: + - sdk/resourceconnector/ci.yml + - sdk/resourceconnector/azure-resourcemanager-resourceconnector/ + exclude: + - sdk/resourceconnector/pom.xml + - sdk/resourceconnector/azure-resourcemanager-resourceconnector/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourceconnector/ci.yml + - sdk/resourceconnector/azure-resourcemanager-resourceconnector/ + exclude: + - sdk/resourceconnector/pom.xml + - sdk/resourceconnector/azure-resourcemanager-resourceconnector/pom.xml + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: resourceconnector + Artifacts: + - name: azure-resourcemanager-resourceconnector + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerresourceconnector diff --git a/sdk/resourceconnector/pom.xml b/sdk/resourceconnector/pom.xml new file mode 100644 index 0000000000000..570745e21ff8d --- /dev/null +++ b/sdk/resourceconnector/pom.xml @@ -0,0 +1,53 @@ + + + 4.0.0 + com.azure + azure-resourceconnector-service + pom + 1.0.0 + + + + coverage + + + + + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + + report-aggregate + verify + + report-aggregate + + + ${project.reporting.outputDirectory}/test-coverage + + + + + + + + + default + + true + + + azure-resourcemanager-resourceconnector + + + +