diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index c264809e6f648..9f36293c7669f 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -191,6 +191,7 @@ com.azure.resourcemanager:azure-resourcemanager-kusto;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-loganalytics;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-eventgrid;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-healthbot;1.0.0-beta.1;1.0.0-beta.1 +com.azure.resourcemanager:azure-resourcemanager-kubernetesconfiguration;1.0.0-beta.1;1.0.0-beta.1 # Unreleased dependencies: Copy the entry from above, prepend "unreleased_" and remove the current diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/CHANGELOG.md b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/CHANGELOG.md new file mode 100644 index 0000000000000..3f6629127a833 --- /dev/null +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2021-01-08) + +- Azure Resource Manager SourceControlConfiguration client library for Java. This package contains Microsoft Azure SDK for SourceControlConfiguration Management SDK. Use these APIs to create Source Control Configuration resources through ARM, for Kubernetes Clusters. Package tag package-preview-2020-10. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). \ No newline at end of file diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/README.md b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/README.md new file mode 100644 index 0000000000000..7baae67f021b9 --- /dev/null +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/README.md @@ -0,0 +1,83 @@ +# Azure Resource Manager SourceControlConfiguration client library for Java + +Azure Resource Manager SourceControlConfiguration client library for Java. + +This package contains Microsoft Azure SDK for SourceControlConfiguration Management SDK. Use these APIs to create Source Control Configuration resources through ARM, for Kubernetes Clusters. Package tag package-preview-2020-10. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-kubernetesconfiguration;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-kubernetesconfiguration + 1.0.0-beta.1 + +``` +[//]: # ({x-version-update-end}) + +### Include the recommended packages + +Azure Management Libraries require a `TokenCredential` implementation for authentication and an `HttpClient` implementation for HTTP client. + +[Azure Identity][azure_identity] package and [Azure Core Netty HTTP][azure_core_http_netty] package provide the default implementation. + +### Authentication + +By default, Azure Active Directory token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, `azure` client can be authenticated by following code: + +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +SourceControlConfigurationManager manager = SourceControlConfigurationManager + .authenticate(credential, profile); +``` + +The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise. + +See [Authentication][authenticate] for more options. + +## Key concepts + +See [API design][design] for general introduction on design and key concepts on Azure Management Libraries. + +## Examples + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/master/CONTRIBUTING.md). + +1. Fork it +1. Create your feature branch (`git checkout -b my-new-feature`) +1. Commit your changes (`git commit -am 'Add some feature'`) +1. Push to the branch (`git push origin my-new-feature`) +1. Create new Pull Request + + +[jdk]: https://docs.microsoft.com/java/azure/jdk/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/identity/azure-identity +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/resourcemanager/docs/DESIGN.md diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/pom.xml b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/pom.xml new file mode 100644 index 0000000000000..6168867d335dc --- /dev/null +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/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-kubernetesconfiguration + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for SourceControlConfiguration Management + This package contains Microsoft Azure SDK for SourceControlConfiguration Management SDK. Use these APIs to create Source Control Configuration resources through ARM, for Kubernetes Clusters. Package tag package-preview-2020-10. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + + + + + com.azure + azure-core-management + 1.0.0 + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + true + + + + + diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/SourceControlConfigurationManager.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/SourceControlConfigurationManager.java new file mode 100644 index 0000000000000..3119ce757a6b3 --- /dev/null +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/SourceControlConfigurationManager.java @@ -0,0 +1,218 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfiguration; + +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.kubernetesconfiguration.fluent.SourceControlConfigurationClient; +import com.azure.resourcemanager.kubernetesconfiguration.implementation.OperationsImpl; +import com.azure.resourcemanager.kubernetesconfiguration.implementation.SourceControlConfigurationClientBuilder; +import com.azure.resourcemanager.kubernetesconfiguration.implementation.SourceControlConfigurationsImpl; +import com.azure.resourcemanager.kubernetesconfiguration.models.Operations; +import com.azure.resourcemanager.kubernetesconfiguration.models.SourceControlConfigurations; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** + * Entry point to SourceControlConfigurationManager. Use these APIs to create Source Control Configuration resources + * through ARM, for Kubernetes Clusters. + */ +public final class SourceControlConfigurationManager { + private SourceControlConfigurations sourceControlConfigurations; + + private Operations operations; + + private final SourceControlConfigurationClient clientObject; + + private SourceControlConfigurationManager( + HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new SourceControlConfigurationClientBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of SourceControlConfiguration service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the SourceControlConfiguration service API instance. + */ + public static SourceControlConfigurationManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return configure().authenticate(credential, profile); + } + + /** + * Gets a Configurable instance that can be used to create SourceControlConfigurationManager with optional + * configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new SourceControlConfigurationManager.Configurable(); + } + + /** The Configurable allowing configurations to be set. */ + public static final class Configurable { + private final ClientLogger logger = new ClientLogger(Configurable.class); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private RetryPolicy retryPolicy; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = Objects.requireNonNull(defaultPollInterval, "'retryPolicy' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw logger.logExceptionAsError(new IllegalArgumentException("'httpPipeline' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of SourceControlConfiguration service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the SourceControlConfiguration service API instance. + */ + public SourceControlConfigurationManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + if (retryPolicy == null) { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + List policies = new ArrayList<>(); + policies + .add( + new UserAgentPolicy( + null, + "com.azure.resourcemanager.kubernetesconfiguration", + "1.0.0-beta.1", + Configuration.getGlobalConfiguration())); + policies.add(new RequestIdPolicy()); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies + .add( + new BearerTokenAuthenticationPolicy( + credential, profile.getEnvironment().getManagementEndpoint() + "/.default")); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new SourceControlConfigurationManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** @return Resource collection API of SourceControlConfigurations. */ + public SourceControlConfigurations sourceControlConfigurations() { + if (this.sourceControlConfigurations == null) { + this.sourceControlConfigurations = + new SourceControlConfigurationsImpl(clientObject.getSourceControlConfigurations(), this); + } + return sourceControlConfigurations; + } + + /** @return Resource collection API of Operations. */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** + * @return Wrapped service client SourceControlConfigurationClient providing direct access to the underlying + * auto-generated API implementation, based on Azure REST API. + */ + public SourceControlConfigurationClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/fluent/OperationsClient.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/fluent/OperationsClient.java new file mode 100644 index 0000000000000..05a3722376503 --- /dev/null +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/fluent/OperationsClient.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfiguration.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.kubernetesconfiguration.fluent.models.ResourceProviderOperationInner; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public interface OperationsClient { + /** + * List all the available operations the KubernetesConfiguration resource provider supports. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List all the available operations the KubernetesConfiguration resource provider supports. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/fluent/SourceControlConfigurationClient.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/fluent/SourceControlConfigurationClient.java new file mode 100644 index 0000000000000..659028b4939a1 --- /dev/null +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/fluent/SourceControlConfigurationClient.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfiguration.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for SourceControlConfigurationClient class. */ +public interface SourceControlConfigurationClient { + /** + * Gets The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + * + * @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 SourceControlConfigurationsClient object to access its operations. + * + * @return the SourceControlConfigurationsClient object. + */ + SourceControlConfigurationsClient getSourceControlConfigurations(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); +} diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/fluent/SourceControlConfigurationsClient.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/fluent/SourceControlConfigurationsClient.java new file mode 100644 index 0000000000000..66cfdab965d31 --- /dev/null +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/fluent/SourceControlConfigurationsClient.java @@ -0,0 +1,261 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfiguration.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.kubernetesconfiguration.fluent.models.SourceControlConfigurationInner; +import com.azure.resourcemanager.kubernetesconfiguration.models.SourceControlConfigurationsClusterResourceName; +import com.azure.resourcemanager.kubernetesconfiguration.models.SourceControlConfigurationsClusterRp; + +/** An instance of this class provides access to all the operations defined in SourceControlConfigurationsClient. */ +public interface SourceControlConfigurationsClient { + /** + * Gets details of the Source Control Configuration. + * + * @param resourceGroupName The name of the resource group. + * @param clusterRp The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or + * Microsoft.Kubernetes (for OnPrem K8S clusters). + * @param clusterResourceName The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or + * connectedClusters (for OnPrem K8S clusters). + * @param clusterName The name of the kubernetes cluster. + * @param sourceControlConfigurationName Name of the Source Control Configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return details of the Source Control Configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SourceControlConfigurationInner get( + String resourceGroupName, + SourceControlConfigurationsClusterRp clusterRp, + SourceControlConfigurationsClusterResourceName clusterResourceName, + String clusterName, + String sourceControlConfigurationName); + + /** + * Gets details of the Source Control Configuration. + * + * @param resourceGroupName The name of the resource group. + * @param clusterRp The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or + * Microsoft.Kubernetes (for OnPrem K8S clusters). + * @param clusterResourceName The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or + * connectedClusters (for OnPrem K8S clusters). + * @param clusterName The name of the kubernetes cluster. + * @param sourceControlConfigurationName Name of the Source Control Configuration. + * @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 details of the Source Control Configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + SourceControlConfigurationsClusterRp clusterRp, + SourceControlConfigurationsClusterResourceName clusterResourceName, + String clusterName, + String sourceControlConfigurationName, + Context context); + + /** + * Create a new Kubernetes Source Control Configuration. + * + * @param resourceGroupName The name of the resource group. + * @param clusterRp The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or + * Microsoft.Kubernetes (for OnPrem K8S clusters). + * @param clusterResourceName The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or + * connectedClusters (for OnPrem K8S clusters). + * @param clusterName The name of the kubernetes cluster. + * @param sourceControlConfigurationName Name of the Source Control Configuration. + * @param sourceControlConfiguration Properties necessary to Create KubernetesConfiguration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 SourceControl Configuration object returned in Get & Put response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SourceControlConfigurationInner createOrUpdate( + String resourceGroupName, + SourceControlConfigurationsClusterRp clusterRp, + SourceControlConfigurationsClusterResourceName clusterResourceName, + String clusterName, + String sourceControlConfigurationName, + SourceControlConfigurationInner sourceControlConfiguration); + + /** + * Create a new Kubernetes Source Control Configuration. + * + * @param resourceGroupName The name of the resource group. + * @param clusterRp The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or + * Microsoft.Kubernetes (for OnPrem K8S clusters). + * @param clusterResourceName The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or + * connectedClusters (for OnPrem K8S clusters). + * @param clusterName The name of the kubernetes cluster. + * @param sourceControlConfigurationName Name of the Source Control Configuration. + * @param sourceControlConfiguration Properties necessary to Create KubernetesConfiguration. + * @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 SourceControl Configuration object returned in Get & Put response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + SourceControlConfigurationsClusterRp clusterRp, + SourceControlConfigurationsClusterResourceName clusterResourceName, + String clusterName, + String sourceControlConfigurationName, + SourceControlConfigurationInner sourceControlConfiguration, + Context context); + + /** + * This will delete the YAML file used to set up the Source control configuration, thus stopping future sync from + * the source repo. + * + * @param resourceGroupName The name of the resource group. + * @param clusterRp The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or + * Microsoft.Kubernetes (for OnPrem K8S clusters). + * @param clusterResourceName The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or + * connectedClusters (for OnPrem K8S clusters). + * @param clusterName The name of the kubernetes cluster. + * @param sourceControlConfigurationName Name of the Source Control Configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, + SourceControlConfigurationsClusterRp clusterRp, + SourceControlConfigurationsClusterResourceName clusterResourceName, + String clusterName, + String sourceControlConfigurationName); + + /** + * This will delete the YAML file used to set up the Source control configuration, thus stopping future sync from + * the source repo. + * + * @param resourceGroupName The name of the resource group. + * @param clusterRp The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or + * Microsoft.Kubernetes (for OnPrem K8S clusters). + * @param clusterResourceName The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or + * connectedClusters (for OnPrem K8S clusters). + * @param clusterName The name of the kubernetes cluster. + * @param sourceControlConfigurationName Name of the Source Control Configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, + SourceControlConfigurationsClusterRp clusterRp, + SourceControlConfigurationsClusterResourceName clusterResourceName, + String clusterName, + String sourceControlConfigurationName, + Context context); + + /** + * This will delete the YAML file used to set up the Source control configuration, thus stopping future sync from + * the source repo. + * + * @param resourceGroupName The name of the resource group. + * @param clusterRp The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or + * Microsoft.Kubernetes (for OnPrem K8S clusters). + * @param clusterResourceName The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or + * connectedClusters (for OnPrem K8S clusters). + * @param clusterName The name of the kubernetes cluster. + * @param sourceControlConfigurationName Name of the Source Control Configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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, + SourceControlConfigurationsClusterRp clusterRp, + SourceControlConfigurationsClusterResourceName clusterResourceName, + String clusterName, + String sourceControlConfigurationName); + + /** + * This will delete the YAML file used to set up the Source control configuration, thus stopping future sync from + * the source repo. + * + * @param resourceGroupName The name of the resource group. + * @param clusterRp The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or + * Microsoft.Kubernetes (for OnPrem K8S clusters). + * @param clusterResourceName The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or + * connectedClusters (for OnPrem K8S clusters). + * @param clusterName The name of the kubernetes cluster. + * @param sourceControlConfigurationName Name of the Source Control Configuration. + * @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, + SourceControlConfigurationsClusterRp clusterRp, + SourceControlConfigurationsClusterResourceName clusterResourceName, + String clusterName, + String sourceControlConfigurationName, + Context context); + + /** + * List all Source Control Configurations. + * + * @param resourceGroupName The name of the resource group. + * @param clusterRp The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or + * Microsoft.Kubernetes (for OnPrem K8S clusters). + * @param clusterResourceName The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or + * connectedClusters (for OnPrem K8S clusters). + * @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 Source Control Configurations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, + SourceControlConfigurationsClusterRp clusterRp, + SourceControlConfigurationsClusterResourceName clusterResourceName, + String clusterName); + + /** + * List all Source Control Configurations. + * + * @param resourceGroupName The name of the resource group. + * @param clusterRp The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or + * Microsoft.Kubernetes (for OnPrem K8S clusters). + * @param clusterResourceName The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or + * connectedClusters (for OnPrem K8S clusters). + * @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 Source Control Configurations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, + SourceControlConfigurationsClusterRp clusterRp, + SourceControlConfigurationsClusterResourceName clusterResourceName, + String clusterName, + Context context); +} diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/fluent/models/ResourceProviderOperationInner.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/fluent/models/ResourceProviderOperationInner.java new file mode 100644 index 0000000000000..bf530e97fea4e --- /dev/null +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/fluent/models/ResourceProviderOperationInner.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfiguration.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.kubernetesconfiguration.models.ResourceProviderOperationDisplay; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Supported operation of this resource provider. */ +@Fluent +public final class ResourceProviderOperationInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceProviderOperationInner.class); + + /* + * Operation name, in format of {provider}/{resource}/{operation} + */ + @JsonProperty(value = "name") + private String name; + + /* + * Display metadata associated with the operation. + */ + @JsonProperty(value = "display") + private ResourceProviderOperationDisplay display; + + /* + * The flag that indicates whether the operation applies to data plane. + */ + @JsonProperty(value = "isDataAction", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isDataAction; + + /** + * Get the name property: Operation name, in format of {provider}/{resource}/{operation}. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Operation name, in format of {provider}/{resource}/{operation}. + * + * @param name the name value to set. + * @return the ResourceProviderOperationInner object itself. + */ + public ResourceProviderOperationInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the display property: Display metadata associated with the operation. + * + * @return the display value. + */ + public ResourceProviderOperationDisplay display() { + return this.display; + } + + /** + * Set the display property: Display metadata associated with the operation. + * + * @param display the display value to set. + * @return the ResourceProviderOperationInner object itself. + */ + public ResourceProviderOperationInner withDisplay(ResourceProviderOperationDisplay display) { + this.display = display; + return this; + } + + /** + * Get the isDataAction property: The flag that indicates whether the operation applies to data plane. + * + * @return the isDataAction value. + */ + public Boolean isDataAction() { + return this.isDataAction; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } +} diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/fluent/models/SourceControlConfigurationInner.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/fluent/models/SourceControlConfigurationInner.java new file mode 100644 index 0000000000000..74260e2bdd49e --- /dev/null +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/fluent/models/SourceControlConfigurationInner.java @@ -0,0 +1,389 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfiguration.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.kubernetesconfiguration.models.ComplianceStatus; +import com.azure.resourcemanager.kubernetesconfiguration.models.HelmOperatorProperties; +import com.azure.resourcemanager.kubernetesconfiguration.models.OperatorScopeType; +import com.azure.resourcemanager.kubernetesconfiguration.models.OperatorType; +import com.azure.resourcemanager.kubernetesconfiguration.models.ProvisioningStateType; +import com.azure.resourcemanager.kubernetesconfiguration.models.SystemData; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The SourceControl Configuration object returned in Get & Put response. */ +@JsonFlatten +@Fluent +public class SourceControlConfigurationInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SourceControlConfigurationInner.class); + + /* + * Url of the SourceControl Repository. + */ + @JsonProperty(value = "properties.repositoryUrl") + private String repositoryUrl; + + /* + * The namespace to which this operator is installed to. Maximum of 253 + * lower case alphanumeric characters, hyphen and period only. + */ + @JsonProperty(value = "properties.operatorNamespace") + private String operatorNamespace; + + /* + * Instance name of the operator - identifying the specific configuration. + */ + @JsonProperty(value = "properties.operatorInstanceName") + private String operatorInstanceName; + + /* + * Type of the operator + */ + @JsonProperty(value = "properties.operatorType") + private OperatorType operatorType; + + /* + * Any Parameters for the Operator instance in string format. + */ + @JsonProperty(value = "properties.operatorParams") + private String operatorParams; + + /* + * Name-value pairs of protected configuration settings for the + * configuration + */ + @JsonProperty(value = "properties.configurationProtectedSettings") + private Map configurationProtectedSettings; + + /* + * Scope at which the operator will be installed. + */ + @JsonProperty(value = "properties.operatorScope") + private OperatorScopeType operatorScope; + + /* + * Public Key associated with this SourceControl configuration (either + * generated within the cluster or provided by the user). + */ + @JsonProperty(value = "properties.repositoryPublicKey", access = JsonProperty.Access.WRITE_ONLY) + private String repositoryPublicKey; + + /* + * Base64-encoded known_hosts contents containing public SSH keys required + * to access private Git instances + */ + @JsonProperty(value = "properties.sshKnownHostsContents") + private String sshKnownHostsContents; + + /* + * Option to enable Helm Operator for this git configuration. + */ + @JsonProperty(value = "properties.enableHelmOperator") + private Boolean enableHelmOperator; + + /* + * Properties for Helm operator. + */ + @JsonProperty(value = "properties.helmOperatorProperties") + private HelmOperatorProperties helmOperatorProperties; + + /* + * The provisioning state of the resource provider. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningStateType provisioningState; + + /* + * Compliance Status of the Configuration + */ + @JsonProperty(value = "properties.complianceStatus", access = JsonProperty.Access.WRITE_ONLY) + private ComplianceStatus complianceStatus; + + /* + * 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 + */ + @JsonProperty(value = "systemData") + private SystemData systemData; + + /** + * Get the repositoryUrl property: Url of the SourceControl Repository. + * + * @return the repositoryUrl value. + */ + public String repositoryUrl() { + return this.repositoryUrl; + } + + /** + * Set the repositoryUrl property: Url of the SourceControl Repository. + * + * @param repositoryUrl the repositoryUrl value to set. + * @return the SourceControlConfigurationInner object itself. + */ + public SourceControlConfigurationInner withRepositoryUrl(String repositoryUrl) { + this.repositoryUrl = repositoryUrl; + return this; + } + + /** + * Get the operatorNamespace property: The namespace to which this operator is installed to. Maximum of 253 lower + * case alphanumeric characters, hyphen and period only. + * + * @return the operatorNamespace value. + */ + public String operatorNamespace() { + return this.operatorNamespace; + } + + /** + * Set the operatorNamespace property: The namespace to which this operator is installed to. Maximum of 253 lower + * case alphanumeric characters, hyphen and period only. + * + * @param operatorNamespace the operatorNamespace value to set. + * @return the SourceControlConfigurationInner object itself. + */ + public SourceControlConfigurationInner withOperatorNamespace(String operatorNamespace) { + this.operatorNamespace = operatorNamespace; + return this; + } + + /** + * Get the operatorInstanceName property: Instance name of the operator - identifying the specific configuration. + * + * @return the operatorInstanceName value. + */ + public String operatorInstanceName() { + return this.operatorInstanceName; + } + + /** + * Set the operatorInstanceName property: Instance name of the operator - identifying the specific configuration. + * + * @param operatorInstanceName the operatorInstanceName value to set. + * @return the SourceControlConfigurationInner object itself. + */ + public SourceControlConfigurationInner withOperatorInstanceName(String operatorInstanceName) { + this.operatorInstanceName = operatorInstanceName; + return this; + } + + /** + * Get the operatorType property: Type of the operator. + * + * @return the operatorType value. + */ + public OperatorType operatorType() { + return this.operatorType; + } + + /** + * Set the operatorType property: Type of the operator. + * + * @param operatorType the operatorType value to set. + * @return the SourceControlConfigurationInner object itself. + */ + public SourceControlConfigurationInner withOperatorType(OperatorType operatorType) { + this.operatorType = operatorType; + return this; + } + + /** + * Get the operatorParams property: Any Parameters for the Operator instance in string format. + * + * @return the operatorParams value. + */ + public String operatorParams() { + return this.operatorParams; + } + + /** + * Set the operatorParams property: Any Parameters for the Operator instance in string format. + * + * @param operatorParams the operatorParams value to set. + * @return the SourceControlConfigurationInner object itself. + */ + public SourceControlConfigurationInner withOperatorParams(String operatorParams) { + this.operatorParams = operatorParams; + return this; + } + + /** + * Get the configurationProtectedSettings property: Name-value pairs of protected configuration settings for the + * configuration. + * + * @return the configurationProtectedSettings value. + */ + public Map configurationProtectedSettings() { + return this.configurationProtectedSettings; + } + + /** + * Set the configurationProtectedSettings property: Name-value pairs of protected configuration settings for the + * configuration. + * + * @param configurationProtectedSettings the configurationProtectedSettings value to set. + * @return the SourceControlConfigurationInner object itself. + */ + public SourceControlConfigurationInner withConfigurationProtectedSettings( + Map configurationProtectedSettings) { + this.configurationProtectedSettings = configurationProtectedSettings; + return this; + } + + /** + * Get the operatorScope property: Scope at which the operator will be installed. + * + * @return the operatorScope value. + */ + public OperatorScopeType operatorScope() { + return this.operatorScope; + } + + /** + * Set the operatorScope property: Scope at which the operator will be installed. + * + * @param operatorScope the operatorScope value to set. + * @return the SourceControlConfigurationInner object itself. + */ + public SourceControlConfigurationInner withOperatorScope(OperatorScopeType operatorScope) { + this.operatorScope = operatorScope; + return this; + } + + /** + * Get the repositoryPublicKey property: Public Key associated with this SourceControl configuration (either + * generated within the cluster or provided by the user). + * + * @return the repositoryPublicKey value. + */ + public String repositoryPublicKey() { + return this.repositoryPublicKey; + } + + /** + * Get the sshKnownHostsContents property: Base64-encoded known_hosts contents containing public SSH keys required + * to access private Git instances. + * + * @return the sshKnownHostsContents value. + */ + public String sshKnownHostsContents() { + return this.sshKnownHostsContents; + } + + /** + * Set the sshKnownHostsContents property: Base64-encoded known_hosts contents containing public SSH keys required + * to access private Git instances. + * + * @param sshKnownHostsContents the sshKnownHostsContents value to set. + * @return the SourceControlConfigurationInner object itself. + */ + public SourceControlConfigurationInner withSshKnownHostsContents(String sshKnownHostsContents) { + this.sshKnownHostsContents = sshKnownHostsContents; + return this; + } + + /** + * Get the enableHelmOperator property: Option to enable Helm Operator for this git configuration. + * + * @return the enableHelmOperator value. + */ + public Boolean enableHelmOperator() { + return this.enableHelmOperator; + } + + /** + * Set the enableHelmOperator property: Option to enable Helm Operator for this git configuration. + * + * @param enableHelmOperator the enableHelmOperator value to set. + * @return the SourceControlConfigurationInner object itself. + */ + public SourceControlConfigurationInner withEnableHelmOperator(Boolean enableHelmOperator) { + this.enableHelmOperator = enableHelmOperator; + return this; + } + + /** + * Get the helmOperatorProperties property: Properties for Helm operator. + * + * @return the helmOperatorProperties value. + */ + public HelmOperatorProperties helmOperatorProperties() { + return this.helmOperatorProperties; + } + + /** + * Set the helmOperatorProperties property: Properties for Helm operator. + * + * @param helmOperatorProperties the helmOperatorProperties value to set. + * @return the SourceControlConfigurationInner object itself. + */ + public SourceControlConfigurationInner withHelmOperatorProperties(HelmOperatorProperties helmOperatorProperties) { + this.helmOperatorProperties = helmOperatorProperties; + return this; + } + + /** + * Get the provisioningState property: The provisioning state of the resource provider. + * + * @return the provisioningState value. + */ + public ProvisioningStateType provisioningState() { + return this.provisioningState; + } + + /** + * Get the complianceStatus property: Compliance Status of the Configuration. + * + * @return the complianceStatus value. + */ + public ComplianceStatus complianceStatus() { + return this.complianceStatus; + } + + /** + * 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; + } + + /** + * Set 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. + * + * @param systemData the systemData value to set. + * @return the SourceControlConfigurationInner object itself. + */ + public SourceControlConfigurationInner withSystemData(SystemData systemData) { + this.systemData = systemData; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (helmOperatorProperties() != null) { + helmOperatorProperties().validate(); + } + if (complianceStatus() != null) { + complianceStatus().validate(); + } + if (systemData() != null) { + systemData().validate(); + } + } +} diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/fluent/models/package-info.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/fluent/models/package-info.java new file mode 100644 index 0000000000000..890b6299f666a --- /dev/null +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/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 SourceControlConfigurationClient. Use these APIs to create Source + * Control Configuration resources through ARM, for Kubernetes Clusters. + */ +package com.azure.resourcemanager.kubernetesconfiguration.fluent.models; diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/fluent/package-info.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/fluent/package-info.java new file mode 100644 index 0000000000000..14a2cdc93df4a --- /dev/null +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/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 SourceControlConfigurationClient. Use these APIs to create Source Control + * Configuration resources through ARM, for Kubernetes Clusters. + */ +package com.azure.resourcemanager.kubernetesconfiguration.fluent; diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/implementation/OperationsClientImpl.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/implementation/OperationsClientImpl.java new file mode 100644 index 0000000000000..6895da432bdf4 --- /dev/null +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/implementation/OperationsClientImpl.java @@ -0,0 +1,270 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfiguration.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.kubernetesconfiguration.fluent.OperationsClient; +import com.azure.resourcemanager.kubernetesconfiguration.fluent.models.ResourceProviderOperationInner; +import com.azure.resourcemanager.kubernetesconfiguration.models.ResourceProviderOperationList; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public final class OperationsClientImpl implements OperationsClient { + private final ClientLogger logger = new ClientLogger(OperationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final OperationsService service; + + /** The service client containing this operation class. */ + private final SourceControlConfigurationClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(SourceControlConfigurationClientImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SourceControlConfigurationClientOperations to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SourceControlConfigu") + private interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.KubernetesConfiguration/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List all the available operations the KubernetesConfiguration resource provider supports. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List all the available operations the KubernetesConfiguration resource provider supports. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List all the available operations the KubernetesConfiguration resource provider supports. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List all the available operations the KubernetesConfiguration resource provider supports. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List all the available operations the KubernetesConfiguration resource provider supports. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List all the available operations the KubernetesConfiguration resource provider supports. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/implementation/OperationsImpl.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..2ebb8bc45c31f --- /dev/null +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/implementation/OperationsImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfiguration.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.kubernetesconfiguration.SourceControlConfigurationManager; +import com.azure.resourcemanager.kubernetesconfiguration.fluent.OperationsClient; +import com.azure.resourcemanager.kubernetesconfiguration.fluent.models.ResourceProviderOperationInner; +import com.azure.resourcemanager.kubernetesconfiguration.models.Operations; +import com.azure.resourcemanager.kubernetesconfiguration.models.ResourceProviderOperation; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class OperationsImpl implements Operations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationsImpl.class); + + private final OperationsClient innerClient; + + private final SourceControlConfigurationManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, SourceControlConfigurationManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return inner.mapPage(inner1 -> new ResourceProviderOperationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return inner.mapPage(inner1 -> new ResourceProviderOperationImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private SourceControlConfigurationManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/implementation/ResourceProviderOperationImpl.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/implementation/ResourceProviderOperationImpl.java new file mode 100644 index 0000000000000..a45c3fde49039 --- /dev/null +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/implementation/ResourceProviderOperationImpl.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfiguration.implementation; + +import com.azure.resourcemanager.kubernetesconfiguration.SourceControlConfigurationManager; +import com.azure.resourcemanager.kubernetesconfiguration.fluent.models.ResourceProviderOperationInner; +import com.azure.resourcemanager.kubernetesconfiguration.models.ResourceProviderOperation; +import com.azure.resourcemanager.kubernetesconfiguration.models.ResourceProviderOperationDisplay; + +public final class ResourceProviderOperationImpl implements ResourceProviderOperation { + private ResourceProviderOperationInner innerObject; + + private final SourceControlConfigurationManager serviceManager; + + ResourceProviderOperationImpl( + ResourceProviderOperationInner innerObject, SourceControlConfigurationManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public ResourceProviderOperationDisplay display() { + return this.innerModel().display(); + } + + public Boolean isDataAction() { + return this.innerModel().isDataAction(); + } + + public ResourceProviderOperationInner innerModel() { + return this.innerObject; + } + + private SourceControlConfigurationManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/implementation/SourceControlConfigurationClientBuilder.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/implementation/SourceControlConfigurationClientBuilder.java new file mode 100644 index 0000000000000..d98393f02fef3 --- /dev/null +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/implementation/SourceControlConfigurationClientBuilder.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfiguration.implementation; + +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.CookiePolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerAdapter; +import java.time.Duration; + +/** A builder for creating a new instance of the SourceControlConfigurationClientImpl type. */ +@ServiceClientBuilder(serviceClients = {SourceControlConfigurationClientImpl.class}) +public final class SourceControlConfigurationClientBuilder { + /* + * The Azure subscription ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000) + */ + private String subscriptionId; + + /** + * Sets The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + * + * @param subscriptionId the subscriptionId value. + * @return the SourceControlConfigurationClientBuilder. + */ + public SourceControlConfigurationClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the SourceControlConfigurationClientBuilder. + */ + public SourceControlConfigurationClientBuilder 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 SourceControlConfigurationClientBuilder. + */ + public SourceControlConfigurationClientBuilder environment(AzureEnvironment environment) { + this.environment = environment; + return this; + } + + /* + * The default poll interval for long-running operation + */ + private Duration defaultPollInterval; + + /** + * Sets The default poll interval for long-running operation. + * + * @param defaultPollInterval the defaultPollInterval value. + * @return the SourceControlConfigurationClientBuilder. + */ + public SourceControlConfigurationClientBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + return this; + } + + /* + * The HTTP pipeline to send requests through + */ + private HttpPipeline pipeline; + + /** + * Sets The HTTP pipeline to send requests through. + * + * @param pipeline the pipeline value. + * @return the SourceControlConfigurationClientBuilder. + */ + public SourceControlConfigurationClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The serializer to serialize an object into a string + */ + private SerializerAdapter serializerAdapter; + + /** + * Sets The serializer to serialize an object into a string. + * + * @param serializerAdapter the serializerAdapter value. + * @return the SourceControlConfigurationClientBuilder. + */ + public SourceControlConfigurationClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of SourceControlConfigurationClientImpl with the provided parameters. + * + * @return an instance of SourceControlConfigurationClientImpl. + */ + public SourceControlConfigurationClientImpl buildClient() { + if (endpoint == null) { + this.endpoint = "https://management.azure.com"; + } + if (environment == null) { + this.environment = AzureEnvironment.AZURE; + } + if (defaultPollInterval == null) { + this.defaultPollInterval = Duration.ofSeconds(30); + } + if (pipeline == null) { + this.pipeline = + new HttpPipelineBuilder() + .policies(new UserAgentPolicy(), new RetryPolicy(), new CookiePolicy()) + .build(); + } + if (serializerAdapter == null) { + this.serializerAdapter = SerializerFactory.createDefaultManagementSerializerAdapter(); + } + SourceControlConfigurationClientImpl client = + new SourceControlConfigurationClientImpl( + pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + return client; + } +} diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/implementation/SourceControlConfigurationClientImpl.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/implementation/SourceControlConfigurationClientImpl.java new file mode 100644 index 0000000000000..e435a5f0ee9ab --- /dev/null +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/implementation/SourceControlConfigurationClientImpl.java @@ -0,0 +1,308 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfiguration.implementation; + +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.kubernetesconfiguration.fluent.OperationsClient; +import com.azure.resourcemanager.kubernetesconfiguration.fluent.SourceControlConfigurationClient; +import com.azure.resourcemanager.kubernetesconfiguration.fluent.SourceControlConfigurationsClient; +import java.io.IOException; +import java.lang.reflect.Type; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import java.util.Map; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** Initializes a new instance of the SourceControlConfigurationClientImpl type. */ +@ServiceClient(builder = SourceControlConfigurationClientBuilder.class) +public final class SourceControlConfigurationClientImpl implements SourceControlConfigurationClient { + private final ClientLogger logger = new ClientLogger(SourceControlConfigurationClientImpl.class); + + /** The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). */ + private final String subscriptionId; + + /** + * Gets The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + * + * @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 SourceControlConfigurationsClient object to access its operations. */ + private final SourceControlConfigurationsClient sourceControlConfigurations; + + /** + * Gets the SourceControlConfigurationsClient object to access its operations. + * + * @return the SourceControlConfigurationsClient object. + */ + public SourceControlConfigurationsClient getSourceControlConfigurations() { + return this.sourceControlConfigurations; + } + + /** The OperationsClient object to access its operations. */ + private final OperationsClient operations; + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + public OperationsClient getOperations() { + return this.operations; + } + + /** + * Initializes an instance of SourceControlConfigurationClient 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 Azure subscription ID. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * @param endpoint server parameter. + */ + SourceControlConfigurationClientImpl( + HttpPipeline httpPipeline, + SerializerAdapter serializerAdapter, + Duration defaultPollInterval, + AzureEnvironment environment, + String subscriptionId, + String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + this.apiVersion = "2020-10-01-preview"; + this.sourceControlConfigurations = new SourceControlConfigurationsClientImpl(this); + this.operations = new OperationsClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + for (Map.Entry entry : this.getContext().getValues().entrySet()) { + context = context.addData(entry.getKey(), entry.getValue()); + } + return context; + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult( + Mono>> activationResponse, + HttpPipeline httpPipeline, + Type pollResultType, + Type finalResultType, + Context context) { + return PollerFactory + .create( + serializerAdapter, + httpPipeline, + pollResultType, + finalResultType, + defaultPollInterval, + activationResponse, + context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = + new HttpResponseImpl( + lroError.getResponseStatusCode(), lroError.getResponseHeaders(), lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = + this + .getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException ioe) { + logger.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(s); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } +} diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/implementation/SourceControlConfigurationImpl.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/implementation/SourceControlConfigurationImpl.java new file mode 100644 index 0000000000000..66fa6a9abf449 --- /dev/null +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/implementation/SourceControlConfigurationImpl.java @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfiguration.implementation; + +import com.azure.resourcemanager.kubernetesconfiguration.SourceControlConfigurationManager; +import com.azure.resourcemanager.kubernetesconfiguration.fluent.models.SourceControlConfigurationInner; +import com.azure.resourcemanager.kubernetesconfiguration.models.ComplianceStatus; +import com.azure.resourcemanager.kubernetesconfiguration.models.HelmOperatorProperties; +import com.azure.resourcemanager.kubernetesconfiguration.models.OperatorScopeType; +import com.azure.resourcemanager.kubernetesconfiguration.models.OperatorType; +import com.azure.resourcemanager.kubernetesconfiguration.models.ProvisioningStateType; +import com.azure.resourcemanager.kubernetesconfiguration.models.SourceControlConfiguration; +import com.azure.resourcemanager.kubernetesconfiguration.models.SystemData; +import java.util.Collections; +import java.util.Map; + +public final class SourceControlConfigurationImpl implements SourceControlConfiguration { + private SourceControlConfigurationInner innerObject; + + private final SourceControlConfigurationManager serviceManager; + + SourceControlConfigurationImpl( + SourceControlConfigurationInner innerObject, SourceControlConfigurationManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String repositoryUrl() { + return this.innerModel().repositoryUrl(); + } + + public String operatorNamespace() { + return this.innerModel().operatorNamespace(); + } + + public String operatorInstanceName() { + return this.innerModel().operatorInstanceName(); + } + + public OperatorType operatorType() { + return this.innerModel().operatorType(); + } + + public String operatorParams() { + return this.innerModel().operatorParams(); + } + + public Map configurationProtectedSettings() { + Map inner = this.innerModel().configurationProtectedSettings(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public OperatorScopeType operatorScope() { + return this.innerModel().operatorScope(); + } + + public String repositoryPublicKey() { + return this.innerModel().repositoryPublicKey(); + } + + public String sshKnownHostsContents() { + return this.innerModel().sshKnownHostsContents(); + } + + public Boolean enableHelmOperator() { + return this.innerModel().enableHelmOperator(); + } + + public HelmOperatorProperties helmOperatorProperties() { + return this.innerModel().helmOperatorProperties(); + } + + public ProvisioningStateType provisioningState() { + return this.innerModel().provisioningState(); + } + + public ComplianceStatus complianceStatus() { + return this.innerModel().complianceStatus(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public SourceControlConfigurationInner innerModel() { + return this.innerObject; + } + + private SourceControlConfigurationManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/implementation/SourceControlConfigurationsClientImpl.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/implementation/SourceControlConfigurationsClientImpl.java new file mode 100644 index 0000000000000..f69a98896ce65 --- /dev/null +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/implementation/SourceControlConfigurationsClientImpl.java @@ -0,0 +1,1380 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfiguration.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.kubernetesconfiguration.fluent.SourceControlConfigurationsClient; +import com.azure.resourcemanager.kubernetesconfiguration.fluent.models.SourceControlConfigurationInner; +import com.azure.resourcemanager.kubernetesconfiguration.models.SourceControlConfigurationList; +import com.azure.resourcemanager.kubernetesconfiguration.models.SourceControlConfigurationsClusterResourceName; +import com.azure.resourcemanager.kubernetesconfiguration.models.SourceControlConfigurationsClusterRp; +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 SourceControlConfigurationsClient. */ +public final class SourceControlConfigurationsClientImpl implements SourceControlConfigurationsClient { + private final ClientLogger logger = new ClientLogger(SourceControlConfigurationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final SourceControlConfigurationsService service; + + /** The service client containing this operation class. */ + private final SourceControlConfigurationClientImpl client; + + /** + * Initializes an instance of SourceControlConfigurationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SourceControlConfigurationsClientImpl(SourceControlConfigurationClientImpl client) { + this.service = + RestProxy + .create( + SourceControlConfigurationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SourceControlConfigurationClientSourceControlConfigurations to be + * used by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SourceControlConfigu") + private interface SourceControlConfigurationsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}" + + "/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration" + + "/sourceControlConfigurations/{sourceControlConfigurationName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("clusterRp") SourceControlConfigurationsClusterRp clusterRp, + @PathParam("clusterResourceName") SourceControlConfigurationsClusterResourceName clusterResourceName, + @PathParam("clusterName") String clusterName, + @PathParam("sourceControlConfigurationName") String sourceControlConfigurationName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}" + + "/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration" + + "/sourceControlConfigurations/{sourceControlConfigurationName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("clusterRp") SourceControlConfigurationsClusterRp clusterRp, + @PathParam("clusterResourceName") SourceControlConfigurationsClusterResourceName clusterResourceName, + @PathParam("clusterName") String clusterName, + @PathParam("sourceControlConfigurationName") String sourceControlConfigurationName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") SourceControlConfigurationInner sourceControlConfiguration, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}" + + "/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration" + + "/sourceControlConfigurations/{sourceControlConfigurationName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("clusterRp") SourceControlConfigurationsClusterRp clusterRp, + @PathParam("clusterResourceName") SourceControlConfigurationsClusterResourceName clusterResourceName, + @PathParam("clusterName") String clusterName, + @PathParam("sourceControlConfigurationName") String sourceControlConfigurationName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}" + + "/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration" + + "/sourceControlConfigurations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("clusterRp") SourceControlConfigurationsClusterRp clusterRp, + @PathParam("clusterResourceName") SourceControlConfigurationsClusterResourceName 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); + } + + /** + * Gets details of the Source Control Configuration. + * + * @param resourceGroupName The name of the resource group. + * @param clusterRp The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or + * Microsoft.Kubernetes (for OnPrem K8S clusters). + * @param clusterResourceName The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or + * connectedClusters (for OnPrem K8S clusters). + * @param clusterName The name of the kubernetes cluster. + * @param sourceControlConfigurationName Name of the Source Control Configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return details of the Source Control Configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + SourceControlConfigurationsClusterRp clusterRp, + SourceControlConfigurationsClusterResourceName clusterResourceName, + String clusterName, + String sourceControlConfigurationName) { + 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 (sourceControlConfigurationName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter sourceControlConfigurationName 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, + sourceControlConfigurationName, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets details of the Source Control Configuration. + * + * @param resourceGroupName The name of the resource group. + * @param clusterRp The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or + * Microsoft.Kubernetes (for OnPrem K8S clusters). + * @param clusterResourceName The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or + * connectedClusters (for OnPrem K8S clusters). + * @param clusterName The name of the kubernetes cluster. + * @param sourceControlConfigurationName Name of the Source Control Configuration. + * @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 details of the Source Control Configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + SourceControlConfigurationsClusterRp clusterRp, + SourceControlConfigurationsClusterResourceName clusterResourceName, + String clusterName, + String sourceControlConfigurationName, + 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 (sourceControlConfigurationName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter sourceControlConfigurationName 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, + sourceControlConfigurationName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets details of the Source Control Configuration. + * + * @param resourceGroupName The name of the resource group. + * @param clusterRp The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or + * Microsoft.Kubernetes (for OnPrem K8S clusters). + * @param clusterResourceName The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or + * connectedClusters (for OnPrem K8S clusters). + * @param clusterName The name of the kubernetes cluster. + * @param sourceControlConfigurationName Name of the Source Control Configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return details of the Source Control Configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + SourceControlConfigurationsClusterRp clusterRp, + SourceControlConfigurationsClusterResourceName clusterResourceName, + String clusterName, + String sourceControlConfigurationName) { + return getWithResponseAsync( + resourceGroupName, clusterRp, clusterResourceName, clusterName, sourceControlConfigurationName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets details of the Source Control Configuration. + * + * @param resourceGroupName The name of the resource group. + * @param clusterRp The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or + * Microsoft.Kubernetes (for OnPrem K8S clusters). + * @param clusterResourceName The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or + * connectedClusters (for OnPrem K8S clusters). + * @param clusterName The name of the kubernetes cluster. + * @param sourceControlConfigurationName Name of the Source Control Configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return details of the Source Control Configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SourceControlConfigurationInner get( + String resourceGroupName, + SourceControlConfigurationsClusterRp clusterRp, + SourceControlConfigurationsClusterResourceName clusterResourceName, + String clusterName, + String sourceControlConfigurationName) { + return getAsync(resourceGroupName, clusterRp, clusterResourceName, clusterName, sourceControlConfigurationName) + .block(); + } + + /** + * Gets details of the Source Control Configuration. + * + * @param resourceGroupName The name of the resource group. + * @param clusterRp The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or + * Microsoft.Kubernetes (for OnPrem K8S clusters). + * @param clusterResourceName The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or + * connectedClusters (for OnPrem K8S clusters). + * @param clusterName The name of the kubernetes cluster. + * @param sourceControlConfigurationName Name of the Source Control Configuration. + * @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 details of the Source Control Configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + SourceControlConfigurationsClusterRp clusterRp, + SourceControlConfigurationsClusterResourceName clusterResourceName, + String clusterName, + String sourceControlConfigurationName, + Context context) { + return getWithResponseAsync( + resourceGroupName, clusterRp, clusterResourceName, clusterName, sourceControlConfigurationName, context) + .block(); + } + + /** + * Create a new Kubernetes Source Control Configuration. + * + * @param resourceGroupName The name of the resource group. + * @param clusterRp The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or + * Microsoft.Kubernetes (for OnPrem K8S clusters). + * @param clusterResourceName The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or + * connectedClusters (for OnPrem K8S clusters). + * @param clusterName The name of the kubernetes cluster. + * @param sourceControlConfigurationName Name of the Source Control Configuration. + * @param sourceControlConfiguration Properties necessary to Create KubernetesConfiguration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 SourceControl Configuration object returned in Get & Put response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + SourceControlConfigurationsClusterRp clusterRp, + SourceControlConfigurationsClusterResourceName clusterResourceName, + String clusterName, + String sourceControlConfigurationName, + SourceControlConfigurationInner sourceControlConfiguration) { + 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 (sourceControlConfigurationName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter sourceControlConfigurationName is required and cannot be null.")); + } + if (sourceControlConfiguration == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter sourceControlConfiguration is required and cannot be null.")); + } else { + sourceControlConfiguration.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + clusterRp, + clusterResourceName, + clusterName, + sourceControlConfigurationName, + this.client.getApiVersion(), + sourceControlConfiguration, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create a new Kubernetes Source Control Configuration. + * + * @param resourceGroupName The name of the resource group. + * @param clusterRp The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or + * Microsoft.Kubernetes (for OnPrem K8S clusters). + * @param clusterResourceName The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or + * connectedClusters (for OnPrem K8S clusters). + * @param clusterName The name of the kubernetes cluster. + * @param sourceControlConfigurationName Name of the Source Control Configuration. + * @param sourceControlConfiguration Properties necessary to Create KubernetesConfiguration. + * @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 SourceControl Configuration object returned in Get & Put response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + SourceControlConfigurationsClusterRp clusterRp, + SourceControlConfigurationsClusterResourceName clusterResourceName, + String clusterName, + String sourceControlConfigurationName, + SourceControlConfigurationInner sourceControlConfiguration, + 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 (sourceControlConfigurationName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter sourceControlConfigurationName is required and cannot be null.")); + } + if (sourceControlConfiguration == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter sourceControlConfiguration is required and cannot be null.")); + } else { + sourceControlConfiguration.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + clusterRp, + clusterResourceName, + clusterName, + sourceControlConfigurationName, + this.client.getApiVersion(), + sourceControlConfiguration, + accept, + context); + } + + /** + * Create a new Kubernetes Source Control Configuration. + * + * @param resourceGroupName The name of the resource group. + * @param clusterRp The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or + * Microsoft.Kubernetes (for OnPrem K8S clusters). + * @param clusterResourceName The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or + * connectedClusters (for OnPrem K8S clusters). + * @param clusterName The name of the kubernetes cluster. + * @param sourceControlConfigurationName Name of the Source Control Configuration. + * @param sourceControlConfiguration Properties necessary to Create KubernetesConfiguration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 SourceControl Configuration object returned in Get & Put response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + SourceControlConfigurationsClusterRp clusterRp, + SourceControlConfigurationsClusterResourceName clusterResourceName, + String clusterName, + String sourceControlConfigurationName, + SourceControlConfigurationInner sourceControlConfiguration) { + return createOrUpdateWithResponseAsync( + resourceGroupName, + clusterRp, + clusterResourceName, + clusterName, + sourceControlConfigurationName, + sourceControlConfiguration) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Create a new Kubernetes Source Control Configuration. + * + * @param resourceGroupName The name of the resource group. + * @param clusterRp The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or + * Microsoft.Kubernetes (for OnPrem K8S clusters). + * @param clusterResourceName The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or + * connectedClusters (for OnPrem K8S clusters). + * @param clusterName The name of the kubernetes cluster. + * @param sourceControlConfigurationName Name of the Source Control Configuration. + * @param sourceControlConfiguration Properties necessary to Create KubernetesConfiguration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 SourceControl Configuration object returned in Get & Put response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SourceControlConfigurationInner createOrUpdate( + String resourceGroupName, + SourceControlConfigurationsClusterRp clusterRp, + SourceControlConfigurationsClusterResourceName clusterResourceName, + String clusterName, + String sourceControlConfigurationName, + SourceControlConfigurationInner sourceControlConfiguration) { + return createOrUpdateAsync( + resourceGroupName, + clusterRp, + clusterResourceName, + clusterName, + sourceControlConfigurationName, + sourceControlConfiguration) + .block(); + } + + /** + * Create a new Kubernetes Source Control Configuration. + * + * @param resourceGroupName The name of the resource group. + * @param clusterRp The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or + * Microsoft.Kubernetes (for OnPrem K8S clusters). + * @param clusterResourceName The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or + * connectedClusters (for OnPrem K8S clusters). + * @param clusterName The name of the kubernetes cluster. + * @param sourceControlConfigurationName Name of the Source Control Configuration. + * @param sourceControlConfiguration Properties necessary to Create KubernetesConfiguration. + * @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 SourceControl Configuration object returned in Get & Put response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + SourceControlConfigurationsClusterRp clusterRp, + SourceControlConfigurationsClusterResourceName clusterResourceName, + String clusterName, + String sourceControlConfigurationName, + SourceControlConfigurationInner sourceControlConfiguration, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, + clusterRp, + clusterResourceName, + clusterName, + sourceControlConfigurationName, + sourceControlConfiguration, + context) + .block(); + } + + /** + * This will delete the YAML file used to set up the Source control configuration, thus stopping future sync from + * the source repo. + * + * @param resourceGroupName The name of the resource group. + * @param clusterRp The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or + * Microsoft.Kubernetes (for OnPrem K8S clusters). + * @param clusterResourceName The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or + * connectedClusters (for OnPrem K8S clusters). + * @param clusterName The name of the kubernetes cluster. + * @param sourceControlConfigurationName Name of the Source Control Configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, + SourceControlConfigurationsClusterRp clusterRp, + SourceControlConfigurationsClusterResourceName clusterResourceName, + String clusterName, + String sourceControlConfigurationName) { + 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 (sourceControlConfigurationName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter sourceControlConfigurationName 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, + sourceControlConfigurationName, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * This will delete the YAML file used to set up the Source control configuration, thus stopping future sync from + * the source repo. + * + * @param resourceGroupName The name of the resource group. + * @param clusterRp The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or + * Microsoft.Kubernetes (for OnPrem K8S clusters). + * @param clusterResourceName The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or + * connectedClusters (for OnPrem K8S clusters). + * @param clusterName The name of the kubernetes cluster. + * @param sourceControlConfigurationName Name of the Source Control Configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, + SourceControlConfigurationsClusterRp clusterRp, + SourceControlConfigurationsClusterResourceName clusterResourceName, + String clusterName, + String sourceControlConfigurationName, + 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 (sourceControlConfigurationName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter sourceControlConfigurationName 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, + sourceControlConfigurationName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * This will delete the YAML file used to set up the Source control configuration, thus stopping future sync from + * the source repo. + * + * @param resourceGroupName The name of the resource group. + * @param clusterRp The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or + * Microsoft.Kubernetes (for OnPrem K8S clusters). + * @param clusterResourceName The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or + * connectedClusters (for OnPrem K8S clusters). + * @param clusterName The name of the kubernetes cluster. + * @param sourceControlConfigurationName Name of the Source Control Configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, + SourceControlConfigurationsClusterRp clusterRp, + SourceControlConfigurationsClusterResourceName clusterResourceName, + String clusterName, + String sourceControlConfigurationName) { + Mono>> mono = + deleteWithResponseAsync( + resourceGroupName, clusterRp, clusterResourceName, clusterName, sourceControlConfigurationName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * This will delete the YAML file used to set up the Source control configuration, thus stopping future sync from + * the source repo. + * + * @param resourceGroupName The name of the resource group. + * @param clusterRp The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or + * Microsoft.Kubernetes (for OnPrem K8S clusters). + * @param clusterResourceName The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or + * connectedClusters (for OnPrem K8S clusters). + * @param clusterName The name of the kubernetes cluster. + * @param sourceControlConfigurationName Name of the Source Control Configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, + SourceControlConfigurationsClusterRp clusterRp, + SourceControlConfigurationsClusterResourceName clusterResourceName, + String clusterName, + String sourceControlConfigurationName, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync( + resourceGroupName, + clusterRp, + clusterResourceName, + clusterName, + sourceControlConfigurationName, + context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * This will delete the YAML file used to set up the Source control configuration, thus stopping future sync from + * the source repo. + * + * @param resourceGroupName The name of the resource group. + * @param clusterRp The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or + * Microsoft.Kubernetes (for OnPrem K8S clusters). + * @param clusterResourceName The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or + * connectedClusters (for OnPrem K8S clusters). + * @param clusterName The name of the kubernetes cluster. + * @param sourceControlConfigurationName Name of the Source Control Configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, + SourceControlConfigurationsClusterRp clusterRp, + SourceControlConfigurationsClusterResourceName clusterResourceName, + String clusterName, + String sourceControlConfigurationName) { + return beginDeleteAsync( + resourceGroupName, clusterRp, clusterResourceName, clusterName, sourceControlConfigurationName) + .getSyncPoller(); + } + + /** + * This will delete the YAML file used to set up the Source control configuration, thus stopping future sync from + * the source repo. + * + * @param resourceGroupName The name of the resource group. + * @param clusterRp The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or + * Microsoft.Kubernetes (for OnPrem K8S clusters). + * @param clusterResourceName The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or + * connectedClusters (for OnPrem K8S clusters). + * @param clusterName The name of the kubernetes cluster. + * @param sourceControlConfigurationName Name of the Source Control Configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, + SourceControlConfigurationsClusterRp clusterRp, + SourceControlConfigurationsClusterResourceName clusterResourceName, + String clusterName, + String sourceControlConfigurationName, + Context context) { + return beginDeleteAsync( + resourceGroupName, clusterRp, clusterResourceName, clusterName, sourceControlConfigurationName, context) + .getSyncPoller(); + } + + /** + * This will delete the YAML file used to set up the Source control configuration, thus stopping future sync from + * the source repo. + * + * @param resourceGroupName The name of the resource group. + * @param clusterRp The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or + * Microsoft.Kubernetes (for OnPrem K8S clusters). + * @param clusterResourceName The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or + * connectedClusters (for OnPrem K8S clusters). + * @param clusterName The name of the kubernetes cluster. + * @param sourceControlConfigurationName Name of the Source Control Configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, + SourceControlConfigurationsClusterRp clusterRp, + SourceControlConfigurationsClusterResourceName clusterResourceName, + String clusterName, + String sourceControlConfigurationName) { + return beginDeleteAsync( + resourceGroupName, clusterRp, clusterResourceName, clusterName, sourceControlConfigurationName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * This will delete the YAML file used to set up the Source control configuration, thus stopping future sync from + * the source repo. + * + * @param resourceGroupName The name of the resource group. + * @param clusterRp The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or + * Microsoft.Kubernetes (for OnPrem K8S clusters). + * @param clusterResourceName The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or + * connectedClusters (for OnPrem K8S clusters). + * @param clusterName The name of the kubernetes cluster. + * @param sourceControlConfigurationName Name of the Source Control Configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, + SourceControlConfigurationsClusterRp clusterRp, + SourceControlConfigurationsClusterResourceName clusterResourceName, + String clusterName, + String sourceControlConfigurationName, + Context context) { + return beginDeleteAsync( + resourceGroupName, clusterRp, clusterResourceName, clusterName, sourceControlConfigurationName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * This will delete the YAML file used to set up the Source control configuration, thus stopping future sync from + * the source repo. + * + * @param resourceGroupName The name of the resource group. + * @param clusterRp The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or + * Microsoft.Kubernetes (for OnPrem K8S clusters). + * @param clusterResourceName The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or + * connectedClusters (for OnPrem K8S clusters). + * @param clusterName The name of the kubernetes cluster. + * @param sourceControlConfigurationName Name of the Source Control Configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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, + SourceControlConfigurationsClusterRp clusterRp, + SourceControlConfigurationsClusterResourceName clusterResourceName, + String clusterName, + String sourceControlConfigurationName) { + deleteAsync(resourceGroupName, clusterRp, clusterResourceName, clusterName, sourceControlConfigurationName) + .block(); + } + + /** + * This will delete the YAML file used to set up the Source control configuration, thus stopping future sync from + * the source repo. + * + * @param resourceGroupName The name of the resource group. + * @param clusterRp The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or + * Microsoft.Kubernetes (for OnPrem K8S clusters). + * @param clusterResourceName The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or + * connectedClusters (for OnPrem K8S clusters). + * @param clusterName The name of the kubernetes cluster. + * @param sourceControlConfigurationName Name of the Source Control Configuration. + * @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, + SourceControlConfigurationsClusterRp clusterRp, + SourceControlConfigurationsClusterResourceName clusterResourceName, + String clusterName, + String sourceControlConfigurationName, + Context context) { + deleteAsync( + resourceGroupName, clusterRp, clusterResourceName, clusterName, sourceControlConfigurationName, context) + .block(); + } + + /** + * List all Source Control Configurations. + * + * @param resourceGroupName The name of the resource group. + * @param clusterRp The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or + * Microsoft.Kubernetes (for OnPrem K8S clusters). + * @param clusterResourceName The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or + * connectedClusters (for OnPrem K8S clusters). + * @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 Source Control Configurations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, + SourceControlConfigurationsClusterRp clusterRp, + SourceControlConfigurationsClusterResourceName 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List all Source Control Configurations. + * + * @param resourceGroupName The name of the resource group. + * @param clusterRp The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or + * Microsoft.Kubernetes (for OnPrem K8S clusters). + * @param clusterResourceName The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or + * connectedClusters (for OnPrem K8S clusters). + * @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 Source Control Configurations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, + SourceControlConfigurationsClusterRp clusterRp, + SourceControlConfigurationsClusterResourceName 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 Source Control Configurations. + * + * @param resourceGroupName The name of the resource group. + * @param clusterRp The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or + * Microsoft.Kubernetes (for OnPrem K8S clusters). + * @param clusterResourceName The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or + * connectedClusters (for OnPrem K8S clusters). + * @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 Source Control Configurations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, + SourceControlConfigurationsClusterRp clusterRp, + SourceControlConfigurationsClusterResourceName clusterResourceName, + String clusterName) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, clusterRp, clusterResourceName, clusterName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List all Source Control Configurations. + * + * @param resourceGroupName The name of the resource group. + * @param clusterRp The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or + * Microsoft.Kubernetes (for OnPrem K8S clusters). + * @param clusterResourceName The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or + * connectedClusters (for OnPrem K8S clusters). + * @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 Source Control Configurations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, + SourceControlConfigurationsClusterRp clusterRp, + SourceControlConfigurationsClusterResourceName clusterResourceName, + String clusterName, + Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, clusterRp, clusterResourceName, clusterName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List all Source Control Configurations. + * + * @param resourceGroupName The name of the resource group. + * @param clusterRp The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or + * Microsoft.Kubernetes (for OnPrem K8S clusters). + * @param clusterResourceName The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or + * connectedClusters (for OnPrem K8S clusters). + * @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 Source Control Configurations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, + SourceControlConfigurationsClusterRp clusterRp, + SourceControlConfigurationsClusterResourceName clusterResourceName, + String clusterName) { + return new PagedIterable<>(listAsync(resourceGroupName, clusterRp, clusterResourceName, clusterName)); + } + + /** + * List all Source Control Configurations. + * + * @param resourceGroupName The name of the resource group. + * @param clusterRp The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or + * Microsoft.Kubernetes (for OnPrem K8S clusters). + * @param clusterResourceName The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or + * connectedClusters (for OnPrem K8S clusters). + * @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 Source Control Configurations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, + SourceControlConfigurationsClusterRp clusterRp, + SourceControlConfigurationsClusterResourceName clusterResourceName, + String clusterName, + Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, clusterRp, clusterResourceName, clusterName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Source Control Configurations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Source Control Configurations. + */ + @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/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/implementation/SourceControlConfigurationsImpl.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/implementation/SourceControlConfigurationsImpl.java new file mode 100644 index 0000000000000..f7996a35beee4 --- /dev/null +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/implementation/SourceControlConfigurationsImpl.java @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfiguration.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.kubernetesconfiguration.SourceControlConfigurationManager; +import com.azure.resourcemanager.kubernetesconfiguration.fluent.SourceControlConfigurationsClient; +import com.azure.resourcemanager.kubernetesconfiguration.fluent.models.SourceControlConfigurationInner; +import com.azure.resourcemanager.kubernetesconfiguration.models.SourceControlConfiguration; +import com.azure.resourcemanager.kubernetesconfiguration.models.SourceControlConfigurations; +import com.azure.resourcemanager.kubernetesconfiguration.models.SourceControlConfigurationsClusterResourceName; +import com.azure.resourcemanager.kubernetesconfiguration.models.SourceControlConfigurationsClusterRp; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class SourceControlConfigurationsImpl implements SourceControlConfigurations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SourceControlConfigurationsImpl.class); + + private final SourceControlConfigurationsClient innerClient; + + private final SourceControlConfigurationManager serviceManager; + + public SourceControlConfigurationsImpl( + SourceControlConfigurationsClient innerClient, SourceControlConfigurationManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public SourceControlConfiguration get( + String resourceGroupName, + SourceControlConfigurationsClusterRp clusterRp, + SourceControlConfigurationsClusterResourceName clusterResourceName, + String clusterName, + String sourceControlConfigurationName) { + SourceControlConfigurationInner inner = + this + .serviceClient() + .get(resourceGroupName, clusterRp, clusterResourceName, clusterName, sourceControlConfigurationName); + if (inner != null) { + return new SourceControlConfigurationImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + SourceControlConfigurationsClusterRp clusterRp, + SourceControlConfigurationsClusterResourceName clusterResourceName, + String clusterName, + String sourceControlConfigurationName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse( + resourceGroupName, + clusterRp, + clusterResourceName, + clusterName, + sourceControlConfigurationName, + context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SourceControlConfigurationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SourceControlConfiguration createOrUpdate( + String resourceGroupName, + SourceControlConfigurationsClusterRp clusterRp, + SourceControlConfigurationsClusterResourceName clusterResourceName, + String clusterName, + String sourceControlConfigurationName, + SourceControlConfigurationInner sourceControlConfiguration) { + SourceControlConfigurationInner inner = + this + .serviceClient() + .createOrUpdate( + resourceGroupName, + clusterRp, + clusterResourceName, + clusterName, + sourceControlConfigurationName, + sourceControlConfiguration); + if (inner != null) { + return new SourceControlConfigurationImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response createOrUpdateWithResponse( + String resourceGroupName, + SourceControlConfigurationsClusterRp clusterRp, + SourceControlConfigurationsClusterResourceName clusterResourceName, + String clusterName, + String sourceControlConfigurationName, + SourceControlConfigurationInner sourceControlConfiguration, + Context context) { + Response inner = + this + .serviceClient() + .createOrUpdateWithResponse( + resourceGroupName, + clusterRp, + clusterResourceName, + clusterName, + sourceControlConfigurationName, + sourceControlConfiguration, + context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SourceControlConfigurationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete( + String resourceGroupName, + SourceControlConfigurationsClusterRp clusterRp, + SourceControlConfigurationsClusterResourceName clusterResourceName, + String clusterName, + String sourceControlConfigurationName) { + this + .serviceClient() + .delete(resourceGroupName, clusterRp, clusterResourceName, clusterName, sourceControlConfigurationName); + } + + public void delete( + String resourceGroupName, + SourceControlConfigurationsClusterRp clusterRp, + SourceControlConfigurationsClusterResourceName clusterResourceName, + String clusterName, + String sourceControlConfigurationName, + Context context) { + this + .serviceClient() + .delete( + resourceGroupName, + clusterRp, + clusterResourceName, + clusterName, + sourceControlConfigurationName, + context); + } + + public PagedIterable list( + String resourceGroupName, + SourceControlConfigurationsClusterRp clusterRp, + SourceControlConfigurationsClusterResourceName clusterResourceName, + String clusterName) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, clusterRp, clusterResourceName, clusterName); + return inner.mapPage(inner1 -> new SourceControlConfigurationImpl(inner1, this.manager())); + } + + public PagedIterable list( + String resourceGroupName, + SourceControlConfigurationsClusterRp clusterRp, + SourceControlConfigurationsClusterResourceName clusterResourceName, + String clusterName, + Context context) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, clusterRp, clusterResourceName, clusterName, context); + return inner.mapPage(inner1 -> new SourceControlConfigurationImpl(inner1, this.manager())); + } + + private SourceControlConfigurationsClient serviceClient() { + return this.innerClient; + } + + private SourceControlConfigurationManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/implementation/Utils.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/implementation/Utils.java new file mode 100644 index 0000000000000..54138d71d0405 --- /dev/null +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/implementation/Utils.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfiguration.implementation; + +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; + +final class Utils { + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterator itr = Arrays.stream(id.split("/")).iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && !part.trim().isEmpty()) { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { + if (id == null || pathTemplate == null) { + return null; + } + String parameterNameParentheses = "{" + parameterName + "}"; + List idSegmentsReverted = Arrays.asList(id.split("/")); + List pathSegments = Arrays.asList(pathTemplate.split("/")); + Collections.reverse(idSegmentsReverted); + Iterator idItrReverted = idSegmentsReverted.iterator(); + int pathIndex = pathSegments.size(); + while (idItrReverted.hasNext() && pathIndex > 0) { + String idSegment = idItrReverted.next(); + String pathSegment = pathSegments.get(--pathIndex); + if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { + if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { + if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { + List segments = new ArrayList<>(); + segments.add(idSegment); + idItrReverted.forEachRemaining(segments::add); + Collections.reverse(segments); + if (segments.size() > 0 && segments.get(0).isEmpty()) { + segments.remove(0); + } + return String.join("/", segments); + } else { + return idSegment; + } + } + } + } + return null; + } +} diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/implementation/package-info.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/implementation/package-info.java new file mode 100644 index 0000000000000..1a022ff5a3c32 --- /dev/null +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/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 SourceControlConfigurationClient. Use these APIs to create Source Control + * Configuration resources through ARM, for Kubernetes Clusters. + */ +package com.azure.resourcemanager.kubernetesconfiguration.implementation; diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/ComplianceStateType.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/ComplianceStateType.java new file mode 100644 index 0000000000000..fe79e77156cd3 --- /dev/null +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/ComplianceStateType.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfiguration.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ComplianceStateType. */ +public final class ComplianceStateType extends ExpandableStringEnum { + /** Static value Pending for ComplianceStateType. */ + public static final ComplianceStateType PENDING = fromString("Pending"); + + /** Static value Compliant for ComplianceStateType. */ + public static final ComplianceStateType COMPLIANT = fromString("Compliant"); + + /** Static value Noncompliant for ComplianceStateType. */ + public static final ComplianceStateType NONCOMPLIANT = fromString("Noncompliant"); + + /** Static value Installed for ComplianceStateType. */ + public static final ComplianceStateType INSTALLED = fromString("Installed"); + + /** Static value Failed for ComplianceStateType. */ + public static final ComplianceStateType FAILED = fromString("Failed"); + + /** + * Creates or finds a ComplianceStateType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ComplianceStateType. + */ + @JsonCreator + public static ComplianceStateType fromString(String name) { + return fromString(name, ComplianceStateType.class); + } + + /** @return known ComplianceStateType values. */ + public static Collection values() { + return values(ComplianceStateType.class); + } +} diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/ComplianceStatus.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/ComplianceStatus.java new file mode 100644 index 0000000000000..c7baffee43f2a --- /dev/null +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/ComplianceStatus.java @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfiguration.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Compliance Status details. */ +@Fluent +public final class ComplianceStatus { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ComplianceStatus.class); + + /* + * The compliance state of the configuration. + */ + @JsonProperty(value = "complianceState", access = JsonProperty.Access.WRITE_ONLY) + private ComplianceStateType complianceState; + + /* + * Datetime the configuration was last applied. + */ + @JsonProperty(value = "lastConfigApplied") + private OffsetDateTime lastConfigApplied; + + /* + * Message from when the configuration was applied. + */ + @JsonProperty(value = "message") + private String message; + + /* + * Level of the message. + */ + @JsonProperty(value = "messageLevel") + private MessageLevelType messageLevel; + + /** + * Get the complianceState property: The compliance state of the configuration. + * + * @return the complianceState value. + */ + public ComplianceStateType complianceState() { + return this.complianceState; + } + + /** + * Get the lastConfigApplied property: Datetime the configuration was last applied. + * + * @return the lastConfigApplied value. + */ + public OffsetDateTime lastConfigApplied() { + return this.lastConfigApplied; + } + + /** + * Set the lastConfigApplied property: Datetime the configuration was last applied. + * + * @param lastConfigApplied the lastConfigApplied value to set. + * @return the ComplianceStatus object itself. + */ + public ComplianceStatus withLastConfigApplied(OffsetDateTime lastConfigApplied) { + this.lastConfigApplied = lastConfigApplied; + return this; + } + + /** + * Get the message property: Message from when the configuration was applied. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: Message from when the configuration was applied. + * + * @param message the message value to set. + * @return the ComplianceStatus object itself. + */ + public ComplianceStatus withMessage(String message) { + this.message = message; + return this; + } + + /** + * Get the messageLevel property: Level of the message. + * + * @return the messageLevel value. + */ + public MessageLevelType messageLevel() { + return this.messageLevel; + } + + /** + * Set the messageLevel property: Level of the message. + * + * @param messageLevel the messageLevel value to set. + * @return the ComplianceStatus object itself. + */ + public ComplianceStatus withMessageLevel(MessageLevelType messageLevel) { + this.messageLevel = messageLevel; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/HelmOperatorProperties.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/HelmOperatorProperties.java new file mode 100644 index 0000000000000..7b51cd3f8b3c6 --- /dev/null +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/HelmOperatorProperties.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfiguration.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties for Helm operator. */ +@Fluent +public final class HelmOperatorProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(HelmOperatorProperties.class); + + /* + * Version of the operator Helm chart. + */ + @JsonProperty(value = "chartVersion") + private String chartVersion; + + /* + * Values override for the operator Helm chart. + */ + @JsonProperty(value = "chartValues") + private String chartValues; + + /** + * Get the chartVersion property: Version of the operator Helm chart. + * + * @return the chartVersion value. + */ + public String chartVersion() { + return this.chartVersion; + } + + /** + * Set the chartVersion property: Version of the operator Helm chart. + * + * @param chartVersion the chartVersion value to set. + * @return the HelmOperatorProperties object itself. + */ + public HelmOperatorProperties withChartVersion(String chartVersion) { + this.chartVersion = chartVersion; + return this; + } + + /** + * Get the chartValues property: Values override for the operator Helm chart. + * + * @return the chartValues value. + */ + public String chartValues() { + return this.chartValues; + } + + /** + * Set the chartValues property: Values override for the operator Helm chart. + * + * @param chartValues the chartValues value to set. + * @return the HelmOperatorProperties object itself. + */ + public HelmOperatorProperties withChartValues(String chartValues) { + this.chartValues = chartValues; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/MessageLevelType.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/MessageLevelType.java new file mode 100644 index 0000000000000..6fc8db2a7b7f4 --- /dev/null +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/MessageLevelType.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfiguration.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for MessageLevelType. */ +public final class MessageLevelType extends ExpandableStringEnum { + /** Static value Error for MessageLevelType. */ + public static final MessageLevelType ERROR = fromString("Error"); + + /** Static value Warning for MessageLevelType. */ + public static final MessageLevelType WARNING = fromString("Warning"); + + /** Static value Information for MessageLevelType. */ + public static final MessageLevelType INFORMATION = fromString("Information"); + + /** + * Creates or finds a MessageLevelType from its string representation. + * + * @param name a name to look for. + * @return the corresponding MessageLevelType. + */ + @JsonCreator + public static MessageLevelType fromString(String name) { + return fromString(name, MessageLevelType.class); + } + + /** @return known MessageLevelType values. */ + public static Collection values() { + return values(MessageLevelType.class); + } +} diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/Operations.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/Operations.java new file mode 100644 index 0000000000000..a085c84c1d275 --- /dev/null +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/Operations.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfiguration.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Operations. */ +public interface Operations { + /** + * List all the available operations the KubernetesConfiguration resource provider supports. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list operations. + */ + PagedIterable list(); + + /** + * List all the available operations the KubernetesConfiguration resource provider supports. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list operations. + */ + PagedIterable list(Context context); +} diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/OperatorScopeType.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/OperatorScopeType.java new file mode 100644 index 0000000000000..2f7bb7464a80f --- /dev/null +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/OperatorScopeType.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfiguration.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for OperatorScopeType. */ +public final class OperatorScopeType extends ExpandableStringEnum { + /** Static value cluster for OperatorScopeType. */ + public static final OperatorScopeType CLUSTER = fromString("cluster"); + + /** Static value namespace for OperatorScopeType. */ + public static final OperatorScopeType NAMESPACE = fromString("namespace"); + + /** + * Creates or finds a OperatorScopeType from its string representation. + * + * @param name a name to look for. + * @return the corresponding OperatorScopeType. + */ + @JsonCreator + public static OperatorScopeType fromString(String name) { + return fromString(name, OperatorScopeType.class); + } + + /** @return known OperatorScopeType values. */ + public static Collection values() { + return values(OperatorScopeType.class); + } +} diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/OperatorType.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/OperatorType.java new file mode 100644 index 0000000000000..984777577f852 --- /dev/null +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/OperatorType.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfiguration.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for OperatorType. */ +public final class OperatorType extends ExpandableStringEnum { + /** Static value Flux for OperatorType. */ + public static final OperatorType FLUX = fromString("Flux"); + + /** + * Creates or finds a OperatorType from its string representation. + * + * @param name a name to look for. + * @return the corresponding OperatorType. + */ + @JsonCreator + public static OperatorType fromString(String name) { + return fromString(name, OperatorType.class); + } + + /** @return known OperatorType values. */ + public static Collection values() { + return values(OperatorType.class); + } +} diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/ProvisioningStateType.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/ProvisioningStateType.java new file mode 100644 index 0000000000000..3ba7b515a1c24 --- /dev/null +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/ProvisioningStateType.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfiguration.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ProvisioningStateType. */ +public final class ProvisioningStateType extends ExpandableStringEnum { + /** Static value Accepted for ProvisioningStateType. */ + public static final ProvisioningStateType ACCEPTED = fromString("Accepted"); + + /** Static value Deleting for ProvisioningStateType. */ + public static final ProvisioningStateType DELETING = fromString("Deleting"); + + /** Static value Running for ProvisioningStateType. */ + public static final ProvisioningStateType RUNNING = fromString("Running"); + + /** Static value Succeeded for ProvisioningStateType. */ + public static final ProvisioningStateType SUCCEEDED = fromString("Succeeded"); + + /** Static value Failed for ProvisioningStateType. */ + public static final ProvisioningStateType FAILED = fromString("Failed"); + + /** + * Creates or finds a ProvisioningStateType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProvisioningStateType. + */ + @JsonCreator + public static ProvisioningStateType fromString(String name) { + return fromString(name, ProvisioningStateType.class); + } + + /** @return known ProvisioningStateType values. */ + public static Collection values() { + return values(ProvisioningStateType.class); + } +} diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/ResourceProviderOperation.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/ResourceProviderOperation.java new file mode 100644 index 0000000000000..6121074ccac1e --- /dev/null +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/ResourceProviderOperation.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfiguration.models; + +import com.azure.resourcemanager.kubernetesconfiguration.fluent.models.ResourceProviderOperationInner; + +/** An immutable client-side representation of ResourceProviderOperation. */ +public interface ResourceProviderOperation { + /** + * Gets the name property: Operation name, in format of {provider}/{resource}/{operation}. + * + * @return the name value. + */ + String name(); + + /** + * Gets the display property: Display metadata associated with the operation. + * + * @return the display value. + */ + ResourceProviderOperationDisplay display(); + + /** + * Gets the isDataAction property: The flag that indicates whether the operation applies to data plane. + * + * @return the isDataAction value. + */ + Boolean isDataAction(); + + /** + * Gets the inner com.azure.resourcemanager.kubernetesconfiguration.fluent.models.ResourceProviderOperationInner + * object. + * + * @return the inner object. + */ + ResourceProviderOperationInner innerModel(); +} diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/ResourceProviderOperationDisplay.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/ResourceProviderOperationDisplay.java new file mode 100644 index 0000000000000..33fe8b8b658c7 --- /dev/null +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/ResourceProviderOperationDisplay.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfiguration.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Display metadata associated with the operation. */ +@Fluent +public final class ResourceProviderOperationDisplay { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceProviderOperationDisplay.class); + + /* + * Resource provider: Microsoft KubernetesConfiguration. + */ + @JsonProperty(value = "provider") + private String provider; + + /* + * Resource on which the operation is performed. + */ + @JsonProperty(value = "resource") + private String resource; + + /* + * Type of operation: get, read, delete, etc. + */ + @JsonProperty(value = "operation") + private String operation; + + /* + * Description of this operation. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get the provider property: Resource provider: Microsoft KubernetesConfiguration. + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Set the provider property: Resource provider: Microsoft KubernetesConfiguration. + * + * @param provider the provider value to set. + * @return the ResourceProviderOperationDisplay object itself. + */ + public ResourceProviderOperationDisplay withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get the resource property: Resource on which the operation is performed. + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Set the resource property: Resource on which the operation is performed. + * + * @param resource the resource value to set. + * @return the ResourceProviderOperationDisplay object itself. + */ + public ResourceProviderOperationDisplay withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get the operation property: Type of operation: get, read, delete, etc. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Set the operation property: Type of operation: get, read, delete, etc. + * + * @param operation the operation value to set. + * @return the ResourceProviderOperationDisplay object itself. + */ + public ResourceProviderOperationDisplay withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get the description property: Description of this operation. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Description of this operation. + * + * @param description the description value to set. + * @return the ResourceProviderOperationDisplay object itself. + */ + public ResourceProviderOperationDisplay withDescription(String description) { + this.description = description; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/ResourceProviderOperationList.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/ResourceProviderOperationList.java new file mode 100644 index 0000000000000..b07191661bb3f --- /dev/null +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/ResourceProviderOperationList.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfiguration.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.kubernetesconfiguration.fluent.models.ResourceProviderOperationInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Result of the request to list operations. */ +@Fluent +public final class ResourceProviderOperationList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceProviderOperationList.class); + + /* + * List of operations supported by this resource provider. + */ + @JsonProperty(value = "value") + private List value; + + /* + * URL to the next set of results, if any. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: List of operations supported by this resource provider. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of operations supported by this resource provider. + * + * @param value the value value to set. + * @return the ResourceProviderOperationList object itself. + */ + public ResourceProviderOperationList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: URL to the next set of results, 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()); + } + } +} diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/SourceControlConfiguration.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/SourceControlConfiguration.java new file mode 100644 index 0000000000000..f5c672eb17ab4 --- /dev/null +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/SourceControlConfiguration.java @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfiguration.models; + +import com.azure.resourcemanager.kubernetesconfiguration.fluent.models.SourceControlConfigurationInner; +import java.util.Map; + +/** An immutable client-side representation of SourceControlConfiguration. */ +public interface SourceControlConfiguration { + /** + * 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 repositoryUrl property: Url of the SourceControl Repository. + * + * @return the repositoryUrl value. + */ + String repositoryUrl(); + + /** + * Gets the operatorNamespace property: The namespace to which this operator is installed to. Maximum of 253 lower + * case alphanumeric characters, hyphen and period only. + * + * @return the operatorNamespace value. + */ + String operatorNamespace(); + + /** + * Gets the operatorInstanceName property: Instance name of the operator - identifying the specific configuration. + * + * @return the operatorInstanceName value. + */ + String operatorInstanceName(); + + /** + * Gets the operatorType property: Type of the operator. + * + * @return the operatorType value. + */ + OperatorType operatorType(); + + /** + * Gets the operatorParams property: Any Parameters for the Operator instance in string format. + * + * @return the operatorParams value. + */ + String operatorParams(); + + /** + * Gets the configurationProtectedSettings property: Name-value pairs of protected configuration settings for the + * configuration. + * + * @return the configurationProtectedSettings value. + */ + Map configurationProtectedSettings(); + + /** + * Gets the operatorScope property: Scope at which the operator will be installed. + * + * @return the operatorScope value. + */ + OperatorScopeType operatorScope(); + + /** + * Gets the repositoryPublicKey property: Public Key associated with this SourceControl configuration (either + * generated within the cluster or provided by the user). + * + * @return the repositoryPublicKey value. + */ + String repositoryPublicKey(); + + /** + * Gets the sshKnownHostsContents property: Base64-encoded known_hosts contents containing public SSH keys required + * to access private Git instances. + * + * @return the sshKnownHostsContents value. + */ + String sshKnownHostsContents(); + + /** + * Gets the enableHelmOperator property: Option to enable Helm Operator for this git configuration. + * + * @return the enableHelmOperator value. + */ + Boolean enableHelmOperator(); + + /** + * Gets the helmOperatorProperties property: Properties for Helm operator. + * + * @return the helmOperatorProperties value. + */ + HelmOperatorProperties helmOperatorProperties(); + + /** + * Gets the provisioningState property: The provisioning state of the resource provider. + * + * @return the provisioningState value. + */ + ProvisioningStateType provisioningState(); + + /** + * Gets the complianceStatus property: Compliance Status of the Configuration. + * + * @return the complianceStatus value. + */ + ComplianceStatus complianceStatus(); + + /** + * 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 inner com.azure.resourcemanager.kubernetesconfiguration.fluent.models.SourceControlConfigurationInner + * object. + * + * @return the inner object. + */ + SourceControlConfigurationInner innerModel(); +} diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/SourceControlConfigurationList.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/SourceControlConfigurationList.java new file mode 100644 index 0000000000000..e6f135d505baa --- /dev/null +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/SourceControlConfigurationList.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.kubernetesconfiguration.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.kubernetesconfiguration.fluent.models.SourceControlConfigurationInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * Result of the request to list Source Control Configurations. It contains a list of SourceControlConfiguration objects + * and a URL link to get the next set of results. + */ +@Immutable +public final class SourceControlConfigurationList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SourceControlConfigurationList.class); + + /* + * List of Source Control Configurations within a Kubernetes cluster. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * URL to get the next set of configuration objects, if any. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: List of Source Control Configurations 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 configuration 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()); + } + } +} diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/SourceControlConfigurations.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/SourceControlConfigurations.java new file mode 100644 index 0000000000000..caf2d5294bdbd --- /dev/null +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/SourceControlConfigurations.java @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfiguration.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.kubernetesconfiguration.fluent.models.SourceControlConfigurationInner; + +/** Resource collection API of SourceControlConfigurations. */ +public interface SourceControlConfigurations { + /** + * Gets details of the Source Control Configuration. + * + * @param resourceGroupName The name of the resource group. + * @param clusterRp The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or + * Microsoft.Kubernetes (for OnPrem K8S clusters). + * @param clusterResourceName The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or + * connectedClusters (for OnPrem K8S clusters). + * @param clusterName The name of the kubernetes cluster. + * @param sourceControlConfigurationName Name of the Source Control Configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return details of the Source Control Configuration. + */ + SourceControlConfiguration get( + String resourceGroupName, + SourceControlConfigurationsClusterRp clusterRp, + SourceControlConfigurationsClusterResourceName clusterResourceName, + String clusterName, + String sourceControlConfigurationName); + + /** + * Gets details of the Source Control Configuration. + * + * @param resourceGroupName The name of the resource group. + * @param clusterRp The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or + * Microsoft.Kubernetes (for OnPrem K8S clusters). + * @param clusterResourceName The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or + * connectedClusters (for OnPrem K8S clusters). + * @param clusterName The name of the kubernetes cluster. + * @param sourceControlConfigurationName Name of the Source Control Configuration. + * @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 details of the Source Control Configuration. + */ + Response getWithResponse( + String resourceGroupName, + SourceControlConfigurationsClusterRp clusterRp, + SourceControlConfigurationsClusterResourceName clusterResourceName, + String clusterName, + String sourceControlConfigurationName, + Context context); + + /** + * Create a new Kubernetes Source Control Configuration. + * + * @param resourceGroupName The name of the resource group. + * @param clusterRp The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or + * Microsoft.Kubernetes (for OnPrem K8S clusters). + * @param clusterResourceName The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or + * connectedClusters (for OnPrem K8S clusters). + * @param clusterName The name of the kubernetes cluster. + * @param sourceControlConfigurationName Name of the Source Control Configuration. + * @param sourceControlConfiguration Properties necessary to Create KubernetesConfiguration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 SourceControl Configuration object returned in Get & Put response. + */ + SourceControlConfiguration createOrUpdate( + String resourceGroupName, + SourceControlConfigurationsClusterRp clusterRp, + SourceControlConfigurationsClusterResourceName clusterResourceName, + String clusterName, + String sourceControlConfigurationName, + SourceControlConfigurationInner sourceControlConfiguration); + + /** + * Create a new Kubernetes Source Control Configuration. + * + * @param resourceGroupName The name of the resource group. + * @param clusterRp The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or + * Microsoft.Kubernetes (for OnPrem K8S clusters). + * @param clusterResourceName The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or + * connectedClusters (for OnPrem K8S clusters). + * @param clusterName The name of the kubernetes cluster. + * @param sourceControlConfigurationName Name of the Source Control Configuration. + * @param sourceControlConfiguration Properties necessary to Create KubernetesConfiguration. + * @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 SourceControl Configuration object returned in Get & Put response. + */ + Response createOrUpdateWithResponse( + String resourceGroupName, + SourceControlConfigurationsClusterRp clusterRp, + SourceControlConfigurationsClusterResourceName clusterResourceName, + String clusterName, + String sourceControlConfigurationName, + SourceControlConfigurationInner sourceControlConfiguration, + Context context); + + /** + * This will delete the YAML file used to set up the Source control configuration, thus stopping future sync from + * the source repo. + * + * @param resourceGroupName The name of the resource group. + * @param clusterRp The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or + * Microsoft.Kubernetes (for OnPrem K8S clusters). + * @param clusterResourceName The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or + * connectedClusters (for OnPrem K8S clusters). + * @param clusterName The name of the kubernetes cluster. + * @param sourceControlConfigurationName Name of the Source Control Configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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, + SourceControlConfigurationsClusterRp clusterRp, + SourceControlConfigurationsClusterResourceName clusterResourceName, + String clusterName, + String sourceControlConfigurationName); + + /** + * This will delete the YAML file used to set up the Source control configuration, thus stopping future sync from + * the source repo. + * + * @param resourceGroupName The name of the resource group. + * @param clusterRp The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or + * Microsoft.Kubernetes (for OnPrem K8S clusters). + * @param clusterResourceName The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or + * connectedClusters (for OnPrem K8S clusters). + * @param clusterName The name of the kubernetes cluster. + * @param sourceControlConfigurationName Name of the Source Control Configuration. + * @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, + SourceControlConfigurationsClusterRp clusterRp, + SourceControlConfigurationsClusterResourceName clusterResourceName, + String clusterName, + String sourceControlConfigurationName, + Context context); + + /** + * List all Source Control Configurations. + * + * @param resourceGroupName The name of the resource group. + * @param clusterRp The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or + * Microsoft.Kubernetes (for OnPrem K8S clusters). + * @param clusterResourceName The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or + * connectedClusters (for OnPrem K8S clusters). + * @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 Source Control Configurations. + */ + PagedIterable list( + String resourceGroupName, + SourceControlConfigurationsClusterRp clusterRp, + SourceControlConfigurationsClusterResourceName clusterResourceName, + String clusterName); + + /** + * List all Source Control Configurations. + * + * @param resourceGroupName The name of the resource group. + * @param clusterRp The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS clusters) or + * Microsoft.Kubernetes (for OnPrem K8S clusters). + * @param clusterResourceName The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or + * connectedClusters (for OnPrem K8S clusters). + * @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 Source Control Configurations. + */ + PagedIterable list( + String resourceGroupName, + SourceControlConfigurationsClusterRp clusterRp, + SourceControlConfigurationsClusterResourceName clusterResourceName, + String clusterName, + Context context); +} diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/SourceControlConfigurationsClusterResourceName.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/SourceControlConfigurationsClusterResourceName.java new file mode 100644 index 0000000000000..6541e224413c1 --- /dev/null +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/SourceControlConfigurationsClusterResourceName.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfiguration.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for SourceControlConfigurationsClusterResourceName. */ +public final class SourceControlConfigurationsClusterResourceName + extends ExpandableStringEnum { + /** Static value managedClusters for SourceControlConfigurationsClusterResourceName. */ + public static final SourceControlConfigurationsClusterResourceName MANAGED_CLUSTERS = fromString("managedClusters"); + + /** Static value connectedClusters for SourceControlConfigurationsClusterResourceName. */ + public static final SourceControlConfigurationsClusterResourceName CONNECTED_CLUSTERS = + fromString("connectedClusters"); + + /** + * Creates or finds a SourceControlConfigurationsClusterResourceName from its string representation. + * + * @param name a name to look for. + * @return the corresponding SourceControlConfigurationsClusterResourceName. + */ + @JsonCreator + public static SourceControlConfigurationsClusterResourceName fromString(String name) { + return fromString(name, SourceControlConfigurationsClusterResourceName.class); + } + + /** @return known SourceControlConfigurationsClusterResourceName values. */ + public static Collection values() { + return values(SourceControlConfigurationsClusterResourceName.class); + } +} diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/SourceControlConfigurationsClusterRp.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/SourceControlConfigurationsClusterRp.java new file mode 100644 index 0000000000000..b74cbd1dbbb29 --- /dev/null +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/SourceControlConfigurationsClusterRp.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfiguration.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for SourceControlConfigurationsClusterRp. */ +public final class SourceControlConfigurationsClusterRp + extends ExpandableStringEnum { + /** Static value Microsoft.ContainerService for SourceControlConfigurationsClusterRp. */ + public static final SourceControlConfigurationsClusterRp MICROSOFT_CONTAINER_SERVICE = + fromString("Microsoft.ContainerService"); + + /** Static value Microsoft.Kubernetes for SourceControlConfigurationsClusterRp. */ + public static final SourceControlConfigurationsClusterRp MICROSOFT_KUBERNETES = fromString("Microsoft.Kubernetes"); + + /** + * Creates or finds a SourceControlConfigurationsClusterRp from its string representation. + * + * @param name a name to look for. + * @return the corresponding SourceControlConfigurationsClusterRp. + */ + @JsonCreator + public static SourceControlConfigurationsClusterRp fromString(String name) { + return fromString(name, SourceControlConfigurationsClusterRp.class); + } + + /** @return known SourceControlConfigurationsClusterRp values. */ + public static Collection values() { + return values(SourceControlConfigurationsClusterRp.class); + } +} diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/SystemData.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/SystemData.java new file mode 100644 index 0000000000000..6d08d337321f2 --- /dev/null +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/SystemData.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.kubernetesconfiguration.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** + * 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. + */ +@Immutable +public final class SystemData { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SystemData.class); + + /* + * A string identifier for the identity that created the resource + */ + @JsonProperty(value = "createdBy", access = JsonProperty.Access.WRITE_ONLY) + private String createdBy; + + /* + * The type of identity that created the resource: user, application, + * managedIdentity, key + */ + @JsonProperty(value = "createdByType", access = JsonProperty.Access.WRITE_ONLY) + private String createdByType; + + /* + * The timestamp of resource creation (UTC) + */ + @JsonProperty(value = "createdAt", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime createdAt; + + /* + * A string identifier for the identity that last modified the resource + */ + @JsonProperty(value = "lastModifiedBy", access = JsonProperty.Access.WRITE_ONLY) + private String lastModifiedBy; + + /* + * The type of identity that last modified the resource: user, application, + * managedIdentity, key + */ + @JsonProperty(value = "lastModifiedByType", access = JsonProperty.Access.WRITE_ONLY) + private String lastModifiedByType; + + /* + * The timestamp of resource last modification (UTC) + */ + @JsonProperty(value = "lastModifiedAt", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastModifiedAt; + + /** + * Get the createdBy property: A string identifier for the identity that created the resource. + * + * @return the createdBy value. + */ + public String createdBy() { + return this.createdBy; + } + + /** + * Get the createdByType property: The type of identity that created the resource: user, application, + * managedIdentity, key. + * + * @return the createdByType value. + */ + public String createdByType() { + return this.createdByType; + } + + /** + * Get the createdAt property: The timestamp of resource creation (UTC). + * + * @return the createdAt value. + */ + public OffsetDateTime createdAt() { + return this.createdAt; + } + + /** + * Get the lastModifiedBy property: A string identifier for the identity that last modified the resource. + * + * @return the lastModifiedBy value. + */ + public String lastModifiedBy() { + return this.lastModifiedBy; + } + + /** + * Get the lastModifiedByType property: The type of identity that last modified the resource: user, application, + * managedIdentity, key. + * + * @return the lastModifiedByType value. + */ + public String lastModifiedByType() { + return this.lastModifiedByType; + } + + /** + * Get the lastModifiedAt property: The timestamp of resource last modification (UTC). + * + * @return the lastModifiedAt value. + */ + public OffsetDateTime lastModifiedAt() { + return this.lastModifiedAt; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/package-info.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/models/package-info.java new file mode 100644 index 0000000000000..c863b2883a001 --- /dev/null +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/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 SourceControlConfigurationClient. Use these APIs to create Source Control + * Configuration resources through ARM, for Kubernetes Clusters. + */ +package com.azure.resourcemanager.kubernetesconfiguration.models; diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/package-info.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/package-info.java new file mode 100644 index 0000000000000..537d035634711 --- /dev/null +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/com/azure/resourcemanager/kubernetesconfiguration/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 SourceControlConfigurationClient. Use these APIs to create Source Control + * Configuration resources through ARM, for Kubernetes Clusters. + */ +package com.azure.resourcemanager.kubernetesconfiguration; diff --git a/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/module-info.java b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/module-info.java new file mode 100644 index 0000000000000..e8aedbd68e7ae --- /dev/null +++ b/sdk/kubernetesconfiguration/azure-resourcemanager-kubernetesconfiguration/src/main/java/module-info.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +module com.azure.resourcemanager.kubernetesconfiguration { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.kubernetesconfiguration; + exports com.azure.resourcemanager.kubernetesconfiguration.fluent; + exports com.azure.resourcemanager.kubernetesconfiguration.fluent.models; + exports com.azure.resourcemanager.kubernetesconfiguration.models; + + opens com.azure.resourcemanager.kubernetesconfiguration.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.kubernetesconfiguration.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/kubernetesconfiguration/ci.yml b/sdk/kubernetesconfiguration/ci.yml new file mode 100644 index 0000000000000..3a6f5e93afdd3 --- /dev/null +++ b/sdk/kubernetesconfiguration/ci.yml @@ -0,0 +1,31 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - master + - hotfix/* + - release/* + paths: + include: + - sdk/kubernetesconfiguration/ + +pr: + branches: + include: + - master + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/kubernetesconfiguration/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: kubernetesconfiguration + Artifacts: + - name: azure-resourcemanager-kubernetesconfiguration + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerkubernetesconfiguration diff --git a/sdk/kubernetesconfiguration/pom.xml b/sdk/kubernetesconfiguration/pom.xml new file mode 100644 index 0000000000000..1cb9396d2a01b --- /dev/null +++ b/sdk/kubernetesconfiguration/pom.xml @@ -0,0 +1,14 @@ + + + 4.0.0 + com.azure + azure-kubernetesconfiguration-service + pom + 1.0.0 + + azure-resourcemanager-kubernetesconfiguration + +