From 008cd4ee30736e612630ab3e4d5429c96e7485c8 Mon Sep 17 00:00:00 2001 From: nanthi Date: Wed, 20 May 2020 23:04:44 -0700 Subject: [PATCH 1/3] K8sConfiguration .Net SDK - Create --- ...bernetesconfiguration_resource-manager.txt | 14 + .../AzSdk.RP.props | 7 + ...ure.Management.KubernetesConfiguration.sln | 31 + .../src/Generated/IOperations.cs | 73 ++ .../ISourceControlConfigurationClient.cs | 80 ++ .../ISourceControlConfigurationsOperations.cs | 255 ++++ .../src/Generated/Models/ComplianceState.cs | 107 ++ .../Models/ComplianceStateConverter.cs | 53 + .../src/Generated/Models/ComplianceStatus.cs | 82 ++ .../Generated/Models/EnableHelmOperator.cs | 105 ++ .../Models/EnableHelmOperatorConverter.cs | 53 + .../src/Generated/Models/ErrorDefinition.cs | 71 + .../src/Generated/Models/ErrorResponse.cs | 51 + .../Models/ErrorResponseException.cs | 62 + .../Models/HelmOperatorProperties.cs | 61 + .../src/Generated/Models/MessageLevel.cs | 107 ++ .../Generated/Models/MessageLevelConverter.cs | 53 + .../src/Generated/Models/OperatorScope.cs | 105 ++ .../Models/OperatorScopeConverter.cs | 53 + .../src/Generated/Models/OperatorType.cs | 103 ++ .../Generated/Models/OperatorTypeConverter.cs | 53 + .../src/Generated/Models/Page.cs | 53 + .../src/Generated/Models/ProvisioningState.cs | 111 ++ .../Models/ProvisioningStateConverter.cs | 53 + .../src/Generated/Models/ProxyResource.cs | 46 + .../src/Generated/Models/Resource.cs | 69 + .../Models/ResourceProviderOperation.cs | 62 + .../ResourceProviderOperationDisplay.cs | 80 ++ .../src/Generated/Models/Result.cs | 51 + .../Models/SourceControlConfiguration.cs | 162 +++ .../src/Generated/Operations.cs | 406 ++++++ .../src/Generated/OperationsExtensions.cs | 97 ++ ...dkInfo_SourceControlConfigurationClient.cs | 28 + .../SourceControlConfigurationClient.cs | 362 +++++ .../SourceControlConfigurationsOperations.cs | 1168 +++++++++++++++++ ...ntrolConfigurationsOperationsExtensions.cs | 417 ++++++ ....Management.KubernetesConfiguration.csproj | 33 + .../src/generate.ps1 | 1 + .../Helpers/RecordedDelegatingHandler.cs | 24 + ...ement.KubernetesConfiguration.Tests.csproj | 45 + .../SourceControlConfigurationTests.cs | 72 + ...pdateDeleteSourceControlConfiguration.json | 419 ++++++ .../tests/TestSupport/ClusterInfo.cs | 35 + .../SourceControlConfigurationTestBase.cs | 104 ++ 44 files changed, 5477 insertions(+) create mode 100644 eng/mgmt/mgmtmetadata/kubernetesconfiguration_resource-manager.txt create mode 100644 sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/AzSdk.RP.props create mode 100644 sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/Microsoft.Azure.Management.KubernetesConfiguration.sln create mode 100644 sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/IOperations.cs create mode 100644 sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/ISourceControlConfigurationClient.cs create mode 100644 sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/ISourceControlConfigurationsOperations.cs create mode 100644 sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/ComplianceState.cs create mode 100644 sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/ComplianceStateConverter.cs create mode 100644 sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/ComplianceStatus.cs create mode 100644 sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/EnableHelmOperator.cs create mode 100644 sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/EnableHelmOperatorConverter.cs create mode 100644 sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/ErrorDefinition.cs create mode 100644 sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/ErrorResponse.cs create mode 100644 sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/ErrorResponseException.cs create mode 100644 sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/HelmOperatorProperties.cs create mode 100644 sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/MessageLevel.cs create mode 100644 sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/MessageLevelConverter.cs create mode 100644 sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/OperatorScope.cs create mode 100644 sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/OperatorScopeConverter.cs create mode 100644 sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/OperatorType.cs create mode 100644 sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/OperatorTypeConverter.cs create mode 100644 sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/Page.cs create mode 100644 sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/ProvisioningState.cs create mode 100644 sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/ProvisioningStateConverter.cs create mode 100644 sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/ProxyResource.cs create mode 100644 sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/Resource.cs create mode 100644 sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/ResourceProviderOperation.cs create mode 100644 sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/ResourceProviderOperationDisplay.cs create mode 100644 sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/Result.cs create mode 100644 sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/SourceControlConfiguration.cs create mode 100644 sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Operations.cs create mode 100644 sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/OperationsExtensions.cs create mode 100644 sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/SdkInfo_SourceControlConfigurationClient.cs create mode 100644 sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/SourceControlConfigurationClient.cs create mode 100644 sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/SourceControlConfigurationsOperations.cs create mode 100644 sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/SourceControlConfigurationsOperationsExtensions.cs create mode 100644 sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Microsoft.Azure.Management.KubernetesConfiguration.csproj create mode 100644 sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/generate.ps1 create mode 100644 sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/tests/Helpers/RecordedDelegatingHandler.cs create mode 100644 sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/tests/Microsoft.Azure.Management.KubernetesConfiguration.Tests.csproj create mode 100644 sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/tests/ScenarioTests/SourceControlConfigurationTests.cs create mode 100644 sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/tests/SessionRecords/SourceControlConfigurationTest/CanCreateUpdateDeleteSourceControlConfiguration.json create mode 100644 sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/tests/TestSupport/ClusterInfo.cs create mode 100644 sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/tests/TestSupport/SourceControlConfigurationTestBase.cs diff --git a/eng/mgmt/mgmtmetadata/kubernetesconfiguration_resource-manager.txt b/eng/mgmt/mgmtmetadata/kubernetesconfiguration_resource-manager.txt new file mode 100644 index 0000000000000..82af1ff9f4108 --- /dev/null +++ b/eng/mgmt/mgmtmetadata/kubernetesconfiguration_resource-manager.txt @@ -0,0 +1,14 @@ +Installing AutoRest version: v2 +AutoRest installed successfully. +Commencing code generation +Generating CSharp code +Executing AutoRest command +cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/kubernetesconfiguration/resource-manager/readme.md --csharp --version=v2 --reflect-api-versions --opt-in-extensible-enums --csharp-sdks-folder=D:\Git\azure-sdk-for-net\sdk +2020-04-21 21:30:32 UTC +Azure-rest-api-specs repository information +GitHub fork: Azure +Branch: master +Commit: cda732a85c755cf7b4e86477a6d6f92d856d6ad6 +AutoRest information +Requested version: v2 +Bootstrapper version: autorest@2.0.4413 diff --git a/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/AzSdk.RP.props b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/AzSdk.RP.props new file mode 100644 index 0000000000000..8c5f6ac805278 --- /dev/null +++ b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/AzSdk.RP.props @@ -0,0 +1,7 @@ + + + + KubernetesConfiguration_2019-11-01-preview; + $(PackageTags);$(CommonTags);$(AzureApiTag); + + \ No newline at end of file diff --git a/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/Microsoft.Azure.Management.KubernetesConfiguration.sln b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/Microsoft.Azure.Management.KubernetesConfiguration.sln new file mode 100644 index 0000000000000..dbd85b1c4db26 --- /dev/null +++ b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/Microsoft.Azure.Management.KubernetesConfiguration.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30011.22 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Azure.Management.KubernetesConfiguration", "src\Microsoft.Azure.Management.KubernetesConfiguration.csproj", "{89B24529-C450-4FD6-BDE3-943BCE24C279}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Azure.Management.KubernetesConfiguration.Tests", "tests\Microsoft.Azure.Management.KubernetesConfiguration.Tests.csproj", "{21C6E113-ADE8-43D1-8D38-6516A2E0A9E4}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {89B24529-C450-4FD6-BDE3-943BCE24C279}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {89B24529-C450-4FD6-BDE3-943BCE24C279}.Debug|Any CPU.Build.0 = Debug|Any CPU + {89B24529-C450-4FD6-BDE3-943BCE24C279}.Release|Any CPU.ActiveCfg = Release|Any CPU + {89B24529-C450-4FD6-BDE3-943BCE24C279}.Release|Any CPU.Build.0 = Release|Any CPU + {21C6E113-ADE8-43D1-8D38-6516A2E0A9E4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {21C6E113-ADE8-43D1-8D38-6516A2E0A9E4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {21C6E113-ADE8-43D1-8D38-6516A2E0A9E4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {21C6E113-ADE8-43D1-8D38-6516A2E0A9E4}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {F804C967-83FF-40E3-8571-4DAC47FBDEC2} + EndGlobalSection +EndGlobal diff --git a/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/IOperations.cs b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/IOperations.cs new file mode 100644 index 0000000000000..f08d0bb8a147a --- /dev/null +++ b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/IOperations.cs @@ -0,0 +1,73 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.KubernetesConfiguration +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Operations operations. + /// + public partial interface IOperations + { + /// + /// List all the available operations the KubernetesConfiguration + /// resource provider supports. + /// + /// + /// The API version to be used with the HTTP request. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string apiVersion, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List all the available operations the KubernetesConfiguration + /// resource provider supports. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/ISourceControlConfigurationClient.cs b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/ISourceControlConfigurationClient.cs new file mode 100644 index 0000000000000..6514f29126927 --- /dev/null +++ b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/ISourceControlConfigurationClient.cs @@ -0,0 +1,80 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.KubernetesConfiguration +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + + /// + /// Use these APIs to create Source Control Configuration resources through + /// ARM, for Kubernetes Clusters. + /// + public partial interface ISourceControlConfigurationClient : System.IDisposable + { + /// + /// The base URI of the service. + /// + System.Uri BaseUri { get; set; } + + /// + /// Gets or sets json serialization settings. + /// + JsonSerializerSettings SerializationSettings { get; } + + /// + /// Gets or sets json deserialization settings. + /// + JsonSerializerSettings DeserializationSettings { get; } + + /// + /// Credentials needed for the client to connect to Azure. + /// + ServiceClientCredentials Credentials { get; } + + /// + /// The Azure subscription ID. This is a GUID-formatted string (e.g. + /// 00000000-0000-0000-0000-000000000000) + /// + string SubscriptionId { get; set; } + + /// + /// The preferred language for the response. + /// + string AcceptLanguage { get; set; } + + /// + /// The retry timeout in seconds for Long Running Operations. Default + /// value is 30. + /// + int? LongRunningOperationRetryTimeout { get; set; } + + /// + /// Whether a unique x-ms-client-request-id should be generated. When + /// set to true a unique x-ms-client-request-id value is generated and + /// included in each request. Default is true. + /// + bool? GenerateClientRequestId { get; set; } + + + /// + /// Gets the ISourceControlConfigurationsOperations. + /// + ISourceControlConfigurationsOperations SourceControlConfigurations { get; } + + /// + /// Gets the IOperations. + /// + IOperations Operations { get; } + + } +} diff --git a/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/ISourceControlConfigurationsOperations.cs b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/ISourceControlConfigurationsOperations.cs new file mode 100644 index 0000000000000..3289f5b7d0e3c --- /dev/null +++ b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/ISourceControlConfigurationsOperations.cs @@ -0,0 +1,255 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.KubernetesConfiguration +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SourceControlConfigurationsOperations operations. + /// + public partial interface ISourceControlConfigurationsOperations + { + /// + /// Gets details of the Source Control Configuration. + /// + /// + /// The name of the resource group. + /// + /// + /// The Kubernetes cluster RP - either Microsoft.ContainerService (for + /// AKS clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). + /// Possible values include: 'Microsoft.ContainerService', + /// 'Microsoft.Kubernetes' + /// + /// + /// The Kubernetes cluster resource name - either managedClusters (for + /// AKS clusters) or connectedClusters (for OnPrem K8S clusters). + /// Possible values include: 'managedClusters', 'connectedClusters' + /// + /// + /// The name of the kubernetes cluster. + /// + /// + /// Name of the Source Control Configuration. + /// + /// + /// The API version to be used with the HTTP request. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string clusterRp, string clusterResourceName, string clusterName, string sourceControlConfigurationName, string apiVersion, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create a new Kubernetes Source Control Configuration. + /// + /// + /// The name of the resource group. + /// + /// + /// The Kubernetes cluster RP - either Microsoft.ContainerService (for + /// AKS clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). + /// Possible values include: 'Microsoft.ContainerService', + /// 'Microsoft.Kubernetes' + /// + /// + /// The Kubernetes cluster resource name - either managedClusters (for + /// AKS clusters) or connectedClusters (for OnPrem K8S clusters). + /// Possible values include: 'managedClusters', 'connectedClusters' + /// + /// + /// The name of the kubernetes cluster. + /// + /// + /// Name of the Source Control Configuration. + /// + /// + /// The API version to be used with the HTTP request. + /// + /// + /// Properties necessary to Create KubernetesConfiguration. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string clusterRp, string clusterResourceName, string clusterName, string sourceControlConfigurationName, string apiVersion, SourceControlConfiguration sourceControlConfiguration, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// This will delete the YAML file used to set up the Source control + /// configuration, thus stopping future sync from the source repo. + /// + /// + /// The name of the resource group. + /// + /// + /// The Kubernetes cluster RP - either Microsoft.ContainerService (for + /// AKS clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). + /// Possible values include: 'Microsoft.ContainerService', + /// 'Microsoft.Kubernetes' + /// + /// + /// The Kubernetes cluster resource name - either managedClusters (for + /// AKS clusters) or connectedClusters (for OnPrem K8S clusters). + /// Possible values include: 'managedClusters', 'connectedClusters' + /// + /// + /// The name of the kubernetes cluster. + /// + /// + /// Name of the Source Control Configuration. + /// + /// + /// The API version to be used with the HTTP request. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string clusterRp, string clusterResourceName, string clusterName, string sourceControlConfigurationName, string apiVersion, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List all Source Control Configurations. + /// + /// + /// The name of the resource group. + /// + /// + /// The Kubernetes cluster RP - either Microsoft.ContainerService (for + /// AKS clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). + /// Possible values include: 'Microsoft.ContainerService', + /// 'Microsoft.Kubernetes' + /// + /// + /// The Kubernetes cluster resource name - either managedClusters (for + /// AKS clusters) or connectedClusters (for OnPrem K8S clusters). + /// Possible values include: 'managedClusters', 'connectedClusters' + /// + /// + /// The name of the kubernetes cluster. + /// + /// + /// The API version to be used with the HTTP request. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string clusterRp, string clusterResourceName, string clusterName, string apiVersion, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// This will delete the YAML file used to set up the Source control + /// configuration, thus stopping future sync from the source repo. + /// + /// + /// The name of the resource group. + /// + /// + /// The Kubernetes cluster RP - either Microsoft.ContainerService (for + /// AKS clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). + /// Possible values include: 'Microsoft.ContainerService', + /// 'Microsoft.Kubernetes' + /// + /// + /// The Kubernetes cluster resource name - either managedClusters (for + /// AKS clusters) or connectedClusters (for OnPrem K8S clusters). + /// Possible values include: 'managedClusters', 'connectedClusters' + /// + /// + /// The name of the kubernetes cluster. + /// + /// + /// Name of the Source Control Configuration. + /// + /// + /// The API version to be used with the HTTP request. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string clusterRp, string clusterResourceName, string clusterName, string sourceControlConfigurationName, string apiVersion, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List all Source Control Configurations. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/ComplianceState.cs b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/ComplianceState.cs new file mode 100644 index 0000000000000..9979797bd8d63 --- /dev/null +++ b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/ComplianceState.cs @@ -0,0 +1,107 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.KubernetesConfiguration.Models +{ + using Newtonsoft.Json; + + /// + /// Defines values for ComplianceState. + /// + /// + /// Determine base value for a given allowed value if exists, else return + /// the value itself + /// + [JsonConverter(typeof(ComplianceStateConverter))] + public struct ComplianceState : System.IEquatable + { + private ComplianceState(string underlyingValue) + { + UnderlyingValue=underlyingValue; + } + + public static readonly ComplianceState Pending = "Pending"; + + public static readonly ComplianceState Compliant = "Compliant"; + + public static readonly ComplianceState Noncompliant = "Noncompliant"; + + + /// + /// Underlying value of enum ComplianceState + /// + private readonly string UnderlyingValue; + + /// + /// Returns string representation for ComplianceState + /// + public override string ToString() + { + return UnderlyingValue == null ? null : UnderlyingValue.ToString(); + } + + /// + /// Compares enums of type ComplianceState + /// + public bool Equals(ComplianceState e) + { + return UnderlyingValue.Equals(e.UnderlyingValue); + } + + /// + /// Implicit operator to convert string to ComplianceState + /// + public static implicit operator ComplianceState(string value) + { + return new ComplianceState(value); + } + + /// + /// Implicit operator to convert ComplianceState to string + /// + public static implicit operator string(ComplianceState e) + { + return e.UnderlyingValue; + } + + /// + /// Overriding == operator for enum ComplianceState + /// + public static bool operator == (ComplianceState e1, ComplianceState e2) + { + return e2.Equals(e1); + } + + /// + /// Overriding != operator for enum ComplianceState + /// + public static bool operator != (ComplianceState e1, ComplianceState e2) + { + return !e2.Equals(e1); + } + + /// + /// Overrides Equals operator for ComplianceState + /// + public override bool Equals(object obj) + { + return obj is ComplianceState && Equals((ComplianceState)obj); + } + + /// + /// Returns for hashCode ComplianceState + /// + public override int GetHashCode() + { + return UnderlyingValue.GetHashCode(); + } + + } +} diff --git a/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/ComplianceStateConverter.cs b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/ComplianceStateConverter.cs new file mode 100644 index 0000000000000..37acc8d242a62 --- /dev/null +++ b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/ComplianceStateConverter.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.KubernetesConfiguration.Models +{ + using Newtonsoft.Json; + + using System.Reflection; + + /// + /// Defines values for ComplianceState. + /// + public sealed class ComplianceStateConverter : JsonConverter + { + + /// + /// Returns if objectType can be converted to ComplianceState by the + /// converter. + /// + public override bool CanConvert(System.Type objectType) + { + return typeof(ComplianceState).GetTypeInfo().IsAssignableFrom(objectType.GetTypeInfo()); + } + + /// + /// Overrides ReadJson and converts token to ComplianceState. + /// + public override object ReadJson(JsonReader reader, System.Type objectType, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType == Newtonsoft.Json.JsonToken.Null) + { + return null; + } + return (ComplianceState)serializer.Deserialize(reader); + } + + /// + /// Overriding WriteJson for ComplianceState for serialization. + /// + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteValue(value.ToString()); + } + + } +} diff --git a/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/ComplianceStatus.cs b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/ComplianceStatus.cs new file mode 100644 index 0000000000000..dd243347cbbfa --- /dev/null +++ b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/ComplianceStatus.cs @@ -0,0 +1,82 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.KubernetesConfiguration.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Compliance Status details + /// + public partial class ComplianceStatus + { + /// + /// Initializes a new instance of the ComplianceStatus class. + /// + public ComplianceStatus() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ComplianceStatus class. + /// + /// The compliance state of the + /// configuration. Possible values include: 'Pending', 'Compliant', + /// 'Noncompliant' + /// Datetime the configuration was last + /// applied. + /// Message from when the configuration was + /// applied. + /// Level of the message. Possible values + /// include: 'Error', 'Warning', 'Information' + public ComplianceStatus(ComplianceState? complianceState = default(ComplianceState?), System.DateTime? lastConfigApplied = default(System.DateTime?), string message = default(string), MessageLevel? messageLevel = default(MessageLevel?)) + { + ComplianceState = complianceState; + LastConfigApplied = lastConfigApplied; + Message = message; + MessageLevel = messageLevel; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the compliance state of the configuration. Possible values + /// include: 'Pending', 'Compliant', 'Noncompliant' + /// + [JsonProperty(PropertyName = "complianceState")] + public ComplianceState? ComplianceState { get; private set; } + + /// + /// Gets or sets datetime the configuration was last applied. + /// + [JsonProperty(PropertyName = "lastConfigApplied")] + public System.DateTime? LastConfigApplied { get; set; } + + /// + /// Gets or sets message from when the configuration was applied. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + + /// + /// Gets or sets level of the message. Possible values include: + /// 'Error', 'Warning', 'Information' + /// + [JsonProperty(PropertyName = "messageLevel")] + public MessageLevel? MessageLevel { get; set; } + + } +} diff --git a/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/EnableHelmOperator.cs b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/EnableHelmOperator.cs new file mode 100644 index 0000000000000..f1251da610c92 --- /dev/null +++ b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/EnableHelmOperator.cs @@ -0,0 +1,105 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.KubernetesConfiguration.Models +{ + using Newtonsoft.Json; + + /// + /// Defines values for EnableHelmOperator. + /// + /// + /// Determine base value for a given allowed value if exists, else return + /// the value itself + /// + [JsonConverter(typeof(EnableHelmOperatorConverter))] + public struct EnableHelmOperator : System.IEquatable + { + private EnableHelmOperator(string underlyingValue) + { + UnderlyingValue=underlyingValue; + } + + public static readonly EnableHelmOperator True = "true"; + + public static readonly EnableHelmOperator False = "false"; + + + /// + /// Underlying value of enum EnableHelmOperator + /// + private readonly string UnderlyingValue; + + /// + /// Returns string representation for EnableHelmOperator + /// + public override string ToString() + { + return UnderlyingValue == null ? null : UnderlyingValue.ToString(); + } + + /// + /// Compares enums of type EnableHelmOperator + /// + public bool Equals(EnableHelmOperator e) + { + return UnderlyingValue.Equals(e.UnderlyingValue); + } + + /// + /// Implicit operator to convert string to EnableHelmOperator + /// + public static implicit operator EnableHelmOperator(string value) + { + return new EnableHelmOperator(value); + } + + /// + /// Implicit operator to convert EnableHelmOperator to string + /// + public static implicit operator string(EnableHelmOperator e) + { + return e.UnderlyingValue; + } + + /// + /// Overriding == operator for enum EnableHelmOperator + /// + public static bool operator == (EnableHelmOperator e1, EnableHelmOperator e2) + { + return e2.Equals(e1); + } + + /// + /// Overriding != operator for enum EnableHelmOperator + /// + public static bool operator != (EnableHelmOperator e1, EnableHelmOperator e2) + { + return !e2.Equals(e1); + } + + /// + /// Overrides Equals operator for EnableHelmOperator + /// + public override bool Equals(object obj) + { + return obj is EnableHelmOperator && Equals((EnableHelmOperator)obj); + } + + /// + /// Returns for hashCode EnableHelmOperator + /// + public override int GetHashCode() + { + return UnderlyingValue.GetHashCode(); + } + + } +} diff --git a/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/EnableHelmOperatorConverter.cs b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/EnableHelmOperatorConverter.cs new file mode 100644 index 0000000000000..fd9a0293f2f3e --- /dev/null +++ b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/EnableHelmOperatorConverter.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.KubernetesConfiguration.Models +{ + using Newtonsoft.Json; + + using System.Reflection; + + /// + /// Defines values for EnableHelmOperator. + /// + public sealed class EnableHelmOperatorConverter : JsonConverter + { + + /// + /// Returns if objectType can be converted to EnableHelmOperator by the + /// converter. + /// + public override bool CanConvert(System.Type objectType) + { + return typeof(EnableHelmOperator).GetTypeInfo().IsAssignableFrom(objectType.GetTypeInfo()); + } + + /// + /// Overrides ReadJson and converts token to EnableHelmOperator. + /// + public override object ReadJson(JsonReader reader, System.Type objectType, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType == Newtonsoft.Json.JsonToken.Null) + { + return null; + } + return (EnableHelmOperator)serializer.Deserialize(reader); + } + + /// + /// Overriding WriteJson for EnableHelmOperator for serialization. + /// + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteValue(value.ToString()); + } + + } +} diff --git a/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/ErrorDefinition.cs b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/ErrorDefinition.cs new file mode 100644 index 0000000000000..ce9bd9c1fc1e1 --- /dev/null +++ b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/ErrorDefinition.cs @@ -0,0 +1,71 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.KubernetesConfiguration.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Error definition. + /// + public partial class ErrorDefinition + { + /// + /// Initializes a new instance of the ErrorDefinition class. + /// + public ErrorDefinition() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorDefinition class. + /// + /// Service specific error code which serves as the + /// substatus for the HTTP error code. + /// Description of the error. + /// Internal error details. + public ErrorDefinition(string code = default(string), string message = default(string), IList details = default(IList)) + { + Code = code; + Message = message; + Details = details; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets service specific error code which serves as the substatus for + /// the HTTP error code. + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; private set; } + + /// + /// Gets description of the error. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; private set; } + + /// + /// Gets internal error details. + /// + [JsonProperty(PropertyName = "details")] + public IList Details { get; private set; } + + } +} diff --git a/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/ErrorResponse.cs b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/ErrorResponse.cs new file mode 100644 index 0000000000000..885eae1fb483d --- /dev/null +++ b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/ErrorResponse.cs @@ -0,0 +1,51 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.KubernetesConfiguration.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Error response. + /// + public partial class ErrorResponse + { + /// + /// Initializes a new instance of the ErrorResponse class. + /// + public ErrorResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorResponse class. + /// + /// Error definition. + public ErrorResponse(ErrorDefinition error = default(ErrorDefinition)) + { + Error = error; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets error definition. + /// + [JsonProperty(PropertyName = "error")] + public ErrorDefinition Error { get; set; } + + } +} diff --git a/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/ErrorResponseException.cs b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/ErrorResponseException.cs new file mode 100644 index 0000000000000..c48a0a9ea9d9e --- /dev/null +++ b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/ErrorResponseException.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.KubernetesConfiguration.Models +{ + using Microsoft.Rest; + + /// + /// Exception thrown for an invalid response with ErrorResponse + /// information. + /// + public partial class ErrorResponseException : RestException + { + /// + /// Gets information about the associated HTTP request. + /// + public HttpRequestMessageWrapper Request { get; set; } + + /// + /// Gets information about the associated HTTP response. + /// + public HttpResponseMessageWrapper Response { get; set; } + + /// + /// Gets or sets the body object. + /// + public ErrorResponse Body { get; set; } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + public ErrorResponseException() + { + } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + /// The exception message. + public ErrorResponseException(string message) + : this(message, null) + { + } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + /// The exception message. + /// Inner exception. + public ErrorResponseException(string message, System.Exception innerException) + : base(message, innerException) + { + } + } +} diff --git a/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/HelmOperatorProperties.cs b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/HelmOperatorProperties.cs new file mode 100644 index 0000000000000..0efb7c6e9aba6 --- /dev/null +++ b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/HelmOperatorProperties.cs @@ -0,0 +1,61 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.KubernetesConfiguration.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Properties for Helm operator. + /// + public partial class HelmOperatorProperties + { + /// + /// Initializes a new instance of the HelmOperatorProperties class. + /// + public HelmOperatorProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the HelmOperatorProperties class. + /// + /// Version of the operator Helm + /// chart. + /// Values override for the operator Helm + /// chart. + public HelmOperatorProperties(string chartVersion = default(string), string chartValues = default(string)) + { + ChartVersion = chartVersion; + ChartValues = chartValues; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets version of the operator Helm chart. + /// + [JsonProperty(PropertyName = "chartVersion")] + public string ChartVersion { get; set; } + + /// + /// Gets or sets values override for the operator Helm chart. + /// + [JsonProperty(PropertyName = "chartValues")] + public string ChartValues { get; set; } + + } +} diff --git a/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/MessageLevel.cs b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/MessageLevel.cs new file mode 100644 index 0000000000000..407ef1cc6218a --- /dev/null +++ b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/MessageLevel.cs @@ -0,0 +1,107 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.KubernetesConfiguration.Models +{ + using Newtonsoft.Json; + + /// + /// Defines values for MessageLevel. + /// + /// + /// Determine base value for a given allowed value if exists, else return + /// the value itself + /// + [JsonConverter(typeof(MessageLevelConverter))] + public struct MessageLevel : System.IEquatable + { + private MessageLevel(string underlyingValue) + { + UnderlyingValue=underlyingValue; + } + + public static readonly MessageLevel Error = "Error"; + + public static readonly MessageLevel Warning = "Warning"; + + public static readonly MessageLevel Information = "Information"; + + + /// + /// Underlying value of enum MessageLevel + /// + private readonly string UnderlyingValue; + + /// + /// Returns string representation for MessageLevel + /// + public override string ToString() + { + return UnderlyingValue == null ? null : UnderlyingValue.ToString(); + } + + /// + /// Compares enums of type MessageLevel + /// + public bool Equals(MessageLevel e) + { + return UnderlyingValue.Equals(e.UnderlyingValue); + } + + /// + /// Implicit operator to convert string to MessageLevel + /// + public static implicit operator MessageLevel(string value) + { + return new MessageLevel(value); + } + + /// + /// Implicit operator to convert MessageLevel to string + /// + public static implicit operator string(MessageLevel e) + { + return e.UnderlyingValue; + } + + /// + /// Overriding == operator for enum MessageLevel + /// + public static bool operator == (MessageLevel e1, MessageLevel e2) + { + return e2.Equals(e1); + } + + /// + /// Overriding != operator for enum MessageLevel + /// + public static bool operator != (MessageLevel e1, MessageLevel e2) + { + return !e2.Equals(e1); + } + + /// + /// Overrides Equals operator for MessageLevel + /// + public override bool Equals(object obj) + { + return obj is MessageLevel && Equals((MessageLevel)obj); + } + + /// + /// Returns for hashCode MessageLevel + /// + public override int GetHashCode() + { + return UnderlyingValue.GetHashCode(); + } + + } +} diff --git a/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/MessageLevelConverter.cs b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/MessageLevelConverter.cs new file mode 100644 index 0000000000000..c4c202adc4244 --- /dev/null +++ b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/MessageLevelConverter.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.KubernetesConfiguration.Models +{ + using Newtonsoft.Json; + + using System.Reflection; + + /// + /// Defines values for MessageLevel. + /// + public sealed class MessageLevelConverter : JsonConverter + { + + /// + /// Returns if objectType can be converted to MessageLevel by the + /// converter. + /// + public override bool CanConvert(System.Type objectType) + { + return typeof(MessageLevel).GetTypeInfo().IsAssignableFrom(objectType.GetTypeInfo()); + } + + /// + /// Overrides ReadJson and converts token to MessageLevel. + /// + public override object ReadJson(JsonReader reader, System.Type objectType, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType == Newtonsoft.Json.JsonToken.Null) + { + return null; + } + return (MessageLevel)serializer.Deserialize(reader); + } + + /// + /// Overriding WriteJson for MessageLevel for serialization. + /// + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteValue(value.ToString()); + } + + } +} diff --git a/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/OperatorScope.cs b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/OperatorScope.cs new file mode 100644 index 0000000000000..d04b088e8ca2a --- /dev/null +++ b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/OperatorScope.cs @@ -0,0 +1,105 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.KubernetesConfiguration.Models +{ + using Newtonsoft.Json; + + /// + /// Defines values for OperatorScope. + /// + /// + /// Determine base value for a given allowed value if exists, else return + /// the value itself + /// + [JsonConverter(typeof(OperatorScopeConverter))] + public struct OperatorScope : System.IEquatable + { + private OperatorScope(string underlyingValue) + { + UnderlyingValue=underlyingValue; + } + + public static readonly OperatorScope Cluster = "cluster"; + + public static readonly OperatorScope Namespace = "namespace"; + + + /// + /// Underlying value of enum OperatorScope + /// + private readonly string UnderlyingValue; + + /// + /// Returns string representation for OperatorScope + /// + public override string ToString() + { + return UnderlyingValue == null ? null : UnderlyingValue.ToString(); + } + + /// + /// Compares enums of type OperatorScope + /// + public bool Equals(OperatorScope e) + { + return UnderlyingValue.Equals(e.UnderlyingValue); + } + + /// + /// Implicit operator to convert string to OperatorScope + /// + public static implicit operator OperatorScope(string value) + { + return new OperatorScope(value); + } + + /// + /// Implicit operator to convert OperatorScope to string + /// + public static implicit operator string(OperatorScope e) + { + return e.UnderlyingValue; + } + + /// + /// Overriding == operator for enum OperatorScope + /// + public static bool operator == (OperatorScope e1, OperatorScope e2) + { + return e2.Equals(e1); + } + + /// + /// Overriding != operator for enum OperatorScope + /// + public static bool operator != (OperatorScope e1, OperatorScope e2) + { + return !e2.Equals(e1); + } + + /// + /// Overrides Equals operator for OperatorScope + /// + public override bool Equals(object obj) + { + return obj is OperatorScope && Equals((OperatorScope)obj); + } + + /// + /// Returns for hashCode OperatorScope + /// + public override int GetHashCode() + { + return UnderlyingValue.GetHashCode(); + } + + } +} diff --git a/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/OperatorScopeConverter.cs b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/OperatorScopeConverter.cs new file mode 100644 index 0000000000000..a560a4671ed54 --- /dev/null +++ b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/OperatorScopeConverter.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.KubernetesConfiguration.Models +{ + using Newtonsoft.Json; + + using System.Reflection; + + /// + /// Defines values for OperatorScope. + /// + public sealed class OperatorScopeConverter : JsonConverter + { + + /// + /// Returns if objectType can be converted to OperatorScope by the + /// converter. + /// + public override bool CanConvert(System.Type objectType) + { + return typeof(OperatorScope).GetTypeInfo().IsAssignableFrom(objectType.GetTypeInfo()); + } + + /// + /// Overrides ReadJson and converts token to OperatorScope. + /// + public override object ReadJson(JsonReader reader, System.Type objectType, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType == Newtonsoft.Json.JsonToken.Null) + { + return null; + } + return (OperatorScope)serializer.Deserialize(reader); + } + + /// + /// Overriding WriteJson for OperatorScope for serialization. + /// + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteValue(value.ToString()); + } + + } +} diff --git a/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/OperatorType.cs b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/OperatorType.cs new file mode 100644 index 0000000000000..d31e4aac12b03 --- /dev/null +++ b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/OperatorType.cs @@ -0,0 +1,103 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.KubernetesConfiguration.Models +{ + using Newtonsoft.Json; + + /// + /// Defines values for OperatorType. + /// + /// + /// Determine base value for a given allowed value if exists, else return + /// the value itself + /// + [JsonConverter(typeof(OperatorTypeConverter))] + public struct OperatorType : System.IEquatable + { + private OperatorType(string underlyingValue) + { + UnderlyingValue=underlyingValue; + } + + public static readonly OperatorType Flux = "Flux"; + + + /// + /// Underlying value of enum OperatorType + /// + private readonly string UnderlyingValue; + + /// + /// Returns string representation for OperatorType + /// + public override string ToString() + { + return UnderlyingValue == null ? null : UnderlyingValue.ToString(); + } + + /// + /// Compares enums of type OperatorType + /// + public bool Equals(OperatorType e) + { + return UnderlyingValue.Equals(e.UnderlyingValue); + } + + /// + /// Implicit operator to convert string to OperatorType + /// + public static implicit operator OperatorType(string value) + { + return new OperatorType(value); + } + + /// + /// Implicit operator to convert OperatorType to string + /// + public static implicit operator string(OperatorType e) + { + return e.UnderlyingValue; + } + + /// + /// Overriding == operator for enum OperatorType + /// + public static bool operator == (OperatorType e1, OperatorType e2) + { + return e2.Equals(e1); + } + + /// + /// Overriding != operator for enum OperatorType + /// + public static bool operator != (OperatorType e1, OperatorType e2) + { + return !e2.Equals(e1); + } + + /// + /// Overrides Equals operator for OperatorType + /// + public override bool Equals(object obj) + { + return obj is OperatorType && Equals((OperatorType)obj); + } + + /// + /// Returns for hashCode OperatorType + /// + public override int GetHashCode() + { + return UnderlyingValue.GetHashCode(); + } + + } +} diff --git a/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/OperatorTypeConverter.cs b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/OperatorTypeConverter.cs new file mode 100644 index 0000000000000..35d93112816b6 --- /dev/null +++ b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/OperatorTypeConverter.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.KubernetesConfiguration.Models +{ + using Newtonsoft.Json; + + using System.Reflection; + + /// + /// Defines values for OperatorType. + /// + public sealed class OperatorTypeConverter : JsonConverter + { + + /// + /// Returns if objectType can be converted to OperatorType by the + /// converter. + /// + public override bool CanConvert(System.Type objectType) + { + return typeof(OperatorType).GetTypeInfo().IsAssignableFrom(objectType.GetTypeInfo()); + } + + /// + /// Overrides ReadJson and converts token to OperatorType. + /// + public override object ReadJson(JsonReader reader, System.Type objectType, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType == Newtonsoft.Json.JsonToken.Null) + { + return null; + } + return (OperatorType)serializer.Deserialize(reader); + } + + /// + /// Overriding WriteJson for OperatorType for serialization. + /// + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteValue(value.ToString()); + } + + } +} diff --git a/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/Page.cs b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/Page.cs new file mode 100644 index 0000000000000..af92fdb2640ff --- /dev/null +++ b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/Page.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.KubernetesConfiguration.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + + /// + /// Defines a page in Azure responses. + /// + /// Type of the page content items + [JsonObject] + public class Page : IPage + { + /// + /// Gets the link to the next page. + /// + [JsonProperty("nextLink")] + public string NextPageLink { get; private set; } + + [JsonProperty("value")] + private IList Items{ get; set; } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + public IEnumerator GetEnumerator() + { + return Items == null ? System.Linq.Enumerable.Empty().GetEnumerator() : Items.GetEnumerator(); + } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } +} diff --git a/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/ProvisioningState.cs b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/ProvisioningState.cs new file mode 100644 index 0000000000000..95d90660f55dc --- /dev/null +++ b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/ProvisioningState.cs @@ -0,0 +1,111 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.KubernetesConfiguration.Models +{ + using Newtonsoft.Json; + + /// + /// Defines values for ProvisioningState. + /// + /// + /// Determine base value for a given allowed value if exists, else return + /// the value itself + /// + [JsonConverter(typeof(ProvisioningStateConverter))] + public struct ProvisioningState : System.IEquatable + { + private ProvisioningState(string underlyingValue) + { + UnderlyingValue=underlyingValue; + } + + public static readonly ProvisioningState Accepted = "Accepted"; + + public static readonly ProvisioningState Deleting = "Deleting"; + + public static readonly ProvisioningState Running = "Running"; + + public static readonly ProvisioningState Succeeded = "Succeeded"; + + public static readonly ProvisioningState Failed = "Failed"; + + + /// + /// Underlying value of enum ProvisioningState + /// + private readonly string UnderlyingValue; + + /// + /// Returns string representation for ProvisioningState + /// + public override string ToString() + { + return UnderlyingValue == null ? null : UnderlyingValue.ToString(); + } + + /// + /// Compares enums of type ProvisioningState + /// + public bool Equals(ProvisioningState e) + { + return UnderlyingValue.Equals(e.UnderlyingValue); + } + + /// + /// Implicit operator to convert string to ProvisioningState + /// + public static implicit operator ProvisioningState(string value) + { + return new ProvisioningState(value); + } + + /// + /// Implicit operator to convert ProvisioningState to string + /// + public static implicit operator string(ProvisioningState e) + { + return e.UnderlyingValue; + } + + /// + /// Overriding == operator for enum ProvisioningState + /// + public static bool operator == (ProvisioningState e1, ProvisioningState e2) + { + return e2.Equals(e1); + } + + /// + /// Overriding != operator for enum ProvisioningState + /// + public static bool operator != (ProvisioningState e1, ProvisioningState e2) + { + return !e2.Equals(e1); + } + + /// + /// Overrides Equals operator for ProvisioningState + /// + public override bool Equals(object obj) + { + return obj is ProvisioningState && Equals((ProvisioningState)obj); + } + + /// + /// Returns for hashCode ProvisioningState + /// + public override int GetHashCode() + { + return UnderlyingValue.GetHashCode(); + } + + } +} diff --git a/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/ProvisioningStateConverter.cs b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/ProvisioningStateConverter.cs new file mode 100644 index 0000000000000..e7dc2ea27a25f --- /dev/null +++ b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/ProvisioningStateConverter.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.KubernetesConfiguration.Models +{ + using Newtonsoft.Json; + + using System.Reflection; + + /// + /// Defines values for ProvisioningState. + /// + public sealed class ProvisioningStateConverter : JsonConverter + { + + /// + /// Returns if objectType can be converted to ProvisioningState by the + /// converter. + /// + public override bool CanConvert(System.Type objectType) + { + return typeof(ProvisioningState).GetTypeInfo().IsAssignableFrom(objectType.GetTypeInfo()); + } + + /// + /// Overrides ReadJson and converts token to ProvisioningState. + /// + public override object ReadJson(JsonReader reader, System.Type objectType, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType == Newtonsoft.Json.JsonToken.Null) + { + return null; + } + return (ProvisioningState)serializer.Deserialize(reader); + } + + /// + /// Overriding WriteJson for ProvisioningState for serialization. + /// + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteValue(value.ToString()); + } + + } +} diff --git a/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/ProxyResource.cs b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/ProxyResource.cs new file mode 100644 index 0000000000000..5c120a076b04c --- /dev/null +++ b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/ProxyResource.cs @@ -0,0 +1,46 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.KubernetesConfiguration.Models +{ + using System.Linq; + + /// + /// ARM proxy resource. + /// + public partial class ProxyResource : Resource + { + /// + /// Initializes a new instance of the ProxyResource class. + /// + public ProxyResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ProxyResource class. + /// + /// Resource Id + /// Resource name + /// Resource type + public ProxyResource(string id = default(string), string name = default(string), string type = default(string)) + : base(id, name, type) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/Resource.cs b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/Resource.cs new file mode 100644 index 0000000000000..52e2fc72fc7a6 --- /dev/null +++ b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/Resource.cs @@ -0,0 +1,69 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.KubernetesConfiguration.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The Resource model definition. + /// + public partial class Resource : IResource + { + /// + /// Initializes a new instance of the Resource class. + /// + public Resource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Resource class. + /// + /// Resource Id + /// Resource name + /// Resource type + public Resource(string id = default(string), string name = default(string), string type = default(string)) + { + Id = id; + Name = name; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets resource Id + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets resource name + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets resource type + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + } +} diff --git a/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/ResourceProviderOperation.cs b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/ResourceProviderOperation.cs new file mode 100644 index 0000000000000..6b6ff77e604f4 --- /dev/null +++ b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/ResourceProviderOperation.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.KubernetesConfiguration.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Supported operation of this resource provider. + /// + public partial class ResourceProviderOperation + { + /// + /// Initializes a new instance of the ResourceProviderOperation class. + /// + public ResourceProviderOperation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceProviderOperation class. + /// + /// Operation name, in format of + /// {provider}/{resource}/{operation} + /// Display metadata associated with the + /// operation. + public ResourceProviderOperation(string name = default(string), ResourceProviderOperationDisplay display = default(ResourceProviderOperationDisplay)) + { + Name = name; + Display = display; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets operation name, in format of + /// {provider}/{resource}/{operation} + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets display metadata associated with the operation. + /// + [JsonProperty(PropertyName = "display")] + public ResourceProviderOperationDisplay Display { get; set; } + + } +} diff --git a/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/ResourceProviderOperationDisplay.cs b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/ResourceProviderOperationDisplay.cs new file mode 100644 index 0000000000000..8c21c2ae97903 --- /dev/null +++ b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/ResourceProviderOperationDisplay.cs @@ -0,0 +1,80 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.KubernetesConfiguration.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Display metadata associated with the operation. + /// + public partial class ResourceProviderOperationDisplay + { + /// + /// Initializes a new instance of the ResourceProviderOperationDisplay + /// class. + /// + public ResourceProviderOperationDisplay() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceProviderOperationDisplay + /// class. + /// + /// Resource provider: Microsoft + /// KubernetesConfiguration. + /// Resource on which the operation is + /// performed. + /// Type of operation: get, read, delete, + /// etc. + /// Description of this operation. + public ResourceProviderOperationDisplay(string provider = default(string), string resource = default(string), string operation = default(string), string description = default(string)) + { + Provider = provider; + Resource = resource; + Operation = operation; + Description = description; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource provider: Microsoft KubernetesConfiguration. + /// + [JsonProperty(PropertyName = "provider")] + public string Provider { get; set; } + + /// + /// Gets or sets resource on which the operation is performed. + /// + [JsonProperty(PropertyName = "resource")] + public string Resource { get; set; } + + /// + /// Gets or sets type of operation: get, read, delete, etc. + /// + [JsonProperty(PropertyName = "operation")] + public string Operation { get; set; } + + /// + /// Gets or sets description of this operation. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + } +} diff --git a/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/Result.cs b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/Result.cs new file mode 100644 index 0000000000000..b0529bcf59a57 --- /dev/null +++ b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/Result.cs @@ -0,0 +1,51 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.KubernetesConfiguration.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Sample result definition + /// + public partial class Result + { + /// + /// Initializes a new instance of the Result class. + /// + public Result() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Result class. + /// + /// Sample property of type string + public Result(string sampleProperty = default(string)) + { + SampleProperty = sampleProperty; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets sample property of type string + /// + [JsonProperty(PropertyName = "sampleProperty")] + public string SampleProperty { get; set; } + + } +} diff --git a/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/SourceControlConfiguration.cs b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/SourceControlConfiguration.cs new file mode 100644 index 0000000000000..ce218689d5b5a --- /dev/null +++ b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Models/SourceControlConfiguration.cs @@ -0,0 +1,162 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.KubernetesConfiguration.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The SourceControl Configuration object. + /// + [Rest.Serialization.JsonTransformation] + public partial class SourceControlConfiguration : ProxyResource + { + /// + /// Initializes a new instance of the SourceControlConfiguration class. + /// + public SourceControlConfiguration() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SourceControlConfiguration class. + /// + /// Resource Id + /// Resource name + /// Resource type + /// Url of the SourceControl + /// Repository. + /// The namespace to which this + /// operator is installed to. Maximum of 253 lower case alphanumeric + /// characters, hyphen and period only. + /// Instance name of the operator - + /// identifying the specific configuration. + /// Type of the operator. Possible values + /// include: 'Flux' + /// Any Parameters for the Operator + /// instance in string format. + /// Scope at which the operator will be + /// installed. Possible values include: 'cluster', 'namespace' + /// Public Key associated with this + /// SourceControl configuration (either generated within the cluster or + /// provided by the user). + /// Option to enable Helm Operator for + /// this git configuration. Possible values include: 'true', + /// 'false' + /// Properties for Helm + /// operator. + /// The provisioning state of the + /// resource provider. Possible values include: 'Accepted', 'Deleting', + /// 'Running', 'Succeeded', 'Failed' + /// Compliance Status of the + /// Configuration + public SourceControlConfiguration(string id = default(string), string name = default(string), string type = default(string), string repositoryUrl = default(string), string operatorNamespace = default(string), string operatorInstanceName = default(string), OperatorType? operatorType = default(OperatorType?), string operatorParams = default(string), OperatorScope? operatorScope = default(OperatorScope?), string repositoryPublicKey = default(string), EnableHelmOperator? enableHelmOperator = default(EnableHelmOperator?), HelmOperatorProperties helmOperatorProperties = default(HelmOperatorProperties), ProvisioningState? provisioningState = default(ProvisioningState?), ComplianceStatus complianceStatus = default(ComplianceStatus)) + : base(id, name, type) + { + RepositoryUrl = repositoryUrl; + OperatorNamespace = operatorNamespace; + OperatorInstanceName = operatorInstanceName; + OperatorType = operatorType; + OperatorParams = operatorParams; + OperatorScope = operatorScope; + RepositoryPublicKey = repositoryPublicKey; + EnableHelmOperator = enableHelmOperator; + HelmOperatorProperties = helmOperatorProperties; + ProvisioningState = provisioningState; + ComplianceStatus = complianceStatus; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets url of the SourceControl Repository. + /// + [JsonProperty(PropertyName = "properties.repositoryUrl")] + public string RepositoryUrl { get; set; } + + /// + /// Gets or sets the namespace to which this operator is installed to. + /// Maximum of 253 lower case alphanumeric characters, hyphen and + /// period only. + /// + [JsonProperty(PropertyName = "properties.operatorNamespace")] + public string OperatorNamespace { get; set; } + + /// + /// Gets or sets instance name of the operator - identifying the + /// specific configuration. + /// + [JsonProperty(PropertyName = "properties.operatorInstanceName")] + public string OperatorInstanceName { get; set; } + + /// + /// Gets or sets type of the operator. Possible values include: 'Flux' + /// + [JsonProperty(PropertyName = "properties.operatorType")] + public OperatorType? OperatorType { get; set; } + + /// + /// Gets or sets any Parameters for the Operator instance in string + /// format. + /// + [JsonProperty(PropertyName = "properties.operatorParams")] + public string OperatorParams { get; set; } + + /// + /// Gets or sets scope at which the operator will be installed. + /// Possible values include: 'cluster', 'namespace' + /// + [JsonProperty(PropertyName = "properties.operatorScope")] + public OperatorScope? OperatorScope { get; set; } + + /// + /// Gets public Key associated with this SourceControl configuration + /// (either generated within the cluster or provided by the user). + /// + [JsonProperty(PropertyName = "properties.repositoryPublicKey")] + public string RepositoryPublicKey { get; private set; } + + /// + /// Gets or sets option to enable Helm Operator for this git + /// configuration. Possible values include: 'true', 'false' + /// + [JsonProperty(PropertyName = "properties.enableHelmOperator")] + public EnableHelmOperator? EnableHelmOperator { get; set; } + + /// + /// Gets or sets properties for Helm operator. + /// + [JsonProperty(PropertyName = "properties.helmOperatorProperties")] + public HelmOperatorProperties HelmOperatorProperties { get; set; } + + /// + /// Gets the provisioning state of the resource provider. Possible + /// values include: 'Accepted', 'Deleting', 'Running', 'Succeeded', + /// 'Failed' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public ProvisioningState? ProvisioningState { get; private set; } + + /// + /// Gets compliance Status of the Configuration + /// + [JsonProperty(PropertyName = "properties.complianceStatus")] + public ComplianceStatus ComplianceStatus { get; private set; } + + } +} diff --git a/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Operations.cs b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Operations.cs new file mode 100644 index 0000000000000..8eed38eaf616c --- /dev/null +++ b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/Operations.cs @@ -0,0 +1,406 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.KubernetesConfiguration +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Operations operations. + /// + internal partial class Operations : IServiceOperations, IOperations + { + /// + /// Initializes a new instance of the Operations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal Operations(SourceControlConfigurationClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SourceControlConfigurationClient + /// + public SourceControlConfigurationClient Client { get; private set; } + + /// + /// List all the available operations the KubernetesConfiguration resource + /// provider supports. + /// + /// + /// The API version to be used with the HTTP request. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string apiVersion, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (apiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "apiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.KubernetesConfiguration/operations").ToString(); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List all the available operations the KubernetesConfiguration resource + /// provider supports. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/OperationsExtensions.cs b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/OperationsExtensions.cs new file mode 100644 index 0000000000000..ffaf56b68016e --- /dev/null +++ b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/OperationsExtensions.cs @@ -0,0 +1,97 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.KubernetesConfiguration +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for Operations. + /// + public static partial class OperationsExtensions + { + /// + /// List all the available operations the KubernetesConfiguration resource + /// provider supports. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The API version to be used with the HTTP request. + /// + public static IPage List(this IOperations operations, string apiVersion) + { + return operations.ListAsync(apiVersion).GetAwaiter().GetResult(); + } + + /// + /// List all the available operations the KubernetesConfiguration resource + /// provider supports. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The API version to be used with the HTTP request. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IOperations operations, string apiVersion, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(apiVersion, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List all the available operations the KubernetesConfiguration resource + /// provider supports. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List all the available operations the KubernetesConfiguration resource + /// provider supports. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/SdkInfo_SourceControlConfigurationClient.cs b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/SdkInfo_SourceControlConfigurationClient.cs new file mode 100644 index 0000000000000..6b617a67925dc --- /dev/null +++ b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/SdkInfo_SourceControlConfigurationClient.cs @@ -0,0 +1,28 @@ + +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.KubernetesConfiguration +{ + using System; + using System.Collections.Generic; + using System.Linq; + + internal static partial class SdkInfo + { + public static IEnumerable> ApiInfo_SourceControlConfigurationClient + { + get + { + return new Tuple[] + { + new Tuple("KubernetesConfiguration", "Operations", "2019-11-01-preview"), + new Tuple("KubernetesConfiguration", "SourceControlConfigurations", "2019-11-01-preview"), + }.AsEnumerable(); + } + } + } +} diff --git a/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/SourceControlConfigurationClient.cs b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/SourceControlConfigurationClient.cs new file mode 100644 index 0000000000000..7f5414a5be554 --- /dev/null +++ b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/SourceControlConfigurationClient.cs @@ -0,0 +1,362 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.KubernetesConfiguration +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Serialization; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + + /// + /// Use these APIs to create Source Control Configuration resources through + /// ARM, for Kubernetes Clusters. + /// + public partial class SourceControlConfigurationClient : ServiceClient, ISourceControlConfigurationClient, IAzureClient + { + /// + /// The base URI of the service. + /// + public System.Uri BaseUri { get; set; } + + /// + /// Gets or sets json serialization settings. + /// + public JsonSerializerSettings SerializationSettings { get; private set; } + + /// + /// Gets or sets json deserialization settings. + /// + public JsonSerializerSettings DeserializationSettings { get; private set; } + + /// + /// Credentials needed for the client to connect to Azure. + /// + public ServiceClientCredentials Credentials { get; private set; } + + /// + /// The Azure subscription ID. This is a GUID-formatted string (e.g. + /// 00000000-0000-0000-0000-000000000000) + /// + public string SubscriptionId { get; set; } + + /// + /// The preferred language for the response. + /// + public string AcceptLanguage { get; set; } + + /// + /// The retry timeout in seconds for Long Running Operations. Default value is + /// 30. + /// + public int? LongRunningOperationRetryTimeout { get; set; } + + /// + /// Whether a unique x-ms-client-request-id should be generated. When set to + /// true a unique x-ms-client-request-id value is generated and included in + /// each request. Default is true. + /// + public bool? GenerateClientRequestId { get; set; } + + /// + /// Gets the ISourceControlConfigurationsOperations. + /// + public virtual ISourceControlConfigurationsOperations SourceControlConfigurations { get; private set; } + + /// + /// Gets the IOperations. + /// + public virtual IOperations Operations { get; private set; } + + /// + /// Initializes a new instance of the SourceControlConfigurationClient class. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling SourceControlConfigurationClient.Dispose(). False: will not dispose provided httpClient + protected SourceControlConfigurationClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) + { + Initialize(); + } + + /// + /// Initializes a new instance of the SourceControlConfigurationClient class. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected SourceControlConfigurationClient(params DelegatingHandler[] handlers) : base(handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the SourceControlConfigurationClient class. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected SourceControlConfigurationClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) + { + Initialize(); + } + + /// + /// Initializes a new instance of the SourceControlConfigurationClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + protected SourceControlConfigurationClient(System.Uri baseUri, params DelegatingHandler[] handlers) : this(handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + BaseUri = baseUri; + } + + /// + /// Initializes a new instance of the SourceControlConfigurationClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + protected SourceControlConfigurationClient(System.Uri baseUri, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + BaseUri = baseUri; + } + + /// + /// Initializes a new instance of the SourceControlConfigurationClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public SourceControlConfigurationClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the SourceControlConfigurationClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling SourceControlConfigurationClient.Dispose(). False: will not dispose provided httpClient + /// + /// Thrown when a required parameter is null + /// + public SourceControlConfigurationClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the SourceControlConfigurationClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public SourceControlConfigurationClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the SourceControlConfigurationClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public SourceControlConfigurationClient(System.Uri baseUri, ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + BaseUri = baseUri; + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// Initializes a new instance of the SourceControlConfigurationClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public SourceControlConfigurationClient(System.Uri baseUri, ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + BaseUri = baseUri; + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + + /// + /// An optional partial-method to perform custom initialization. + /// + partial void CustomInitialize(); + /// + /// Initializes client properties. + /// + private void Initialize() + { + SourceControlConfigurations = new SourceControlConfigurationsOperations(this); + Operations = new Operations(this); + BaseUri = new System.Uri("https://management.azure.com"); + AcceptLanguage = "en-US"; + LongRunningOperationRetryTimeout = 30; + GenerateClientRequestId = true; + SerializationSettings = new JsonSerializerSettings + { + Formatting = Newtonsoft.Json.Formatting.Indented, + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new ReadOnlyJsonContractResolver(), + Converters = new List + { + new Iso8601TimeSpanConverter() + } + }; + SerializationSettings.Converters.Add(new TransformationJsonConverter()); + DeserializationSettings = new JsonSerializerSettings + { + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new ReadOnlyJsonContractResolver(), + Converters = new List + { + new Iso8601TimeSpanConverter() + } + }; + CustomInitialize(); + DeserializationSettings.Converters.Add(new TransformationJsonConverter()); + DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); + } + } +} diff --git a/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/SourceControlConfigurationsOperations.cs b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/SourceControlConfigurationsOperations.cs new file mode 100644 index 0000000000000..94be6868ee08c --- /dev/null +++ b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/SourceControlConfigurationsOperations.cs @@ -0,0 +1,1168 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.KubernetesConfiguration +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SourceControlConfigurationsOperations operations. + /// + internal partial class SourceControlConfigurationsOperations : IServiceOperations, ISourceControlConfigurationsOperations + { + /// + /// Initializes a new instance of the SourceControlConfigurationsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal SourceControlConfigurationsOperations(SourceControlConfigurationClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the SourceControlConfigurationClient + /// + public SourceControlConfigurationClient Client { get; private set; } + + /// + /// Gets details of the Source Control Configuration. + /// + /// + /// The name of the resource group. + /// + /// + /// The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS + /// clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). Possible + /// values include: 'Microsoft.ContainerService', 'Microsoft.Kubernetes' + /// + /// + /// The Kubernetes cluster resource name - either managedClusters (for AKS + /// clusters) or connectedClusters (for OnPrem K8S clusters). Possible values + /// include: 'managedClusters', 'connectedClusters' + /// + /// + /// The name of the kubernetes cluster. + /// + /// + /// Name of the Source Control Configuration. + /// + /// + /// The API version to be used with the HTTP request. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string clusterRp, string clusterResourceName, string clusterName, string sourceControlConfigurationName, string apiVersion, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (clusterRp == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "clusterRp"); + } + if (clusterResourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "clusterResourceName"); + } + if (clusterName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "clusterName"); + } + if (sourceControlConfigurationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sourceControlConfigurationName"); + } + if (apiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "apiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("clusterRp", clusterRp); + tracingParameters.Add("clusterResourceName", clusterResourceName); + tracingParameters.Add("clusterName", clusterName); + tracingParameters.Add("sourceControlConfigurationName", sourceControlConfigurationName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{clusterRp}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(clusterRp, Client.SerializationSettings).Trim('"'))); + _url = _url.Replace("{clusterResourceName}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(clusterResourceName, Client.SerializationSettings).Trim('"'))); + _url = _url.Replace("{clusterName}", System.Uri.EscapeDataString(clusterName)); + _url = _url.Replace("{sourceControlConfigurationName}", System.Uri.EscapeDataString(sourceControlConfigurationName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Create a new Kubernetes Source Control Configuration. + /// + /// + /// The name of the resource group. + /// + /// + /// The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS + /// clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). Possible + /// values include: 'Microsoft.ContainerService', 'Microsoft.Kubernetes' + /// + /// + /// The Kubernetes cluster resource name - either managedClusters (for AKS + /// clusters) or connectedClusters (for OnPrem K8S clusters). Possible values + /// include: 'managedClusters', 'connectedClusters' + /// + /// + /// The name of the kubernetes cluster. + /// + /// + /// Name of the Source Control Configuration. + /// + /// + /// The API version to be used with the HTTP request. + /// + /// + /// Properties necessary to Create KubernetesConfiguration. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string clusterRp, string clusterResourceName, string clusterName, string sourceControlConfigurationName, string apiVersion, SourceControlConfiguration sourceControlConfiguration, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (clusterRp == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "clusterRp"); + } + if (clusterResourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "clusterResourceName"); + } + if (clusterName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "clusterName"); + } + if (sourceControlConfigurationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sourceControlConfigurationName"); + } + if (apiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "apiVersion"); + } + if (sourceControlConfiguration == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sourceControlConfiguration"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("clusterRp", clusterRp); + tracingParameters.Add("clusterResourceName", clusterResourceName); + tracingParameters.Add("clusterName", clusterName); + tracingParameters.Add("sourceControlConfigurationName", sourceControlConfigurationName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("sourceControlConfiguration", sourceControlConfiguration); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{clusterRp}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(clusterRp, Client.SerializationSettings).Trim('"'))); + _url = _url.Replace("{clusterResourceName}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(clusterResourceName, Client.SerializationSettings).Trim('"'))); + _url = _url.Replace("{clusterName}", System.Uri.EscapeDataString(clusterName)); + _url = _url.Replace("{sourceControlConfigurationName}", System.Uri.EscapeDataString(sourceControlConfigurationName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(sourceControlConfiguration != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(sourceControlConfiguration, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// This will delete the YAML file used to set up the Source control + /// configuration, thus stopping future sync from the source repo. + /// + /// + /// The name of the resource group. + /// + /// + /// The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS + /// clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). Possible + /// values include: 'Microsoft.ContainerService', 'Microsoft.Kubernetes' + /// + /// + /// The Kubernetes cluster resource name - either managedClusters (for AKS + /// clusters) or connectedClusters (for OnPrem K8S clusters). Possible values + /// include: 'managedClusters', 'connectedClusters' + /// + /// + /// The name of the kubernetes cluster. + /// + /// + /// Name of the Source Control Configuration. + /// + /// + /// The API version to be used with the HTTP request. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string clusterRp, string clusterResourceName, string clusterName, string sourceControlConfigurationName, string apiVersion, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, clusterRp, clusterResourceName, clusterName, sourceControlConfigurationName, apiVersion, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// List all Source Control Configurations. + /// + /// + /// The name of the resource group. + /// + /// + /// The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS + /// clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). Possible + /// values include: 'Microsoft.ContainerService', 'Microsoft.Kubernetes' + /// + /// + /// The Kubernetes cluster resource name - either managedClusters (for AKS + /// clusters) or connectedClusters (for OnPrem K8S clusters). Possible values + /// include: 'managedClusters', 'connectedClusters' + /// + /// + /// The name of the kubernetes cluster. + /// + /// + /// The API version to be used with the HTTP request. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string clusterRp, string clusterResourceName, string clusterName, string apiVersion, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (clusterRp == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "clusterRp"); + } + if (clusterResourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "clusterResourceName"); + } + if (clusterName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "clusterName"); + } + if (apiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "apiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("clusterRp", clusterRp); + tracingParameters.Add("clusterResourceName", clusterResourceName); + tracingParameters.Add("clusterName", clusterName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{clusterRp}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(clusterRp, Client.SerializationSettings).Trim('"'))); + _url = _url.Replace("{clusterResourceName}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(clusterResourceName, Client.SerializationSettings).Trim('"'))); + _url = _url.Replace("{clusterName}", System.Uri.EscapeDataString(clusterName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// This will delete the YAML file used to set up the Source control + /// configuration, thus stopping future sync from the source repo. + /// + /// + /// The name of the resource group. + /// + /// + /// The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS + /// clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). Possible + /// values include: 'Microsoft.ContainerService', 'Microsoft.Kubernetes' + /// + /// + /// The Kubernetes cluster resource name - either managedClusters (for AKS + /// clusters) or connectedClusters (for OnPrem K8S clusters). Possible values + /// include: 'managedClusters', 'connectedClusters' + /// + /// + /// The name of the kubernetes cluster. + /// + /// + /// Name of the Source Control Configuration. + /// + /// + /// The API version to be used with the HTTP request. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string clusterRp, string clusterResourceName, string clusterName, string sourceControlConfigurationName, string apiVersion, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (clusterRp == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "clusterRp"); + } + if (clusterResourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "clusterResourceName"); + } + if (clusterName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "clusterName"); + } + if (sourceControlConfigurationName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sourceControlConfigurationName"); + } + if (apiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "apiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("clusterRp", clusterRp); + tracingParameters.Add("clusterResourceName", clusterResourceName); + tracingParameters.Add("clusterName", clusterName); + tracingParameters.Add("sourceControlConfigurationName", sourceControlConfigurationName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{clusterRp}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(clusterRp, Client.SerializationSettings).Trim('"'))); + _url = _url.Replace("{clusterResourceName}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(clusterResourceName, Client.SerializationSettings).Trim('"'))); + _url = _url.Replace("{clusterName}", System.Uri.EscapeDataString(clusterName)); + _url = _url.Replace("{sourceControlConfigurationName}", System.Uri.EscapeDataString(sourceControlConfigurationName)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 204) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List all Source Control Configurations. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/SourceControlConfigurationsOperationsExtensions.cs b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/SourceControlConfigurationsOperationsExtensions.cs new file mode 100644 index 0000000000000..0fe53d62387cb --- /dev/null +++ b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Generated/SourceControlConfigurationsOperationsExtensions.cs @@ -0,0 +1,417 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.KubernetesConfiguration +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for SourceControlConfigurationsOperations. + /// + public static partial class SourceControlConfigurationsOperationsExtensions + { + /// + /// Gets details of the Source Control Configuration. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS + /// clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). Possible + /// values include: 'Microsoft.ContainerService', 'Microsoft.Kubernetes' + /// + /// + /// The Kubernetes cluster resource name - either managedClusters (for AKS + /// clusters) or connectedClusters (for OnPrem K8S clusters). Possible values + /// include: 'managedClusters', 'connectedClusters' + /// + /// + /// The name of the kubernetes cluster. + /// + /// + /// Name of the Source Control Configuration. + /// + /// + /// The API version to be used with the HTTP request. + /// + public static SourceControlConfiguration Get(this ISourceControlConfigurationsOperations operations, string resourceGroupName, string clusterRp, string clusterResourceName, string clusterName, string sourceControlConfigurationName, string apiVersion) + { + return operations.GetAsync(resourceGroupName, clusterRp, clusterResourceName, clusterName, sourceControlConfigurationName, apiVersion).GetAwaiter().GetResult(); + } + + /// + /// Gets details of the Source Control Configuration. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS + /// clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). Possible + /// values include: 'Microsoft.ContainerService', 'Microsoft.Kubernetes' + /// + /// + /// The Kubernetes cluster resource name - either managedClusters (for AKS + /// clusters) or connectedClusters (for OnPrem K8S clusters). Possible values + /// include: 'managedClusters', 'connectedClusters' + /// + /// + /// The name of the kubernetes cluster. + /// + /// + /// Name of the Source Control Configuration. + /// + /// + /// The API version to be used with the HTTP request. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ISourceControlConfigurationsOperations operations, string resourceGroupName, string clusterRp, string clusterResourceName, string clusterName, string sourceControlConfigurationName, string apiVersion, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, clusterRp, clusterResourceName, clusterName, sourceControlConfigurationName, apiVersion, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create a new Kubernetes Source Control Configuration. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS + /// clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). Possible + /// values include: 'Microsoft.ContainerService', 'Microsoft.Kubernetes' + /// + /// + /// The Kubernetes cluster resource name - either managedClusters (for AKS + /// clusters) or connectedClusters (for OnPrem K8S clusters). Possible values + /// include: 'managedClusters', 'connectedClusters' + /// + /// + /// The name of the kubernetes cluster. + /// + /// + /// Name of the Source Control Configuration. + /// + /// + /// The API version to be used with the HTTP request. + /// + /// + /// Properties necessary to Create KubernetesConfiguration. + /// + public static SourceControlConfiguration CreateOrUpdate(this ISourceControlConfigurationsOperations operations, string resourceGroupName, string clusterRp, string clusterResourceName, string clusterName, string sourceControlConfigurationName, string apiVersion, SourceControlConfiguration sourceControlConfiguration) + { + return operations.CreateOrUpdateAsync(resourceGroupName, clusterRp, clusterResourceName, clusterName, sourceControlConfigurationName, apiVersion, sourceControlConfiguration).GetAwaiter().GetResult(); + } + + /// + /// Create a new Kubernetes Source Control Configuration. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS + /// clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). Possible + /// values include: 'Microsoft.ContainerService', 'Microsoft.Kubernetes' + /// + /// + /// The Kubernetes cluster resource name - either managedClusters (for AKS + /// clusters) or connectedClusters (for OnPrem K8S clusters). Possible values + /// include: 'managedClusters', 'connectedClusters' + /// + /// + /// The name of the kubernetes cluster. + /// + /// + /// Name of the Source Control Configuration. + /// + /// + /// The API version to be used with the HTTP request. + /// + /// + /// Properties necessary to Create KubernetesConfiguration. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this ISourceControlConfigurationsOperations operations, string resourceGroupName, string clusterRp, string clusterResourceName, string clusterName, string sourceControlConfigurationName, string apiVersion, SourceControlConfiguration sourceControlConfiguration, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, clusterRp, clusterResourceName, clusterName, sourceControlConfigurationName, apiVersion, sourceControlConfiguration, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// This will delete the YAML file used to set up the Source control + /// configuration, thus stopping future sync from the source repo. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS + /// clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). Possible + /// values include: 'Microsoft.ContainerService', 'Microsoft.Kubernetes' + /// + /// + /// The Kubernetes cluster resource name - either managedClusters (for AKS + /// clusters) or connectedClusters (for OnPrem K8S clusters). Possible values + /// include: 'managedClusters', 'connectedClusters' + /// + /// + /// The name of the kubernetes cluster. + /// + /// + /// Name of the Source Control Configuration. + /// + /// + /// The API version to be used with the HTTP request. + /// + public static void Delete(this ISourceControlConfigurationsOperations operations, string resourceGroupName, string clusterRp, string clusterResourceName, string clusterName, string sourceControlConfigurationName, string apiVersion) + { + operations.DeleteAsync(resourceGroupName, clusterRp, clusterResourceName, clusterName, sourceControlConfigurationName, apiVersion).GetAwaiter().GetResult(); + } + + /// + /// This will delete the YAML file used to set up the Source control + /// configuration, thus stopping future sync from the source repo. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS + /// clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). Possible + /// values include: 'Microsoft.ContainerService', 'Microsoft.Kubernetes' + /// + /// + /// The Kubernetes cluster resource name - either managedClusters (for AKS + /// clusters) or connectedClusters (for OnPrem K8S clusters). Possible values + /// include: 'managedClusters', 'connectedClusters' + /// + /// + /// The name of the kubernetes cluster. + /// + /// + /// Name of the Source Control Configuration. + /// + /// + /// The API version to be used with the HTTP request. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this ISourceControlConfigurationsOperations operations, string resourceGroupName, string clusterRp, string clusterResourceName, string clusterName, string sourceControlConfigurationName, string apiVersion, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, clusterRp, clusterResourceName, clusterName, sourceControlConfigurationName, apiVersion, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// List all Source Control Configurations. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS + /// clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). Possible + /// values include: 'Microsoft.ContainerService', 'Microsoft.Kubernetes' + /// + /// + /// The Kubernetes cluster resource name - either managedClusters (for AKS + /// clusters) or connectedClusters (for OnPrem K8S clusters). Possible values + /// include: 'managedClusters', 'connectedClusters' + /// + /// + /// The name of the kubernetes cluster. + /// + /// + /// The API version to be used with the HTTP request. + /// + public static IPage List(this ISourceControlConfigurationsOperations operations, string resourceGroupName, string clusterRp, string clusterResourceName, string clusterName, string apiVersion) + { + return operations.ListAsync(resourceGroupName, clusterRp, clusterResourceName, clusterName, apiVersion).GetAwaiter().GetResult(); + } + + /// + /// List all Source Control Configurations. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS + /// clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). Possible + /// values include: 'Microsoft.ContainerService', 'Microsoft.Kubernetes' + /// + /// + /// The Kubernetes cluster resource name - either managedClusters (for AKS + /// clusters) or connectedClusters (for OnPrem K8S clusters). Possible values + /// include: 'managedClusters', 'connectedClusters' + /// + /// + /// The name of the kubernetes cluster. + /// + /// + /// The API version to be used with the HTTP request. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this ISourceControlConfigurationsOperations operations, string resourceGroupName, string clusterRp, string clusterResourceName, string clusterName, string apiVersion, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, clusterRp, clusterResourceName, clusterName, apiVersion, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// This will delete the YAML file used to set up the Source control + /// configuration, thus stopping future sync from the source repo. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS + /// clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). Possible + /// values include: 'Microsoft.ContainerService', 'Microsoft.Kubernetes' + /// + /// + /// The Kubernetes cluster resource name - either managedClusters (for AKS + /// clusters) or connectedClusters (for OnPrem K8S clusters). Possible values + /// include: 'managedClusters', 'connectedClusters' + /// + /// + /// The name of the kubernetes cluster. + /// + /// + /// Name of the Source Control Configuration. + /// + /// + /// The API version to be used with the HTTP request. + /// + public static void BeginDelete(this ISourceControlConfigurationsOperations operations, string resourceGroupName, string clusterRp, string clusterResourceName, string clusterName, string sourceControlConfigurationName, string apiVersion) + { + operations.BeginDeleteAsync(resourceGroupName, clusterRp, clusterResourceName, clusterName, sourceControlConfigurationName, apiVersion).GetAwaiter().GetResult(); + } + + /// + /// This will delete the YAML file used to set up the Source control + /// configuration, thus stopping future sync from the source repo. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The Kubernetes cluster RP - either Microsoft.ContainerService (for AKS + /// clusters) or Microsoft.Kubernetes (for OnPrem K8S clusters). Possible + /// values include: 'Microsoft.ContainerService', 'Microsoft.Kubernetes' + /// + /// + /// The Kubernetes cluster resource name - either managedClusters (for AKS + /// clusters) or connectedClusters (for OnPrem K8S clusters). Possible values + /// include: 'managedClusters', 'connectedClusters' + /// + /// + /// The name of the kubernetes cluster. + /// + /// + /// Name of the Source Control Configuration. + /// + /// + /// The API version to be used with the HTTP request. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this ISourceControlConfigurationsOperations operations, string resourceGroupName, string clusterRp, string clusterResourceName, string clusterName, string sourceControlConfigurationName, string apiVersion, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, clusterRp, clusterResourceName, clusterName, sourceControlConfigurationName, apiVersion, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// List all Source Control Configurations. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this ISourceControlConfigurationsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List all Source Control Configurations. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this ISourceControlConfigurationsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Microsoft.Azure.Management.KubernetesConfiguration.csproj b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Microsoft.Azure.Management.KubernetesConfiguration.csproj new file mode 100644 index 0000000000000..17afb4c56a888 --- /dev/null +++ b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Microsoft.Azure.Management.KubernetesConfiguration.csproj @@ -0,0 +1,33 @@ + + + + + + + Microsoft.Azure.Management.KubernetesConfiguration + Provides Microsoft Azure KubernetesConfiguration management operations including the ability to create, update and delete runbooks and schedules. + 3.8.2-preview + + Microsoft Azure KubernetesConfiguration Management Library + Microsoft.Azure.Management.KubernetesConfiguration + KubernetesConfiguration; + + + + + + $(SdkTargetFx) + + + + + + + + + + + \ No newline at end of file diff --git a/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/generate.ps1 b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/generate.ps1 new file mode 100644 index 0000000000000..fef7483cba9a8 --- /dev/null +++ b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/generate.ps1 @@ -0,0 +1 @@ +Start-AutoRestCodeGeneration -ResourceProvider "kubernetesconfiguration/resource-manager" -AutoRestVersion "v2" -AutoRestCodeGenerationFlags --opt-in-extensible-enums diff --git a/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/tests/Helpers/RecordedDelegatingHandler.cs b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/tests/Helpers/RecordedDelegatingHandler.cs new file mode 100644 index 0000000000000..47d938476fe91 --- /dev/null +++ b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/tests/Helpers/RecordedDelegatingHandler.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +namespace KubernetesConfiguration.Tests.Helpers +{ + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + public class RecordedDelegatingHandler : DelegatingHandler + { + /// + /// Passes the async operation to the base class + /// + /// The request to send + /// The cancellation token for the async operation + /// The async task + protected override async Task SendAsync(HttpRequestMessage request, + CancellationToken cancellationToken) + { + return await base.SendAsync(request, cancellationToken); + } + } +} diff --git a/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/tests/Microsoft.Azure.Management.KubernetesConfiguration.Tests.csproj b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/tests/Microsoft.Azure.Management.KubernetesConfiguration.Tests.csproj new file mode 100644 index 0000000000000..f1d4c6e50d1d2 --- /dev/null +++ b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/tests/Microsoft.Azure.Management.KubernetesConfiguration.Tests.csproj @@ -0,0 +1,45 @@ + + + + KubernetesConfiguration.Tests + KubernetesConfiguration.Tests + 1.0.0 + Test Project for Automation tests + true + + + + + + + + + + + + + + C:\Users\nanthi\.nuget\packages\newtonsoft.json\10.0.3\lib\netstandard1.3\Newtonsoft.Json.dll + + + + + + PreserveNewest + + + + + + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + diff --git a/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/tests/ScenarioTests/SourceControlConfigurationTests.cs b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/tests/ScenarioTests/SourceControlConfigurationTests.cs new file mode 100644 index 0000000000000..2d859fbf7817e --- /dev/null +++ b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/tests/ScenarioTests/SourceControlConfigurationTests.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +namespace KubernetesConfiguration.Tests.ScenarioTests +{ + using System.Linq; + using Microsoft.Rest.ClientRuntime.Azure.TestFramework; + using Xunit; + using Microsoft.Azure.Management.KubernetesConfiguration.Models; + using KubernetesConfiguration.Tests.TestSupport; + using Microsoft.Azure.Management.KubernetesConfiguration.Tests.TestSupport; + + public class SourceControlConfigurationTest + { + [Fact] + public void CanCreateUpdateDeleteSourceControlConfiguration() + { + ClusterInfo cluster = new ClusterInfo( + name: "azure-arc5", + type: ClusterInfo.ClusterType.connectedClusters, + location: "eastus2euap", + resourceGroup: "haikudevtesting" + ); + + SourceControlConfiguration configuration = new SourceControlConfiguration( + name: "netsdktestconfig01a", + type: SourceControlConfigurationTestBase.ConfigurationType, + repositoryUrl: "git://github.com/anubhav929/flux-get-started", + operatorNamespace: "netsdktestconfig01a-opns", + operatorInstanceName: "netsdktestconfig01a-opin", + operatorParams: "--git-readonly", + operatorScope: "namespace", + enableHelmOperator: "true" + ); + + using (var context = MockContext.Start(this.GetType())) + { + using (var testFixture = new SourceControlConfigurationTestBase(context)) + { + testFixture.Cluster = cluster; + testFixture.SourceControlConfiguration = configuration; + + // List configurations and get count + var configurations = testFixture.ListSourceControlConfigurations(); + int configCount = configurations.Count(); + + // Create a configuration + var newConfig = testFixture.CreateSourceControlConfiguration(); + Assert.NotNull(newConfig); + + // Get the configuration and verify + var config = testFixture.GetSourceControlConfiguration(); + Assert.Equal(configuration.Name, config.Name); + Assert.True((config.ComplianceStatus.ComplianceState.ToString() == "Pending") || (config.ComplianceStatus.ComplianceState.ToString() == "Installed")); + + // List configurations and get count to confirm it is up by one + configurations = testFixture.ListSourceControlConfigurations(); + Assert.True(configurations.Count() == configCount + 1); + + // Delete the configuration created + testFixture.DeleteSourceControlConfiguration(); + + // List configurations and get count to confirm it is what we started with + configurations = testFixture.ListSourceControlConfigurations(); + Assert.True(configurations.Count() == configCount); + } + } + } + } +} + + diff --git a/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/tests/SessionRecords/SourceControlConfigurationTest/CanCreateUpdateDeleteSourceControlConfiguration.json b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/tests/SessionRecords/SourceControlConfigurationTest/CanCreateUpdateDeleteSourceControlConfiguration.json new file mode 100644 index 0000000000000..fe32ac0febe59 --- /dev/null +++ b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/tests/SessionRecords/SourceControlConfigurationTest/CanCreateUpdateDeleteSourceControlConfiguration.json @@ -0,0 +1,419 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/cd45f23b-b832-4fa4-a434-1bf7e6f14a5a/resourceGroups/haikudevtesting/providers/Microsoft.Kubernetes/connectedClusters/azure-arc5/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations?api-version=2019-11-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvY2Q0NWYyM2ItYjgzMi00ZmE0LWE0MzQtMWJmN2U2ZjE0YTVhL3Jlc291cmNlR3JvdXBzL2hhaWt1ZGV2dGVzdGluZy9wcm92aWRlcnMvTWljcm9zb2Z0Lkt1YmVybmV0ZXMvY29ubmVjdGVkQ2x1c3RlcnMvYXp1cmUtYXJjNS9wcm92aWRlcnMvTWljcm9zb2Z0Lkt1YmVybmV0ZXNDb25maWd1cmF0aW9uL3NvdXJjZUNvbnRyb2xDb25maWd1cmF0aW9ucz9hcGktdmVyc2lvbj0yMDE5LTExLTAxLXByZXZpZXc=", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "d565be1d-91ef-4e17-9be6-ec4d7d3a54e2" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.26614.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18363.", + "Microsoft.Azure.Management.KubernetesConfiguration.SourceControlConfigurationClient/3.8.2.preview" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 21 May 2020 05:47:27 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "openresty/1.15.8.2" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11998" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "api-supported-versions": [ + "2019-11-01-Preview" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "a133e9f4-ed0a-4f0e-8bcf-b14ef94e38d9" + ], + "x-ms-correlation-request-id": [ + "a133e9f4-ed0a-4f0e-8bcf-b14ef94e38d9" + ], + "x-ms-routing-request-id": [ + "WESTUS:20200521T054728Z:a133e9f4-ed0a-4f0e-8bcf-b14ef94e38d9" + ], + "Content-Length": [ + "28" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"value\": [],\r\n \"nextLink\": null\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/cd45f23b-b832-4fa4-a434-1bf7e6f14a5a/resourceGroups/haikudevtesting/providers/Microsoft.Kubernetes/connectedClusters/azure-arc5/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations?api-version=2019-11-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvY2Q0NWYyM2ItYjgzMi00ZmE0LWE0MzQtMWJmN2U2ZjE0YTVhL3Jlc291cmNlR3JvdXBzL2hhaWt1ZGV2dGVzdGluZy9wcm92aWRlcnMvTWljcm9zb2Z0Lkt1YmVybmV0ZXMvY29ubmVjdGVkQ2x1c3RlcnMvYXp1cmUtYXJjNS9wcm92aWRlcnMvTWljcm9zb2Z0Lkt1YmVybmV0ZXNDb25maWd1cmF0aW9uL3NvdXJjZUNvbnRyb2xDb25maWd1cmF0aW9ucz9hcGktdmVyc2lvbj0yMDE5LTExLTAxLXByZXZpZXc=", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "481f8689-7bbf-4c69-b178-c779dd60c7ca" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.26614.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18363.", + "Microsoft.Azure.Management.KubernetesConfiguration.SourceControlConfigurationClient/3.8.2.preview" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 21 May 2020 05:47:29 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "openresty/1.15.8.2" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-request-id": [ + "b252b58c-ce13-413f-ad20-25482be75326" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11996" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "api-supported-versions": [ + "2019-11-01-Preview" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-correlation-request-id": [ + "b252b58c-ce13-413f-ad20-25482be75326" + ], + "x-ms-routing-request-id": [ + "WESTUS:20200521T054729Z:b252b58c-ce13-413f-ad20-25482be75326" + ], + "Content-Length": [ + "1001" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"id\": \"/subscriptions/cd45f23b-b832-4fa4-a434-1bf7e6f14a5a/resourceGroups/haikudevtesting/providers/Microsoft.Kubernetes/connectedClusters/azure-arc5/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/netsdktestconfig01a\",\r\n \"name\": \"netsdktestconfig01a\",\r\n \"type\": \"Microsoft.KubernetesConfiguration/sourceControlConfigurations\",\r\n \"properties\": {\r\n \"operatorNamespace\": \"netsdktestconfig01a-opns\",\r\n \"provisioningState\": \"Succeeded\",\r\n \"complianceStatus\": {\r\n \"complianceState\": \"Pending\",\r\n \"lastConfigApplied\": \"0001-01-01T00:00:00\",\r\n \"message\": \"{\\\"OperatorMessage\\\":null,\\\"ClusterState\\\":null}\",\r\n \"messageLevel\": 3\r\n },\r\n \"enableHelmOperator\": true,\r\n \"repositoryUrl\": \"git://github.com/anubhav929/flux-get-started\",\r\n \"operatorInstanceName\": \"netsdktestconfig01a-opin\",\r\n \"operatorType\": \"Flux\",\r\n \"operatorScope\": \"namespace\",\r\n \"operatorParams\": \"--git-readonly\",\r\n \"repositoryPublicKey\": \"\",\r\n \"configKind\": 0,\r\n \"createdDate\": \"2020-05-20T22:47:28.9579829-07:00\",\r\n \"lastModifiedDate\": \"2020-05-20T22:47:28.957983-07:00\"\r\n }\r\n }\r\n ],\r\n \"nextLink\": null\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/cd45f23b-b832-4fa4-a434-1bf7e6f14a5a/resourceGroups/haikudevtesting/providers/Microsoft.Kubernetes/connectedClusters/azure-arc5/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations?api-version=2019-11-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvY2Q0NWYyM2ItYjgzMi00ZmE0LWE0MzQtMWJmN2U2ZjE0YTVhL3Jlc291cmNlR3JvdXBzL2hhaWt1ZGV2dGVzdGluZy9wcm92aWRlcnMvTWljcm9zb2Z0Lkt1YmVybmV0ZXMvY29ubmVjdGVkQ2x1c3RlcnMvYXp1cmUtYXJjNS9wcm92aWRlcnMvTWljcm9zb2Z0Lkt1YmVybmV0ZXNDb25maWd1cmF0aW9uL3NvdXJjZUNvbnRyb2xDb25maWd1cmF0aW9ucz9hcGktdmVyc2lvbj0yMDE5LTExLTAxLXByZXZpZXc=", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "4e3d1e12-b27e-4a58-980e-506ee6015916" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.26614.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18363.", + "Microsoft.Azure.Management.KubernetesConfiguration.SourceControlConfigurationClient/3.8.2.preview" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 21 May 2020 05:47:29 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "openresty/1.15.8.2" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11995" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "api-supported-versions": [ + "2019-11-01-Preview" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "8ee236bc-919c-4e19-888b-1339032dea96" + ], + "x-ms-correlation-request-id": [ + "8ee236bc-919c-4e19-888b-1339032dea96" + ], + "x-ms-routing-request-id": [ + "WESTUS:20200521T054730Z:8ee236bc-919c-4e19-888b-1339032dea96" + ], + "Content-Length": [ + "28" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"value\": [],\r\n \"nextLink\": null\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/cd45f23b-b832-4fa4-a434-1bf7e6f14a5a/resourceGroups/haikudevtesting/providers/Microsoft.Kubernetes/connectedClusters/azure-arc5/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/netsdktestconfig01a?api-version=2019-11-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvY2Q0NWYyM2ItYjgzMi00ZmE0LWE0MzQtMWJmN2U2ZjE0YTVhL3Jlc291cmNlR3JvdXBzL2hhaWt1ZGV2dGVzdGluZy9wcm92aWRlcnMvTWljcm9zb2Z0Lkt1YmVybmV0ZXMvY29ubmVjdGVkQ2x1c3RlcnMvYXp1cmUtYXJjNS9wcm92aWRlcnMvTWljcm9zb2Z0Lkt1YmVybmV0ZXNDb25maWd1cmF0aW9uL3NvdXJjZUNvbnRyb2xDb25maWd1cmF0aW9ucy9uZXRzZGt0ZXN0Y29uZmlnMDFhP2FwaS12ZXJzaW9uPTIwMTktMTEtMDEtcHJldmlldw==", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {\r\n \"repositoryUrl\": \"git://github.com/anubhav929/flux-get-started\",\r\n \"operatorNamespace\": \"netsdktestconfig01a-opns\",\r\n \"operatorInstanceName\": \"netsdktestconfig01a-opin\",\r\n \"operatorParams\": \"--git-readonly\",\r\n \"operatorScope\": \"namespace\",\r\n \"enableHelmOperator\": \"true\"\r\n }\r\n}", + "RequestHeaders": { + "x-ms-client-request-id": [ + "40f4ef0b-65af-492c-b55b-308a9703f439" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.26614.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18363.", + "Microsoft.Azure.Management.KubernetesConfiguration.SourceControlConfigurationClient/3.8.2.preview" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "319" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 21 May 2020 05:47:28 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Location": [ + "/subscriptions/cd45f23b-b832-4fa4-a434-1bf7e6f14a5a/resourceGroups/haikudevtesting/providers/Microsoft.Kubernetes/connectedClusters/azure-arc5/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/netsdktestconfig01a" + ], + "Server": [ + "openresty/1.15.8.2" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1199" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "api-supported-versions": [ + "2019-11-01-Preview" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "f8943a26-b54e-4bc4-8027-ed937729d67e" + ], + "x-ms-correlation-request-id": [ + "f8943a26-b54e-4bc4-8027-ed937729d67e" + ], + "x-ms-routing-request-id": [ + "WESTUS:20200521T054729Z:f8943a26-b54e-4bc4-8027-ed937729d67e" + ], + "Content-Length": [ + "973" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/cd45f23b-b832-4fa4-a434-1bf7e6f14a5a/resourceGroups/haikudevtesting/providers/Microsoft.Kubernetes/connectedClusters/azure-arc5/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/netsdktestconfig01a\",\r\n \"name\": \"netsdktestconfig01a\",\r\n \"type\": \"Microsoft.KubernetesConfiguration/sourceControlConfigurations\",\r\n \"properties\": {\r\n \"operatorNamespace\": \"netsdktestconfig01a-opns\",\r\n \"provisioningState\": \"Succeeded\",\r\n \"complianceStatus\": {\r\n \"complianceState\": \"Pending\",\r\n \"lastConfigApplied\": \"0001-01-01T00:00:00\",\r\n \"message\": \"{\\\"OperatorMessage\\\":null,\\\"ClusterState\\\":null}\",\r\n \"messageLevel\": 3\r\n },\r\n \"enableHelmOperator\": true,\r\n \"repositoryUrl\": \"git://github.com/anubhav929/flux-get-started\",\r\n \"operatorInstanceName\": \"netsdktestconfig01a-opin\",\r\n \"operatorType\": \"Flux\",\r\n \"operatorScope\": \"namespace\",\r\n \"operatorParams\": \"--git-readonly\",\r\n \"repositoryPublicKey\": \"\",\r\n \"configKind\": 0,\r\n \"createdDate\": \"2020-05-20T22:47:28.9579829-07:00\",\r\n \"lastModifiedDate\": \"2020-05-20T22:47:28.957983-07:00\"\r\n }\r\n}", + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/cd45f23b-b832-4fa4-a434-1bf7e6f14a5a/resourceGroups/haikudevtesting/providers/Microsoft.Kubernetes/connectedClusters/azure-arc5/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/netsdktestconfig01a?api-version=2019-11-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvY2Q0NWYyM2ItYjgzMi00ZmE0LWE0MzQtMWJmN2U2ZjE0YTVhL3Jlc291cmNlR3JvdXBzL2hhaWt1ZGV2dGVzdGluZy9wcm92aWRlcnMvTWljcm9zb2Z0Lkt1YmVybmV0ZXMvY29ubmVjdGVkQ2x1c3RlcnMvYXp1cmUtYXJjNS9wcm92aWRlcnMvTWljcm9zb2Z0Lkt1YmVybmV0ZXNDb25maWd1cmF0aW9uL3NvdXJjZUNvbnRyb2xDb25maWd1cmF0aW9ucy9uZXRzZGt0ZXN0Y29uZmlnMDFhP2FwaS12ZXJzaW9uPTIwMTktMTEtMDEtcHJldmlldw==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "1be71015-11c4-4a16-8a53-2f892fd61c93" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.26614.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18363.", + "Microsoft.Azure.Management.KubernetesConfiguration.SourceControlConfigurationClient/3.8.2.preview" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 21 May 2020 05:47:28 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "openresty/1.15.8.2" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-request-id": [ + "d911d974-46d0-4145-bc12-203523e58bad" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "11997" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "api-supported-versions": [ + "2019-11-01-Preview" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-correlation-request-id": [ + "d911d974-46d0-4145-bc12-203523e58bad" + ], + "x-ms-routing-request-id": [ + "WESTUS:20200521T054729Z:d911d974-46d0-4145-bc12-203523e58bad" + ], + "Content-Length": [ + "973" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/cd45f23b-b832-4fa4-a434-1bf7e6f14a5a/resourceGroups/haikudevtesting/providers/Microsoft.Kubernetes/connectedClusters/azure-arc5/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/netsdktestconfig01a\",\r\n \"name\": \"netsdktestconfig01a\",\r\n \"type\": \"Microsoft.KubernetesConfiguration/sourceControlConfigurations\",\r\n \"properties\": {\r\n \"operatorNamespace\": \"netsdktestconfig01a-opns\",\r\n \"provisioningState\": \"Succeeded\",\r\n \"complianceStatus\": {\r\n \"complianceState\": \"Pending\",\r\n \"lastConfigApplied\": \"0001-01-01T00:00:00\",\r\n \"message\": \"{\\\"OperatorMessage\\\":null,\\\"ClusterState\\\":null}\",\r\n \"messageLevel\": 3\r\n },\r\n \"enableHelmOperator\": true,\r\n \"repositoryUrl\": \"git://github.com/anubhav929/flux-get-started\",\r\n \"operatorInstanceName\": \"netsdktestconfig01a-opin\",\r\n \"operatorType\": \"Flux\",\r\n \"operatorScope\": \"namespace\",\r\n \"operatorParams\": \"--git-readonly\",\r\n \"repositoryPublicKey\": \"\",\r\n \"configKind\": 0,\r\n \"createdDate\": \"2020-05-20T22:47:28.9579829-07:00\",\r\n \"lastModifiedDate\": \"2020-05-20T22:47:28.957983-07:00\"\r\n }\r\n}", + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/cd45f23b-b832-4fa4-a434-1bf7e6f14a5a/resourceGroups/haikudevtesting/providers/Microsoft.Kubernetes/connectedClusters/azure-arc5/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/netsdktestconfig01a?api-version=2019-11-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvY2Q0NWYyM2ItYjgzMi00ZmE0LWE0MzQtMWJmN2U2ZjE0YTVhL3Jlc291cmNlR3JvdXBzL2hhaWt1ZGV2dGVzdGluZy9wcm92aWRlcnMvTWljcm9zb2Z0Lkt1YmVybmV0ZXMvY29ubmVjdGVkQ2x1c3RlcnMvYXp1cmUtYXJjNS9wcm92aWRlcnMvTWljcm9zb2Z0Lkt1YmVybmV0ZXNDb25maWd1cmF0aW9uL3NvdXJjZUNvbnRyb2xDb25maWd1cmF0aW9ucy9uZXRzZGt0ZXN0Y29uZmlnMDFhP2FwaS12ZXJzaW9uPTIwMTktMTEtMDEtcHJldmlldw==", + "RequestMethod": "DELETE", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "4812a86a-cbb7-4190-876e-850fc9ffb0f8" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.26614.01", + "OSName/Windows", + "OSVersion/Microsoft.Windows.10.0.18363.", + "Microsoft.Azure.Management.KubernetesConfiguration.SourceControlConfigurationClient/3.8.2.preview" + ] + }, + "ResponseHeaders": { + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 21 May 2020 05:47:29 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "openresty/1.15.8.2" + ], + "x-ms-ratelimit-remaining-subscription-deletes": [ + "14999" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "api-supported-versions": [ + "2019-11-01-Preview" + ], + "X-Content-Type-Options": [ + "nosniff" + ], + "x-ms-request-id": [ + "7fbbabf7-ebb8-4f11-a1ac-7020cf2b062b" + ], + "x-ms-correlation-request-id": [ + "7fbbabf7-ebb8-4f11-a1ac-7020cf2b062b" + ], + "x-ms-routing-request-id": [ + "WESTUS:20200521T054729Z:7fbbabf7-ebb8-4f11-a1ac-7020cf2b062b" + ], + "Content-Length": [ + "152" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ] + }, + "ResponseBody": "{\r\n \"version\": \"1.1\",\r\n \"content\": null,\r\n \"statusCode\": 200,\r\n \"reasonPhrase\": \"OK\",\r\n \"headers\": [],\r\n \"trailingHeaders\": [],\r\n \"requestMessage\": null,\r\n \"isSuccessStatusCode\": true\r\n}", + "StatusCode": 200 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "cd45f23b-b832-4fa4-a434-1bf7e6f14a5a" + } +} \ No newline at end of file diff --git a/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/tests/TestSupport/ClusterInfo.cs b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/tests/TestSupport/ClusterInfo.cs new file mode 100644 index 0000000000000..862c0f18bcc43 --- /dev/null +++ b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/tests/TestSupport/ClusterInfo.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +namespace Microsoft.Azure.Management.KubernetesConfiguration.Tests.TestSupport +{ + /// + /// Class that represents the Cluster + /// + public class ClusterInfo + { + public readonly string ResourceGroup; + public readonly string Name; + public readonly string RpName; + public readonly string Type; + public readonly string Location; + + public enum ClusterType + { + connectedClusters, + managedClusters + } + + public const string ArcClusterRP = "Microsoft.Kubernetes"; + public const string AksClusterRP = "Microsoft.ContainerServices"; + + public ClusterInfo(string name, ClusterType type, string location, string resourceGroup) + { + this.Name = name; + this.Type = type.ToString(); + this.RpName = type == ClusterType.connectedClusters ? ArcClusterRP : AksClusterRP; + this.Location = location; + this.ResourceGroup = resourceGroup; + } + } +} diff --git a/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/tests/TestSupport/SourceControlConfigurationTestBase.cs b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/tests/TestSupport/SourceControlConfigurationTestBase.cs new file mode 100644 index 0000000000000..885a7b30a0bbc --- /dev/null +++ b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/tests/TestSupport/SourceControlConfigurationTestBase.cs @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +namespace KubernetesConfiguration.Tests.TestSupport +{ + using System; + using KubernetesConfiguration.Tests.Helpers; + using Microsoft.Azure.Management.KubernetesConfiguration; + using Microsoft.Azure.Management.Resources; + using Microsoft.Rest.Azure; + using Microsoft.Rest.ClientRuntime.Azure.TestFramework; + using Microsoft.Azure.Management.KubernetesConfiguration.Models; + using Microsoft.Azure.Management.KubernetesConfiguration.Tests.TestSupport; + + /// + /// Base class for tests of SourceControlConfiguration resource type + /// + public class SourceControlConfigurationTestBase : TestBase, IDisposable + { + public SourceControlConfigurationClient SourceControlConfigurationClient { get; set; } + + public SourceControlConfiguration SourceControlConfiguration { get; set; } + + public const string ApiVersion = "2019-11-01-preview"; + public const string ConfigurationType = "SourceControlConfiguration"; + public const string OperatorTypeFlux = "Flux"; + + public ClusterInfo Cluster { get; set; } + + public SourceControlConfigurationTestBase(MockContext context) + { + var handler = new RecordedDelegatingHandler(); + SourceControlConfigurationClient = context.GetServiceClient(false, handler); + } + + /// + /// Creates or Updates a SourceControlConfiguration + /// + /// The SourceControlConfiguration object that was created or updated. + public SourceControlConfiguration CreateSourceControlConfiguration() + { + return SourceControlConfigurationClient.SourceControlConfigurations.CreateOrUpdate( + resourceGroupName: Cluster.ResourceGroup, + clusterRp: Cluster.RpName, + clusterResourceName: Cluster.Type, + clusterName: Cluster.Name, + sourceControlConfigurationName: SourceControlConfiguration.Name, + apiVersion: ApiVersion, + sourceControlConfiguration: SourceControlConfiguration); + } + + /// + /// Get a SourceControlConfiguration + /// + /// The SourceControlConfiguration object. + public SourceControlConfiguration GetSourceControlConfiguration() + { + return SourceControlConfigurationClient.SourceControlConfigurations.Get( + resourceGroupName: Cluster.ResourceGroup, + clusterRp: Cluster.RpName, + clusterResourceName: Cluster.Type, + clusterName: Cluster.Name, + sourceControlConfigurationName: SourceControlConfiguration.Name, + apiVersion: ApiVersion); + } + + /// + /// Delete a SourceControlConfiguration + /// + public void DeleteSourceControlConfiguration() + { + SourceControlConfigurationClient.SourceControlConfigurations.Delete( + resourceGroupName: Cluster.ResourceGroup, + clusterRp: Cluster.RpName, + clusterResourceName: Cluster.Type, + clusterName: Cluster.Name, + sourceControlConfigurationName: SourceControlConfiguration.Name, + apiVersion: ApiVersion); + } + + /// + /// List SourceControlConfigurations in a cluster + /// + /// + public IPage ListSourceControlConfigurations() + { + return SourceControlConfigurationClient.SourceControlConfigurations.List( + resourceGroupName: Cluster.ResourceGroup, + clusterRp: Cluster.RpName, + clusterResourceName: Cluster.Type, + clusterName: Cluster.Name, + apiVersion: ApiVersion); + } + + #region Common Methods + + public void Dispose() + { + SourceControlConfigurationClient.Dispose(); + } + + #endregion + } +} \ No newline at end of file From fc322ad03bf170f8ea20c02cc09f8d0b1292e8a5 Mon Sep 17 00:00:00 2001 From: Yeming Liu Date: Thu, 21 May 2020 15:57:43 +0800 Subject: [PATCH 2/3] include k8s in CI --- eng/pipelines/mgmt.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/eng/pipelines/mgmt.yml b/eng/pipelines/mgmt.yml index 0c653a1e14324..cf937f7a0fbfd 100644 --- a/eng/pipelines/mgmt.yml +++ b/eng/pipelines/mgmt.yml @@ -70,6 +70,7 @@ pr: - sdk/iotcentral/Microsoft.Azure.Management.IotCentral - sdk/iothub/Microsoft.Azure.Management.IotHub - sdk/keyvault/Microsoft.Azure.Management.KeyVault + - sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration - sdk/kusto/Microsoft.Azure.Management.Kusto - sdk/labservices/Microsoft.Azure.Management.LabServices - sdk/locationbasedservices/Microsoft.Azure.Management.LocationBasedServices From dc0d06de8cad006d815255cb5b871cba3a0df661 Mon Sep 17 00:00:00 2001 From: nanthi Date: Mon, 1 Jun 2020 16:46:58 -0700 Subject: [PATCH 3/3] Project version and dependencies update --- ...crosoft.Azure.Management.KubernetesConfiguration.csproj | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Microsoft.Azure.Management.KubernetesConfiguration.csproj b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Microsoft.Azure.Management.KubernetesConfiguration.csproj index 17afb4c56a888..0867f9595ae3a 100644 --- a/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Microsoft.Azure.Management.KubernetesConfiguration.csproj +++ b/sdk/kubernetesconfiguration/Microsoft.Azure.Management.KubernetesConfiguration/src/Microsoft.Azure.Management.KubernetesConfiguration.csproj @@ -6,7 +6,7 @@ Microsoft.Azure.Management.KubernetesConfiguration Provides Microsoft Azure KubernetesConfiguration management operations including the ability to create, update and delete runbooks and schedules. - 3.8.2-preview + 1.0.0-preview.1 Microsoft Azure KubernetesConfiguration Management Library Microsoft.Azure.Management.KubernetesConfiguration @@ -24,10 +24,5 @@ New features: - - - - - \ No newline at end of file