diff --git a/eng/automation/api-specs.yaml b/eng/automation/api-specs.yaml index e1784ce597af..54022b203096 100644 --- a/eng/automation/api-specs.yaml +++ b/eng/automation/api-specs.yaml @@ -66,6 +66,8 @@ informatica: service: informaticadatamanagement keyvault: suffix: generated +kubernetesconfiguration/Microsoft.KubernetesConfiguration/extensions: + service: kubernetesconfigurationmicrosoftkubernetesconfigurationextensions liftrastronomer: service: astro liftrqumulo: diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index b04d701dd93c..8dccea7962cd 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -477,6 +477,7 @@ com.azure.resourcemanager:azure-resourcemanager-carbonoptimization;1.0.0-beta.1; com.azure.resourcemanager:azure-resourcemanager-dependencymap;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-portalservicescopilot;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-lambdatesthyperexecute;1.0.0-beta.1;1.0.0-beta.1 +com.azure.resourcemanager:azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions;1.0.0-beta.1;1.0.0-beta.1 com.azure.tools:azure-sdk-archetype;1.0.0;1.2.0-beta.1 com.azure.tools:azure-sdk-build-tool;1.0.0;1.1.0-beta.1 com.azure.v2:azure-client-sdk-parent;2.0.0-beta.1;2.0.0-beta.1 diff --git a/pom.xml b/pom.xml index 59226c65adf6..58e1d43abe9d 100644 --- a/pom.xml +++ b/pom.xml @@ -129,6 +129,7 @@ sdk/iotoperations sdk/keyvault sdk/kubernetesconfiguration + sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions sdk/kusto sdk/labservices sdk/lambdatesthyperexecute diff --git a/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/CHANGELOG.md b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/CHANGELOG.md new file mode 100644 index 000000000000..0eaa7d0fa12e --- /dev/null +++ b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 1.0.0-beta.1 (2025-04-30) + +- Azure Resource Manager Extensions client library for Java. This package contains Microsoft Azure SDK for Extensions Management SDK. KubernetesConfiguration Extensions Client. Package tag package-2024-11. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). +### Features Added + +- Initial release for the azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions Java SDK. diff --git a/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/README.md b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/README.md new file mode 100644 index 000000000000..3fc5e3e2b01d --- /dev/null +++ b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/README.md @@ -0,0 +1,102 @@ +# Azure Resource Manager Extensions client library for Java + +Azure Resource Manager Extensions client library for Java. + +This package contains Microsoft Azure SDK for Extensions Management SDK. KubernetesConfiguration Extensions Client. Package tag package-2024-11. 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-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions + 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] and [Azure Core Netty HTTP][azure_core_http_netty] packages provide the default implementation. + +### Authentication + +Microsoft Entra ID token authentication relies on the [credential class][azure_identity_credentials] from [Azure Identity][azure_identity] package. + +Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment variable. + +Assuming the use of the `DefaultAzureCredential` credential class, the client can be authenticated using the following code: + +```java +AzureProfile profile = new AzureProfile(AzureCloud.AZURE_PUBLIC_CLOUD); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +ExtensionsManager manager = ExtensionsManager + .authenticate(credential, profile); +``` + +The sample code assumes global Azure. Please change the `AzureCloud.AZURE_PUBLIC_CLOUD` 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/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/SAMPLE.md) + + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide][cg]. + +This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit . + +When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repositories using our CLA. + +This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For more information see the [Code of Conduct FAQ][coc_faq] or contact with any additional questions or comments. + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://learn.microsoft.com/azure/developer/java/fundamentals/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity +[azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/identity/azure-identity#credentials +[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 +[cg]: https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md +[coc]: https://opensource.microsoft.com/codeofconduct/ +[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ diff --git a/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/SAMPLE.md b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/SAMPLE.md new file mode 100644 index 000000000000..4de4770a3dc8 --- /dev/null +++ b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/SAMPLE.md @@ -0,0 +1,257 @@ +# Code snippets and samples + + +## Extensions + +- [Create](#extensions_create) +- [Delete](#extensions_delete) +- [Get](#extensions_get) +- [List](#extensions_list) +- [Update](#extensions_update) + +## OperationStatus + +- [Get](#operationstatus_get) +### Extensions_Create + +```java +/** + * Samples for Extensions Delete. + */ +public final class ExtensionsDeleteSamples { + /* + * x-ms-original-file: + * specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/extensions/stable/2024- + * 11-01/examples/DeleteExtension.json + */ + /** + * Sample code: Delete Extension. + * + * @param manager Entry point to ExtensionsManager. + */ + public static void deleteExtension( + com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.ExtensionsManager manager) { + manager.extensions() + .delete("rg1", "Microsoft.Kubernetes", "connectedClusters", "clusterName1", "ClusterMonitor", null, + com.azure.core.util.Context.NONE); + } +} +``` + +### Extensions_Delete + +```java +import com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.fluent.models.ExtensionInner; +import com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.models.Plan; +import com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.models.Scope; +import com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.models.ScopeCluster; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Extensions Create. + */ +public final class ExtensionsCreateSamples { + /* + * x-ms-original-file: + * specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/extensions/stable/2024- + * 11-01/examples/CreateExtension.json + */ + /** + * Sample code: Create Extension. + * + * @param manager Entry point to ExtensionsManager. + */ + public static void createExtension( + com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.ExtensionsManager manager) { + manager.extensions() + .create("rg1", "Microsoft.Kubernetes", "connectedClusters", "clusterName1", "ClusterMonitor", + new ExtensionInner().withExtensionType("azuremonitor-containers") + .withAutoUpgradeMinorVersion(true) + .withReleaseTrain("Preview") + .withScope(new Scope().withCluster(new ScopeCluster().withReleaseNamespace("kube-system"))) + .withConfigurationSettings(mapOf("omsagent.env.clusterName", "clusterName1", "omsagent.secret.wsid", + "fakeTokenPlaceholder")) + .withConfigurationProtectedSettings(mapOf("omsagent.secret.key", "fakeTokenPlaceholder")), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/extensions/stable/2024- + * 11-01/examples/CreateExtensionWithPlan.json + */ + /** + * Sample code: Create Extension with Plan. + * + * @param manager Entry point to ExtensionsManager. + */ + public static void createExtensionWithPlan( + com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.ExtensionsManager manager) { + manager.extensions() + .create("rg1", "Microsoft.Kubernetes", "connectedClusters", "clusterName1", "azureVote", + new ExtensionInner() + .withPlan(new Plan().withName("azure-vote-standard") + .withPublisher("Microsoft") + .withProduct("azure-vote-standard-offer-id")) + .withExtensionType("azure-vote") + .withAutoUpgradeMinorVersion(true) + .withReleaseTrain("Preview"), + com.azure.core.util.Context.NONE); + } + + // Use "Map.of" if available + @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; + } +} +``` + +### Extensions_Get + +```java +import com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.models.PatchExtension; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Extensions Update. + */ +public final class ExtensionsUpdateSamples { + /* + * x-ms-original-file: + * specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/extensions/stable/2024- + * 11-01/examples/PatchExtension.json + */ + /** + * Sample code: Update Extension. + * + * @param manager Entry point to ExtensionsManager. + */ + public static void updateExtension( + com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.ExtensionsManager manager) { + manager.extensions() + .update("rg1", "Microsoft.Kubernetes", "connectedClusters", "clusterName1", "ClusterMonitor", + new PatchExtension().withAutoUpgradeMinorVersion(true) + .withReleaseTrain("Preview") + .withConfigurationSettings(mapOf("omsagent.env.clusterName", "clusterName1", "omsagent.secret.wsid", + "fakeTokenPlaceholder")) + .withConfigurationProtectedSettings(mapOf("omsagent.secret.key", "fakeTokenPlaceholder")), + com.azure.core.util.Context.NONE); + } + + // Use "Map.of" if available + @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; + } +} +``` + +### Extensions_List + +```java +/** + * Samples for Extensions Get. + */ +public final class ExtensionsGetSamples { + /* + * x-ms-original-file: + * specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/extensions/stable/2024- + * 11-01/examples/GetExtensionWithPlan.json + */ + /** + * Sample code: Get Extension with Plan. + * + * @param manager Entry point to ExtensionsManager. + */ + public static void getExtensionWithPlan( + com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.ExtensionsManager manager) { + manager.extensions() + .getWithResponse("rg1", "Microsoft.Kubernetes", "connectedClusters", "clusterName1", "azureVote", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/extensions/stable/2024- + * 11-01/examples/GetExtension.json + */ + /** + * Sample code: Get Extension. + * + * @param manager Entry point to ExtensionsManager. + */ + public static void getExtension( + com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.ExtensionsManager manager) { + manager.extensions() + .getWithResponse("rg1", "Microsoft.Kubernetes", "connectedClusters", "clusterName1", "ClusterMonitor", + com.azure.core.util.Context.NONE); + } +} +``` + +### Extensions_Update + +```java +/** + * Samples for Extensions List. + */ +public final class ExtensionsListSamples { + /* + * x-ms-original-file: + * specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/extensions/stable/2024- + * 11-01/examples/ListExtensions.json + */ + /** + * Sample code: List Extensions. + * + * @param manager Entry point to ExtensionsManager. + */ + public static void listExtensions( + com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.ExtensionsManager manager) { + manager.extensions() + .list("rg1", "Microsoft.Kubernetes", "connectedClusters", "clusterName1", com.azure.core.util.Context.NONE); + } +} +``` + +### OperationStatus_Get + +```java +/** + * Samples for OperationStatus Get. + */ +public final class OperationStatusGetSamples { + /* + * x-ms-original-file: + * specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/extensions/stable/2024- + * 11-01/examples/GetExtensionAsyncOperationStatus.json + */ + /** + * Sample code: ExtensionAsyncOperationStatus Get. + * + * @param manager Entry point to ExtensionsManager. + */ + public static void extensionAsyncOperationStatusGet( + com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.ExtensionsManager manager) { + manager.operationStatus() + .getWithResponse("rg1", "Microsoft.Kubernetes", "connectedClusters", "clusterName1", "ClusterMonitor", + "99999999-9999-9999-9999-999999999999", com.azure.core.util.Context.NONE); + } +} +``` + diff --git a/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/pom.xml b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/pom.xml new file mode 100644 index 000000000000..f07c859aa7c6 --- /dev/null +++ b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/pom.xml @@ -0,0 +1,62 @@ + + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for Extensions Management + This package contains Microsoft Azure SDK for Extensions Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. KubernetesConfiguration Extensions Client. Package tag package-2024-11. + 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 + 0 + 0 + true + + + + com.azure + azure-core + 1.55.3 + + + com.azure + azure-core-management + 1.17.0 + + + diff --git a/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/ExtensionsManager.java b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/ExtensionsManager.java new file mode 100644 index 000000000000..8f8137ea266e --- /dev/null +++ b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/ExtensionsManager.java @@ -0,0 +1,298 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions; + +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.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.fluent.ExtensionsManagementClient; +import com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.implementation.ExtensionsImpl; +import com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.implementation.ExtensionsManagementClientBuilder; +import com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.implementation.OperationStatusImpl; +import com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.models.Extensions; +import com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.models.OperationStatus; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * Entry point to ExtensionsManager. + * KubernetesConfiguration Extensions Client. + */ +public final class ExtensionsManager { + private Extensions extensions; + + private OperationStatus operationStatus; + + private final ExtensionsManagementClient clientObject; + + private ExtensionsManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = new ExtensionsManagementClientBuilder().pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of Extensions service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Extensions service API instance. + */ + public static ExtensionsManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return configure().authenticate(credential, profile); + } + + /** + * Creates an instance of Extensions service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the Extensions service API instance. + */ + public static ExtensionsManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new ExtensionsManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create ExtensionsManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new ExtensionsManager.Configurable(); + } + + /** + * The Configurable allowing configurations to be set. + */ + public static final class Configurable { + private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); + private static final String SDK_VERSION = "version"; + private static final Map PROPERTIES = CoreUtils.getProperties( + "azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.properties"); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); + private RetryPolicy retryPolicy; + private RetryOptions retryOptions; + 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 retry options for the HTTP pipeline retry policy. + *

+ * This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. + * + * @param retryOptions the retry options for the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryOptions(RetryOptions retryOptions) { + this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' 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, "'defaultPollInterval' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of Extensions service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Extensions service API instance. + */ + public ExtensionsManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder.append("azsdk-java") + .append("-") + .append("com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions") + .append("/") + .append(clientVersion); + 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) { + if (retryOptions != null) { + retryPolicy = new RetryPolicy(retryOptions); + } else { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new AddHeadersFromContextPolicy()); + policies.add(new RequestIdPolicy()); + policies.addAll(this.policies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies.add(new BearerTokenAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies.addAll(this.policies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .collect(Collectors.toList())); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new ExtensionsManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** + * Gets the resource collection API of Extensions. + * + * @return Resource collection API of Extensions. + */ + public Extensions extensions() { + if (this.extensions == null) { + this.extensions = new ExtensionsImpl(clientObject.getExtensions(), this); + } + return extensions; + } + + /** + * Gets the resource collection API of OperationStatus. + * + * @return Resource collection API of OperationStatus. + */ + public OperationStatus operationStatus() { + if (this.operationStatus == null) { + this.operationStatus = new OperationStatusImpl(clientObject.getOperationStatus(), this); + } + return operationStatus; + } + + /** + * Gets wrapped service client ExtensionsManagementClient providing direct access to the underlying auto-generated + * API implementation, based on Azure REST API. + * + * @return Wrapped service client ExtensionsManagementClient. + */ + public ExtensionsManagementClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/fluent/ExtensionsClient.java b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/fluent/ExtensionsClient.java new file mode 100644 index 000000000000..5d622fb57f94 --- /dev/null +++ b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/fluent/ExtensionsClient.java @@ -0,0 +1,340 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.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.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.fluent.models.ExtensionInner; +import com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.models.PatchExtension; + +/** + * An instance of this class provides access to all the operations defined in ExtensionsClient. + */ +public interface ExtensionsClient { + /** + * Create a new Kubernetes Cluster Extension. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param extensionName Name of the Extension. + * @param extension Properties necessary to Create an Extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the Extension object. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ExtensionInner> beginCreate(String resourceGroupName, String clusterRp, + String clusterResourceName, String clusterName, String extensionName, ExtensionInner extension); + + /** + * Create a new Kubernetes Cluster Extension. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param extensionName Name of the Extension. + * @param extension Properties necessary to Create an Extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the Extension object. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ExtensionInner> beginCreate(String resourceGroupName, String clusterRp, + String clusterResourceName, String clusterName, String extensionName, ExtensionInner extension, + Context context); + + /** + * Create a new Kubernetes Cluster Extension. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param extensionName Name of the Extension. + * @param extension Properties necessary to Create an Extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Extension object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ExtensionInner create(String resourceGroupName, String clusterRp, String clusterResourceName, String clusterName, + String extensionName, ExtensionInner extension); + + /** + * Create a new Kubernetes Cluster Extension. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param extensionName Name of the Extension. + * @param extension Properties necessary to Create an Extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Extension object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ExtensionInner create(String resourceGroupName, String clusterRp, String clusterResourceName, String clusterName, + String extensionName, ExtensionInner extension, Context context); + + /** + * Gets Kubernetes Cluster Extension. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param extensionName Name of the Extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return kubernetes Cluster Extension along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String clusterRp, String clusterResourceName, + String clusterName, String extensionName, Context context); + + /** + * Gets Kubernetes Cluster Extension. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param extensionName Name of the Extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return kubernetes Cluster Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ExtensionInner get(String resourceGroupName, String clusterRp, String clusterResourceName, String clusterName, + String extensionName); + + /** + * Delete a Kubernetes Cluster Extension. This will cause the Agent to Uninstall the extension from the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param extensionName Name of the Extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String clusterRp, + String clusterResourceName, String clusterName, String extensionName); + + /** + * Delete a Kubernetes Cluster Extension. This will cause the Agent to Uninstall the extension from the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param extensionName Name of the Extension. + * @param forceDelete Delete the extension resource in Azure - not the normal asynchronous delete. + * @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String clusterRp, + String clusterResourceName, String clusterName, String extensionName, Boolean forceDelete, Context context); + + /** + * Delete a Kubernetes Cluster Extension. This will cause the Agent to Uninstall the extension from the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param extensionName Name of the Extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String clusterRp, String clusterResourceName, String clusterName, + String extensionName); + + /** + * Delete a Kubernetes Cluster Extension. This will cause the Agent to Uninstall the extension from the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param extensionName Name of the Extension. + * @param forceDelete Delete the extension resource in Azure - not the normal asynchronous delete. + * @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 clusterRp, String clusterResourceName, String clusterName, + String extensionName, Boolean forceDelete, Context context); + + /** + * Patch an existing Kubernetes Cluster Extension. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param extensionName Name of the Extension. + * @param patchExtension Properties to Patch in an existing Extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the Extension object. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ExtensionInner> beginUpdate(String resourceGroupName, String clusterRp, + String clusterResourceName, String clusterName, String extensionName, PatchExtension patchExtension); + + /** + * Patch an existing Kubernetes Cluster Extension. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param extensionName Name of the Extension. + * @param patchExtension Properties to Patch in an existing Extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the Extension object. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ExtensionInner> beginUpdate(String resourceGroupName, String clusterRp, + String clusterResourceName, String clusterName, String extensionName, PatchExtension patchExtension, + Context context); + + /** + * Patch an existing Kubernetes Cluster Extension. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param extensionName Name of the Extension. + * @param patchExtension Properties to Patch in an existing Extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Extension object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ExtensionInner update(String resourceGroupName, String clusterRp, String clusterResourceName, String clusterName, + String extensionName, PatchExtension patchExtension); + + /** + * Patch an existing Kubernetes Cluster Extension. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param extensionName Name of the Extension. + * @param patchExtension Properties to Patch in an existing Extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Extension object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ExtensionInner update(String resourceGroupName, String clusterRp, String clusterResourceName, String clusterName, + String extensionName, PatchExtension patchExtension, Context context); + + /** + * List all Extensions in the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Extensions as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String clusterRp, String clusterResourceName, + String clusterName); + + /** + * List all Extensions in the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Extensions as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String clusterRp, String clusterResourceName, + String clusterName, Context context); +} diff --git a/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/fluent/ExtensionsManagementClient.java b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/fluent/ExtensionsManagementClient.java new file mode 100644 index 000000000000..494c78c5f72e --- /dev/null +++ b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/fluent/ExtensionsManagementClient.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** + * The interface for ExtensionsManagementClient class. + */ +public interface ExtensionsManagementClient { + /** + * 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 ExtensionsClient object to access its operations. + * + * @return the ExtensionsClient object. + */ + ExtensionsClient getExtensions(); + + /** + * Gets the OperationStatusClient object to access its operations. + * + * @return the OperationStatusClient object. + */ + OperationStatusClient getOperationStatus(); +} diff --git a/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/fluent/OperationStatusClient.java b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/fluent/OperationStatusClient.java new file mode 100644 index 000000000000..39ed614e1eba --- /dev/null +++ b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/fluent/OperationStatusClient.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.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.fluent.models.OperationStatusResultInner; + +/** + * An instance of this class provides access to all the operations defined in OperationStatusClient. + */ +public interface OperationStatusClient { + /** + * Get Async Operation status. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param extensionName Name of the Extension. + * @param operationId operation Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return async Operation status along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String clusterRp, + String clusterResourceName, String clusterName, String extensionName, String operationId, Context context); + + /** + * Get Async Operation status. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param extensionName Name of the Extension. + * @param operationId operation Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return async Operation status. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OperationStatusResultInner get(String resourceGroupName, String clusterRp, String clusterResourceName, + String clusterName, String extensionName, String operationId); +} diff --git a/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/fluent/models/ExtensionInner.java b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/fluent/models/ExtensionInner.java new file mode 100644 index 000000000000..79202a0c79a7 --- /dev/null +++ b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/fluent/models/ExtensionInner.java @@ -0,0 +1,501 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.core.management.exception.ManagementError; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.models.ExtensionPropertiesAksAssignedIdentity; +import com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.models.ExtensionStatus; +import com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.models.Identity; +import com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.models.Plan; +import com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.models.ProvisioningState; +import com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.models.Scope; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * The Extension object. + */ +@Fluent +public final class ExtensionInner extends ProxyResource { + /* + * Properties of an Extension resource + */ + private ExtensionProperties innerProperties; + + /* + * Identity of the Extension resource + */ + private Identity identity; + + /* + * Top level metadata + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for- + * all-azure-resources + */ + private SystemData systemData; + + /* + * The plan information. + */ + private Plan plan; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of ExtensionInner class. + */ + public ExtensionInner() { + } + + /** + * Get the innerProperties property: Properties of an Extension resource. + * + * @return the innerProperties value. + */ + private ExtensionProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the identity property: Identity of the Extension resource. + * + * @return the identity value. + */ + public Identity identity() { + return this.identity; + } + + /** + * Set the identity property: Identity of the Extension resource. + * + * @param identity the identity value to set. + * @return the ExtensionInner object itself. + */ + public ExtensionInner withIdentity(Identity identity) { + this.identity = identity; + return this; + } + + /** + * Get the systemData property: Top level metadata + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the plan property: The plan information. + * + * @return the plan value. + */ + public Plan plan() { + return this.plan; + } + + /** + * Set the plan property: The plan information. + * + * @param plan the plan value to set. + * @return the ExtensionInner object itself. + */ + public ExtensionInner withPlan(Plan plan) { + this.plan = plan; + return this; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Get the extensionType property: Type of the Extension, of which this resource is an instance of. It must be one + * of the Extension Types registered with Microsoft.KubernetesConfiguration by the Extension publisher. + * + * @return the extensionType value. + */ + public String extensionType() { + return this.innerProperties() == null ? null : this.innerProperties().extensionType(); + } + + /** + * Set the extensionType property: Type of the Extension, of which this resource is an instance of. It must be one + * of the Extension Types registered with Microsoft.KubernetesConfiguration by the Extension publisher. + * + * @param extensionType the extensionType value to set. + * @return the ExtensionInner object itself. + */ + public ExtensionInner withExtensionType(String extensionType) { + if (this.innerProperties() == null) { + this.innerProperties = new ExtensionProperties(); + } + this.innerProperties().withExtensionType(extensionType); + return this; + } + + /** + * Get the autoUpgradeMinorVersion property: Flag to note if this extension participates in auto upgrade of minor + * version, or not. + * + * @return the autoUpgradeMinorVersion value. + */ + public Boolean autoUpgradeMinorVersion() { + return this.innerProperties() == null ? null : this.innerProperties().autoUpgradeMinorVersion(); + } + + /** + * Set the autoUpgradeMinorVersion property: Flag to note if this extension participates in auto upgrade of minor + * version, or not. + * + * @param autoUpgradeMinorVersion the autoUpgradeMinorVersion value to set. + * @return the ExtensionInner object itself. + */ + public ExtensionInner withAutoUpgradeMinorVersion(Boolean autoUpgradeMinorVersion) { + if (this.innerProperties() == null) { + this.innerProperties = new ExtensionProperties(); + } + this.innerProperties().withAutoUpgradeMinorVersion(autoUpgradeMinorVersion); + return this; + } + + /** + * Get the releaseTrain property: ReleaseTrain this extension participates in for auto-upgrade (e.g. Stable, + * Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. + * + * @return the releaseTrain value. + */ + public String releaseTrain() { + return this.innerProperties() == null ? null : this.innerProperties().releaseTrain(); + } + + /** + * Set the releaseTrain property: ReleaseTrain this extension participates in for auto-upgrade (e.g. Stable, + * Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. + * + * @param releaseTrain the releaseTrain value to set. + * @return the ExtensionInner object itself. + */ + public ExtensionInner withReleaseTrain(String releaseTrain) { + if (this.innerProperties() == null) { + this.innerProperties = new ExtensionProperties(); + } + this.innerProperties().withReleaseTrain(releaseTrain); + return this; + } + + /** + * Get the version property: User-specified version of the extension for this extension to 'pin'. To use 'version', + * autoUpgradeMinorVersion must be 'false'. + * + * @return the version value. + */ + public String version() { + return this.innerProperties() == null ? null : this.innerProperties().version(); + } + + /** + * Set the version property: User-specified version of the extension for this extension to 'pin'. To use 'version', + * autoUpgradeMinorVersion must be 'false'. + * + * @param version the version value to set. + * @return the ExtensionInner object itself. + */ + public ExtensionInner withVersion(String version) { + if (this.innerProperties() == null) { + this.innerProperties = new ExtensionProperties(); + } + this.innerProperties().withVersion(version); + return this; + } + + /** + * Get the scope property: Scope at which the extension is installed. + * + * @return the scope value. + */ + public Scope scope() { + return this.innerProperties() == null ? null : this.innerProperties().scope(); + } + + /** + * Set the scope property: Scope at which the extension is installed. + * + * @param scope the scope value to set. + * @return the ExtensionInner object itself. + */ + public ExtensionInner withScope(Scope scope) { + if (this.innerProperties() == null) { + this.innerProperties = new ExtensionProperties(); + } + this.innerProperties().withScope(scope); + return this; + } + + /** + * Get the configurationSettings property: Configuration settings, as name-value pairs for configuring this + * extension. + * + * @return the configurationSettings value. + */ + public Map configurationSettings() { + return this.innerProperties() == null ? null : this.innerProperties().configurationSettings(); + } + + /** + * Set the configurationSettings property: Configuration settings, as name-value pairs for configuring this + * extension. + * + * @param configurationSettings the configurationSettings value to set. + * @return the ExtensionInner object itself. + */ + public ExtensionInner withConfigurationSettings(Map configurationSettings) { + if (this.innerProperties() == null) { + this.innerProperties = new ExtensionProperties(); + } + this.innerProperties().withConfigurationSettings(configurationSettings); + return this; + } + + /** + * Get the configurationProtectedSettings property: Configuration settings that are sensitive, as name-value pairs + * for configuring this extension. + * + * @return the configurationProtectedSettings value. + */ + public Map configurationProtectedSettings() { + return this.innerProperties() == null ? null : this.innerProperties().configurationProtectedSettings(); + } + + /** + * Set the configurationProtectedSettings property: Configuration settings that are sensitive, as name-value pairs + * for configuring this extension. + * + * @param configurationProtectedSettings the configurationProtectedSettings value to set. + * @return the ExtensionInner object itself. + */ + public ExtensionInner withConfigurationProtectedSettings(Map configurationProtectedSettings) { + if (this.innerProperties() == null) { + this.innerProperties = new ExtensionProperties(); + } + this.innerProperties().withConfigurationProtectedSettings(configurationProtectedSettings); + return this; + } + + /** + * Get the currentVersion property: Currently installed version of the extension. + * + * @return the currentVersion value. + */ + public String currentVersion() { + return this.innerProperties() == null ? null : this.innerProperties().currentVersion(); + } + + /** + * Get the provisioningState property: Status of installation of this extension. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the statuses property: Status from this extension. + * + * @return the statuses value. + */ + public List statuses() { + return this.innerProperties() == null ? null : this.innerProperties().statuses(); + } + + /** + * Set the statuses property: Status from this extension. + * + * @param statuses the statuses value to set. + * @return the ExtensionInner object itself. + */ + public ExtensionInner withStatuses(List statuses) { + if (this.innerProperties() == null) { + this.innerProperties = new ExtensionProperties(); + } + this.innerProperties().withStatuses(statuses); + return this; + } + + /** + * Get the errorInfo property: Error information from the Agent - e.g. errors during installation. + * + * @return the errorInfo value. + */ + public ManagementError errorInfo() { + return this.innerProperties() == null ? null : this.innerProperties().errorInfo(); + } + + /** + * Get the customLocationSettings property: Custom Location settings properties. + * + * @return the customLocationSettings value. + */ + public Map customLocationSettings() { + return this.innerProperties() == null ? null : this.innerProperties().customLocationSettings(); + } + + /** + * Get the packageUri property: Uri of the Helm package. + * + * @return the packageUri value. + */ + public String packageUri() { + return this.innerProperties() == null ? null : this.innerProperties().packageUri(); + } + + /** + * Get the aksAssignedIdentity property: Identity of the Extension resource in an AKS cluster. + * + * @return the aksAssignedIdentity value. + */ + public ExtensionPropertiesAksAssignedIdentity aksAssignedIdentity() { + return this.innerProperties() == null ? null : this.innerProperties().aksAssignedIdentity(); + } + + /** + * Set the aksAssignedIdentity property: Identity of the Extension resource in an AKS cluster. + * + * @param aksAssignedIdentity the aksAssignedIdentity value to set. + * @return the ExtensionInner object itself. + */ + public ExtensionInner withAksAssignedIdentity(ExtensionPropertiesAksAssignedIdentity aksAssignedIdentity) { + if (this.innerProperties() == null) { + this.innerProperties = new ExtensionProperties(); + } + this.innerProperties().withAksAssignedIdentity(aksAssignedIdentity); + return this; + } + + /** + * Get the isSystemExtension property: Flag to note if this extension is a system extension. + * + * @return the isSystemExtension value. + */ + public Boolean isSystemExtension() { + return this.innerProperties() == null ? null : this.innerProperties().isSystemExtension(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + if (identity() != null) { + identity().validate(); + } + if (plan() != null) { + plan().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + jsonWriter.writeJsonField("identity", this.identity); + jsonWriter.writeJsonField("plan", this.plan); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ExtensionInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ExtensionInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ExtensionInner. + */ + public static ExtensionInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ExtensionInner deserializedExtensionInner = new ExtensionInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedExtensionInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedExtensionInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedExtensionInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedExtensionInner.innerProperties = ExtensionProperties.fromJson(reader); + } else if ("identity".equals(fieldName)) { + deserializedExtensionInner.identity = Identity.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedExtensionInner.systemData = SystemData.fromJson(reader); + } else if ("plan".equals(fieldName)) { + deserializedExtensionInner.plan = Plan.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedExtensionInner; + }); + } +} diff --git a/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/fluent/models/ExtensionProperties.java b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/fluent/models/ExtensionProperties.java new file mode 100644 index 000000000000..b5d3c5f30aa8 --- /dev/null +++ b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/fluent/models/ExtensionProperties.java @@ -0,0 +1,453 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.exception.ManagementError; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.models.ExtensionPropertiesAksAssignedIdentity; +import com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.models.ExtensionStatus; +import com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.models.ProvisioningState; +import com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.models.Scope; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * Properties of an Extension resource. + */ +@Fluent +public final class ExtensionProperties implements JsonSerializable { + /* + * Type of the Extension, of which this resource is an instance of. It must be one of the Extension Types registered + * with Microsoft.KubernetesConfiguration by the Extension publisher. + */ + private String extensionType; + + /* + * Flag to note if this extension participates in auto upgrade of minor version, or not. + */ + private Boolean autoUpgradeMinorVersion; + + /* + * ReleaseTrain this extension participates in for auto-upgrade (e.g. Stable, Preview, etc.) - only if + * autoUpgradeMinorVersion is 'true'. + */ + private String releaseTrain; + + /* + * User-specified version of the extension for this extension to 'pin'. To use 'version', autoUpgradeMinorVersion + * must be 'false'. + */ + private String version; + + /* + * Scope at which the extension is installed. + */ + private Scope scope; + + /* + * Configuration settings, as name-value pairs for configuring this extension. + */ + private Map configurationSettings; + + /* + * Configuration settings that are sensitive, as name-value pairs for configuring this extension. + */ + private Map configurationProtectedSettings; + + /* + * Currently installed version of the extension. + */ + private String currentVersion; + + /* + * Status of installation of this extension. + */ + private ProvisioningState provisioningState; + + /* + * Status from this extension. + */ + private List statuses; + + /* + * Error information from the Agent - e.g. errors during installation. + */ + private ManagementError errorInfo; + + /* + * Custom Location settings properties. + */ + private Map customLocationSettings; + + /* + * Uri of the Helm package + */ + private String packageUri; + + /* + * Identity of the Extension resource in an AKS cluster + */ + private ExtensionPropertiesAksAssignedIdentity aksAssignedIdentity; + + /* + * Flag to note if this extension is a system extension + */ + private Boolean isSystemExtension; + + /** + * Creates an instance of ExtensionProperties class. + */ + public ExtensionProperties() { + } + + /** + * Get the extensionType property: Type of the Extension, of which this resource is an instance of. It must be one + * of the Extension Types registered with Microsoft.KubernetesConfiguration by the Extension publisher. + * + * @return the extensionType value. + */ + public String extensionType() { + return this.extensionType; + } + + /** + * Set the extensionType property: Type of the Extension, of which this resource is an instance of. It must be one + * of the Extension Types registered with Microsoft.KubernetesConfiguration by the Extension publisher. + * + * @param extensionType the extensionType value to set. + * @return the ExtensionProperties object itself. + */ + public ExtensionProperties withExtensionType(String extensionType) { + this.extensionType = extensionType; + return this; + } + + /** + * Get the autoUpgradeMinorVersion property: Flag to note if this extension participates in auto upgrade of minor + * version, or not. + * + * @return the autoUpgradeMinorVersion value. + */ + public Boolean autoUpgradeMinorVersion() { + return this.autoUpgradeMinorVersion; + } + + /** + * Set the autoUpgradeMinorVersion property: Flag to note if this extension participates in auto upgrade of minor + * version, or not. + * + * @param autoUpgradeMinorVersion the autoUpgradeMinorVersion value to set. + * @return the ExtensionProperties object itself. + */ + public ExtensionProperties withAutoUpgradeMinorVersion(Boolean autoUpgradeMinorVersion) { + this.autoUpgradeMinorVersion = autoUpgradeMinorVersion; + return this; + } + + /** + * Get the releaseTrain property: ReleaseTrain this extension participates in for auto-upgrade (e.g. Stable, + * Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. + * + * @return the releaseTrain value. + */ + public String releaseTrain() { + return this.releaseTrain; + } + + /** + * Set the releaseTrain property: ReleaseTrain this extension participates in for auto-upgrade (e.g. Stable, + * Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. + * + * @param releaseTrain the releaseTrain value to set. + * @return the ExtensionProperties object itself. + */ + public ExtensionProperties withReleaseTrain(String releaseTrain) { + this.releaseTrain = releaseTrain; + return this; + } + + /** + * Get the version property: User-specified version of the extension for this extension to 'pin'. To use 'version', + * autoUpgradeMinorVersion must be 'false'. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: User-specified version of the extension for this extension to 'pin'. To use 'version', + * autoUpgradeMinorVersion must be 'false'. + * + * @param version the version value to set. + * @return the ExtensionProperties object itself. + */ + public ExtensionProperties withVersion(String version) { + this.version = version; + return this; + } + + /** + * Get the scope property: Scope at which the extension is installed. + * + * @return the scope value. + */ + public Scope scope() { + return this.scope; + } + + /** + * Set the scope property: Scope at which the extension is installed. + * + * @param scope the scope value to set. + * @return the ExtensionProperties object itself. + */ + public ExtensionProperties withScope(Scope scope) { + this.scope = scope; + return this; + } + + /** + * Get the configurationSettings property: Configuration settings, as name-value pairs for configuring this + * extension. + * + * @return the configurationSettings value. + */ + public Map configurationSettings() { + return this.configurationSettings; + } + + /** + * Set the configurationSettings property: Configuration settings, as name-value pairs for configuring this + * extension. + * + * @param configurationSettings the configurationSettings value to set. + * @return the ExtensionProperties object itself. + */ + public ExtensionProperties withConfigurationSettings(Map configurationSettings) { + this.configurationSettings = configurationSettings; + return this; + } + + /** + * Get the configurationProtectedSettings property: Configuration settings that are sensitive, as name-value pairs + * for configuring this extension. + * + * @return the configurationProtectedSettings value. + */ + public Map configurationProtectedSettings() { + return this.configurationProtectedSettings; + } + + /** + * Set the configurationProtectedSettings property: Configuration settings that are sensitive, as name-value pairs + * for configuring this extension. + * + * @param configurationProtectedSettings the configurationProtectedSettings value to set. + * @return the ExtensionProperties object itself. + */ + public ExtensionProperties withConfigurationProtectedSettings(Map configurationProtectedSettings) { + this.configurationProtectedSettings = configurationProtectedSettings; + return this; + } + + /** + * Get the currentVersion property: Currently installed version of the extension. + * + * @return the currentVersion value. + */ + public String currentVersion() { + return this.currentVersion; + } + + /** + * Get the provisioningState property: Status of installation of this extension. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the statuses property: Status from this extension. + * + * @return the statuses value. + */ + public List statuses() { + return this.statuses; + } + + /** + * Set the statuses property: Status from this extension. + * + * @param statuses the statuses value to set. + * @return the ExtensionProperties object itself. + */ + public ExtensionProperties withStatuses(List statuses) { + this.statuses = statuses; + return this; + } + + /** + * Get the errorInfo property: Error information from the Agent - e.g. errors during installation. + * + * @return the errorInfo value. + */ + public ManagementError errorInfo() { + return this.errorInfo; + } + + /** + * Get the customLocationSettings property: Custom Location settings properties. + * + * @return the customLocationSettings value. + */ + public Map customLocationSettings() { + return this.customLocationSettings; + } + + /** + * Get the packageUri property: Uri of the Helm package. + * + * @return the packageUri value. + */ + public String packageUri() { + return this.packageUri; + } + + /** + * Get the aksAssignedIdentity property: Identity of the Extension resource in an AKS cluster. + * + * @return the aksAssignedIdentity value. + */ + public ExtensionPropertiesAksAssignedIdentity aksAssignedIdentity() { + return this.aksAssignedIdentity; + } + + /** + * Set the aksAssignedIdentity property: Identity of the Extension resource in an AKS cluster. + * + * @param aksAssignedIdentity the aksAssignedIdentity value to set. + * @return the ExtensionProperties object itself. + */ + public ExtensionProperties withAksAssignedIdentity(ExtensionPropertiesAksAssignedIdentity aksAssignedIdentity) { + this.aksAssignedIdentity = aksAssignedIdentity; + return this; + } + + /** + * Get the isSystemExtension property: Flag to note if this extension is a system extension. + * + * @return the isSystemExtension value. + */ + public Boolean isSystemExtension() { + return this.isSystemExtension; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (scope() != null) { + scope().validate(); + } + if (statuses() != null) { + statuses().forEach(e -> e.validate()); + } + if (aksAssignedIdentity() != null) { + aksAssignedIdentity().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("extensionType", this.extensionType); + jsonWriter.writeBooleanField("autoUpgradeMinorVersion", this.autoUpgradeMinorVersion); + jsonWriter.writeStringField("releaseTrain", this.releaseTrain); + jsonWriter.writeStringField("version", this.version); + jsonWriter.writeJsonField("scope", this.scope); + jsonWriter.writeMapField("configurationSettings", this.configurationSettings, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeMapField("configurationProtectedSettings", this.configurationProtectedSettings, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeArrayField("statuses", this.statuses, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("aksAssignedIdentity", this.aksAssignedIdentity); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ExtensionProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ExtensionProperties if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ExtensionProperties. + */ + public static ExtensionProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ExtensionProperties deserializedExtensionProperties = new ExtensionProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("extensionType".equals(fieldName)) { + deserializedExtensionProperties.extensionType = reader.getString(); + } else if ("autoUpgradeMinorVersion".equals(fieldName)) { + deserializedExtensionProperties.autoUpgradeMinorVersion + = reader.getNullable(JsonReader::getBoolean); + } else if ("releaseTrain".equals(fieldName)) { + deserializedExtensionProperties.releaseTrain = reader.getString(); + } else if ("version".equals(fieldName)) { + deserializedExtensionProperties.version = reader.getString(); + } else if ("scope".equals(fieldName)) { + deserializedExtensionProperties.scope = Scope.fromJson(reader); + } else if ("configurationSettings".equals(fieldName)) { + Map configurationSettings = reader.readMap(reader1 -> reader1.getString()); + deserializedExtensionProperties.configurationSettings = configurationSettings; + } else if ("configurationProtectedSettings".equals(fieldName)) { + Map configurationProtectedSettings = reader.readMap(reader1 -> reader1.getString()); + deserializedExtensionProperties.configurationProtectedSettings = configurationProtectedSettings; + } else if ("currentVersion".equals(fieldName)) { + deserializedExtensionProperties.currentVersion = reader.getString(); + } else if ("provisioningState".equals(fieldName)) { + deserializedExtensionProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else if ("statuses".equals(fieldName)) { + List statuses = reader.readArray(reader1 -> ExtensionStatus.fromJson(reader1)); + deserializedExtensionProperties.statuses = statuses; + } else if ("errorInfo".equals(fieldName)) { + deserializedExtensionProperties.errorInfo = ManagementError.fromJson(reader); + } else if ("customLocationSettings".equals(fieldName)) { + Map customLocationSettings = reader.readMap(reader1 -> reader1.getString()); + deserializedExtensionProperties.customLocationSettings = customLocationSettings; + } else if ("packageUri".equals(fieldName)) { + deserializedExtensionProperties.packageUri = reader.getString(); + } else if ("aksAssignedIdentity".equals(fieldName)) { + deserializedExtensionProperties.aksAssignedIdentity + = ExtensionPropertiesAksAssignedIdentity.fromJson(reader); + } else if ("isSystemExtension".equals(fieldName)) { + deserializedExtensionProperties.isSystemExtension = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedExtensionProperties; + }); + } +} diff --git a/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/fluent/models/OperationStatusResultInner.java b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/fluent/models/OperationStatusResultInner.java new file mode 100644 index 000000000000..d8832483e53d --- /dev/null +++ b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/fluent/models/OperationStatusResultInner.java @@ -0,0 +1,205 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * The current status of an async operation. + */ +@Fluent +public final class OperationStatusResultInner implements JsonSerializable { + /* + * Fully qualified ID for the async operation. + */ + private String id; + + /* + * Name of the async operation. + */ + private String name; + + /* + * Operation status. + */ + private String status; + + /* + * Additional information, if available. + */ + private Map properties; + + /* + * If present, details of the operation error. + */ + private ManagementError error; + + /** + * Creates an instance of OperationStatusResultInner class. + */ + public OperationStatusResultInner() { + } + + /** + * Get the id property: Fully qualified ID for the async operation. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Fully qualified ID for the async operation. + * + * @param id the id value to set. + * @return the OperationStatusResultInner object itself. + */ + public OperationStatusResultInner withId(String id) { + this.id = id; + return this; + } + + /** + * Get the name property: Name of the async operation. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the async operation. + * + * @param name the name value to set. + * @return the OperationStatusResultInner object itself. + */ + public OperationStatusResultInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the status property: Operation status. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Set the status property: Operation status. + * + * @param status the status value to set. + * @return the OperationStatusResultInner object itself. + */ + public OperationStatusResultInner withStatus(String status) { + this.status = status; + return this; + } + + /** + * Get the properties property: Additional information, if available. + * + * @return the properties value. + */ + public Map properties() { + return this.properties; + } + + /** + * Set the properties property: Additional information, if available. + * + * @param properties the properties value to set. + * @return the OperationStatusResultInner object itself. + */ + public OperationStatusResultInner withProperties(Map properties) { + this.properties = properties; + return this; + } + + /** + * Get the error property: If present, details of the operation error. + * + * @return the error value. + */ + public ManagementError error() { + return this.error; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (status() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property status in model OperationStatusResultInner")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(OperationStatusResultInner.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("status", this.status); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeMapField("properties", this.properties, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationStatusResultInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationStatusResultInner if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OperationStatusResultInner. + */ + public static OperationStatusResultInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationStatusResultInner deserializedOperationStatusResultInner = new OperationStatusResultInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("status".equals(fieldName)) { + deserializedOperationStatusResultInner.status = reader.getString(); + } else if ("id".equals(fieldName)) { + deserializedOperationStatusResultInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedOperationStatusResultInner.name = reader.getString(); + } else if ("properties".equals(fieldName)) { + Map properties = reader.readMap(reader1 -> reader1.getString()); + deserializedOperationStatusResultInner.properties = properties; + } else if ("error".equals(fieldName)) { + deserializedOperationStatusResultInner.error = ManagementError.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationStatusResultInner; + }); + } +} diff --git a/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/fluent/models/PatchExtensionProperties.java b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/fluent/models/PatchExtensionProperties.java new file mode 100644 index 000000000000..3d4429b79e1f --- /dev/null +++ b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/fluent/models/PatchExtensionProperties.java @@ -0,0 +1,225 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * Updatable properties of an Extension Patch Request. + */ +@Fluent +public final class PatchExtensionProperties implements JsonSerializable { + /* + * Flag to note if this extension participates in auto upgrade of minor version, or not. + */ + private Boolean autoUpgradeMinorVersion; + + /* + * ReleaseTrain this extension participates in for auto-upgrade (e.g. Stable, Preview, etc.) - only if + * autoUpgradeMinorVersion is 'true'. + */ + private String releaseTrain; + + /* + * Version of the extension for this extension, if it is 'pinned' to a specific version. autoUpgradeMinorVersion + * must be 'false'. + */ + private String version; + + /* + * Configuration settings, as name-value pairs for configuring this extension. + */ + private Map configurationSettings; + + /* + * Configuration settings that are sensitive, as name-value pairs for configuring this extension. + */ + private Map configurationProtectedSettings; + + /** + * Creates an instance of PatchExtensionProperties class. + */ + public PatchExtensionProperties() { + } + + /** + * Get the autoUpgradeMinorVersion property: Flag to note if this extension participates in auto upgrade of minor + * version, or not. + * + * @return the autoUpgradeMinorVersion value. + */ + public Boolean autoUpgradeMinorVersion() { + return this.autoUpgradeMinorVersion; + } + + /** + * Set the autoUpgradeMinorVersion property: Flag to note if this extension participates in auto upgrade of minor + * version, or not. + * + * @param autoUpgradeMinorVersion the autoUpgradeMinorVersion value to set. + * @return the PatchExtensionProperties object itself. + */ + public PatchExtensionProperties withAutoUpgradeMinorVersion(Boolean autoUpgradeMinorVersion) { + this.autoUpgradeMinorVersion = autoUpgradeMinorVersion; + return this; + } + + /** + * Get the releaseTrain property: ReleaseTrain this extension participates in for auto-upgrade (e.g. Stable, + * Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. + * + * @return the releaseTrain value. + */ + public String releaseTrain() { + return this.releaseTrain; + } + + /** + * Set the releaseTrain property: ReleaseTrain this extension participates in for auto-upgrade (e.g. Stable, + * Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. + * + * @param releaseTrain the releaseTrain value to set. + * @return the PatchExtensionProperties object itself. + */ + public PatchExtensionProperties withReleaseTrain(String releaseTrain) { + this.releaseTrain = releaseTrain; + return this; + } + + /** + * Get the version property: Version of the extension for this extension, if it is 'pinned' to a specific version. + * autoUpgradeMinorVersion must be 'false'. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: Version of the extension for this extension, if it is 'pinned' to a specific version. + * autoUpgradeMinorVersion must be 'false'. + * + * @param version the version value to set. + * @return the PatchExtensionProperties object itself. + */ + public PatchExtensionProperties withVersion(String version) { + this.version = version; + return this; + } + + /** + * Get the configurationSettings property: Configuration settings, as name-value pairs for configuring this + * extension. + * + * @return the configurationSettings value. + */ + public Map configurationSettings() { + return this.configurationSettings; + } + + /** + * Set the configurationSettings property: Configuration settings, as name-value pairs for configuring this + * extension. + * + * @param configurationSettings the configurationSettings value to set. + * @return the PatchExtensionProperties object itself. + */ + public PatchExtensionProperties withConfigurationSettings(Map configurationSettings) { + this.configurationSettings = configurationSettings; + return this; + } + + /** + * Get the configurationProtectedSettings property: Configuration settings that are sensitive, as name-value pairs + * for configuring this extension. + * + * @return the configurationProtectedSettings value. + */ + public Map configurationProtectedSettings() { + return this.configurationProtectedSettings; + } + + /** + * Set the configurationProtectedSettings property: Configuration settings that are sensitive, as name-value pairs + * for configuring this extension. + * + * @param configurationProtectedSettings the configurationProtectedSettings value to set. + * @return the PatchExtensionProperties object itself. + */ + public PatchExtensionProperties + withConfigurationProtectedSettings(Map configurationProtectedSettings) { + this.configurationProtectedSettings = configurationProtectedSettings; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("autoUpgradeMinorVersion", this.autoUpgradeMinorVersion); + jsonWriter.writeStringField("releaseTrain", this.releaseTrain); + jsonWriter.writeStringField("version", this.version); + jsonWriter.writeMapField("configurationSettings", this.configurationSettings, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeMapField("configurationProtectedSettings", this.configurationProtectedSettings, + (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PatchExtensionProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PatchExtensionProperties if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the PatchExtensionProperties. + */ + public static PatchExtensionProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PatchExtensionProperties deserializedPatchExtensionProperties = new PatchExtensionProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("autoUpgradeMinorVersion".equals(fieldName)) { + deserializedPatchExtensionProperties.autoUpgradeMinorVersion + = reader.getNullable(JsonReader::getBoolean); + } else if ("releaseTrain".equals(fieldName)) { + deserializedPatchExtensionProperties.releaseTrain = reader.getString(); + } else if ("version".equals(fieldName)) { + deserializedPatchExtensionProperties.version = reader.getString(); + } else if ("configurationSettings".equals(fieldName)) { + Map configurationSettings = reader.readMap(reader1 -> reader1.getString()); + deserializedPatchExtensionProperties.configurationSettings = configurationSettings; + } else if ("configurationProtectedSettings".equals(fieldName)) { + Map configurationProtectedSettings = reader.readMap(reader1 -> reader1.getString()); + deserializedPatchExtensionProperties.configurationProtectedSettings + = configurationProtectedSettings; + } else { + reader.skipChildren(); + } + } + + return deserializedPatchExtensionProperties; + }); + } +} diff --git a/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/fluent/models/package-info.java b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/fluent/models/package-info.java new file mode 100644 index 000000000000..5fe3fa255a8c --- /dev/null +++ b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/fluent/models/package-info.java @@ -0,0 +1,9 @@ +// 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 ExtensionsManagementClient. + * KubernetesConfiguration Extensions Client. + */ +package com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.fluent.models; diff --git a/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/fluent/package-info.java b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/fluent/package-info.java new file mode 100644 index 000000000000..4bf5e581d196 --- /dev/null +++ b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/fluent/package-info.java @@ -0,0 +1,9 @@ +// 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 ExtensionsManagementClient. + * KubernetesConfiguration Extensions Client. + */ +package com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.fluent; diff --git a/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/implementation/ExtensionImpl.java b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/implementation/ExtensionImpl.java new file mode 100644 index 000000000000..0d218fc304f0 --- /dev/null +++ b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/implementation/ExtensionImpl.java @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.management.exception.ManagementError; +import com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.fluent.models.ExtensionInner; +import com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.models.Extension; +import com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.models.ExtensionPropertiesAksAssignedIdentity; +import com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.models.ExtensionStatus; +import com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.models.Identity; +import com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.models.Plan; +import com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.models.ProvisioningState; +import com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.models.Scope; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class ExtensionImpl implements Extension { + private ExtensionInner innerObject; + + private final com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.ExtensionsManager serviceManager; + + ExtensionImpl(ExtensionInner innerObject, + com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.ExtensionsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public Identity identity() { + return this.innerModel().identity(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Plan plan() { + return this.innerModel().plan(); + } + + public String extensionType() { + return this.innerModel().extensionType(); + } + + public Boolean autoUpgradeMinorVersion() { + return this.innerModel().autoUpgradeMinorVersion(); + } + + public String releaseTrain() { + return this.innerModel().releaseTrain(); + } + + public String version() { + return this.innerModel().version(); + } + + public Scope scope() { + return this.innerModel().scope(); + } + + public Map configurationSettings() { + Map inner = this.innerModel().configurationSettings(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public Map configurationProtectedSettings() { + Map inner = this.innerModel().configurationProtectedSettings(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public String currentVersion() { + return this.innerModel().currentVersion(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public List statuses() { + List inner = this.innerModel().statuses(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public ManagementError errorInfo() { + return this.innerModel().errorInfo(); + } + + public Map customLocationSettings() { + Map inner = this.innerModel().customLocationSettings(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public String packageUri() { + return this.innerModel().packageUri(); + } + + public ExtensionPropertiesAksAssignedIdentity aksAssignedIdentity() { + return this.innerModel().aksAssignedIdentity(); + } + + public Boolean isSystemExtension() { + return this.innerModel().isSystemExtension(); + } + + public ExtensionInner innerModel() { + return this.innerObject; + } + + private + com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.ExtensionsManager + manager() { + return this.serviceManager; + } +} diff --git a/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/implementation/ExtensionsClientImpl.java b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/implementation/ExtensionsClientImpl.java new file mode 100644 index 000000000000..11514e4debd8 --- /dev/null +++ b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/implementation/ExtensionsClientImpl.java @@ -0,0 +1,1520 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.fluent.ExtensionsClient; +import com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.fluent.models.ExtensionInner; +import com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.models.ExtensionsList; +import com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.models.PatchExtension; +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 ExtensionsClient. + */ +public final class ExtensionsClientImpl implements ExtensionsClient { + /** + * The proxy service used to perform REST calls. + */ + private final ExtensionsService service; + + /** + * The service client containing this operation class. + */ + private final ExtensionsManagementClientImpl client; + + /** + * Initializes an instance of ExtensionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ExtensionsClientImpl(ExtensionsManagementClientImpl client) { + this.service + = RestProxy.create(ExtensionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ExtensionsManagementClientExtensions to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ExtensionsManagement") + public interface ExtensionsService { + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> create(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("clusterRp") String clusterRp, + @PathParam("clusterResourceName") String clusterResourceName, @PathParam("clusterName") String clusterName, + @PathParam("extensionName") String extensionName, @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ExtensionInner extension, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("clusterRp") String clusterRp, + @PathParam("clusterResourceName") String clusterResourceName, @PathParam("clusterName") String clusterName, + @PathParam("extensionName") String extensionName, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}") + @ExpectedResponses({ 200, 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("clusterRp") String clusterRp, + @PathParam("clusterResourceName") String clusterResourceName, @PathParam("clusterName") String clusterName, + @PathParam("extensionName") String extensionName, @QueryParam("api-version") String apiVersion, + @QueryParam("forceDelete") Boolean forceDelete, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("clusterRp") String clusterRp, + @PathParam("clusterResourceName") String clusterResourceName, @PathParam("clusterName") String clusterName, + @PathParam("extensionName") String extensionName, @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") PatchExtension patchExtension, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("clusterRp") String clusterRp, + @PathParam("clusterResourceName") String clusterResourceName, @PathParam("clusterName") String clusterName, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Create a new Kubernetes Cluster Extension. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param extensionName Name of the Extension. + * @param extension Properties necessary to Create an Extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Extension object along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync(String resourceGroupName, String clusterRp, + String clusterResourceName, String clusterName, String extensionName, ExtensionInner extension) { + 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 (clusterRp == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterRp is required and cannot be null.")); + } + if (clusterResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter clusterResourceName is required and cannot be null.")); + } + if (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null.")); + } + if (extensionName == null) { + return Mono.error(new IllegalArgumentException("Parameter extensionName is required and cannot be null.")); + } + if (extension == null) { + return Mono.error(new IllegalArgumentException("Parameter extension is required and cannot be null.")); + } else { + extension.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.create(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName, + this.client.getApiVersion(), extension, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a new Kubernetes Cluster Extension. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param extensionName Name of the Extension. + * @param extension Properties necessary to Create an Extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Extension object along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync(String resourceGroupName, String clusterRp, + String clusterResourceName, String clusterName, String extensionName, ExtensionInner extension, + 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 (clusterRp == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterRp is required and cannot be null.")); + } + if (clusterResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter clusterResourceName is required and cannot be null.")); + } + if (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null.")); + } + if (extensionName == null) { + return Mono.error(new IllegalArgumentException("Parameter extensionName is required and cannot be null.")); + } + if (extension == null) { + return Mono.error(new IllegalArgumentException("Parameter extension is required and cannot be null.")); + } else { + extension.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.create(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, clusterRp, + clusterResourceName, clusterName, extensionName, this.client.getApiVersion(), extension, accept, context); + } + + /** + * Create a new Kubernetes Cluster Extension. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param extensionName Name of the Extension. + * @param extension Properties necessary to Create an Extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the Extension object. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ExtensionInner> beginCreateAsync(String resourceGroupName, + String clusterRp, String clusterResourceName, String clusterName, String extensionName, + ExtensionInner extension) { + Mono>> mono = createWithResponseAsync(resourceGroupName, clusterRp, + clusterResourceName, clusterName, extensionName, extension); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + ExtensionInner.class, ExtensionInner.class, this.client.getContext()); + } + + /** + * Create a new Kubernetes Cluster Extension. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param extensionName Name of the Extension. + * @param extension Properties necessary to Create an Extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the Extension object. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ExtensionInner> beginCreateAsync(String resourceGroupName, + String clusterRp, String clusterResourceName, String clusterName, String extensionName, + ExtensionInner extension, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = createWithResponseAsync(resourceGroupName, clusterRp, + clusterResourceName, clusterName, extensionName, extension, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + ExtensionInner.class, ExtensionInner.class, context); + } + + /** + * Create a new Kubernetes Cluster Extension. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param extensionName Name of the Extension. + * @param extension Properties necessary to Create an Extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the Extension object. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ExtensionInner> beginCreate(String resourceGroupName, + String clusterRp, String clusterResourceName, String clusterName, String extensionName, + ExtensionInner extension) { + return this + .beginCreateAsync(resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName, extension) + .getSyncPoller(); + } + + /** + * Create a new Kubernetes Cluster Extension. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param extensionName Name of the Extension. + * @param extension Properties necessary to Create an Extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the Extension object. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ExtensionInner> beginCreate(String resourceGroupName, + String clusterRp, String clusterResourceName, String clusterName, String extensionName, + ExtensionInner extension, Context context) { + return this + .beginCreateAsync(resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName, extension, + context) + .getSyncPoller(); + } + + /** + * Create a new Kubernetes Cluster Extension. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param extensionName Name of the Extension. + * @param extension Properties necessary to Create an Extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Extension object on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String clusterRp, String clusterResourceName, + String clusterName, String extensionName, ExtensionInner extension) { + return beginCreateAsync(resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName, + extension).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a new Kubernetes Cluster Extension. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param extensionName Name of the Extension. + * @param extension Properties necessary to Create an Extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Extension object on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String clusterRp, String clusterResourceName, + String clusterName, String extensionName, ExtensionInner extension, Context context) { + return beginCreateAsync(resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName, + extension, context).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a new Kubernetes Cluster Extension. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param extensionName Name of the Extension. + * @param extension Properties necessary to Create an Extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Extension object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ExtensionInner create(String resourceGroupName, String clusterRp, String clusterResourceName, + String clusterName, String extensionName, ExtensionInner extension) { + return createAsync(resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName, extension) + .block(); + } + + /** + * Create a new Kubernetes Cluster Extension. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param extensionName Name of the Extension. + * @param extension Properties necessary to Create an Extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Extension object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ExtensionInner create(String resourceGroupName, String clusterRp, String clusterResourceName, + String clusterName, String extensionName, ExtensionInner extension, Context context) { + return createAsync(resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName, extension, + context).block(); + } + + /** + * Gets Kubernetes Cluster Extension. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param extensionName Name of the Extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return kubernetes Cluster Extension along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String clusterRp, + String clusterResourceName, String clusterName, String extensionName) { + 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 (clusterRp == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterRp is required and cannot be null.")); + } + if (clusterResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter clusterResourceName is required and cannot be null.")); + } + if (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null.")); + } + if (extensionName == null) { + return Mono.error(new IllegalArgumentException("Parameter extensionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName, + this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets Kubernetes Cluster Extension. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param extensionName Name of the Extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return kubernetes Cluster Extension along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String clusterRp, + String clusterResourceName, String clusterName, String extensionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (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 (clusterRp == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterRp is required and cannot be null.")); + } + if (clusterResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter clusterResourceName is required and cannot be null.")); + } + if (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null.")); + } + if (extensionName == null) { + return Mono.error(new IllegalArgumentException("Parameter extensionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, clusterRp, + clusterResourceName, clusterName, extensionName, this.client.getApiVersion(), accept, context); + } + + /** + * Gets Kubernetes Cluster Extension. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param extensionName Name of the Extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return kubernetes Cluster Extension on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String clusterRp, String clusterResourceName, + String clusterName, String extensionName) { + return getWithResponseAsync(resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets Kubernetes Cluster Extension. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param extensionName Name of the Extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return kubernetes Cluster Extension along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String clusterRp, + String clusterResourceName, String clusterName, String extensionName, Context context) { + return getWithResponseAsync(resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName, + context).block(); + } + + /** + * Gets Kubernetes Cluster Extension. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param extensionName Name of the Extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return kubernetes Cluster Extension. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ExtensionInner get(String resourceGroupName, String clusterRp, String clusterResourceName, + String clusterName, String extensionName) { + return getWithResponse(resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName, + Context.NONE).getValue(); + } + + /** + * Delete a Kubernetes Cluster Extension. This will cause the Agent to Uninstall the extension from the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param extensionName Name of the Extension. + * @param forceDelete Delete the extension resource in Azure - not the normal asynchronous delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, String clusterRp, + String clusterResourceName, String clusterName, String extensionName, Boolean forceDelete) { + 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 (clusterRp == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterRp is required and cannot be null.")); + } + if (clusterResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter clusterResourceName is required and cannot be null.")); + } + if (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null.")); + } + if (extensionName == null) { + return Mono.error(new IllegalArgumentException("Parameter extensionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName, + this.client.getApiVersion(), forceDelete, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a Kubernetes Cluster Extension. This will cause the Agent to Uninstall the extension from the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param extensionName Name of the Extension. + * @param forceDelete Delete the extension resource in Azure - not the normal asynchronous delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, String clusterRp, + String clusterResourceName, String clusterName, String extensionName, Boolean forceDelete, 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 (clusterRp == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterRp is required and cannot be null.")); + } + if (clusterResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter clusterResourceName is required and cannot be null.")); + } + if (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null.")); + } + if (extensionName == null) { + return Mono.error(new IllegalArgumentException("Parameter extensionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, clusterRp, + clusterResourceName, clusterName, extensionName, this.client.getApiVersion(), forceDelete, accept, context); + } + + /** + * Delete a Kubernetes Cluster Extension. This will cause the Agent to Uninstall the extension from the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param extensionName Name of the Extension. + * @param forceDelete Delete the extension resource in Azure - not the normal asynchronous delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String clusterRp, + String clusterResourceName, String clusterName, String extensionName, Boolean forceDelete) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, clusterRp, + clusterResourceName, clusterName, extensionName, forceDelete); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Delete a Kubernetes Cluster Extension. This will cause the Agent to Uninstall the extension from the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param extensionName Name of the Extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String clusterRp, + String clusterResourceName, String clusterName, String extensionName) { + final Boolean forceDelete = null; + Mono>> mono = deleteWithResponseAsync(resourceGroupName, clusterRp, + clusterResourceName, clusterName, extensionName, forceDelete); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Delete a Kubernetes Cluster Extension. This will cause the Agent to Uninstall the extension from the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param extensionName Name of the Extension. + * @param forceDelete Delete the extension resource in Azure - not the normal asynchronous delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String clusterRp, + String clusterResourceName, String clusterName, String extensionName, Boolean forceDelete, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, clusterRp, + clusterResourceName, clusterName, extensionName, forceDelete, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); + } + + /** + * Delete a Kubernetes Cluster Extension. This will cause the Agent to Uninstall the extension from the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param extensionName Name of the Extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String clusterRp, + String clusterResourceName, String clusterName, String extensionName) { + final Boolean forceDelete = null; + return this + .beginDeleteAsync(resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName, + forceDelete) + .getSyncPoller(); + } + + /** + * Delete a Kubernetes Cluster Extension. This will cause the Agent to Uninstall the extension from the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param extensionName Name of the Extension. + * @param forceDelete Delete the extension resource in Azure - not the normal asynchronous delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String clusterRp, + String clusterResourceName, String clusterName, String extensionName, Boolean forceDelete, Context context) { + return this + .beginDeleteAsync(resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName, + forceDelete, context) + .getSyncPoller(); + } + + /** + * Delete a Kubernetes Cluster Extension. This will cause the Agent to Uninstall the extension from the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param extensionName Name of the Extension. + * @param forceDelete Delete the extension resource in Azure - not the normal asynchronous delete. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String clusterRp, String clusterResourceName, + String clusterName, String extensionName, Boolean forceDelete) { + return beginDeleteAsync(resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName, + forceDelete).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a Kubernetes Cluster Extension. This will cause the Agent to Uninstall the extension from the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param extensionName Name of the Extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String clusterRp, String clusterResourceName, + String clusterName, String extensionName) { + final Boolean forceDelete = null; + return beginDeleteAsync(resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName, + forceDelete).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a Kubernetes Cluster Extension. This will cause the Agent to Uninstall the extension from the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param extensionName Name of the Extension. + * @param forceDelete Delete the extension resource in Azure - not the normal asynchronous delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String clusterRp, String clusterResourceName, + String clusterName, String extensionName, Boolean forceDelete, Context context) { + return beginDeleteAsync(resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName, + forceDelete, context).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a Kubernetes Cluster Extension. This will cause the Agent to Uninstall the extension from the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param extensionName Name of the Extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String clusterRp, String clusterResourceName, String clusterName, + String extensionName) { + final Boolean forceDelete = null; + deleteAsync(resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName, forceDelete).block(); + } + + /** + * Delete a Kubernetes Cluster Extension. This will cause the Agent to Uninstall the extension from the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param extensionName Name of the Extension. + * @param forceDelete Delete the extension resource in Azure - not the normal asynchronous delete. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 clusterRp, String clusterResourceName, String clusterName, + String extensionName, Boolean forceDelete, Context context) { + deleteAsync(resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName, forceDelete, context) + .block(); + } + + /** + * Patch an existing Kubernetes Cluster Extension. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param extensionName Name of the Extension. + * @param patchExtension Properties to Patch in an existing Extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Extension object along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, String clusterRp, + String clusterResourceName, String clusterName, String extensionName, PatchExtension patchExtension) { + 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 (clusterRp == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterRp is required and cannot be null.")); + } + if (clusterResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter clusterResourceName is required and cannot be null.")); + } + if (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null.")); + } + if (extensionName == null) { + return Mono.error(new IllegalArgumentException("Parameter extensionName is required and cannot be null.")); + } + if (patchExtension == null) { + return Mono.error(new IllegalArgumentException("Parameter patchExtension is required and cannot be null.")); + } else { + patchExtension.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName, + this.client.getApiVersion(), patchExtension, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Patch an existing Kubernetes Cluster Extension. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param extensionName Name of the Extension. + * @param patchExtension Properties to Patch in an existing Extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Extension object along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, String clusterRp, + String clusterResourceName, String clusterName, String extensionName, PatchExtension patchExtension, + 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 (clusterRp == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterRp is required and cannot be null.")); + } + if (clusterResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter clusterResourceName is required and cannot be null.")); + } + if (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null.")); + } + if (extensionName == null) { + return Mono.error(new IllegalArgumentException("Parameter extensionName is required and cannot be null.")); + } + if (patchExtension == null) { + return Mono.error(new IllegalArgumentException("Parameter patchExtension is required and cannot be null.")); + } else { + patchExtension.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.update(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, clusterRp, + clusterResourceName, clusterName, extensionName, this.client.getApiVersion(), patchExtension, accept, + context); + } + + /** + * Patch an existing Kubernetes Cluster Extension. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param extensionName Name of the Extension. + * @param patchExtension Properties to Patch in an existing Extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the Extension object. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ExtensionInner> beginUpdateAsync(String resourceGroupName, + String clusterRp, String clusterResourceName, String clusterName, String extensionName, + PatchExtension patchExtension) { + Mono>> mono = updateWithResponseAsync(resourceGroupName, clusterRp, + clusterResourceName, clusterName, extensionName, patchExtension); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + ExtensionInner.class, ExtensionInner.class, this.client.getContext()); + } + + /** + * Patch an existing Kubernetes Cluster Extension. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param extensionName Name of the Extension. + * @param patchExtension Properties to Patch in an existing Extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the Extension object. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ExtensionInner> beginUpdateAsync(String resourceGroupName, + String clusterRp, String clusterResourceName, String clusterName, String extensionName, + PatchExtension patchExtension, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = updateWithResponseAsync(resourceGroupName, clusterRp, + clusterResourceName, clusterName, extensionName, patchExtension, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + ExtensionInner.class, ExtensionInner.class, context); + } + + /** + * Patch an existing Kubernetes Cluster Extension. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param extensionName Name of the Extension. + * @param patchExtension Properties to Patch in an existing Extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the Extension object. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ExtensionInner> beginUpdate(String resourceGroupName, + String clusterRp, String clusterResourceName, String clusterName, String extensionName, + PatchExtension patchExtension) { + return this + .beginUpdateAsync(resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName, + patchExtension) + .getSyncPoller(); + } + + /** + * Patch an existing Kubernetes Cluster Extension. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param extensionName Name of the Extension. + * @param patchExtension Properties to Patch in an existing Extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the Extension object. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ExtensionInner> beginUpdate(String resourceGroupName, + String clusterRp, String clusterResourceName, String clusterName, String extensionName, + PatchExtension patchExtension, Context context) { + return this + .beginUpdateAsync(resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName, + patchExtension, context) + .getSyncPoller(); + } + + /** + * Patch an existing Kubernetes Cluster Extension. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param extensionName Name of the Extension. + * @param patchExtension Properties to Patch in an existing Extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Extension object on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String clusterRp, String clusterResourceName, + String clusterName, String extensionName, PatchExtension patchExtension) { + return beginUpdateAsync(resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName, + patchExtension).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Patch an existing Kubernetes Cluster Extension. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param extensionName Name of the Extension. + * @param patchExtension Properties to Patch in an existing Extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Extension object on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String clusterRp, String clusterResourceName, + String clusterName, String extensionName, PatchExtension patchExtension, Context context) { + return beginUpdateAsync(resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName, + patchExtension, context).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Patch an existing Kubernetes Cluster Extension. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param extensionName Name of the Extension. + * @param patchExtension Properties to Patch in an existing Extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Extension object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ExtensionInner update(String resourceGroupName, String clusterRp, String clusterResourceName, + String clusterName, String extensionName, PatchExtension patchExtension) { + return updateAsync(resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName, + patchExtension).block(); + } + + /** + * Patch an existing Kubernetes Cluster Extension. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param extensionName Name of the Extension. + * @param patchExtension Properties to Patch in an existing Extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Extension object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ExtensionInner update(String resourceGroupName, String clusterRp, String clusterResourceName, + String clusterName, String extensionName, PatchExtension patchExtension, Context context) { + return updateAsync(resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName, + patchExtension, context).block(); + } + + /** + * List all Extensions in the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Extensions along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, String clusterRp, + String clusterResourceName, String clusterName) { + 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 (clusterRp == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterRp is required and cannot be null.")); + } + if (clusterResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter clusterResourceName is required and cannot be null.")); + } + if (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, + clusterRp, clusterResourceName, clusterName, this.client.getApiVersion(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List all Extensions in the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Extensions along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, String clusterRp, + String clusterResourceName, String clusterName, 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 (clusterRp == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterRp is required and cannot be null.")); + } + if (clusterResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter clusterResourceName is required and cannot be null.")); + } + if (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, clusterRp, + clusterResourceName, clusterName, this.client.getApiVersion(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List all Extensions in the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Extensions as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String clusterRp, String clusterResourceName, + String clusterName) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, clusterRp, clusterResourceName, clusterName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List all Extensions in the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Extensions as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String clusterRp, String clusterResourceName, + String clusterName, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, clusterRp, clusterResourceName, clusterName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List all Extensions in the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Extensions as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String clusterRp, String clusterResourceName, + String clusterName) { + return new PagedIterable<>(listAsync(resourceGroupName, clusterRp, clusterResourceName, clusterName)); + } + + /** + * List all Extensions in the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Extensions as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String clusterRp, String clusterResourceName, + String clusterName, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, clusterRp, clusterResourceName, clusterName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Extensions along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Extensions along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/implementation/ExtensionsImpl.java b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/implementation/ExtensionsImpl.java new file mode 100644 index 000000000000..298dda79f6df --- /dev/null +++ b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/implementation/ExtensionsImpl.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.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.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.fluent.ExtensionsClient; +import com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.fluent.models.ExtensionInner; +import com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.models.Extension; +import com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.models.Extensions; +import com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.models.PatchExtension; + +public final class ExtensionsImpl implements Extensions { + private static final ClientLogger LOGGER = new ClientLogger(ExtensionsImpl.class); + + private final ExtensionsClient innerClient; + + private final com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.ExtensionsManager serviceManager; + + public ExtensionsImpl(ExtensionsClient innerClient, + com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.ExtensionsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Extension create(String resourceGroupName, String clusterRp, String clusterResourceName, String clusterName, + String extensionName, ExtensionInner extension) { + ExtensionInner inner = this.serviceClient() + .create(resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName, extension); + if (inner != null) { + return new ExtensionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Extension create(String resourceGroupName, String clusterRp, String clusterResourceName, String clusterName, + String extensionName, ExtensionInner extension, Context context) { + ExtensionInner inner = this.serviceClient() + .create(resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName, extension, context); + if (inner != null) { + return new ExtensionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse(String resourceGroupName, String clusterRp, String clusterResourceName, + String clusterName, String extensionName, Context context) { + Response inner = this.serviceClient() + .getWithResponse(resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ExtensionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Extension get(String resourceGroupName, String clusterRp, String clusterResourceName, String clusterName, + String extensionName) { + ExtensionInner inner + = this.serviceClient().get(resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName); + if (inner != null) { + return new ExtensionImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String clusterRp, String clusterResourceName, String clusterName, + String extensionName) { + this.serviceClient().delete(resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName); + } + + public void delete(String resourceGroupName, String clusterRp, String clusterResourceName, String clusterName, + String extensionName, Boolean forceDelete, Context context) { + this.serviceClient() + .delete(resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName, forceDelete, + context); + } + + public Extension update(String resourceGroupName, String clusterRp, String clusterResourceName, String clusterName, + String extensionName, PatchExtension patchExtension) { + ExtensionInner inner = this.serviceClient() + .update(resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName, patchExtension); + if (inner != null) { + return new ExtensionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Extension update(String resourceGroupName, String clusterRp, String clusterResourceName, String clusterName, + String extensionName, PatchExtension patchExtension, Context context) { + ExtensionInner inner = this.serviceClient() + .update(resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName, patchExtension, + context); + if (inner != null) { + return new ExtensionImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable list(String resourceGroupName, String clusterRp, String clusterResourceName, + String clusterName) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, clusterRp, clusterResourceName, clusterName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ExtensionImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String clusterRp, String clusterResourceName, + String clusterName, Context context) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, clusterRp, clusterResourceName, clusterName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ExtensionImpl(inner1, this.manager())); + } + + private ExtensionsClient serviceClient() { + return this.innerClient; + } + + private + com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.ExtensionsManager + manager() { + return this.serviceManager; + } +} diff --git a/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/implementation/ExtensionsManagementClientBuilder.java b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/implementation/ExtensionsManagementClientBuilder.java new file mode 100644 index 000000000000..b2c2afa7ab38 --- /dev/null +++ b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/implementation/ExtensionsManagementClientBuilder.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.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.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 ExtensionsManagementClientImpl type. + */ +@ServiceClientBuilder(serviceClients = { ExtensionsManagementClientImpl.class }) +public final class ExtensionsManagementClientBuilder { + /* + * The ID of the target subscription. + */ + private String subscriptionId; + + /** + * Sets The ID of the target subscription. + * + * @param subscriptionId the subscriptionId value. + * @return the ExtensionsManagementClientBuilder. + */ + public ExtensionsManagementClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the ExtensionsManagementClientBuilder. + */ + public ExtensionsManagementClientBuilder 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 ExtensionsManagementClientBuilder. + */ + public ExtensionsManagementClientBuilder environment(AzureEnvironment environment) { + this.environment = environment; + 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 ExtensionsManagementClientBuilder. + */ + public ExtensionsManagementClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + 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 ExtensionsManagementClientBuilder. + */ + public ExtensionsManagementClientBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + 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 ExtensionsManagementClientBuilder. + */ + public ExtensionsManagementClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of ExtensionsManagementClientImpl with the provided parameters. + * + * @return an instance of ExtensionsManagementClientImpl. + */ + public ExtensionsManagementClientImpl buildClient() { + String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; + AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; + HttpPipeline localPipeline = (pipeline != null) + ? pipeline + : new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); + Duration localDefaultPollInterval + = (defaultPollInterval != null) ? defaultPollInterval : Duration.ofSeconds(30); + SerializerAdapter localSerializerAdapter = (serializerAdapter != null) + ? serializerAdapter + : SerializerFactory.createDefaultManagementSerializerAdapter(); + ExtensionsManagementClientImpl client = new ExtensionsManagementClientImpl(localPipeline, + localSerializerAdapter, localDefaultPollInterval, localEnvironment, this.subscriptionId, localEndpoint); + return client; + } +} diff --git a/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/implementation/ExtensionsManagementClientImpl.java b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/implementation/ExtensionsManagementClientImpl.java new file mode 100644 index 000000000000..99cee4d14602 --- /dev/null +++ b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/implementation/ExtensionsManagementClientImpl.java @@ -0,0 +1,304 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.implementation; + +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaderName; +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.CoreUtils; +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.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.fluent.ExtensionsClient; +import com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.fluent.ExtensionsManagementClient; +import com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.fluent.OperationStatusClient; +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 reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the ExtensionsManagementClientImpl type. + */ +@ServiceClient(builder = ExtensionsManagementClientBuilder.class) +public final class ExtensionsManagementClientImpl implements ExtensionsManagementClient { + /** + * 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 ExtensionsClient object to access its operations. + */ + private final ExtensionsClient extensions; + + /** + * Gets the ExtensionsClient object to access its operations. + * + * @return the ExtensionsClient object. + */ + public ExtensionsClient getExtensions() { + return this.extensions; + } + + /** + * The OperationStatusClient object to access its operations. + */ + private final OperationStatusClient operationStatus; + + /** + * Gets the OperationStatusClient object to access its operations. + * + * @return the OperationStatusClient object. + */ + public OperationStatusClient getOperationStatus() { + return this.operationStatus; + } + + /** + * Initializes an instance of ExtensionsManagementClient 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. + */ + ExtensionsManagementClientImpl(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 = "2024-11-01"; + this.extensions = new ExtensionsClientImpl(this); + this.operationStatus = new OperationStatusClientImpl(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) { + return CoreUtils.mergeContexts(this.getContext(), 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(HttpHeaderName.fromString(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)); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ExtensionsManagementClientImpl.class); +} diff --git a/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/implementation/OperationStatusClientImpl.java b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/implementation/OperationStatusClientImpl.java new file mode 100644 index 000000000000..7d6dc1190bf3 --- /dev/null +++ b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/implementation/OperationStatusClientImpl.java @@ -0,0 +1,250 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.fluent.OperationStatusClient; +import com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.fluent.models.OperationStatusResultInner; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in OperationStatusClient. + */ +public final class OperationStatusClientImpl implements OperationStatusClient { + /** + * The proxy service used to perform REST calls. + */ + private final OperationStatusService service; + + /** + * The service client containing this operation class. + */ + private final ExtensionsManagementClientImpl client; + + /** + * Initializes an instance of OperationStatusClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationStatusClientImpl(ExtensionsManagementClientImpl client) { + this.service + = RestProxy.create(OperationStatusService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ExtensionsManagementClientOperationStatus to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ExtensionsManagement") + public interface OperationStatusService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}/operations/{operationId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("clusterRp") String clusterRp, + @PathParam("clusterResourceName") String clusterResourceName, @PathParam("clusterName") String clusterName, + @PathParam("extensionName") String extensionName, @QueryParam("api-version") String apiVersion, + @PathParam("operationId") String operationId, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get Async Operation status. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param extensionName Name of the Extension. + * @param operationId operation Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return async Operation status along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String clusterRp, + String clusterResourceName, String clusterName, String extensionName, String operationId) { + 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 (clusterRp == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterRp is required and cannot be null.")); + } + if (clusterResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter clusterResourceName is required and cannot be null.")); + } + if (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null.")); + } + if (extensionName == null) { + return Mono.error(new IllegalArgumentException("Parameter extensionName is required and cannot be null.")); + } + if (operationId == null) { + return Mono.error(new IllegalArgumentException("Parameter operationId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), + resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName, + this.client.getApiVersion(), operationId, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get Async Operation status. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param extensionName Name of the Extension. + * @param operationId operation Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return async Operation status along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String clusterRp, + String clusterResourceName, String clusterName, String extensionName, String operationId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (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 (clusterRp == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterRp is required and cannot be null.")); + } + if (clusterResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter clusterResourceName is required and cannot be null.")); + } + if (clusterName == null) { + return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null.")); + } + if (extensionName == null) { + return Mono.error(new IllegalArgumentException("Parameter extensionName is required and cannot be null.")); + } + if (operationId == null) { + return Mono.error(new IllegalArgumentException("Parameter operationId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, clusterRp, + clusterResourceName, clusterName, extensionName, this.client.getApiVersion(), operationId, accept, context); + } + + /** + * Get Async Operation status. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param extensionName Name of the Extension. + * @param operationId operation Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return async Operation status on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String clusterRp, + String clusterResourceName, String clusterName, String extensionName, String operationId) { + return getWithResponseAsync(resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName, + operationId).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get Async Operation status. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param extensionName Name of the Extension. + * @param operationId operation Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return async Operation status along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String clusterRp, + String clusterResourceName, String clusterName, String extensionName, String operationId, Context context) { + return getWithResponseAsync(resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName, + operationId, context).block(); + } + + /** + * Get Async Operation status. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param extensionName Name of the Extension. + * @param operationId operation Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return async Operation status. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OperationStatusResultInner get(String resourceGroupName, String clusterRp, String clusterResourceName, + String clusterName, String extensionName, String operationId) { + return getWithResponse(resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName, + operationId, Context.NONE).getValue(); + } +} diff --git a/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/implementation/OperationStatusImpl.java b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/implementation/OperationStatusImpl.java new file mode 100644 index 000000000000..e565dc951d32 --- /dev/null +++ b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/implementation/OperationStatusImpl.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.fluent.OperationStatusClient; +import com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.fluent.models.OperationStatusResultInner; +import com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.models.OperationStatus; +import com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.models.OperationStatusResult; + +public final class OperationStatusImpl implements OperationStatus { + private static final ClientLogger LOGGER = new ClientLogger(OperationStatusImpl.class); + + private final OperationStatusClient innerClient; + + private final com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.ExtensionsManager serviceManager; + + public OperationStatusImpl(OperationStatusClient innerClient, + com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.ExtensionsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceGroupName, String clusterRp, + String clusterResourceName, String clusterName, String extensionName, String operationId, Context context) { + Response inner = this.serviceClient() + .getWithResponse(resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName, operationId, + context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new OperationStatusResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public OperationStatusResult get(String resourceGroupName, String clusterRp, String clusterResourceName, + String clusterName, String extensionName, String operationId) { + OperationStatusResultInner inner = this.serviceClient() + .get(resourceGroupName, clusterRp, clusterResourceName, clusterName, extensionName, operationId); + if (inner != null) { + return new OperationStatusResultImpl(inner, this.manager()); + } else { + return null; + } + } + + private OperationStatusClient serviceClient() { + return this.innerClient; + } + + private + com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.ExtensionsManager + manager() { + return this.serviceManager; + } +} diff --git a/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/implementation/OperationStatusResultImpl.java b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/implementation/OperationStatusResultImpl.java new file mode 100644 index 000000000000..630b4168ea79 --- /dev/null +++ b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/implementation/OperationStatusResultImpl.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.implementation; + +import com.azure.core.management.exception.ManagementError; +import com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.fluent.models.OperationStatusResultInner; +import com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.models.OperationStatusResult; +import java.util.Collections; +import java.util.Map; + +public final class OperationStatusResultImpl implements OperationStatusResult { + private OperationStatusResultInner innerObject; + + private final com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.ExtensionsManager serviceManager; + + OperationStatusResultImpl(OperationStatusResultInner innerObject, + com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.ExtensionsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String status() { + return this.innerModel().status(); + } + + public Map properties() { + Map inner = this.innerModel().properties(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public ManagementError error() { + return this.innerModel().error(); + } + + public OperationStatusResultInner innerModel() { + return this.innerObject; + } + + private + com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.ExtensionsManager + manager() { + return this.serviceManager; + } +} diff --git a/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/implementation/ResourceManagerUtils.java b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/implementation/ResourceManagerUtils.java new file mode 100644 index 000000000000..9e534bdac143 --- /dev/null +++ b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/implementation/ResourceManagerUtils.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.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 ResourceManagerUtils { + private ResourceManagerUtils() { + } + + 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.isEmpty() && 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<>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl<>(pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl<>(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/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/implementation/package-info.java b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/implementation/package-info.java new file mode 100644 index 000000000000..d2d0936264c2 --- /dev/null +++ b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/implementation/package-info.java @@ -0,0 +1,9 @@ +// 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 ExtensionsManagementClient. + * KubernetesConfiguration Extensions Client. + */ +package com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.implementation; diff --git a/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/models/AksIdentityType.java b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/models/AksIdentityType.java new file mode 100644 index 000000000000..84e0a74d07c1 --- /dev/null +++ b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/models/AksIdentityType.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.models; + +/** + * The identity type. + */ +public enum AksIdentityType { + /** + * Enum value SystemAssigned. + */ + SYSTEM_ASSIGNED("SystemAssigned"), + + /** + * Enum value UserAssigned. + */ + USER_ASSIGNED("UserAssigned"); + + /** + * The actual serialized value for a AksIdentityType instance. + */ + private final String value; + + AksIdentityType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a AksIdentityType instance. + * + * @param value the serialized value to parse. + * @return the parsed AksIdentityType object, or null if unable to parse. + */ + public static AksIdentityType fromString(String value) { + if (value == null) { + return null; + } + AksIdentityType[] items = AksIdentityType.values(); + for (AksIdentityType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/models/Extension.java b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/models/Extension.java new file mode 100644 index 000000000000..8bbe6d9fc867 --- /dev/null +++ b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/models/Extension.java @@ -0,0 +1,179 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.models; + +import com.azure.core.management.SystemData; +import com.azure.core.management.exception.ManagementError; +import com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.fluent.models.ExtensionInner; +import java.util.List; +import java.util.Map; + +/** + * An immutable client-side representation of Extension. + */ +public interface Extension { + /** + * 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 identity property: Identity of the Extension resource. + * + * @return the identity value. + */ + Identity identity(); + + /** + * Gets the systemData property: Top level metadata + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the plan property: The plan information. + * + * @return the plan value. + */ + Plan plan(); + + /** + * Gets the extensionType property: Type of the Extension, of which this resource is an instance of. It must be one + * of the Extension Types registered with Microsoft.KubernetesConfiguration by the Extension publisher. + * + * @return the extensionType value. + */ + String extensionType(); + + /** + * Gets the autoUpgradeMinorVersion property: Flag to note if this extension participates in auto upgrade of minor + * version, or not. + * + * @return the autoUpgradeMinorVersion value. + */ + Boolean autoUpgradeMinorVersion(); + + /** + * Gets the releaseTrain property: ReleaseTrain this extension participates in for auto-upgrade (e.g. Stable, + * Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. + * + * @return the releaseTrain value. + */ + String releaseTrain(); + + /** + * Gets the version property: User-specified version of the extension for this extension to 'pin'. To use 'version', + * autoUpgradeMinorVersion must be 'false'. + * + * @return the version value. + */ + String version(); + + /** + * Gets the scope property: Scope at which the extension is installed. + * + * @return the scope value. + */ + Scope scope(); + + /** + * Gets the configurationSettings property: Configuration settings, as name-value pairs for configuring this + * extension. + * + * @return the configurationSettings value. + */ + Map configurationSettings(); + + /** + * Gets the configurationProtectedSettings property: Configuration settings that are sensitive, as name-value pairs + * for configuring this extension. + * + * @return the configurationProtectedSettings value. + */ + Map configurationProtectedSettings(); + + /** + * Gets the currentVersion property: Currently installed version of the extension. + * + * @return the currentVersion value. + */ + String currentVersion(); + + /** + * Gets the provisioningState property: Status of installation of this extension. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the statuses property: Status from this extension. + * + * @return the statuses value. + */ + List statuses(); + + /** + * Gets the errorInfo property: Error information from the Agent - e.g. errors during installation. + * + * @return the errorInfo value. + */ + ManagementError errorInfo(); + + /** + * Gets the customLocationSettings property: Custom Location settings properties. + * + * @return the customLocationSettings value. + */ + Map customLocationSettings(); + + /** + * Gets the packageUri property: Uri of the Helm package. + * + * @return the packageUri value. + */ + String packageUri(); + + /** + * Gets the aksAssignedIdentity property: Identity of the Extension resource in an AKS cluster. + * + * @return the aksAssignedIdentity value. + */ + ExtensionPropertiesAksAssignedIdentity aksAssignedIdentity(); + + /** + * Gets the isSystemExtension property: Flag to note if this extension is a system extension. + * + * @return the isSystemExtension value. + */ + Boolean isSystemExtension(); + + /** + * Gets the inner + * com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.fluent.models.ExtensionInner + * object. + * + * @return the inner object. + */ + ExtensionInner innerModel(); +} diff --git a/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/models/ExtensionPropertiesAksAssignedIdentity.java b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/models/ExtensionPropertiesAksAssignedIdentity.java new file mode 100644 index 000000000000..cf6b900d9ecb --- /dev/null +++ b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/models/ExtensionPropertiesAksAssignedIdentity.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Identity of the Extension resource in an AKS cluster. + */ +@Fluent +public final class ExtensionPropertiesAksAssignedIdentity + implements JsonSerializable { + /* + * The principal ID of resource identity. + */ + private String principalId; + + /* + * The tenant ID of resource. + */ + private String tenantId; + + /* + * The identity type. + */ + private AksIdentityType type; + + /** + * Creates an instance of ExtensionPropertiesAksAssignedIdentity class. + */ + public ExtensionPropertiesAksAssignedIdentity() { + } + + /** + * 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 AksIdentityType type() { + return this.type; + } + + /** + * Set the type property: The identity type. + * + * @param type the type value to set. + * @return the ExtensionPropertiesAksAssignedIdentity object itself. + */ + public ExtensionPropertiesAksAssignedIdentity withType(AksIdentityType type) { + this.type = type; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ExtensionPropertiesAksAssignedIdentity from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ExtensionPropertiesAksAssignedIdentity if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ExtensionPropertiesAksAssignedIdentity. + */ + public static ExtensionPropertiesAksAssignedIdentity fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ExtensionPropertiesAksAssignedIdentity deserializedExtensionPropertiesAksAssignedIdentity + = new ExtensionPropertiesAksAssignedIdentity(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("principalId".equals(fieldName)) { + deserializedExtensionPropertiesAksAssignedIdentity.principalId = reader.getString(); + } else if ("tenantId".equals(fieldName)) { + deserializedExtensionPropertiesAksAssignedIdentity.tenantId = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedExtensionPropertiesAksAssignedIdentity.type + = AksIdentityType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedExtensionPropertiesAksAssignedIdentity; + }); + } +} diff --git a/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/models/ExtensionStatus.java b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/models/ExtensionStatus.java new file mode 100644 index 000000000000..9b6bafb918c4 --- /dev/null +++ b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/models/ExtensionStatus.java @@ -0,0 +1,205 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Status from the extension. + */ +@Fluent +public final class ExtensionStatus implements JsonSerializable { + /* + * Status code provided by the Extension + */ + private String code; + + /* + * Short description of status of the extension. + */ + private String displayStatus; + + /* + * Level of the status. + */ + private LevelType level; + + /* + * Detailed message of the status from the Extension. + */ + private String message; + + /* + * DateLiteral (per ISO8601) noting the time of installation status. + */ + private String time; + + /** + * Creates an instance of ExtensionStatus class. + */ + public ExtensionStatus() { + } + + /** + * Get the code property: Status code provided by the Extension. + * + * @return the code value. + */ + public String code() { + return this.code; + } + + /** + * Set the code property: Status code provided by the Extension. + * + * @param code the code value to set. + * @return the ExtensionStatus object itself. + */ + public ExtensionStatus withCode(String code) { + this.code = code; + return this; + } + + /** + * Get the displayStatus property: Short description of status of the extension. + * + * @return the displayStatus value. + */ + public String displayStatus() { + return this.displayStatus; + } + + /** + * Set the displayStatus property: Short description of status of the extension. + * + * @param displayStatus the displayStatus value to set. + * @return the ExtensionStatus object itself. + */ + public ExtensionStatus withDisplayStatus(String displayStatus) { + this.displayStatus = displayStatus; + return this; + } + + /** + * Get the level property: Level of the status. + * + * @return the level value. + */ + public LevelType level() { + return this.level; + } + + /** + * Set the level property: Level of the status. + * + * @param level the level value to set. + * @return the ExtensionStatus object itself. + */ + public ExtensionStatus withLevel(LevelType level) { + this.level = level; + return this; + } + + /** + * Get the message property: Detailed message of the status from the Extension. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: Detailed message of the status from the Extension. + * + * @param message the message value to set. + * @return the ExtensionStatus object itself. + */ + public ExtensionStatus withMessage(String message) { + this.message = message; + return this; + } + + /** + * Get the time property: DateLiteral (per ISO8601) noting the time of installation status. + * + * @return the time value. + */ + public String time() { + return this.time; + } + + /** + * Set the time property: DateLiteral (per ISO8601) noting the time of installation status. + * + * @param time the time value to set. + * @return the ExtensionStatus object itself. + */ + public ExtensionStatus withTime(String time) { + this.time = time; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("code", this.code); + jsonWriter.writeStringField("displayStatus", this.displayStatus); + jsonWriter.writeStringField("level", this.level == null ? null : this.level.toString()); + jsonWriter.writeStringField("message", this.message); + jsonWriter.writeStringField("time", this.time); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ExtensionStatus from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ExtensionStatus if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ExtensionStatus. + */ + public static ExtensionStatus fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ExtensionStatus deserializedExtensionStatus = new ExtensionStatus(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("code".equals(fieldName)) { + deserializedExtensionStatus.code = reader.getString(); + } else if ("displayStatus".equals(fieldName)) { + deserializedExtensionStatus.displayStatus = reader.getString(); + } else if ("level".equals(fieldName)) { + deserializedExtensionStatus.level = LevelType.fromString(reader.getString()); + } else if ("message".equals(fieldName)) { + deserializedExtensionStatus.message = reader.getString(); + } else if ("time".equals(fieldName)) { + deserializedExtensionStatus.time = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedExtensionStatus; + }); + } +} diff --git a/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/models/Extensions.java b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/models/Extensions.java new file mode 100644 index 000000000000..433f3f65343f --- /dev/null +++ b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/models/Extensions.java @@ -0,0 +1,201 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.fluent.models.ExtensionInner; + +/** + * Resource collection API of Extensions. + */ +public interface Extensions { + /** + * Create a new Kubernetes Cluster Extension. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param extensionName Name of the Extension. + * @param extension Properties necessary to Create an Extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Extension object. + */ + Extension create(String resourceGroupName, String clusterRp, String clusterResourceName, String clusterName, + String extensionName, ExtensionInner extension); + + /** + * Create a new Kubernetes Cluster Extension. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param extensionName Name of the Extension. + * @param extension Properties necessary to Create an Extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Extension object. + */ + Extension create(String resourceGroupName, String clusterRp, String clusterResourceName, String clusterName, + String extensionName, ExtensionInner extension, Context context); + + /** + * Gets Kubernetes Cluster Extension. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param extensionName Name of the Extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return kubernetes Cluster Extension along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String clusterRp, String clusterResourceName, + String clusterName, String extensionName, Context context); + + /** + * Gets Kubernetes Cluster Extension. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param extensionName Name of the Extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return kubernetes Cluster Extension. + */ + Extension get(String resourceGroupName, String clusterRp, String clusterResourceName, String clusterName, + String extensionName); + + /** + * Delete a Kubernetes Cluster Extension. This will cause the Agent to Uninstall the extension from the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param extensionName Name of the Extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String clusterRp, String clusterResourceName, String clusterName, + String extensionName); + + /** + * Delete a Kubernetes Cluster Extension. This will cause the Agent to Uninstall the extension from the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param extensionName Name of the Extension. + * @param forceDelete Delete the extension resource in Azure - not the normal asynchronous delete. + * @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 clusterRp, String clusterResourceName, String clusterName, + String extensionName, Boolean forceDelete, Context context); + + /** + * Patch an existing Kubernetes Cluster Extension. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param extensionName Name of the Extension. + * @param patchExtension Properties to Patch in an existing Extension. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Extension object. + */ + Extension update(String resourceGroupName, String clusterRp, String clusterResourceName, String clusterName, + String extensionName, PatchExtension patchExtension); + + /** + * Patch an existing Kubernetes Cluster Extension. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param extensionName Name of the Extension. + * @param patchExtension Properties to Patch in an existing Extension. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Extension object. + */ + Extension update(String resourceGroupName, String clusterRp, String clusterResourceName, String clusterName, + String extensionName, PatchExtension patchExtension, Context context); + + /** + * List all Extensions in the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Extensions as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String clusterRp, String clusterResourceName, + String clusterName); + + /** + * List all Extensions in the cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Extensions as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String clusterRp, String clusterResourceName, + String clusterName, Context context); +} diff --git a/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/models/ExtensionsList.java b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/models/ExtensionsList.java new file mode 100644 index 000000000000..e29bab23ba1b --- /dev/null +++ b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/models/ExtensionsList.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.fluent.models.ExtensionInner; +import java.io.IOException; +import java.util.List; + +/** + * Result of the request to list Extensions. It contains a list of Extension objects and a URL link to get the next set + * of results. + */ +@Immutable +public final class ExtensionsList implements JsonSerializable { + /* + * List of Extensions within a Kubernetes cluster. + */ + private List value; + + /* + * URL to get the next set of extension objects, if any. + */ + private String nextLink; + + /** + * Creates an instance of ExtensionsList class. + */ + public ExtensionsList() { + } + + /** + * Get the value property: List of Extensions within a Kubernetes cluster. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: URL to get the next set of extension objects, if any. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ExtensionsList from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ExtensionsList if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ExtensionsList. + */ + public static ExtensionsList fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ExtensionsList deserializedExtensionsList = new ExtensionsList(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> ExtensionInner.fromJson(reader1)); + deserializedExtensionsList.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedExtensionsList.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedExtensionsList; + }); + } +} diff --git a/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/models/Identity.java b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/models/Identity.java new file mode 100644 index 000000000000..7cad98aa696a --- /dev/null +++ b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/models/Identity.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Identity for the resource. + */ +@Fluent +public final class Identity implements JsonSerializable { + /* + * The principal ID of resource identity. + */ + private String principalId; + + /* + * The tenant ID of resource. + */ + private String tenantId; + + /* + * The identity type. + */ + private ResourceIdentityType type; + + /** + * Creates an instance of Identity class. + */ + public Identity() { + } + + /** + * 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() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Identity from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Identity if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IOException If an error occurs while reading the Identity. + */ + public static Identity fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Identity deserializedIdentity = new Identity(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("principalId".equals(fieldName)) { + deserializedIdentity.principalId = reader.getString(); + } else if ("tenantId".equals(fieldName)) { + deserializedIdentity.tenantId = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedIdentity.type = ResourceIdentityType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedIdentity; + }); + } +} diff --git a/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/models/LevelType.java b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/models/LevelType.java new file mode 100644 index 000000000000..b89116a74f81 --- /dev/null +++ b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/models/LevelType.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Level of the status. + */ +public final class LevelType extends ExpandableStringEnum { + /** + * Static value Error for LevelType. + */ + public static final LevelType ERROR = fromString("Error"); + + /** + * Static value Warning for LevelType. + */ + public static final LevelType WARNING = fromString("Warning"); + + /** + * Static value Information for LevelType. + */ + public static final LevelType INFORMATION = fromString("Information"); + + /** + * Creates a new instance of LevelType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public LevelType() { + } + + /** + * Creates or finds a LevelType from its string representation. + * + * @param name a name to look for. + * @return the corresponding LevelType. + */ + public static LevelType fromString(String name) { + return fromString(name, LevelType.class); + } + + /** + * Gets known LevelType values. + * + * @return known LevelType values. + */ + public static Collection values() { + return values(LevelType.class); + } +} diff --git a/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/models/OperationStatus.java b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/models/OperationStatus.java new file mode 100644 index 000000000000..f470a5f53474 --- /dev/null +++ b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/models/OperationStatus.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of OperationStatus. + */ +public interface OperationStatus { + /** + * Get Async Operation status. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param extensionName Name of the Extension. + * @param operationId operation Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return async Operation status along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String clusterRp, + String clusterResourceName, String clusterName, String extensionName, String operationId, Context context); + + /** + * Get Async Operation status. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterRp The Kubernetes cluster RP - i.e. Microsoft.ContainerService, Microsoft.Kubernetes, + * Microsoft.HybridContainerService. + * @param clusterResourceName The Kubernetes cluster resource name - i.e. managedClusters, connectedClusters, + * provisionedClusters, appliances. + * @param clusterName The name of the kubernetes cluster. + * @param extensionName Name of the Extension. + * @param operationId operation Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return async Operation status. + */ + OperationStatusResult get(String resourceGroupName, String clusterRp, String clusterResourceName, + String clusterName, String extensionName, String operationId); +} diff --git a/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/models/OperationStatusResult.java b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/models/OperationStatusResult.java new file mode 100644 index 000000000000..0ecc25abd095 --- /dev/null +++ b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/models/OperationStatusResult.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.models; + +import com.azure.core.management.exception.ManagementError; +import com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.fluent.models.OperationStatusResultInner; +import java.util.Map; + +/** + * An immutable client-side representation of OperationStatusResult. + */ +public interface OperationStatusResult { + /** + * Gets the id property: Fully qualified ID for the async operation. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: Name of the async operation. + * + * @return the name value. + */ + String name(); + + /** + * Gets the status property: Operation status. + * + * @return the status value. + */ + String status(); + + /** + * Gets the properties property: Additional information, if available. + * + * @return the properties value. + */ + Map properties(); + + /** + * Gets the error property: If present, details of the operation error. + * + * @return the error value. + */ + ManagementError error(); + + /** + * Gets the inner + * com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.fluent.models.OperationStatusResultInner + * object. + * + * @return the inner object. + */ + OperationStatusResultInner innerModel(); +} diff --git a/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/models/PatchExtension.java b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/models/PatchExtension.java new file mode 100644 index 000000000000..d005194477d0 --- /dev/null +++ b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/models/PatchExtension.java @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.fluent.models.PatchExtensionProperties; +import java.io.IOException; +import java.util.Map; + +/** + * The Extension Patch Request object. + */ +@Fluent +public final class PatchExtension implements JsonSerializable { + /* + * Updatable properties of an Extension Patch Request + */ + private PatchExtensionProperties innerProperties; + + /** + * Creates an instance of PatchExtension class. + */ + public PatchExtension() { + } + + /** + * Get the innerProperties property: Updatable properties of an Extension Patch Request. + * + * @return the innerProperties value. + */ + private PatchExtensionProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the autoUpgradeMinorVersion property: Flag to note if this extension participates in auto upgrade of minor + * version, or not. + * + * @return the autoUpgradeMinorVersion value. + */ + public Boolean autoUpgradeMinorVersion() { + return this.innerProperties() == null ? null : this.innerProperties().autoUpgradeMinorVersion(); + } + + /** + * Set the autoUpgradeMinorVersion property: Flag to note if this extension participates in auto upgrade of minor + * version, or not. + * + * @param autoUpgradeMinorVersion the autoUpgradeMinorVersion value to set. + * @return the PatchExtension object itself. + */ + public PatchExtension withAutoUpgradeMinorVersion(Boolean autoUpgradeMinorVersion) { + if (this.innerProperties() == null) { + this.innerProperties = new PatchExtensionProperties(); + } + this.innerProperties().withAutoUpgradeMinorVersion(autoUpgradeMinorVersion); + return this; + } + + /** + * Get the releaseTrain property: ReleaseTrain this extension participates in for auto-upgrade (e.g. Stable, + * Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. + * + * @return the releaseTrain value. + */ + public String releaseTrain() { + return this.innerProperties() == null ? null : this.innerProperties().releaseTrain(); + } + + /** + * Set the releaseTrain property: ReleaseTrain this extension participates in for auto-upgrade (e.g. Stable, + * Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. + * + * @param releaseTrain the releaseTrain value to set. + * @return the PatchExtension object itself. + */ + public PatchExtension withReleaseTrain(String releaseTrain) { + if (this.innerProperties() == null) { + this.innerProperties = new PatchExtensionProperties(); + } + this.innerProperties().withReleaseTrain(releaseTrain); + return this; + } + + /** + * Get the version property: Version of the extension for this extension, if it is 'pinned' to a specific version. + * autoUpgradeMinorVersion must be 'false'. + * + * @return the version value. + */ + public String version() { + return this.innerProperties() == null ? null : this.innerProperties().version(); + } + + /** + * Set the version property: Version of the extension for this extension, if it is 'pinned' to a specific version. + * autoUpgradeMinorVersion must be 'false'. + * + * @param version the version value to set. + * @return the PatchExtension object itself. + */ + public PatchExtension withVersion(String version) { + if (this.innerProperties() == null) { + this.innerProperties = new PatchExtensionProperties(); + } + this.innerProperties().withVersion(version); + return this; + } + + /** + * Get the configurationSettings property: Configuration settings, as name-value pairs for configuring this + * extension. + * + * @return the configurationSettings value. + */ + public Map configurationSettings() { + return this.innerProperties() == null ? null : this.innerProperties().configurationSettings(); + } + + /** + * Set the configurationSettings property: Configuration settings, as name-value pairs for configuring this + * extension. + * + * @param configurationSettings the configurationSettings value to set. + * @return the PatchExtension object itself. + */ + public PatchExtension withConfigurationSettings(Map configurationSettings) { + if (this.innerProperties() == null) { + this.innerProperties = new PatchExtensionProperties(); + } + this.innerProperties().withConfigurationSettings(configurationSettings); + return this; + } + + /** + * Get the configurationProtectedSettings property: Configuration settings that are sensitive, as name-value pairs + * for configuring this extension. + * + * @return the configurationProtectedSettings value. + */ + public Map configurationProtectedSettings() { + return this.innerProperties() == null ? null : this.innerProperties().configurationProtectedSettings(); + } + + /** + * Set the configurationProtectedSettings property: Configuration settings that are sensitive, as name-value pairs + * for configuring this extension. + * + * @param configurationProtectedSettings the configurationProtectedSettings value to set. + * @return the PatchExtension object itself. + */ + public PatchExtension withConfigurationProtectedSettings(Map configurationProtectedSettings) { + if (this.innerProperties() == null) { + this.innerProperties = new PatchExtensionProperties(); + } + this.innerProperties().withConfigurationProtectedSettings(configurationProtectedSettings); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PatchExtension from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PatchExtension if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the PatchExtension. + */ + public static PatchExtension fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PatchExtension deserializedPatchExtension = new PatchExtension(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedPatchExtension.innerProperties = PatchExtensionProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedPatchExtension; + }); + } +} diff --git a/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/models/Plan.java b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/models/Plan.java new file mode 100644 index 000000000000..6d1f121dc408 --- /dev/null +++ b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/models/Plan.java @@ -0,0 +1,224 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Plan for the resource. + */ +@Fluent +public final class Plan implements JsonSerializable { + /* + * A user defined name of the 3rd Party Artifact that is being procured. + */ + private String name; + + /* + * The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic + */ + private String publisher; + + /* + * The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to the OfferID specified for the + * artifact at the time of Data Market onboarding. + */ + private String product; + + /* + * A publisher provided promotion code as provisioned in Data Market for the said product/artifact. + */ + private String promotionCode; + + /* + * The version of the desired product/artifact. + */ + private String version; + + /** + * Creates an instance of Plan class. + */ + public Plan() { + } + + /** + * Get the name property: A user defined name of the 3rd Party Artifact that is being procured. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: A user defined name of the 3rd Party Artifact that is being procured. + * + * @param name the name value to set. + * @return the Plan object itself. + */ + public Plan withName(String name) { + this.name = name; + return this; + } + + /** + * Get the publisher property: The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic. + * + * @return the publisher value. + */ + public String publisher() { + return this.publisher; + } + + /** + * Set the publisher property: The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic. + * + * @param publisher the publisher value to set. + * @return the Plan object itself. + */ + public Plan withPublisher(String publisher) { + this.publisher = publisher; + return this; + } + + /** + * Get the product property: The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to the + * OfferID specified for the artifact at the time of Data Market onboarding. + * + * @return the product value. + */ + public String product() { + return this.product; + } + + /** + * Set the product property: The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to the + * OfferID specified for the artifact at the time of Data Market onboarding. + * + * @param product the product value to set. + * @return the Plan object itself. + */ + public Plan withProduct(String product) { + this.product = product; + return this; + } + + /** + * Get the promotionCode property: A publisher provided promotion code as provisioned in Data Market for the said + * product/artifact. + * + * @return the promotionCode value. + */ + public String promotionCode() { + return this.promotionCode; + } + + /** + * Set the promotionCode property: A publisher provided promotion code as provisioned in Data Market for the said + * product/artifact. + * + * @param promotionCode the promotionCode value to set. + * @return the Plan object itself. + */ + public Plan withPromotionCode(String promotionCode) { + this.promotionCode = promotionCode; + return this; + } + + /** + * Get the version property: The version of the desired product/artifact. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: The version of the desired product/artifact. + * + * @param version the version value to set. + * @return the Plan object itself. + */ + public Plan withVersion(String version) { + this.version = version; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Missing required property name in model Plan")); + } + if (publisher() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property publisher in model Plan")); + } + if (product() == null) { + throw LOGGER.atError().log(new IllegalArgumentException("Missing required property product in model Plan")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(Plan.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("publisher", this.publisher); + jsonWriter.writeStringField("product", this.product); + jsonWriter.writeStringField("promotionCode", this.promotionCode); + jsonWriter.writeStringField("version", this.version); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Plan from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Plan if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Plan. + */ + public static Plan fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Plan deserializedPlan = new Plan(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedPlan.name = reader.getString(); + } else if ("publisher".equals(fieldName)) { + deserializedPlan.publisher = reader.getString(); + } else if ("product".equals(fieldName)) { + deserializedPlan.product = reader.getString(); + } else if ("promotionCode".equals(fieldName)) { + deserializedPlan.promotionCode = reader.getString(); + } else if ("version".equals(fieldName)) { + deserializedPlan.version = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedPlan; + }); + } +} diff --git a/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/models/ProvisioningState.java b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/models/ProvisioningState.java new file mode 100644 index 000000000000..654766ba996a --- /dev/null +++ b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/models/ProvisioningState.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The provisioning state of the resource. + */ +public final class ProvisioningState extends ExpandableStringEnum { + /** + * Static value Succeeded for ProvisioningState. + */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** + * Static value Failed for ProvisioningState. + */ + public static final ProvisioningState FAILED = fromString("Failed"); + + /** + * Static value Canceled for ProvisioningState. + */ + public static final ProvisioningState CANCELED = fromString("Canceled"); + + /** + * Static value Creating for ProvisioningState. + */ + public static final ProvisioningState CREATING = fromString("Creating"); + + /** + * Static value Updating for ProvisioningState. + */ + public static final ProvisioningState UPDATING = fromString("Updating"); + + /** + * Static value Deleting for ProvisioningState. + */ + public static final ProvisioningState DELETING = fromString("Deleting"); + + /** + * Creates a new instance of ProvisioningState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ProvisioningState() { + } + + /** + * Creates or finds a ProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProvisioningState. + */ + public static ProvisioningState fromString(String name) { + return fromString(name, ProvisioningState.class); + } + + /** + * Gets known ProvisioningState values. + * + * @return known ProvisioningState values. + */ + public static Collection values() { + return values(ProvisioningState.class); + } +} diff --git a/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/models/ResourceIdentityType.java b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/models/ResourceIdentityType.java new file mode 100644 index 000000000000..4aa42c84e067 --- /dev/null +++ b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/models/ResourceIdentityType.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.models; + +/** + * The identity type. + */ +public enum ResourceIdentityType { + /** + * Enum value SystemAssigned. + */ + SYSTEM_ASSIGNED("SystemAssigned"); + + /** + * The actual serialized value for a ResourceIdentityType instance. + */ + private final String value; + + ResourceIdentityType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ResourceIdentityType instance. + * + * @param value the serialized value to parse. + * @return the parsed ResourceIdentityType object, or null if unable to parse. + */ + public static ResourceIdentityType fromString(String value) { + if (value == null) { + return null; + } + ResourceIdentityType[] items = ResourceIdentityType.values(); + for (ResourceIdentityType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/models/Scope.java b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/models/Scope.java new file mode 100644 index 000000000000..570fff5d40b9 --- /dev/null +++ b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/models/Scope.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Scope of the extension. It can be either Cluster or Namespace; but not both. + */ +@Fluent +public final class Scope implements JsonSerializable { + /* + * Specifies that the scope of the extension is Cluster + */ + private ScopeCluster cluster; + + /* + * Specifies that the scope of the extension is Namespace + */ + private ScopeNamespace namespace; + + /** + * Creates an instance of Scope class. + */ + public Scope() { + } + + /** + * Get the cluster property: Specifies that the scope of the extension is Cluster. + * + * @return the cluster value. + */ + public ScopeCluster cluster() { + return this.cluster; + } + + /** + * Set the cluster property: Specifies that the scope of the extension is Cluster. + * + * @param cluster the cluster value to set. + * @return the Scope object itself. + */ + public Scope withCluster(ScopeCluster cluster) { + this.cluster = cluster; + return this; + } + + /** + * Get the namespace property: Specifies that the scope of the extension is Namespace. + * + * @return the namespace value. + */ + public ScopeNamespace namespace() { + return this.namespace; + } + + /** + * Set the namespace property: Specifies that the scope of the extension is Namespace. + * + * @param namespace the namespace value to set. + * @return the Scope object itself. + */ + public Scope withNamespace(ScopeNamespace namespace) { + this.namespace = namespace; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (cluster() != null) { + cluster().validate(); + } + if (namespace() != null) { + namespace().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("cluster", this.cluster); + jsonWriter.writeJsonField("namespace", this.namespace); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Scope from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Scope if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IOException If an error occurs while reading the Scope. + */ + public static Scope fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Scope deserializedScope = new Scope(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("cluster".equals(fieldName)) { + deserializedScope.cluster = ScopeCluster.fromJson(reader); + } else if ("namespace".equals(fieldName)) { + deserializedScope.namespace = ScopeNamespace.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedScope; + }); + } +} diff --git a/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/models/ScopeCluster.java b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/models/ScopeCluster.java new file mode 100644 index 000000000000..cd9e4623e570 --- /dev/null +++ b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/models/ScopeCluster.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Specifies that the scope of the extension is Cluster. + */ +@Fluent +public final class ScopeCluster implements JsonSerializable { + /* + * Namespace where the extension Release must be placed, for a Cluster scoped extension. If this namespace does not + * exist, it will be created + */ + private String releaseNamespace; + + /** + * Creates an instance of ScopeCluster class. + */ + public ScopeCluster() { + } + + /** + * Get the releaseNamespace property: Namespace where the extension Release must be placed, for a Cluster scoped + * extension. If this namespace does not exist, it will be created. + * + * @return the releaseNamespace value. + */ + public String releaseNamespace() { + return this.releaseNamespace; + } + + /** + * Set the releaseNamespace property: Namespace where the extension Release must be placed, for a Cluster scoped + * extension. If this namespace does not exist, it will be created. + * + * @param releaseNamespace the releaseNamespace value to set. + * @return the ScopeCluster object itself. + */ + public ScopeCluster withReleaseNamespace(String releaseNamespace) { + this.releaseNamespace = releaseNamespace; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("releaseNamespace", this.releaseNamespace); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ScopeCluster from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ScopeCluster if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ScopeCluster. + */ + public static ScopeCluster fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ScopeCluster deserializedScopeCluster = new ScopeCluster(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("releaseNamespace".equals(fieldName)) { + deserializedScopeCluster.releaseNamespace = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedScopeCluster; + }); + } +} diff --git a/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/models/ScopeNamespace.java b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/models/ScopeNamespace.java new file mode 100644 index 000000000000..b368905c0599 --- /dev/null +++ b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/models/ScopeNamespace.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Specifies that the scope of the extension is Namespace. + */ +@Fluent +public final class ScopeNamespace implements JsonSerializable { + /* + * Namespace where the extension will be created for an Namespace scoped extension. If this namespace does not + * exist, it will be created + */ + private String targetNamespace; + + /** + * Creates an instance of ScopeNamespace class. + */ + public ScopeNamespace() { + } + + /** + * Get the targetNamespace property: Namespace where the extension will be created for an Namespace scoped + * extension. If this namespace does not exist, it will be created. + * + * @return the targetNamespace value. + */ + public String targetNamespace() { + return this.targetNamespace; + } + + /** + * Set the targetNamespace property: Namespace where the extension will be created for an Namespace scoped + * extension. If this namespace does not exist, it will be created. + * + * @param targetNamespace the targetNamespace value to set. + * @return the ScopeNamespace object itself. + */ + public ScopeNamespace withTargetNamespace(String targetNamespace) { + this.targetNamespace = targetNamespace; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("targetNamespace", this.targetNamespace); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ScopeNamespace from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ScopeNamespace if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ScopeNamespace. + */ + public static ScopeNamespace fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ScopeNamespace deserializedScopeNamespace = new ScopeNamespace(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("targetNamespace".equals(fieldName)) { + deserializedScopeNamespace.targetNamespace = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedScopeNamespace; + }); + } +} diff --git a/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/models/package-info.java b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/models/package-info.java new file mode 100644 index 000000000000..6615b093a2dc --- /dev/null +++ b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/models/package-info.java @@ -0,0 +1,9 @@ +// 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 ExtensionsManagementClient. + * KubernetesConfiguration Extensions Client. + */ +package com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.models; diff --git a/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/package-info.java b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/package-info.java new file mode 100644 index 000000000000..765fdacb0d54 --- /dev/null +++ b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/package-info.java @@ -0,0 +1,9 @@ +// 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 ExtensionsManagementClient. + * KubernetesConfiguration Extensions Client. + */ +package com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions; diff --git a/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/module-info.java b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/module-info.java new file mode 100644 index 000000000000..db847e6b8b7c --- /dev/null +++ b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/java/module-info.java @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +module com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions; + exports com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.fluent; + exports com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.fluent.models; + exports com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.models; + + opens com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.fluent.models + to com.azure.core; + opens com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.models + to com.azure.core; +} diff --git a/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/proxy-config.json b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/proxy-config.json new file mode 100644 index 000000000000..edff744c1d49 --- /dev/null +++ b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/proxy-config.json @@ -0,0 +1 @@ +[["com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.implementation.ExtensionsClientImpl$ExtensionsService"],["com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.implementation.OperationStatusClientImpl$OperationStatusService"]] \ No newline at end of file diff --git a/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/reflect-config.json b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/reflect-config.json new file mode 100644 index 000000000000..0637a088a01e --- /dev/null +++ b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/reflect-config.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/resources/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.properties b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/resources/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.properties new file mode 100644 index 000000000000..defbd48204e4 --- /dev/null +++ b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/main/resources/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.properties @@ -0,0 +1 @@ +version=${project.version} diff --git a/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/samples/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/generated/ExtensionsCreateSamples.java b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/samples/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/generated/ExtensionsCreateSamples.java new file mode 100644 index 000000000000..8787f92a49bc --- /dev/null +++ b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/samples/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/generated/ExtensionsCreateSamples.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.generated; + +import com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.fluent.models.ExtensionInner; +import com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.models.Plan; +import com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.models.Scope; +import com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.models.ScopeCluster; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Extensions Create. + */ +public final class ExtensionsCreateSamples { + /* + * x-ms-original-file: + * specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/extensions/stable/2024- + * 11-01/examples/CreateExtension.json + */ + /** + * Sample code: Create Extension. + * + * @param manager Entry point to ExtensionsManager. + */ + public static void createExtension( + com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.ExtensionsManager manager) { + manager.extensions() + .create("rg1", "Microsoft.Kubernetes", "connectedClusters", "clusterName1", "ClusterMonitor", + new ExtensionInner().withExtensionType("azuremonitor-containers") + .withAutoUpgradeMinorVersion(true) + .withReleaseTrain("Preview") + .withScope(new Scope().withCluster(new ScopeCluster().withReleaseNamespace("kube-system"))) + .withConfigurationSettings(mapOf("omsagent.env.clusterName", "clusterName1", "omsagent.secret.wsid", + "fakeTokenPlaceholder")) + .withConfigurationProtectedSettings(mapOf("omsagent.secret.key", "fakeTokenPlaceholder")), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/extensions/stable/2024- + * 11-01/examples/CreateExtensionWithPlan.json + */ + /** + * Sample code: Create Extension with Plan. + * + * @param manager Entry point to ExtensionsManager. + */ + public static void createExtensionWithPlan( + com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.ExtensionsManager manager) { + manager.extensions() + .create("rg1", "Microsoft.Kubernetes", "connectedClusters", "clusterName1", "azureVote", + new ExtensionInner() + .withPlan(new Plan().withName("azure-vote-standard") + .withPublisher("Microsoft") + .withProduct("azure-vote-standard-offer-id")) + .withExtensionType("azure-vote") + .withAutoUpgradeMinorVersion(true) + .withReleaseTrain("Preview"), + com.azure.core.util.Context.NONE); + } + + // Use "Map.of" if available + @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/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/samples/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/generated/ExtensionsDeleteSamples.java b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/samples/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/generated/ExtensionsDeleteSamples.java new file mode 100644 index 000000000000..bafb1680e46b --- /dev/null +++ b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/samples/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/generated/ExtensionsDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.generated; + +/** + * Samples for Extensions Delete. + */ +public final class ExtensionsDeleteSamples { + /* + * x-ms-original-file: + * specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/extensions/stable/2024- + * 11-01/examples/DeleteExtension.json + */ + /** + * Sample code: Delete Extension. + * + * @param manager Entry point to ExtensionsManager. + */ + public static void deleteExtension( + com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.ExtensionsManager manager) { + manager.extensions() + .delete("rg1", "Microsoft.Kubernetes", "connectedClusters", "clusterName1", "ClusterMonitor", null, + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/samples/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/generated/ExtensionsGetSamples.java b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/samples/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/generated/ExtensionsGetSamples.java new file mode 100644 index 000000000000..b2ffa5a90c58 --- /dev/null +++ b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/samples/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/generated/ExtensionsGetSamples.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.generated; + +/** + * Samples for Extensions Get. + */ +public final class ExtensionsGetSamples { + /* + * x-ms-original-file: + * specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/extensions/stable/2024- + * 11-01/examples/GetExtensionWithPlan.json + */ + /** + * Sample code: Get Extension with Plan. + * + * @param manager Entry point to ExtensionsManager. + */ + public static void getExtensionWithPlan( + com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.ExtensionsManager manager) { + manager.extensions() + .getWithResponse("rg1", "Microsoft.Kubernetes", "connectedClusters", "clusterName1", "azureVote", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: + * specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/extensions/stable/2024- + * 11-01/examples/GetExtension.json + */ + /** + * Sample code: Get Extension. + * + * @param manager Entry point to ExtensionsManager. + */ + public static void getExtension( + com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.ExtensionsManager manager) { + manager.extensions() + .getWithResponse("rg1", "Microsoft.Kubernetes", "connectedClusters", "clusterName1", "ClusterMonitor", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/samples/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/generated/ExtensionsListSamples.java b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/samples/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/generated/ExtensionsListSamples.java new file mode 100644 index 000000000000..d1cb178151c6 --- /dev/null +++ b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/samples/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/generated/ExtensionsListSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.generated; + +/** + * Samples for Extensions List. + */ +public final class ExtensionsListSamples { + /* + * x-ms-original-file: + * specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/extensions/stable/2024- + * 11-01/examples/ListExtensions.json + */ + /** + * Sample code: List Extensions. + * + * @param manager Entry point to ExtensionsManager. + */ + public static void listExtensions( + com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.ExtensionsManager manager) { + manager.extensions() + .list("rg1", "Microsoft.Kubernetes", "connectedClusters", "clusterName1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/samples/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/generated/ExtensionsUpdateSamples.java b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/samples/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/generated/ExtensionsUpdateSamples.java new file mode 100644 index 000000000000..87101acc02c7 --- /dev/null +++ b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/samples/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/generated/ExtensionsUpdateSamples.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.generated; + +import com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.models.PatchExtension; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Extensions Update. + */ +public final class ExtensionsUpdateSamples { + /* + * x-ms-original-file: + * specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/extensions/stable/2024- + * 11-01/examples/PatchExtension.json + */ + /** + * Sample code: Update Extension. + * + * @param manager Entry point to ExtensionsManager. + */ + public static void updateExtension( + com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.ExtensionsManager manager) { + manager.extensions() + .update("rg1", "Microsoft.Kubernetes", "connectedClusters", "clusterName1", "ClusterMonitor", + new PatchExtension().withAutoUpgradeMinorVersion(true) + .withReleaseTrain("Preview") + .withConfigurationSettings(mapOf("omsagent.env.clusterName", "clusterName1", "omsagent.secret.wsid", + "fakeTokenPlaceholder")) + .withConfigurationProtectedSettings(mapOf("omsagent.secret.key", "fakeTokenPlaceholder")), + com.azure.core.util.Context.NONE); + } + + // Use "Map.of" if available + @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/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/samples/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/generated/OperationStatusGetSamples.java b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/samples/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/generated/OperationStatusGetSamples.java new file mode 100644 index 000000000000..912049a2e132 --- /dev/null +++ b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/src/samples/java/com/azure/resourcemanager/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/generated/OperationStatusGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.generated; + +/** + * Samples for OperationStatus Get. + */ +public final class OperationStatusGetSamples { + /* + * x-ms-original-file: + * specification/kubernetesconfiguration/resource-manager/Microsoft.KubernetesConfiguration/extensions/stable/2024- + * 11-01/examples/GetExtensionAsyncOperationStatus.json + */ + /** + * Sample code: ExtensionAsyncOperationStatus Get. + * + * @param manager Entry point to ExtensionsManager. + */ + public static void extensionAsyncOperationStatusGet( + com.azure.resourcemanager.kubernetesconfigurationmicrosoftkubernetesconfigurationextensions.ExtensionsManager manager) { + manager.operationStatus() + .getWithResponse("rg1", "Microsoft.Kubernetes", "connectedClusters", "clusterName1", "ClusterMonitor", + "99999999-9999-9999-9999-999999999999", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/ci.yml b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/ci.yml new file mode 100644 index 000000000000..1c333b5e1610 --- /dev/null +++ b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/ci.yml @@ -0,0 +1,46 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + paths: + include: + - sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/ci.yml + - sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/ + exclude: + - sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/pom.xml + - sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/ci.yml + - sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/ + exclude: + - sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/pom.xml + - sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/pom.xml + +parameters: + - name: release_azureresourcemanagerkubernetesconfigurationmicrosoftkubernetesconfigurationextensions + displayName: azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions + type: boolean + default: false + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: kubernetesconfigurationmicrosoftkubernetesconfigurationextensions + Artifacts: + - name: azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerkubernetesconfigurationmicrosoftkubernetesconfigurationextensions + releaseInBatch: ${{ parameters.release_azureresourcemanagerkubernetesconfigurationmicrosoftkubernetesconfigurationextensions }} diff --git a/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/pom.xml b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/pom.xml new file mode 100644 index 000000000000..960a0b816463 --- /dev/null +++ b/sdk/kubernetesconfigurationmicrosoftkubernetesconfigurationextensions/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + com.azure + azure-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions-service + pom + 1.0.0 + + + azure-resourcemanager-kubernetesconfigurationmicrosoftkubernetesconfigurationextensions + +