diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/AgentPoolsOperations.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/AgentPoolsOperations.cs index 57e020a86678..dc15b4178a2b 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/AgentPoolsOperations.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/AgentPoolsOperations.cs @@ -50,11 +50,243 @@ internal AgentPoolsOperations(ContainerServiceClient client) /// public ContainerServiceClient Client { get; private set; } + /// + /// Aborts last operation running on agent pool. + /// + /// + /// Aborting last running operation on agent pool. We return a 204 no content + /// code here to indicate that the operation has been accepted and an abort + /// will be attempted but is not guaranteed to complete successfully. Please + /// look up the provisioning state of the agent pool to keep track of whether + /// it changes to Canceled. A canceled provisioning state indicates that the + /// abort was successful + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// The name of the agent pool. + /// + /// + /// 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 AbortLatestOperationWithHttpMessagesAsync(string resourceGroupName, string resourceName, string agentPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (resourceName != null) + { + if (resourceName.Length > 63) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceName", 63); + } + if (resourceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceName, "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$"); + } + } + if (agentPoolName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "agentPoolName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("agentPoolName", agentPoolName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "AbortLatestOperation", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclusters/{resourceName}/agentPools/{agentPoolName}/abort").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _url = _url.Replace("{agentPoolName}", System.Uri.EscapeDataString(agentPoolName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.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("POST"); + _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 != 204) + { + 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(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + /// /// Gets a list of agent pools in the specified managed cluster. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -86,16 +318,34 @@ internal AgentPoolsOperations(ContainerServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } if (resourceGroupName.Length < 1) { throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); @@ -272,7 +522,7 @@ internal AgentPoolsOperations(ContainerServiceClient client) /// Gets the specified managed cluster agent pool. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -307,16 +557,34 @@ internal AgentPoolsOperations(ContainerServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } if (resourceGroupName.Length < 1) { throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); @@ -499,7 +767,7 @@ internal AgentPoolsOperations(ContainerServiceClient client) /// Creates or updates an agent pool in the specified managed cluster. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -527,7 +795,7 @@ internal AgentPoolsOperations(ContainerServiceClient client) /// Deletes an agent pool in the specified managed cluster. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -535,16 +803,20 @@ internal AgentPoolsOperations(ContainerServiceClient client) /// /// The name of the agent pool. /// + /// + /// ignore-pod-disruption-budget=true to delete those pods on a node without + /// considering Pod Disruption Budget + /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, string agentPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, string agentPoolName, bool? ignorePodDisruptionBudget = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send request - AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, resourceName, agentPoolName, customHeaders, cancellationToken).ConfigureAwait(false); + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, resourceName, agentPoolName, ignorePodDisruptionBudget, customHeaders, cancellationToken).ConfigureAwait(false); return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } @@ -552,7 +824,7 @@ internal AgentPoolsOperations(ContainerServiceClient client) /// Gets the upgrade profile for an agent pool. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -587,16 +859,34 @@ internal AgentPoolsOperations(ContainerServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } if (resourceGroupName.Length < 1) { throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); @@ -784,7 +1074,7 @@ internal AgentPoolsOperations(ContainerServiceClient client) /// for more details about the version lifecycle. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -816,16 +1106,34 @@ internal AgentPoolsOperations(ContainerServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } if (resourceGroupName.Length < 1) { throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); @@ -1008,7 +1316,7 @@ internal AgentPoolsOperations(ContainerServiceClient client) /// https://docs.microsoft.com/azure/aks/node-image-upgrade /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -1022,10 +1330,10 @@ internal AgentPoolsOperations(ContainerServiceClient client) /// /// The cancellation token. /// - public async Task> UpgradeNodeImageVersionWithHttpMessagesAsync(string resourceGroupName, string resourceName, string agentPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> UpgradeNodeImageVersionWithHttpMessagesAsync(string resourceGroupName, string resourceName, string agentPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send request - AzureOperationResponse _response = await BeginUpgradeNodeImageVersionWithHttpMessagesAsync(resourceGroupName, resourceName, agentPoolName, customHeaders, cancellationToken).ConfigureAwait(false); + AzureOperationResponse _response = await BeginUpgradeNodeImageVersionWithHttpMessagesAsync(resourceGroupName, resourceName, agentPoolName, customHeaders, cancellationToken).ConfigureAwait(false); return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } @@ -1033,7 +1341,7 @@ internal AgentPoolsOperations(ContainerServiceClient client) /// Creates or updates an agent pool in the specified managed cluster. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -1071,16 +1379,34 @@ internal AgentPoolsOperations(ContainerServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } if (resourceGroupName.Length < 1) { throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); @@ -1296,7 +1622,7 @@ internal AgentPoolsOperations(ContainerServiceClient client) /// Deletes an agent pool in the specified managed cluster. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -1304,6 +1630,10 @@ internal AgentPoolsOperations(ContainerServiceClient client) /// /// The name of the agent pool. /// + /// + /// ignore-pod-disruption-budget=true to delete those pods on a node without + /// considering Pod Disruption Budget + /// /// /// Headers that will be added to request. /// @@ -1322,22 +1652,40 @@ internal AgentPoolsOperations(ContainerServiceClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, string agentPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, string agentPoolName, bool? ignorePodDisruptionBudget = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } if (resourceGroupName.Length < 1) { throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); @@ -1376,6 +1724,7 @@ internal AgentPoolsOperations(ContainerServiceClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("resourceName", resourceName); tracingParameters.Add("agentPoolName", agentPoolName); + tracingParameters.Add("ignorePodDisruptionBudget", ignorePodDisruptionBudget); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); } @@ -1391,6 +1740,10 @@ internal AgentPoolsOperations(ContainerServiceClient client) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } + if (ignorePodDisruptionBudget != null) + { + _queryParameters.Add(string.Format("ignore-pod-disruption-budget={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(ignorePodDisruptionBudget, Client.SerializationSettings).Trim('"')))); + } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); @@ -1508,7 +1861,7 @@ internal AgentPoolsOperations(ContainerServiceClient client) /// https://docs.microsoft.com/azure/aks/node-image-upgrade /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -1537,22 +1890,40 @@ internal AgentPoolsOperations(ContainerServiceClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginUpgradeNodeImageVersionWithHttpMessagesAsync(string resourceGroupName, string resourceName, string agentPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginUpgradeNodeImageVersionWithHttpMessagesAsync(string resourceGroupName, string resourceName, string agentPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } if (resourceGroupName.Length < 1) { throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); @@ -1699,7 +2070,7 @@ internal AgentPoolsOperations(ContainerServiceClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -1724,6 +2095,19 @@ internal AgentPoolsOperations(ContainerServiceClient client) throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/AgentPoolsOperationsExtensions.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/AgentPoolsOperationsExtensions.cs index e0c7263272e9..3a05e2797a87 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/AgentPoolsOperationsExtensions.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/AgentPoolsOperationsExtensions.cs @@ -21,6 +21,65 @@ namespace Microsoft.Azure.Management.ContainerService /// public static partial class AgentPoolsOperationsExtensions { + /// + /// Aborts last operation running on agent pool. + /// + /// + /// Aborting last running operation on agent pool. We return a 204 no content + /// code here to indicate that the operation has been accepted and an abort + /// will be attempted but is not guaranteed to complete successfully. Please + /// look up the provisioning state of the agent pool to keep track of whether + /// it changes to Canceled. A canceled provisioning state indicates that the + /// abort was successful + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// The name of the agent pool. + /// + public static void AbortLatestOperation(this IAgentPoolsOperations operations, string resourceGroupName, string resourceName, string agentPoolName) + { + operations.AbortLatestOperationAsync(resourceGroupName, resourceName, agentPoolName).GetAwaiter().GetResult(); + } + + /// + /// Aborts last operation running on agent pool. + /// + /// + /// Aborting last running operation on agent pool. We return a 204 no content + /// code here to indicate that the operation has been accepted and an abort + /// will be attempted but is not guaranteed to complete successfully. Please + /// look up the provisioning state of the agent pool to keep track of whether + /// it changes to Canceled. A canceled provisioning state indicates that the + /// abort was successful + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// The name of the agent pool. + /// + /// + /// The cancellation token. + /// + public static async Task AbortLatestOperationAsync(this IAgentPoolsOperations operations, string resourceGroupName, string resourceName, string agentPoolName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.AbortLatestOperationWithHttpMessagesAsync(resourceGroupName, resourceName, agentPoolName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// /// Gets a list of agent pools in the specified managed cluster. /// @@ -28,7 +87,7 @@ public static partial class AgentPoolsOperationsExtensions /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -45,7 +104,7 @@ public static IPage List(this IAgentPoolsOperations operations, strin /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -68,7 +127,7 @@ public static IPage List(this IAgentPoolsOperations operations, strin /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -88,7 +147,7 @@ public static AgentPool Get(this IAgentPoolsOperations operations, string resour /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -114,7 +173,7 @@ public static AgentPool Get(this IAgentPoolsOperations operations, string resour /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -137,7 +196,7 @@ public static AgentPool CreateOrUpdate(this IAgentPoolsOperations operations, st /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -166,7 +225,7 @@ public static AgentPool CreateOrUpdate(this IAgentPoolsOperations operations, st /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -174,9 +233,13 @@ public static AgentPool CreateOrUpdate(this IAgentPoolsOperations operations, st /// /// The name of the agent pool. /// - public static void Delete(this IAgentPoolsOperations operations, string resourceGroupName, string resourceName, string agentPoolName) + /// + /// ignore-pod-disruption-budget=true to delete those pods on a node without + /// considering Pod Disruption Budget + /// + public static void Delete(this IAgentPoolsOperations operations, string resourceGroupName, string resourceName, string agentPoolName, bool? ignorePodDisruptionBudget = default(bool?)) { - operations.DeleteAsync(resourceGroupName, resourceName, agentPoolName).GetAwaiter().GetResult(); + operations.DeleteAsync(resourceGroupName, resourceName, agentPoolName, ignorePodDisruptionBudget).GetAwaiter().GetResult(); } /// @@ -186,7 +249,7 @@ public static void Delete(this IAgentPoolsOperations operations, string resource /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -194,12 +257,16 @@ public static void Delete(this IAgentPoolsOperations operations, string resource /// /// The name of the agent pool. /// + /// + /// ignore-pod-disruption-budget=true to delete those pods on a node without + /// considering Pod Disruption Budget + /// /// /// The cancellation token. /// - public static async Task DeleteAsync(this IAgentPoolsOperations operations, string resourceGroupName, string resourceName, string agentPoolName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task DeleteAsync(this IAgentPoolsOperations operations, string resourceGroupName, string resourceName, string agentPoolName, bool? ignorePodDisruptionBudget = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, resourceName, agentPoolName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, resourceName, agentPoolName, ignorePodDisruptionBudget, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -209,7 +276,7 @@ public static void Delete(this IAgentPoolsOperations operations, string resource /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -229,7 +296,7 @@ public static AgentPoolUpgradeProfile GetUpgradeProfile(this IAgentPoolsOperatio /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -260,7 +327,7 @@ public static AgentPoolUpgradeProfile GetUpgradeProfile(this IAgentPoolsOperatio /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -282,7 +349,7 @@ public static AgentPoolAvailableVersions GetAvailableAgentPoolVersions(this IAge /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -311,7 +378,7 @@ public static AgentPoolAvailableVersions GetAvailableAgentPoolVersions(this IAge /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -337,7 +404,7 @@ public static AgentPool UpgradeNodeImageVersion(this IAgentPoolsOperations opera /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -363,7 +430,7 @@ public static AgentPool UpgradeNodeImageVersion(this IAgentPoolsOperations opera /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -386,7 +453,7 @@ public static AgentPool BeginCreateOrUpdate(this IAgentPoolsOperations operation /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -415,7 +482,7 @@ public static AgentPool BeginCreateOrUpdate(this IAgentPoolsOperations operation /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -423,9 +490,13 @@ public static AgentPool BeginCreateOrUpdate(this IAgentPoolsOperations operation /// /// The name of the agent pool. /// - public static void BeginDelete(this IAgentPoolsOperations operations, string resourceGroupName, string resourceName, string agentPoolName) + /// + /// ignore-pod-disruption-budget=true to delete those pods on a node without + /// considering Pod Disruption Budget + /// + public static void BeginDelete(this IAgentPoolsOperations operations, string resourceGroupName, string resourceName, string agentPoolName, bool? ignorePodDisruptionBudget = default(bool?)) { - operations.BeginDeleteAsync(resourceGroupName, resourceName, agentPoolName).GetAwaiter().GetResult(); + operations.BeginDeleteAsync(resourceGroupName, resourceName, agentPoolName, ignorePodDisruptionBudget).GetAwaiter().GetResult(); } /// @@ -435,7 +506,7 @@ public static void BeginDelete(this IAgentPoolsOperations operations, string res /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -443,12 +514,16 @@ public static void BeginDelete(this IAgentPoolsOperations operations, string res /// /// The name of the agent pool. /// + /// + /// ignore-pod-disruption-budget=true to delete those pods on a node without + /// considering Pod Disruption Budget + /// /// /// The cancellation token. /// - public static async Task BeginDeleteAsync(this IAgentPoolsOperations operations, string resourceGroupName, string resourceName, string agentPoolName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginDeleteAsync(this IAgentPoolsOperations operations, string resourceGroupName, string resourceName, string agentPoolName, bool? ignorePodDisruptionBudget = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, resourceName, agentPoolName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, resourceName, agentPoolName, ignorePodDisruptionBudget, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -464,7 +539,7 @@ public static void BeginDelete(this IAgentPoolsOperations operations, string res /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -490,7 +565,7 @@ public static AgentPool BeginUpgradeNodeImageVersion(this IAgentPoolsOperations /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/ContainerServiceClient.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/ContainerServiceClient.cs index 79b8567011fc..511047010366 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/ContainerServiceClient.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/ContainerServiceClient.cs @@ -47,14 +47,12 @@ public partial class ContainerServiceClient : ServiceClient - /// Subscription credentials which uniquely identify Microsoft Azure - /// subscription. The subscription ID forms part of the URI for every service - /// call. + /// The ID of the target subscription. /// public string SubscriptionId { get; set; } /// - /// Client Api Version. + /// The API version to use for this operation. /// public string ApiVersion { get; private set; } @@ -111,6 +109,36 @@ public partial class ContainerServiceClient : ServiceClient public virtual IResolvePrivateLinkServiceIdOperations ResolvePrivateLinkServiceId { get; private set; } + /// + /// Gets the ISnapshotsOperations. + /// + public virtual ISnapshotsOperations Snapshots { get; private set; } + + /// + /// Gets the IManagedClusterSnapshotsOperations. + /// + public virtual IManagedClusterSnapshotsOperations ManagedClusterSnapshots { get; private set; } + + /// + /// Gets the ITrustedAccessRolesOperations. + /// + public virtual ITrustedAccessRolesOperations TrustedAccessRoles { get; private set; } + + /// + /// Gets the ITrustedAccessRoleBindingsOperations. + /// + public virtual ITrustedAccessRoleBindingsOperations TrustedAccessRoleBindings { get; private set; } + + /// + /// Gets the IFleetsOperations. + /// + public virtual IFleetsOperations Fleets { get; private set; } + + /// + /// Gets the IFleetMembersOperations. + /// + public virtual IFleetMembersOperations FleetMembers { get; private set; } + /// /// Initializes a new instance of the ContainerServiceClient class. /// @@ -359,8 +387,14 @@ private void Initialize() PrivateEndpointConnections = new PrivateEndpointConnectionsOperations(this); PrivateLinkResources = new PrivateLinkResourcesOperations(this); ResolvePrivateLinkServiceId = new ResolvePrivateLinkServiceIdOperations(this); + Snapshots = new SnapshotsOperations(this); + ManagedClusterSnapshots = new ManagedClusterSnapshotsOperations(this); + TrustedAccessRoles = new TrustedAccessRolesOperations(this); + TrustedAccessRoleBindings = new TrustedAccessRoleBindingsOperations(this); + Fleets = new FleetsOperations(this); + FleetMembers = new FleetMembersOperations(this); BaseUri = new System.Uri("https://management.azure.com"); - ApiVersion = "2021-07-01"; + ApiVersion = "2022-09-02-preview"; AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; GenerateClientRequestId = true; diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/FleetMembersOperations.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/FleetMembersOperations.cs new file mode 100644 index 000000000000..cf3189d8ea77 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/FleetMembersOperations.cs @@ -0,0 +1,1375 @@ +// +// 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.ContainerService +{ + 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; + + /// + /// FleetMembersOperations operations. + /// + internal partial class FleetMembersOperations : IServiceOperations, IFleetMembersOperations + { + /// + /// Initializes a new instance of the FleetMembersOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal FleetMembersOperations(ContainerServiceClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ContainerServiceClient + /// + public ContainerServiceClient Client { get; private set; } + + /// + /// Creates or updates a fleet member. + /// + /// + /// A member contains a reference to an existing Kubernetes cluster. Creating a + /// member makes the referenced cluster join the Fleet. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Fleet resource. + /// + /// + /// The name of the Fleet member resource. + /// + /// + /// Omit this value to always overwrite the current resource. Specify the + /// last-seen ETag value to prevent accidentally overwriting concurrent + /// changes. + /// + /// + /// Set to '*' to allow a new resource to be created and prevent updating an + /// existing resource. Other values will result in a 412 Pre-condition Failed + /// response. + /// + /// + /// The ARM resource id of the cluster that joins the Fleet. Must be a valid + /// Azure resource id. e.g.: + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{clusterName}'. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string fleetName, string fleetMemberName, string ifMatch = default(string), string ifNoneMatch = default(string), string clusterResourceId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, fleetName, fleetMemberName, ifMatch, ifNoneMatch, clusterResourceId, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a Fleet member. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Fleet resource. + /// + /// + /// The name of the Fleet member resource. + /// + /// + /// 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 fleetName, string fleetMemberName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (fleetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "fleetName"); + } + if (fleetName != null) + { + if (fleetName.Length > 63) + { + throw new ValidationException(ValidationRules.MaxLength, "fleetName", 63); + } + if (fleetName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "fleetName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(fleetName, "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$")) + { + throw new ValidationException(ValidationRules.Pattern, "fleetName", "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"); + } + } + if (fleetMemberName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "fleetMemberName"); + } + if (fleetMemberName != null) + { + if (fleetMemberName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "fleetMemberName", 50); + } + if (fleetMemberName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "fleetMemberName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(fleetMemberName, "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$")) + { + throw new ValidationException(ValidationRules.Pattern, "fleetMemberName", "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("fleetName", fleetName); + tracingParameters.Add("fleetMemberName", fleetMemberName); + 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/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{fleetName}", System.Uri.EscapeDataString(fleetName)); + _url = _url.Replace("{fleetMemberName}", System.Uri.EscapeDataString(fleetMemberName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.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; + } + + /// + /// Deletes a fleet member. + /// + /// + /// Deleting a Fleet member results in the member cluster leaving fleet. The + /// Member azure resource is deleted upon success. The underlying cluster is + /// not deleted. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Fleet resource. + /// + /// + /// The name of the Fleet member resource. + /// + /// + /// Omit this value to always overwrite the current resource. Specify the + /// last-seen ETag value to prevent accidentally overwriting concurrent + /// changes. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> DeleteWithHttpMessagesAsync(string resourceGroupName, string fleetName, string fleetMemberName, string ifMatch = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationHeaderResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, fleetName, fleetMemberName, ifMatch, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Lists the members of a fleet. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Fleet resource. + /// + /// + /// 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>> ListByFleetWithHttpMessagesAsync(string resourceGroupName, string fleetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (fleetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "fleetName"); + } + if (fleetName != null) + { + if (fleetName.Length > 63) + { + throw new ValidationException(ValidationRules.MaxLength, "fleetName", 63); + } + if (fleetName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "fleetName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(fleetName, "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$")) + { + throw new ValidationException(ValidationRules.Pattern, "fleetName", "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("fleetName", fleetName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByFleet", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{fleetName}", System.Uri.EscapeDataString(fleetName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.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; + } + + /// + /// Creates or updates a fleet member. + /// + /// + /// A member contains a reference to an existing Kubernetes cluster. Creating a + /// member makes the referenced cluster join the Fleet. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Fleet resource. + /// + /// + /// The name of the Fleet member resource. + /// + /// + /// Omit this value to always overwrite the current resource. Specify the + /// last-seen ETag value to prevent accidentally overwriting concurrent + /// changes. + /// + /// + /// Set to '*' to allow a new resource to be created and prevent updating an + /// existing resource. Other values will result in a 412 Pre-condition Failed + /// response. + /// + /// + /// The ARM resource id of the cluster that joins the Fleet. Must be a valid + /// Azure resource id. e.g.: + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{clusterName}'. + /// + /// + /// 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string fleetName, string fleetMemberName, string ifMatch = default(string), string ifNoneMatch = default(string), string clusterResourceId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (fleetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "fleetName"); + } + if (fleetName != null) + { + if (fleetName.Length > 63) + { + throw new ValidationException(ValidationRules.MaxLength, "fleetName", 63); + } + if (fleetName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "fleetName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(fleetName, "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$")) + { + throw new ValidationException(ValidationRules.Pattern, "fleetName", "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"); + } + } + if (fleetMemberName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "fleetMemberName"); + } + if (fleetMemberName != null) + { + if (fleetMemberName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "fleetMemberName", 50); + } + if (fleetMemberName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "fleetMemberName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(fleetMemberName, "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$")) + { + throw new ValidationException(ValidationRules.Pattern, "fleetMemberName", "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"); + } + } + FleetMember parameters = new FleetMember(); + if (clusterResourceId != null) + { + parameters.ClusterResourceId = clusterResourceId; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("fleetName", fleetName); + tracingParameters.Add("fleetMemberName", fleetMemberName); + tracingParameters.Add("ifMatch", ifMatch); + tracingParameters.Add("ifNoneMatch", ifNoneMatch); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{fleetName}", System.Uri.EscapeDataString(fleetName)); + _url = _url.Replace("{fleetMemberName}", System.Uri.EscapeDataString(fleetMemberName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.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 (ifMatch != null) + { + if (_httpRequest.Headers.Contains("If-Match")) + { + _httpRequest.Headers.Remove("If-Match"); + } + _httpRequest.Headers.TryAddWithoutValidation("If-Match", ifMatch); + } + if (ifNoneMatch != null) + { + if (_httpRequest.Headers.Contains("If-None-Match")) + { + _httpRequest.Headers.Remove("If-None-Match"); + } + _httpRequest.Headers.TryAddWithoutValidation("If-None-Match", ifNoneMatch); + } + 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(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, 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; + } + + /// + /// Deletes a fleet member. + /// + /// + /// Deleting a Fleet member results in the member cluster leaving fleet. The + /// Member azure resource is deleted upon success. The underlying cluster is + /// not deleted. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Fleet resource. + /// + /// + /// The name of the Fleet member resource. + /// + /// + /// Omit this value to always overwrite the current resource. Specify the + /// last-seen ETag value to prevent accidentally overwriting concurrent + /// changes. + /// + /// + /// 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 fleetName, string fleetMemberName, string ifMatch = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (fleetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "fleetName"); + } + if (fleetName != null) + { + if (fleetName.Length > 63) + { + throw new ValidationException(ValidationRules.MaxLength, "fleetName", 63); + } + if (fleetName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "fleetName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(fleetName, "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$")) + { + throw new ValidationException(ValidationRules.Pattern, "fleetName", "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"); + } + } + if (fleetMemberName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "fleetMemberName"); + } + if (fleetMemberName != null) + { + if (fleetMemberName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "fleetMemberName", 50); + } + if (fleetMemberName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "fleetMemberName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(fleetMemberName, "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$")) + { + throw new ValidationException(ValidationRules.Pattern, "fleetMemberName", "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("fleetName", fleetName); + tracingParameters.Add("fleetMemberName", fleetMemberName); + tracingParameters.Add("ifMatch", ifMatch); + 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/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{fleetName}", System.Uri.EscapeDataString(fleetName)); + _url = _url.Replace("{fleetMemberName}", System.Uri.EscapeDataString(fleetMemberName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.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 (ifMatch != null) + { + if (_httpRequest.Headers.Contains("If-Match")) + { + _httpRequest.Headers.Remove("If-Match"); + } + _httpRequest.Headers.TryAddWithoutValidation("If-Match", ifMatch); + } + 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 != 202 && (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 AzureOperationHeaderResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists the members of a fleet. + /// + /// + /// 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>> ListByFleetNextWithHttpMessagesAsync(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, "ListByFleetNext", 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/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/FleetMembersOperationsExtensions.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/FleetMembersOperationsExtensions.cs new file mode 100644 index 000000000000..22613cc8328f --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/FleetMembersOperationsExtensions.cs @@ -0,0 +1,445 @@ +// +// 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.ContainerService +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for FleetMembersOperations. + /// + public static partial class FleetMembersOperationsExtensions + { + /// + /// Creates or updates a fleet member. + /// + /// + /// A member contains a reference to an existing Kubernetes cluster. Creating a + /// member makes the referenced cluster join the Fleet. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Fleet resource. + /// + /// + /// The name of the Fleet member resource. + /// + /// + /// Omit this value to always overwrite the current resource. Specify the + /// last-seen ETag value to prevent accidentally overwriting concurrent + /// changes. + /// + /// + /// Set to '*' to allow a new resource to be created and prevent updating an + /// existing resource. Other values will result in a 412 Pre-condition Failed + /// response. + /// + /// + /// The ARM resource id of the cluster that joins the Fleet. Must be a valid + /// Azure resource id. e.g.: + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{clusterName}'. + /// + public static FleetMember CreateOrUpdate(this IFleetMembersOperations operations, string resourceGroupName, string fleetName, string fleetMemberName, string ifMatch = default(string), string ifNoneMatch = default(string), string clusterResourceId = default(string)) + { + return operations.CreateOrUpdateAsync(resourceGroupName, fleetName, fleetMemberName, ifMatch, ifNoneMatch, clusterResourceId).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a fleet member. + /// + /// + /// A member contains a reference to an existing Kubernetes cluster. Creating a + /// member makes the referenced cluster join the Fleet. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Fleet resource. + /// + /// + /// The name of the Fleet member resource. + /// + /// + /// Omit this value to always overwrite the current resource. Specify the + /// last-seen ETag value to prevent accidentally overwriting concurrent + /// changes. + /// + /// + /// Set to '*' to allow a new resource to be created and prevent updating an + /// existing resource. Other values will result in a 412 Pre-condition Failed + /// response. + /// + /// + /// The ARM resource id of the cluster that joins the Fleet. Must be a valid + /// Azure resource id. e.g.: + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{clusterName}'. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IFleetMembersOperations operations, string resourceGroupName, string fleetName, string fleetMemberName, string ifMatch = default(string), string ifNoneMatch = default(string), string clusterResourceId = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, fleetName, fleetMemberName, ifMatch, ifNoneMatch, clusterResourceId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a Fleet member. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Fleet resource. + /// + /// + /// The name of the Fleet member resource. + /// + public static FleetMember Get(this IFleetMembersOperations operations, string resourceGroupName, string fleetName, string fleetMemberName) + { + return operations.GetAsync(resourceGroupName, fleetName, fleetMemberName).GetAwaiter().GetResult(); + } + + /// + /// Gets a Fleet member. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Fleet resource. + /// + /// + /// The name of the Fleet member resource. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IFleetMembersOperations operations, string resourceGroupName, string fleetName, string fleetMemberName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, fleetName, fleetMemberName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a fleet member. + /// + /// + /// Deleting a Fleet member results in the member cluster leaving fleet. The + /// Member azure resource is deleted upon success. The underlying cluster is + /// not deleted. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Fleet resource. + /// + /// + /// The name of the Fleet member resource. + /// + /// + /// Omit this value to always overwrite the current resource. Specify the + /// last-seen ETag value to prevent accidentally overwriting concurrent + /// changes. + /// + public static FleetMembersDeleteHeaders Delete(this IFleetMembersOperations operations, string resourceGroupName, string fleetName, string fleetMemberName, string ifMatch = default(string)) + { + return operations.DeleteAsync(resourceGroupName, fleetName, fleetMemberName, ifMatch).GetAwaiter().GetResult(); + } + + /// + /// Deletes a fleet member. + /// + /// + /// Deleting a Fleet member results in the member cluster leaving fleet. The + /// Member azure resource is deleted upon success. The underlying cluster is + /// not deleted. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Fleet resource. + /// + /// + /// The name of the Fleet member resource. + /// + /// + /// Omit this value to always overwrite the current resource. Specify the + /// last-seen ETag value to prevent accidentally overwriting concurrent + /// changes. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IFleetMembersOperations operations, string resourceGroupName, string fleetName, string fleetMemberName, string ifMatch = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.DeleteWithHttpMessagesAsync(resourceGroupName, fleetName, fleetMemberName, ifMatch, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Headers; + } + } + + /// + /// Lists the members of a fleet. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Fleet resource. + /// + public static IPage ListByFleet(this IFleetMembersOperations operations, string resourceGroupName, string fleetName) + { + return operations.ListByFleetAsync(resourceGroupName, fleetName).GetAwaiter().GetResult(); + } + + /// + /// Lists the members of a fleet. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Fleet resource. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByFleetAsync(this IFleetMembersOperations operations, string resourceGroupName, string fleetName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByFleetWithHttpMessagesAsync(resourceGroupName, fleetName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates a fleet member. + /// + /// + /// A member contains a reference to an existing Kubernetes cluster. Creating a + /// member makes the referenced cluster join the Fleet. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Fleet resource. + /// + /// + /// The name of the Fleet member resource. + /// + /// + /// Omit this value to always overwrite the current resource. Specify the + /// last-seen ETag value to prevent accidentally overwriting concurrent + /// changes. + /// + /// + /// Set to '*' to allow a new resource to be created and prevent updating an + /// existing resource. Other values will result in a 412 Pre-condition Failed + /// response. + /// + /// + /// The ARM resource id of the cluster that joins the Fleet. Must be a valid + /// Azure resource id. e.g.: + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{clusterName}'. + /// + public static FleetMember BeginCreateOrUpdate(this IFleetMembersOperations operations, string resourceGroupName, string fleetName, string fleetMemberName, string ifMatch = default(string), string ifNoneMatch = default(string), string clusterResourceId = default(string)) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, fleetName, fleetMemberName, ifMatch, ifNoneMatch, clusterResourceId).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a fleet member. + /// + /// + /// A member contains a reference to an existing Kubernetes cluster. Creating a + /// member makes the referenced cluster join the Fleet. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Fleet resource. + /// + /// + /// The name of the Fleet member resource. + /// + /// + /// Omit this value to always overwrite the current resource. Specify the + /// last-seen ETag value to prevent accidentally overwriting concurrent + /// changes. + /// + /// + /// Set to '*' to allow a new resource to be created and prevent updating an + /// existing resource. Other values will result in a 412 Pre-condition Failed + /// response. + /// + /// + /// The ARM resource id of the cluster that joins the Fleet. Must be a valid + /// Azure resource id. e.g.: + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{clusterName}'. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IFleetMembersOperations operations, string resourceGroupName, string fleetName, string fleetMemberName, string ifMatch = default(string), string ifNoneMatch = default(string), string clusterResourceId = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, fleetName, fleetMemberName, ifMatch, ifNoneMatch, clusterResourceId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a fleet member. + /// + /// + /// Deleting a Fleet member results in the member cluster leaving fleet. The + /// Member azure resource is deleted upon success. The underlying cluster is + /// not deleted. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Fleet resource. + /// + /// + /// The name of the Fleet member resource. + /// + /// + /// Omit this value to always overwrite the current resource. Specify the + /// last-seen ETag value to prevent accidentally overwriting concurrent + /// changes. + /// + public static FleetMembersDeleteHeaders BeginDelete(this IFleetMembersOperations operations, string resourceGroupName, string fleetName, string fleetMemberName, string ifMatch = default(string)) + { + return operations.BeginDeleteAsync(resourceGroupName, fleetName, fleetMemberName, ifMatch).GetAwaiter().GetResult(); + } + + /// + /// Deletes a fleet member. + /// + /// + /// Deleting a Fleet member results in the member cluster leaving fleet. The + /// Member azure resource is deleted upon success. The underlying cluster is + /// not deleted. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Fleet resource. + /// + /// + /// The name of the Fleet member resource. + /// + /// + /// Omit this value to always overwrite the current resource. Specify the + /// last-seen ETag value to prevent accidentally overwriting concurrent + /// changes. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IFleetMembersOperations operations, string resourceGroupName, string fleetName, string fleetMemberName, string ifMatch = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, fleetName, fleetMemberName, ifMatch, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Headers; + } + } + + /// + /// Lists the members of a fleet. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByFleetNext(this IFleetMembersOperations operations, string nextPageLink) + { + return operations.ListByFleetNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists the members of a fleet. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByFleetNextAsync(this IFleetMembersOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByFleetNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/FleetsOperations.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/FleetsOperations.cs new file mode 100644 index 000000000000..17da3258d23f --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/FleetsOperations.cs @@ -0,0 +1,2101 @@ +// +// 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.ContainerService +{ + 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; + + /// + /// FleetsOperations operations. + /// + internal partial class FleetsOperations : IServiceOperations, IFleetsOperations + { + /// + /// Initializes a new instance of the FleetsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal FleetsOperations(ContainerServiceClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ContainerServiceClient + /// + public ContainerServiceClient Client { get; private set; } + + /// + /// Creates or updates a Fleet. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Fleet resource. + /// + /// + /// The Fleet to create or update. + /// + /// + /// Omit this value to always overwrite the current resource. Specify the + /// last-seen ETag value to prevent accidentally overwriting concurrent + /// changes. + /// + /// + /// Set to '*' to allow a new resource to be created and prevent updating an + /// existing resource. Other values will result in a 412 Pre-condition Failed + /// response. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string fleetName, Fleet parameters, string ifMatch = default(string), string ifNoneMatch = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, fleetName, parameters, ifMatch, ifNoneMatch, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Patches a fleet resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Fleet resource. + /// + /// + /// Omit this value to always overwrite the current resource. Specify the + /// last-seen ETag value to prevent accidentally overwriting concurrent + /// changes. + /// + /// + /// Resource tags. + /// + /// + /// 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string fleetName, string ifMatch = default(string), IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (fleetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "fleetName"); + } + if (fleetName != null) + { + if (fleetName.Length > 63) + { + throw new ValidationException(ValidationRules.MaxLength, "fleetName", 63); + } + if (fleetName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "fleetName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(fleetName, "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$")) + { + throw new ValidationException(ValidationRules.Pattern, "fleetName", "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"); + } + } + FleetPatch parameters = default(FleetPatch); + if (tags != null) + { + parameters = new FleetPatch(); + parameters.Tags = tags; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("fleetName", fleetName); + tracingParameters.Add("ifMatch", ifMatch); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{fleetName}", System.Uri.EscapeDataString(fleetName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.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("PATCH"); + _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 (ifMatch != null) + { + if (_httpRequest.Headers.Contains("If-Match")) + { + _httpRequest.Headers.Remove("If-Match"); + } + _httpRequest.Headers.TryAddWithoutValidation("If-Match", ifMatch); + } + 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(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, 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) + { + 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; + } + + /// + /// Gets a Fleet. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Fleet resource. + /// + /// + /// 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 fleetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (fleetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "fleetName"); + } + if (fleetName != null) + { + if (fleetName.Length > 63) + { + throw new ValidationException(ValidationRules.MaxLength, "fleetName", 63); + } + if (fleetName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "fleetName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(fleetName, "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$")) + { + throw new ValidationException(ValidationRules.Pattern, "fleetName", "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("fleetName", fleetName); + 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/Microsoft.ContainerService/fleets/{fleetName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{fleetName}", System.Uri.EscapeDataString(fleetName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.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; + } + + /// + /// Deletes a Fleet. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Fleet resource. + /// + /// + /// Omit this value to always overwrite the current resource. Specify the + /// last-seen ETag value to prevent accidentally overwriting concurrent + /// changes. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> DeleteWithHttpMessagesAsync(string resourceGroupName, string fleetName, string ifMatch = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationHeaderResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, fleetName, ifMatch, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Lists fleets in the specified subscription and resource group. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// 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>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.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; + } + + /// + /// Lists fleets in the specified subscription. + /// + /// + /// 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(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + 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}/providers/Microsoft.ContainerService/fleets").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.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; + } + + /// + /// Lists the user credentials of a Fleet. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Fleet resource. + /// + /// + /// 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> ListCredentialsWithHttpMessagesAsync(string resourceGroupName, string fleetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (fleetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "fleetName"); + } + if (fleetName != null) + { + if (fleetName.Length > 63) + { + throw new ValidationException(ValidationRules.MaxLength, "fleetName", 63); + } + if (fleetName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "fleetName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(fleetName, "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$")) + { + throw new ValidationException(ValidationRules.Pattern, "fleetName", "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("fleetName", fleetName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListCredentials", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/listCredentials").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{fleetName}", System.Uri.EscapeDataString(fleetName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.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("POST"); + _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; + } + + /// + /// Creates or updates a Fleet. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Fleet resource. + /// + /// + /// The Fleet to create or update. + /// + /// + /// Omit this value to always overwrite the current resource. Specify the + /// last-seen ETag value to prevent accidentally overwriting concurrent + /// changes. + /// + /// + /// Set to '*' to allow a new resource to be created and prevent updating an + /// existing resource. Other values will result in a 412 Pre-condition Failed + /// response. + /// + /// + /// 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string fleetName, Fleet parameters, string ifMatch = default(string), string ifNoneMatch = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (fleetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "fleetName"); + } + if (fleetName != null) + { + if (fleetName.Length > 63) + { + throw new ValidationException(ValidationRules.MaxLength, "fleetName", 63); + } + if (fleetName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "fleetName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(fleetName, "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$")) + { + throw new ValidationException(ValidationRules.Pattern, "fleetName", "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"); + } + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("fleetName", fleetName); + tracingParameters.Add("ifMatch", ifMatch); + tracingParameters.Add("ifNoneMatch", ifNoneMatch); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{fleetName}", System.Uri.EscapeDataString(fleetName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.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 (ifMatch != null) + { + if (_httpRequest.Headers.Contains("If-Match")) + { + _httpRequest.Headers.Remove("If-Match"); + } + _httpRequest.Headers.TryAddWithoutValidation("If-Match", ifMatch); + } + if (ifNoneMatch != null) + { + if (_httpRequest.Headers.Contains("If-None-Match")) + { + _httpRequest.Headers.Remove("If-None-Match"); + } + _httpRequest.Headers.TryAddWithoutValidation("If-None-Match", ifNoneMatch); + } + 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(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, 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; + } + + /// + /// Deletes a Fleet. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Fleet resource. + /// + /// + /// Omit this value to always overwrite the current resource. Specify the + /// last-seen ETag value to prevent accidentally overwriting concurrent + /// changes. + /// + /// + /// 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 fleetName, string ifMatch = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (fleetName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "fleetName"); + } + if (fleetName != null) + { + if (fleetName.Length > 63) + { + throw new ValidationException(ValidationRules.MaxLength, "fleetName", 63); + } + if (fleetName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "fleetName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(fleetName, "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$")) + { + throw new ValidationException(ValidationRules.Pattern, "fleetName", "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("ifMatch", ifMatch); + tracingParameters.Add("fleetName", fleetName); + 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/Microsoft.ContainerService/fleets/{fleetName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{fleetName}", System.Uri.EscapeDataString(fleetName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.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 (ifMatch != null) + { + if (_httpRequest.Headers.Contains("If-Match")) + { + _httpRequest.Headers.Remove("If-Match"); + } + _httpRequest.Headers.TryAddWithoutValidation("If-Match", ifMatch); + } + 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 != 202 && (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 AzureOperationHeaderResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Lists fleets in the specified subscription and resource group. + /// + /// + /// 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>> ListByResourceGroupNextWithHttpMessagesAsync(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, "ListByResourceGroupNext", 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; + } + + /// + /// Lists fleets in the specified subscription. + /// + /// + /// 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/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/FleetsOperationsExtensions.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/FleetsOperationsExtensions.cs new file mode 100644 index 000000000000..88d986cc9d1a --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/FleetsOperationsExtensions.cs @@ -0,0 +1,525 @@ +// +// 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.ContainerService +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for FleetsOperations. + /// + public static partial class FleetsOperationsExtensions + { + /// + /// Creates or updates a Fleet. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Fleet resource. + /// + /// + /// The Fleet to create or update. + /// + /// + /// Omit this value to always overwrite the current resource. Specify the + /// last-seen ETag value to prevent accidentally overwriting concurrent + /// changes. + /// + /// + /// Set to '*' to allow a new resource to be created and prevent updating an + /// existing resource. Other values will result in a 412 Pre-condition Failed + /// response. + /// + public static Fleet CreateOrUpdate(this IFleetsOperations operations, string resourceGroupName, string fleetName, Fleet parameters, string ifMatch = default(string), string ifNoneMatch = default(string)) + { + return operations.CreateOrUpdateAsync(resourceGroupName, fleetName, parameters, ifMatch, ifNoneMatch).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a Fleet. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Fleet resource. + /// + /// + /// The Fleet to create or update. + /// + /// + /// Omit this value to always overwrite the current resource. Specify the + /// last-seen ETag value to prevent accidentally overwriting concurrent + /// changes. + /// + /// + /// Set to '*' to allow a new resource to be created and prevent updating an + /// existing resource. Other values will result in a 412 Pre-condition Failed + /// response. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IFleetsOperations operations, string resourceGroupName, string fleetName, Fleet parameters, string ifMatch = default(string), string ifNoneMatch = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, fleetName, parameters, ifMatch, ifNoneMatch, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Patches a fleet resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Fleet resource. + /// + /// + /// Omit this value to always overwrite the current resource. Specify the + /// last-seen ETag value to prevent accidentally overwriting concurrent + /// changes. + /// + /// + /// Resource tags. + /// + public static Fleet Update(this IFleetsOperations operations, string resourceGroupName, string fleetName, string ifMatch = default(string), IDictionary tags = default(IDictionary)) + { + return operations.UpdateAsync(resourceGroupName, fleetName, ifMatch, tags).GetAwaiter().GetResult(); + } + + /// + /// Patches a fleet resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Fleet resource. + /// + /// + /// Omit this value to always overwrite the current resource. Specify the + /// last-seen ETag value to prevent accidentally overwriting concurrent + /// changes. + /// + /// + /// Resource tags. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IFleetsOperations operations, string resourceGroupName, string fleetName, string ifMatch = default(string), IDictionary tags = default(IDictionary), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, fleetName, ifMatch, tags, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a Fleet. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Fleet resource. + /// + public static Fleet Get(this IFleetsOperations operations, string resourceGroupName, string fleetName) + { + return operations.GetAsync(resourceGroupName, fleetName).GetAwaiter().GetResult(); + } + + /// + /// Gets a Fleet. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Fleet resource. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IFleetsOperations operations, string resourceGroupName, string fleetName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, fleetName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a Fleet. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Fleet resource. + /// + /// + /// Omit this value to always overwrite the current resource. Specify the + /// last-seen ETag value to prevent accidentally overwriting concurrent + /// changes. + /// + public static FleetsDeleteHeaders Delete(this IFleetsOperations operations, string resourceGroupName, string fleetName, string ifMatch = default(string)) + { + return operations.DeleteAsync(resourceGroupName, fleetName, ifMatch).GetAwaiter().GetResult(); + } + + /// + /// Deletes a Fleet. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Fleet resource. + /// + /// + /// Omit this value to always overwrite the current resource. Specify the + /// last-seen ETag value to prevent accidentally overwriting concurrent + /// changes. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IFleetsOperations operations, string resourceGroupName, string fleetName, string ifMatch = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.DeleteWithHttpMessagesAsync(resourceGroupName, fleetName, ifMatch, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Headers; + } + } + + /// + /// Lists fleets in the specified subscription and resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + public static IPage ListByResourceGroup(this IFleetsOperations operations, string resourceGroupName) + { + return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Lists fleets in the specified subscription and resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupAsync(this IFleetsOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists fleets in the specified subscription. + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this IFleetsOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Lists fleets in the specified subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IFleetsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists the user credentials of a Fleet. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Fleet resource. + /// + public static FleetCredentialResults ListCredentials(this IFleetsOperations operations, string resourceGroupName, string fleetName) + { + return operations.ListCredentialsAsync(resourceGroupName, fleetName).GetAwaiter().GetResult(); + } + + /// + /// Lists the user credentials of a Fleet. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Fleet resource. + /// + /// + /// The cancellation token. + /// + public static async Task ListCredentialsAsync(this IFleetsOperations operations, string resourceGroupName, string fleetName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListCredentialsWithHttpMessagesAsync(resourceGroupName, fleetName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates a Fleet. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Fleet resource. + /// + /// + /// The Fleet to create or update. + /// + /// + /// Omit this value to always overwrite the current resource. Specify the + /// last-seen ETag value to prevent accidentally overwriting concurrent + /// changes. + /// + /// + /// Set to '*' to allow a new resource to be created and prevent updating an + /// existing resource. Other values will result in a 412 Pre-condition Failed + /// response. + /// + public static Fleet BeginCreateOrUpdate(this IFleetsOperations operations, string resourceGroupName, string fleetName, Fleet parameters, string ifMatch = default(string), string ifNoneMatch = default(string)) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, fleetName, parameters, ifMatch, ifNoneMatch).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a Fleet. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Fleet resource. + /// + /// + /// The Fleet to create or update. + /// + /// + /// Omit this value to always overwrite the current resource. Specify the + /// last-seen ETag value to prevent accidentally overwriting concurrent + /// changes. + /// + /// + /// Set to '*' to allow a new resource to be created and prevent updating an + /// existing resource. Other values will result in a 412 Pre-condition Failed + /// response. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IFleetsOperations operations, string resourceGroupName, string fleetName, Fleet parameters, string ifMatch = default(string), string ifNoneMatch = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, fleetName, parameters, ifMatch, ifNoneMatch, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a Fleet. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Fleet resource. + /// + /// + /// Omit this value to always overwrite the current resource. Specify the + /// last-seen ETag value to prevent accidentally overwriting concurrent + /// changes. + /// + public static FleetsDeleteHeaders BeginDelete(this IFleetsOperations operations, string resourceGroupName, string fleetName, string ifMatch = default(string)) + { + return operations.BeginDeleteAsync(resourceGroupName, fleetName, ifMatch).GetAwaiter().GetResult(); + } + + /// + /// Deletes a Fleet. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Fleet resource. + /// + /// + /// Omit this value to always overwrite the current resource. Specify the + /// last-seen ETag value to prevent accidentally overwriting concurrent + /// changes. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IFleetsOperations operations, string resourceGroupName, string fleetName, string ifMatch = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, fleetName, ifMatch, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Headers; + } + } + + /// + /// Lists fleets in the specified subscription and resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByResourceGroupNext(this IFleetsOperations operations, string nextPageLink) + { + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists fleets in the specified subscription and resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupNextAsync(this IFleetsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists fleets in the specified subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IFleetsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists fleets in the specified subscription. + /// + /// + /// 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 IFleetsOperations 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/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/IAgentPoolsOperations.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/IAgentPoolsOperations.cs index 7bf6c2693960..cdfb44128d20 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/IAgentPoolsOperations.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/IAgentPoolsOperations.cs @@ -23,11 +23,44 @@ namespace Microsoft.Azure.Management.ContainerService /// public partial interface IAgentPoolsOperations { + /// + /// Aborts last operation running on agent pool. + /// + /// + /// Aborting last running operation on agent pool. We return a 204 no + /// content code here to indicate that the operation has been accepted + /// and an abort will be attempted but is not guaranteed to complete + /// successfully. Please look up the provisioning state of the agent + /// pool to keep track of whether it changes to Canceled. A canceled + /// provisioning state indicates that the abort was successful + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// The name of the agent pool. + /// + /// + /// 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 AbortLatestOperationWithHttpMessagesAsync(string resourceGroupName, string resourceName, string agentPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets a list of agent pools in the specified managed cluster. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -52,7 +85,7 @@ public partial interface IAgentPoolsOperations /// Gets the specified managed cluster agent pool. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -80,7 +113,7 @@ public partial interface IAgentPoolsOperations /// Creates or updates an agent pool in the specified managed cluster. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -111,7 +144,7 @@ public partial interface IAgentPoolsOperations /// Deletes an agent pool in the specified managed cluster. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -119,6 +152,10 @@ public partial interface IAgentPoolsOperations /// /// The name of the agent pool. /// + /// + /// ignore-pod-disruption-budget=true to delete those pods on a node + /// without considering Pod Disruption Budget + /// /// /// The headers that will be added to request. /// @@ -131,12 +168,12 @@ public partial interface IAgentPoolsOperations /// /// Thrown when a required parameter is null /// - Task DeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, string agentPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, string agentPoolName, bool? ignorePodDisruptionBudget = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets the upgrade profile for an agent pool. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -170,7 +207,7 @@ public partial interface IAgentPoolsOperations /// for more details about the version lifecycle. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -202,7 +239,7 @@ public partial interface IAgentPoolsOperations /// https://docs.microsoft.com/azure/aks/node-image-upgrade /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -225,12 +262,12 @@ public partial interface IAgentPoolsOperations /// /// Thrown when a required parameter is null /// - Task> UpgradeNodeImageVersionWithHttpMessagesAsync(string resourceGroupName, string resourceName, string agentPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> UpgradeNodeImageVersionWithHttpMessagesAsync(string resourceGroupName, string resourceName, string agentPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Creates or updates an agent pool in the specified managed cluster. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -261,7 +298,7 @@ public partial interface IAgentPoolsOperations /// Deletes an agent pool in the specified managed cluster. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -269,6 +306,10 @@ public partial interface IAgentPoolsOperations /// /// The name of the agent pool. /// + /// + /// ignore-pod-disruption-budget=true to delete those pods on a node + /// without considering Pod Disruption Budget + /// /// /// The headers that will be added to request. /// @@ -281,7 +322,7 @@ public partial interface IAgentPoolsOperations /// /// Thrown when a required parameter is null /// - Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, string agentPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, string agentPoolName, bool? ignorePodDisruptionBudget = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Upgrades the node image version of an agent pool to the latest. /// @@ -293,7 +334,7 @@ public partial interface IAgentPoolsOperations /// https://docs.microsoft.com/azure/aks/node-image-upgrade /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -316,7 +357,7 @@ public partial interface IAgentPoolsOperations /// /// Thrown when a required parameter is null /// - Task> BeginUpgradeNodeImageVersionWithHttpMessagesAsync(string resourceGroupName, string resourceName, string agentPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> BeginUpgradeNodeImageVersionWithHttpMessagesAsync(string resourceGroupName, string resourceName, string agentPoolName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets a list of agent pools in the specified managed cluster. /// diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/IContainerServiceClient.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/IContainerServiceClient.cs index 2b88f1d25012..b5f15d79c61b 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/IContainerServiceClient.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/IContainerServiceClient.cs @@ -41,14 +41,12 @@ public partial interface IContainerServiceClient : System.IDisposable ServiceClientCredentials Credentials { get; } /// - /// Subscription credentials which uniquely identify Microsoft Azure - /// subscription. The subscription ID forms part of the URI for every - /// service call. + /// The ID of the target subscription. /// string SubscriptionId { get; set; } /// - /// Client Api Version. + /// The API version to use for this operation. /// string ApiVersion { get; } @@ -106,5 +104,35 @@ public partial interface IContainerServiceClient : System.IDisposable /// IResolvePrivateLinkServiceIdOperations ResolvePrivateLinkServiceId { get; } + /// + /// Gets the ISnapshotsOperations. + /// + ISnapshotsOperations Snapshots { get; } + + /// + /// Gets the IManagedClusterSnapshotsOperations. + /// + IManagedClusterSnapshotsOperations ManagedClusterSnapshots { get; } + + /// + /// Gets the ITrustedAccessRolesOperations. + /// + ITrustedAccessRolesOperations TrustedAccessRoles { get; } + + /// + /// Gets the ITrustedAccessRoleBindingsOperations. + /// + ITrustedAccessRoleBindingsOperations TrustedAccessRoleBindings { get; } + + /// + /// Gets the IFleetsOperations. + /// + IFleetsOperations Fleets { get; } + + /// + /// Gets the IFleetMembersOperations. + /// + IFleetMembersOperations FleetMembers { get; } + } } diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/IFleetMembersOperations.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/IFleetMembersOperations.cs new file mode 100644 index 000000000000..031c376a1784 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/IFleetMembersOperations.cs @@ -0,0 +1,266 @@ +// +// 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.ContainerService +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// FleetMembersOperations operations. + /// + public partial interface IFleetMembersOperations + { + /// + /// Creates or updates a fleet member. + /// + /// + /// A member contains a reference to an existing Kubernetes cluster. + /// Creating a member makes the referenced cluster join the Fleet. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Fleet resource. + /// + /// + /// The name of the Fleet member resource. + /// + /// + /// Omit this value to always overwrite the current resource. Specify + /// the last-seen ETag value to prevent accidentally overwriting + /// concurrent changes. + /// + /// + /// Set to '*' to allow a new resource to be created and prevent + /// updating an existing resource. Other values will result in a 412 + /// Pre-condition Failed response. + /// + /// + /// The ARM resource id of the cluster that joins the Fleet. Must be a + /// valid Azure resource id. e.g.: + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{clusterName}'. + /// + /// + /// 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 fleetName, string fleetMemberName, string ifMatch = default(string), string ifNoneMatch = default(string), string clusterResourceId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a Fleet member. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Fleet resource. + /// + /// + /// The name of the Fleet member resource. + /// + /// + /// 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 fleetName, string fleetMemberName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a fleet member. + /// + /// + /// Deleting a Fleet member results in the member cluster leaving + /// fleet. The Member azure resource is deleted upon success. The + /// underlying cluster is not deleted. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Fleet resource. + /// + /// + /// The name of the Fleet member resource. + /// + /// + /// Omit this value to always overwrite the current resource. Specify + /// the last-seen ETag value to prevent accidentally overwriting + /// concurrent changes. + /// + /// + /// 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 fleetName, string fleetMemberName, string ifMatch = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists the members of a fleet. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Fleet resource. + /// + /// + /// 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>> ListByFleetWithHttpMessagesAsync(string resourceGroupName, string fleetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates a fleet member. + /// + /// + /// A member contains a reference to an existing Kubernetes cluster. + /// Creating a member makes the referenced cluster join the Fleet. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Fleet resource. + /// + /// + /// The name of the Fleet member resource. + /// + /// + /// Omit this value to always overwrite the current resource. Specify + /// the last-seen ETag value to prevent accidentally overwriting + /// concurrent changes. + /// + /// + /// Set to '*' to allow a new resource to be created and prevent + /// updating an existing resource. Other values will result in a 412 + /// Pre-condition Failed response. + /// + /// + /// The ARM resource id of the cluster that joins the Fleet. Must be a + /// valid Azure resource id. e.g.: + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{clusterName}'. + /// + /// + /// 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string fleetName, string fleetMemberName, string ifMatch = default(string), string ifNoneMatch = default(string), string clusterResourceId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a fleet member. + /// + /// + /// Deleting a Fleet member results in the member cluster leaving + /// fleet. The Member azure resource is deleted upon success. The + /// underlying cluster is not deleted. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Fleet resource. + /// + /// + /// The name of the Fleet member resource. + /// + /// + /// Omit this value to always overwrite the current resource. Specify + /// the last-seen ETag value to prevent accidentally overwriting + /// concurrent changes. + /// + /// + /// 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 fleetName, string fleetMemberName, string ifMatch = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists the members of a fleet. + /// + /// + /// 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>> ListByFleetNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/IFleetsOperations.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/IFleetsOperations.cs new file mode 100644 index 000000000000..950bc725c47f --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/IFleetsOperations.cs @@ -0,0 +1,325 @@ +// +// 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.ContainerService +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// FleetsOperations operations. + /// + public partial interface IFleetsOperations + { + /// + /// Creates or updates a Fleet. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Fleet resource. + /// + /// + /// The Fleet to create or update. + /// + /// + /// Omit this value to always overwrite the current resource. Specify + /// the last-seen ETag value to prevent accidentally overwriting + /// concurrent changes. + /// + /// + /// Set to '*' to allow a new resource to be created and prevent + /// updating an existing resource. Other values will result in a 412 + /// Pre-condition Failed response. + /// + /// + /// 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 fleetName, Fleet parameters, string ifMatch = default(string), string ifNoneMatch = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Patches a fleet resource. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Fleet resource. + /// + /// + /// Omit this value to always overwrite the current resource. Specify + /// the last-seen ETag value to prevent accidentally overwriting + /// concurrent changes. + /// + /// + /// Resource tags. + /// + /// + /// 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string fleetName, string ifMatch = default(string), IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a Fleet. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Fleet resource. + /// + /// + /// 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 fleetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a Fleet. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Fleet resource. + /// + /// + /// Omit this value to always overwrite the current resource. Specify + /// the last-seen ETag value to prevent accidentally overwriting + /// concurrent changes. + /// + /// + /// 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 fleetName, string ifMatch = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists fleets in the specified subscription and resource group. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// 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>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists fleets in the specified subscription. + /// + /// + /// 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(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists the user credentials of a Fleet. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Fleet resource. + /// + /// + /// 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> ListCredentialsWithHttpMessagesAsync(string resourceGroupName, string fleetName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates a Fleet. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Fleet resource. + /// + /// + /// The Fleet to create or update. + /// + /// + /// Omit this value to always overwrite the current resource. Specify + /// the last-seen ETag value to prevent accidentally overwriting + /// concurrent changes. + /// + /// + /// Set to '*' to allow a new resource to be created and prevent + /// updating an existing resource. Other values will result in a 412 + /// Pre-condition Failed response. + /// + /// + /// 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string fleetName, Fleet parameters, string ifMatch = default(string), string ifNoneMatch = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a Fleet. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the Fleet resource. + /// + /// + /// Omit this value to always overwrite the current resource. Specify + /// the last-seen ETag value to prevent accidentally overwriting + /// concurrent changes. + /// + /// + /// 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 fleetName, string ifMatch = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists fleets in the specified subscription and resource group. + /// + /// + /// 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>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists fleets in the specified subscription. + /// + /// + /// 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/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/IMaintenanceConfigurationsOperations.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/IMaintenanceConfigurationsOperations.cs index 8b6ea84dee6d..aec8c81a7d30 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/IMaintenanceConfigurationsOperations.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/IMaintenanceConfigurationsOperations.cs @@ -28,7 +28,7 @@ public partial interface IMaintenanceConfigurationsOperations /// cluster. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -53,7 +53,7 @@ public partial interface IMaintenanceConfigurationsOperations /// Gets the specified maintenance configuration of a managed cluster. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -82,7 +82,7 @@ public partial interface IMaintenanceConfigurationsOperations /// managed cluster. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -113,7 +113,7 @@ public partial interface IMaintenanceConfigurationsOperations /// Deletes a maintenance configuration. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/IManagedClusterSnapshotsOperations.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/IManagedClusterSnapshotsOperations.cs new file mode 100644 index 000000000000..99d24c6e1e05 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/IManagedClusterSnapshotsOperations.cs @@ -0,0 +1,219 @@ +// +// 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.ContainerService +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ManagedClusterSnapshotsOperations operations. + /// + public partial interface IManagedClusterSnapshotsOperations + { + /// + /// Gets a list of managed cluster snapshots in the specified + /// subscription. + /// + /// + /// 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(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists managed cluster snapshots in the specified subscription and + /// resource group. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// 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>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a managed cluster snapshot. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// 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 resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates a managed cluster snapshot. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// The managed cluster snapshot to create or update. + /// + /// + /// 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 resourceName, ManagedClusterSnapshot parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates tags on a managed cluster snapshot. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// Resource tags. + /// + /// + /// 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> UpdateTagsWithHttpMessagesAsync(string resourceGroupName, string resourceName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a managed cluster snapshot. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// 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 resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of managed cluster snapshots in the specified + /// subscription. + /// + /// + /// 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)); + /// + /// Lists managed cluster snapshots in the specified subscription and + /// resource group. + /// + /// + /// 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>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/IManagedClustersOperations.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/IManagedClustersOperations.cs index 23d59d0baea0..37cac3f156f3 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/IManagedClustersOperations.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/IManagedClustersOperations.cs @@ -27,7 +27,7 @@ public partial interface IManagedClustersOperations /// Gets supported OS options in the specified subscription. /// /// - /// The name of a supported Azure region. + /// The name of Azure region. /// /// /// The resource type for which the OS options needs to be returned @@ -72,7 +72,7 @@ public partial interface IManagedClustersOperations /// group. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The headers that will be added to request. @@ -94,7 +94,7 @@ public partial interface IManagedClustersOperations /// Gets the upgrade profile of a managed cluster. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -126,7 +126,7 @@ public partial interface IManagedClustersOperations /// . /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -155,7 +155,7 @@ public partial interface IManagedClustersOperations /// Lists the admin credentials of a managed cluster. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -183,7 +183,7 @@ public partial interface IManagedClustersOperations /// Lists the user credentials of a managed cluster. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -191,6 +191,13 @@ public partial interface IManagedClustersOperations /// /// server fqdn type for credentials to be returned /// + /// + /// Only apply to AAD clusters, specifies the format of returned + /// kubeconfig. Format 'azure' will return azure auth-provider + /// kubeconfig; format 'exec' will return exec format kubeconfig, which + /// requires kubelogin binary in the path. Possible values include: + /// 'azure', 'exec' + /// /// /// The headers that will be added to request. /// @@ -206,12 +213,12 @@ public partial interface IManagedClustersOperations /// /// Thrown when a required parameter is null /// - Task> ListClusterUserCredentialsWithHttpMessagesAsync(string resourceGroupName, string resourceName, string serverFqdn = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ListClusterUserCredentialsWithHttpMessagesAsync(string resourceGroupName, string resourceName, string serverFqdn = default(string), string format = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists the cluster monitoring user credentials of a managed cluster. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -239,7 +246,7 @@ public partial interface IManagedClustersOperations /// Gets a managed cluster. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -264,7 +271,7 @@ public partial interface IManagedClustersOperations /// Creates or updates a managed cluster. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -292,7 +299,7 @@ public partial interface IManagedClustersOperations /// Updates tags on a managed cluster. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -320,11 +327,15 @@ public partial interface IManagedClustersOperations /// Deletes a managed cluster. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. /// + /// + /// ignore-pod-disruption-budget=true to delete those pods on a node + /// without considering Pod Disruption Budget + /// /// /// The headers that will be added to request. /// @@ -337,7 +348,7 @@ public partial interface IManagedClustersOperations /// /// Thrown when a required parameter is null /// - Task DeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, bool? ignorePodDisruptionBudget = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Reset the Service Principal Profile of a managed cluster. /// @@ -346,7 +357,7 @@ public partial interface IManagedClustersOperations /// service principal /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -371,7 +382,7 @@ public partial interface IManagedClustersOperations /// Reset the AAD Profile of a managed cluster. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -393,6 +404,36 @@ public partial interface IManagedClustersOperations /// Task ResetAADProfileWithHttpMessagesAsync(string resourceGroupName, string resourceName, ManagedClusterAADProfile parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Aborts last operation running on managed cluster. + /// + /// + /// Aborting last running operation on managed cluster. We return a + /// 204 no content code here to indicate that the operation has been + /// accepted and an abort will be attempted but is not guaranteed to + /// complete successfully. Please look up the provisioning state of the + /// managed cluster to keep track of whether it changes to Canceled. A + /// canceled provisioning state indicates that the abort was successful + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// 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 AbortLatestOperationWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Rotates the certificates of a managed cluster. /// /// @@ -401,7 +442,7 @@ public partial interface IManagedClustersOperations /// for more details about rotating managed cluster certificates. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -420,6 +461,28 @@ public partial interface IManagedClustersOperations /// Task RotateClusterCertificatesWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Rotates the service account signing keys of a managed cluster. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// 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 RotateServiceAccountSigningKeysWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Stops a Managed Cluster /// /// @@ -432,7 +495,7 @@ public partial interface IManagedClustersOperations /// for more details about stopping a cluster. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -459,7 +522,7 @@ public partial interface IManagedClustersOperations /// for more details about starting a cluster. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -486,7 +549,7 @@ public partial interface IManagedClustersOperations /// Command](https://docs.microsoft.com/azure/aks/private-clusters#aks-run-command-preview). /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -515,7 +578,7 @@ public partial interface IManagedClustersOperations /// Cluster. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -549,7 +612,7 @@ public partial interface IManagedClustersOperations /// returns properties of each egress endpoint. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -574,7 +637,7 @@ public partial interface IManagedClustersOperations /// Creates or updates a managed cluster. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -602,7 +665,7 @@ public partial interface IManagedClustersOperations /// Updates tags on a managed cluster. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -630,11 +693,15 @@ public partial interface IManagedClustersOperations /// Deletes a managed cluster. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. /// + /// + /// ignore-pod-disruption-budget=true to delete those pods on a node + /// without considering Pod Disruption Budget + /// /// /// The headers that will be added to request. /// @@ -647,7 +714,7 @@ public partial interface IManagedClustersOperations /// /// Thrown when a required parameter is null /// - Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, bool? ignorePodDisruptionBudget = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Reset the Service Principal Profile of a managed cluster. /// @@ -656,7 +723,7 @@ public partial interface IManagedClustersOperations /// service principal /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -681,7 +748,7 @@ public partial interface IManagedClustersOperations /// Reset the AAD Profile of a managed cluster. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -711,7 +778,7 @@ public partial interface IManagedClustersOperations /// for more details about rotating managed cluster certificates. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -730,6 +797,28 @@ public partial interface IManagedClustersOperations /// Task BeginRotateClusterCertificatesWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Rotates the service account signing keys of a managed cluster. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// 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 BeginRotateServiceAccountSigningKeysWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Stops a Managed Cluster /// /// @@ -742,7 +831,7 @@ public partial interface IManagedClustersOperations /// for more details about stopping a cluster. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -769,7 +858,7 @@ public partial interface IManagedClustersOperations /// for more details about starting a cluster. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -796,7 +885,7 @@ public partial interface IManagedClustersOperations /// Command](https://docs.microsoft.com/azure/aks/private-clusters#aks-run-command-preview). /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/IPrivateEndpointConnectionsOperations.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/IPrivateEndpointConnectionsOperations.cs index 65c6818cb075..c7215b26ffaf 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/IPrivateEndpointConnectionsOperations.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/IPrivateEndpointConnectionsOperations.cs @@ -32,7 +32,7 @@ public partial interface IPrivateEndpointConnectionsOperations /// https://docs.microsoft.com/azure/aks/private-clusters /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -61,7 +61,7 @@ public partial interface IPrivateEndpointConnectionsOperations /// https://docs.microsoft.com/azure/aks/private-clusters /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -89,7 +89,7 @@ public partial interface IPrivateEndpointConnectionsOperations /// Updates a private endpoint connection. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -120,7 +120,7 @@ public partial interface IPrivateEndpointConnectionsOperations /// Deletes a private endpoint connection. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -145,7 +145,7 @@ public partial interface IPrivateEndpointConnectionsOperations /// Deletes a private endpoint connection. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/IPrivateLinkResourcesOperations.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/IPrivateLinkResourcesOperations.cs index cd758eb5d374..3a8134d0ca55 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/IPrivateLinkResourcesOperations.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/IPrivateLinkResourcesOperations.cs @@ -32,7 +32,7 @@ public partial interface IPrivateLinkResourcesOperations /// https://docs.microsoft.com/azure/aks/private-clusters /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/IResolvePrivateLinkServiceIdOperations.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/IResolvePrivateLinkServiceIdOperations.cs index a8d2d4863090..743ac50836f1 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/IResolvePrivateLinkServiceIdOperations.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/IResolvePrivateLinkServiceIdOperations.cs @@ -27,7 +27,7 @@ public partial interface IResolvePrivateLinkServiceIdOperations /// Gets the private link service ID for the specified managed cluster. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/ISnapshotsOperations.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/ISnapshotsOperations.cs new file mode 100644 index 000000000000..604e546f73f3 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/ISnapshotsOperations.cs @@ -0,0 +1,215 @@ +// +// 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.ContainerService +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// SnapshotsOperations operations. + /// + public partial interface ISnapshotsOperations + { + /// + /// Gets a list of snapshots in the specified subscription. + /// + /// + /// 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(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists snapshots in the specified subscription and resource group. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// 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>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a snapshot. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// 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 resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates a snapshot. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// The snapshot to create or update. + /// + /// + /// 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 resourceName, Snapshot parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates tags on a snapshot. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// Resource tags. + /// + /// + /// 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> UpdateTagsWithHttpMessagesAsync(string resourceGroupName, string resourceName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a snapshot. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// 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 resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of snapshots in the specified subscription. + /// + /// + /// 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)); + /// + /// Lists snapshots in the specified subscription and resource group. + /// + /// + /// 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>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/ITrustedAccessRoleBindingsOperations.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/ITrustedAccessRoleBindingsOperations.cs new file mode 100644 index 000000000000..1761ac429de1 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/ITrustedAccessRoleBindingsOperations.cs @@ -0,0 +1,158 @@ +// +// 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.ContainerService +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// TrustedAccessRoleBindingsOperations operations. + /// + public partial interface ITrustedAccessRoleBindingsOperations + { + /// + /// List trusted access role bindings. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// 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 resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get a trusted access role binding. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// The name of trusted access role binding. + /// + /// + /// 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 resourceName, string trustedAccessRoleBindingName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update a trusted access role binding + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// The name of trusted access role binding. + /// + /// + /// A trusted access role binding + /// + /// + /// 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 resourceName, string trustedAccessRoleBindingName, TrustedAccessRoleBinding trustedAccessRoleBinding, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete a trusted access role binding. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// The name of trusted access role binding. + /// + /// + /// 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 resourceName, string trustedAccessRoleBindingName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List trusted access role bindings. + /// + /// + /// 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/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/ITrustedAccessRolesOperations.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/ITrustedAccessRolesOperations.cs new file mode 100644 index 000000000000..8a5c8cb1f9c4 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/ITrustedAccessRolesOperations.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.ContainerService +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// TrustedAccessRolesOperations operations. + /// + public partial interface ITrustedAccessRolesOperations + { + /// + /// List supported trusted access roles. + /// + /// + /// The name of Azure region. + /// + /// + /// 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 location, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List supported trusted access roles. + /// + /// + /// 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/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/MaintenanceConfigurationsOperations.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/MaintenanceConfigurationsOperations.cs index 07ee742f075d..7c28a1eeae51 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/MaintenanceConfigurationsOperations.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/MaintenanceConfigurationsOperations.cs @@ -54,7 +54,7 @@ internal MaintenanceConfigurationsOperations(ContainerServiceClient client) /// Gets a list of maintenance configurations in the specified managed cluster. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -86,16 +86,34 @@ internal MaintenanceConfigurationsOperations(ContainerServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } if (resourceGroupName.Length < 1) { throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); @@ -272,7 +290,7 @@ internal MaintenanceConfigurationsOperations(ContainerServiceClient client) /// Gets the specified maintenance configuration of a managed cluster. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -307,16 +325,34 @@ internal MaintenanceConfigurationsOperations(ContainerServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } if (resourceGroupName.Length < 1) { throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); @@ -500,7 +536,7 @@ internal MaintenanceConfigurationsOperations(ContainerServiceClient client) /// cluster. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -538,16 +574,34 @@ internal MaintenanceConfigurationsOperations(ContainerServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } if (resourceGroupName.Length < 1) { throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); @@ -741,7 +795,7 @@ internal MaintenanceConfigurationsOperations(ContainerServiceClient client) /// Deletes a maintenance configuration. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -773,16 +827,34 @@ internal MaintenanceConfigurationsOperations(ContainerServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } if (resourceGroupName.Length < 1) { throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/MaintenanceConfigurationsOperationsExtensions.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/MaintenanceConfigurationsOperationsExtensions.cs index 638889d85358..b50c1e74eaa7 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/MaintenanceConfigurationsOperationsExtensions.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/MaintenanceConfigurationsOperationsExtensions.cs @@ -28,7 +28,7 @@ public static partial class MaintenanceConfigurationsOperationsExtensions /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -45,7 +45,7 @@ public static IPage ListByManagedCluster(this IMainten /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -68,7 +68,7 @@ public static IPage ListByManagedCluster(this IMainten /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -88,7 +88,7 @@ public static MaintenanceConfiguration Get(this IMaintenanceConfigurationsOperat /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -115,7 +115,7 @@ public static MaintenanceConfiguration Get(this IMaintenanceConfigurationsOperat /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -139,7 +139,7 @@ public static MaintenanceConfiguration CreateOrUpdate(this IMaintenanceConfigura /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -168,7 +168,7 @@ public static MaintenanceConfiguration CreateOrUpdate(this IMaintenanceConfigura /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -188,7 +188,7 @@ public static void Delete(this IMaintenanceConfigurationsOperations operations, /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/ManagedClusterSnapshotsOperations.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/ManagedClusterSnapshotsOperations.cs new file mode 100644 index 000000000000..ba3feafa0c76 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/ManagedClusterSnapshotsOperations.cs @@ -0,0 +1,1780 @@ +// +// 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.ContainerService +{ + 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; + + /// + /// ManagedClusterSnapshotsOperations operations. + /// + internal partial class ManagedClusterSnapshotsOperations : IServiceOperations, IManagedClusterSnapshotsOperations + { + /// + /// Initializes a new instance of the ManagedClusterSnapshotsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ManagedClusterSnapshotsOperations(ContainerServiceClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ContainerServiceClient + /// + public ContainerServiceClient Client { get; private set; } + + /// + /// Gets a list of managed cluster snapshots in the specified subscription. + /// + /// + /// 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(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + 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}/providers/Microsoft.ContainerService/managedclustersnapshots").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.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; + } + + /// + /// Lists managed cluster snapshots in the specified subscription and resource + /// group. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// 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>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.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; + } + + /// + /// Gets a managed cluster snapshot. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// 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 resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (resourceName != null) + { + if (resourceName.Length > 63) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceName", 63); + } + if (resourceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceName, "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$"); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + 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/Microsoft.ContainerService/managedclustersnapshots/{resourceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.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; + } + + /// + /// Creates or updates a managed cluster snapshot. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// The managed cluster snapshot to create or update. + /// + /// + /// 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 resourceName, ManagedClusterSnapshot parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (resourceName != null) + { + if (resourceName.Length > 63) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceName", 63); + } + if (resourceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceName, "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$"); + } + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("parameters", parameters); + 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/Microsoft.ContainerService/managedclustersnapshots/{resourceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.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(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, 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 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); + } + } + // 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; + } + + /// + /// Updates tags on a managed cluster snapshot. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// Resource tags. + /// + /// + /// 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> UpdateTagsWithHttpMessagesAsync(string resourceGroupName, string resourceName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (resourceName != null) + { + if (resourceName.Length > 63) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceName", 63); + } + if (resourceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceName, "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$"); + } + } + TagsObject parameters = new TagsObject(); + if (tags != null) + { + parameters.Tags = tags; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "UpdateTags", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.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("PATCH"); + _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(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, 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) + { + 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; + } + + /// + /// Deletes a managed cluster snapshot. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// 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 DeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (resourceName != null) + { + if (resourceName.Length > 63) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceName", 63); + } + if (resourceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceName, "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$"); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclustersnapshots/{resourceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.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 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(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of managed cluster snapshots in the specified subscription. + /// + /// + /// 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; + } + + /// + /// Lists managed cluster snapshots in the specified subscription and resource + /// group. + /// + /// + /// 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>> ListByResourceGroupNextWithHttpMessagesAsync(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, "ListByResourceGroupNext", 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/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/ManagedClusterSnapshotsOperationsExtensions.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/ManagedClusterSnapshotsOperationsExtensions.cs new file mode 100644 index 000000000000..b6341671b624 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/ManagedClusterSnapshotsOperationsExtensions.cs @@ -0,0 +1,330 @@ +// +// 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.ContainerService +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ManagedClusterSnapshotsOperations. + /// + public static partial class ManagedClusterSnapshotsOperationsExtensions + { + /// + /// Gets a list of managed cluster snapshots in the specified subscription. + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this IManagedClusterSnapshotsOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Gets a list of managed cluster snapshots in the specified subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IManagedClusterSnapshotsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists managed cluster snapshots in the specified subscription and resource + /// group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + public static IPage ListByResourceGroup(this IManagedClusterSnapshotsOperations operations, string resourceGroupName) + { + return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Lists managed cluster snapshots in the specified subscription and resource + /// group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupAsync(this IManagedClusterSnapshotsOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a managed cluster snapshot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the managed cluster resource. + /// + public static ManagedClusterSnapshot Get(this IManagedClusterSnapshotsOperations operations, string resourceGroupName, string resourceName) + { + return operations.GetAsync(resourceGroupName, resourceName).GetAwaiter().GetResult(); + } + + /// + /// Gets a managed cluster snapshot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IManagedClusterSnapshotsOperations operations, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, resourceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates a managed cluster snapshot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// The managed cluster snapshot to create or update. + /// + public static ManagedClusterSnapshot CreateOrUpdate(this IManagedClusterSnapshotsOperations operations, string resourceGroupName, string resourceName, ManagedClusterSnapshot parameters) + { + return operations.CreateOrUpdateAsync(resourceGroupName, resourceName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a managed cluster snapshot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// The managed cluster snapshot to create or update. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IManagedClusterSnapshotsOperations operations, string resourceGroupName, string resourceName, ManagedClusterSnapshot parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, resourceName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates tags on a managed cluster snapshot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// Resource tags. + /// + public static ManagedClusterSnapshot UpdateTags(this IManagedClusterSnapshotsOperations operations, string resourceGroupName, string resourceName, IDictionary tags = default(IDictionary)) + { + return operations.UpdateTagsAsync(resourceGroupName, resourceName, tags).GetAwaiter().GetResult(); + } + + /// + /// Updates tags on a managed cluster snapshot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// Resource tags. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateTagsAsync(this IManagedClusterSnapshotsOperations operations, string resourceGroupName, string resourceName, IDictionary tags = default(IDictionary), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateTagsWithHttpMessagesAsync(resourceGroupName, resourceName, tags, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a managed cluster snapshot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the managed cluster resource. + /// + public static void Delete(this IManagedClusterSnapshotsOperations operations, string resourceGroupName, string resourceName) + { + operations.DeleteAsync(resourceGroupName, resourceName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a managed cluster snapshot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IManagedClusterSnapshotsOperations operations, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, resourceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets a list of managed cluster snapshots in the specified subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IManagedClusterSnapshotsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of managed cluster snapshots in the specified subscription. + /// + /// + /// 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 IManagedClusterSnapshotsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists managed cluster snapshots in the specified subscription and resource + /// group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByResourceGroupNext(this IManagedClusterSnapshotsOperations operations, string nextPageLink) + { + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists managed cluster snapshots in the specified subscription and resource + /// group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupNextAsync(this IManagedClusterSnapshotsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/ManagedClustersOperations.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/ManagedClustersOperations.cs index 1d51d037c289..5adedbb7446e 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/ManagedClustersOperations.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/ManagedClustersOperations.cs @@ -54,7 +54,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) /// Gets supported OS options in the specified subscription. /// /// - /// The name of a supported Azure region. + /// The name of Azure region. /// /// /// The resource type for which the OS options needs to be returned @@ -86,14 +86,35 @@ internal ManagedClustersOperations(ContainerServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (location == null) { throw new ValidationException(ValidationRules.CannotBeNull, "location"); } + if (location != null) + { + if (location.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "location", 1); + } + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -275,10 +296,24 @@ internal ManagedClustersOperations(ContainerServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -427,7 +462,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) /// Lists managed clusters in the specified subscription and resource group. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// Headers that will be added to request. @@ -456,16 +491,34 @@ internal ManagedClustersOperations(ContainerServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } if (resourceGroupName.Length < 1) { throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); @@ -621,7 +674,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) /// Gets the upgrade profile of a managed cluster. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -653,16 +706,34 @@ internal ManagedClustersOperations(ContainerServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } if (resourceGroupName.Length < 1) { throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); @@ -846,7 +917,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) /// . /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -882,16 +953,34 @@ internal ManagedClustersOperations(ContainerServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } if (resourceGroupName.Length < 1) { throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); @@ -1074,7 +1163,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) /// Lists the admin credentials of a managed cluster. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -1109,16 +1198,34 @@ internal ManagedClustersOperations(ContainerServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } if (resourceGroupName.Length < 1) { throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); @@ -1300,7 +1407,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) /// Lists the user credentials of a managed cluster. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -1308,6 +1415,12 @@ internal ManagedClustersOperations(ContainerServiceClient client) /// /// server fqdn type for credentials to be returned /// + /// + /// Only apply to AAD clusters, specifies the format of returned kubeconfig. + /// Format 'azure' will return azure auth-provider kubeconfig; format 'exec' + /// will return exec format kubeconfig, which requires kubelogin binary in the + /// path. Possible values include: 'azure', 'exec' + /// /// /// Headers that will be added to request. /// @@ -1329,22 +1442,40 @@ internal ManagedClustersOperations(ContainerServiceClient client) /// /// A response object containing the response body and response headers. /// - public async Task> ListClusterUserCredentialsWithHttpMessagesAsync(string resourceGroupName, string resourceName, string serverFqdn = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ListClusterUserCredentialsWithHttpMessagesAsync(string resourceGroupName, string resourceName, string serverFqdn = default(string), string format = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } if (resourceGroupName.Length < 1) { throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); @@ -1379,6 +1510,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("resourceName", resourceName); tracingParameters.Add("serverFqdn", serverFqdn); + tracingParameters.Add("format", format); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListClusterUserCredentials", tracingParameters); } @@ -1397,6 +1529,10 @@ internal ManagedClustersOperations(ContainerServiceClient client) { _queryParameters.Add(string.Format("server-fqdn={0}", System.Uri.EscapeDataString(serverFqdn))); } + if (format != null) + { + _queryParameters.Add(string.Format("format={0}", System.Uri.EscapeDataString(format))); + } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); @@ -1526,7 +1662,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) /// Lists the cluster monitoring user credentials of a managed cluster. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -1561,16 +1697,34 @@ internal ManagedClustersOperations(ContainerServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } if (resourceGroupName.Length < 1) { throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); @@ -1752,7 +1906,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) /// Gets a managed cluster. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -1784,16 +1938,34 @@ internal ManagedClustersOperations(ContainerServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } if (resourceGroupName.Length < 1) { throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); @@ -1970,7 +2142,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) /// Creates or updates a managed cluster. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -1995,7 +2167,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) /// Updates tags on a managed cluster. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -2020,21 +2192,25 @@ internal ManagedClustersOperations(ContainerServiceClient client) /// Deletes a managed cluster. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. /// + /// + /// ignore-pod-disruption-budget=true to delete those pods on a node without + /// considering Pod Disruption Budget + /// /// /// The headers that will be added to request. /// /// /// The cancellation token. /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, bool? ignorePodDisruptionBudget = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send request - AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, resourceName, customHeaders, cancellationToken).ConfigureAwait(false); + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, resourceName, ignorePodDisruptionBudget, customHeaders, cancellationToken).ConfigureAwait(false); return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } @@ -2046,7 +2222,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) /// principal /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -2071,7 +2247,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) /// Reset the AAD Profile of a managed cluster. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -2093,131 +2269,22 @@ internal ManagedClustersOperations(ContainerServiceClient client) } /// - /// Rotates the certificates of a managed cluster. - /// - /// - /// See [Certificate - /// rotation](https://docs.microsoft.com/azure/aks/certificate-rotation) for - /// more details about rotating managed cluster certificates. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the managed cluster resource. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task RotateClusterCertificatesWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginRotateClusterCertificatesWithHttpMessagesAsync(resourceGroupName, resourceName, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Stops a Managed Cluster - /// - /// - /// This can only be performed on Azure Virtual Machine Scale set backed - /// clusters. Stopping a cluster stops the control plane and agent nodes - /// entirely, while maintaining all object and cluster state. A cluster does - /// not accrue charges while it is stopped. See [stopping a - /// cluster](https://docs.microsoft.com/azure/aks/start-stop-cluster) for more - /// details about stopping a cluster. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the managed cluster resource. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task StopWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginStopWithHttpMessagesAsync(resourceGroupName, resourceName, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Starts a previously stopped Managed Cluster - /// - /// - /// See [starting a - /// cluster](https://docs.microsoft.com/azure/aks/start-stop-cluster) for more - /// details about starting a cluster. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the managed cluster resource. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task StartWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginStartWithHttpMessagesAsync(resourceGroupName, resourceName, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Submits a command to run against the Managed Cluster. + /// Aborts last operation running on managed cluster. /// /// - /// AKS will create a pod to run the command. This is primarily useful for - /// private clusters. For more information see [AKS Run - /// Command](https://docs.microsoft.com/azure/aks/private-clusters#aks-run-command-preview). + /// Aborting last running operation on managed cluster. We return a 204 no + /// content code here to indicate that the operation has been accepted and an + /// abort will be attempted but is not guaranteed to complete successfully. + /// Please look up the provisioning state of the managed cluster to keep track + /// of whether it changes to Canceled. A canceled provisioning state indicates + /// that the abort was successful /// /// - /// The name of the resource group. - /// - /// - /// The name of the managed cluster resource. - /// - /// - /// The run command request - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task> RunCommandWithHttpMessagesAsync(string resourceGroupName, string resourceName, RunCommandRequest requestPayload, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginRunCommandWithHttpMessagesAsync(resourceGroupName, resourceName, requestPayload, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Gets the results of a command which has been run on the Managed Cluster. - /// - /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. /// - /// - /// Id of the command. - /// /// /// Headers that will be added to request. /// @@ -2227,9 +2294,6 @@ internal ManagedClustersOperations(ContainerServiceClient client) /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when unable to deserialize the response - /// /// /// Thrown when a required parameter is null /// @@ -2239,22 +2303,40 @@ internal ManagedClustersOperations(ContainerServiceClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetCommandResultWithHttpMessagesAsync(string resourceGroupName, string resourceName, string commandId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task AbortLatestOperationWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } if (resourceGroupName.Length < 1) { throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); @@ -2279,10 +2361,6 @@ internal ManagedClustersOperations(ContainerServiceClient client) throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$"); } } - if (commandId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "commandId"); - } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2292,17 +2370,15 @@ internal ManagedClustersOperations(ContainerServiceClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("resourceName", resourceName); - tracingParameters.Add("commandId", commandId); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetCommandResult", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "AbortLatestOperation", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclusters/{resourceName}/abort").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); - _url = _url.Replace("{commandId}", System.Uri.EscapeDataString(commandId)); List _queryParameters = new List(); if (Client.ApiVersion != null) { @@ -2315,7 +2391,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -2366,7 +2442,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 202) + if ((int)_statusCode != 204) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -2401,26 +2477,631 @@ internal ManagedClustersOperations(ContainerServiceClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + 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) + if (_shouldTrace) { - _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) - { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Rotates the certificates of a managed cluster. + /// + /// + /// See [Certificate + /// rotation](https://docs.microsoft.com/azure/aks/certificate-rotation) for + /// more details about rotating managed cluster certificates. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task RotateClusterCertificatesWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginRotateClusterCertificatesWithHttpMessagesAsync(resourceGroupName, resourceName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Rotates the service account signing keys of a managed cluster. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task RotateServiceAccountSigningKeysWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginRotateServiceAccountSigningKeysWithHttpMessagesAsync(resourceGroupName, resourceName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Stops a Managed Cluster + /// + /// + /// This can only be performed on Azure Virtual Machine Scale set backed + /// clusters. Stopping a cluster stops the control plane and agent nodes + /// entirely, while maintaining all object and cluster state. A cluster does + /// not accrue charges while it is stopped. See [stopping a + /// cluster](https://docs.microsoft.com/azure/aks/start-stop-cluster) for more + /// details about stopping a cluster. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task StopWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginStopWithHttpMessagesAsync(resourceGroupName, resourceName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Starts a previously stopped Managed Cluster + /// + /// + /// See [starting a + /// cluster](https://docs.microsoft.com/azure/aks/start-stop-cluster) for more + /// details about starting a cluster. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task StartWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginStartWithHttpMessagesAsync(resourceGroupName, resourceName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Submits a command to run against the Managed Cluster. + /// + /// + /// AKS will create a pod to run the command. This is primarily useful for + /// private clusters. For more information see [AKS Run + /// Command](https://docs.microsoft.com/azure/aks/private-clusters#aks-run-command-preview). + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// The run command request + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> RunCommandWithHttpMessagesAsync(string resourceGroupName, string resourceName, RunCommandRequest requestPayload, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginRunCommandWithHttpMessagesAsync(resourceGroupName, resourceName, requestPayload, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the results of a command which has been run on the Managed Cluster. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// Id of the command. + /// + /// + /// 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> GetCommandResultWithHttpMessagesAsync(string resourceGroupName, string resourceName, string commandId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (resourceName != null) + { + if (resourceName.Length > 63) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceName", 63); + } + if (resourceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceName, "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$"); + } + } + if (commandId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "commandId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("commandId", commandId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetCommandResult", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _url = _url.Replace("{commandId}", System.Uri.EscapeDataString(commandId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.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 && (int)_statusCode != 202) + { + 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; + } + + /// + /// Gets a list of egress endpoints (network endpoints of all outbound + /// dependencies) in the specified managed cluster. + /// + /// + /// Gets a list of egress endpoints (network endpoints of all outbound + /// dependencies) in the specified managed cluster. The operation returns + /// properties of each egress endpoint. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// 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>> ListOutboundNetworkDependenciesEndpointsWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (resourceName != null) + { + if (resourceName.Length > 63) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceName", 63); + } + if (resourceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceName, "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$"); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListOutboundNetworkDependenciesEndpoints", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.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); @@ -2434,20 +3115,17 @@ internal ManagedClustersOperations(ContainerServiceClient client) } /// - /// Gets a list of egress endpoints (network endpoints of all outbound - /// dependencies) in the specified managed cluster. + /// Creates or updates a managed cluster. /// - /// - /// Gets a list of egress endpoints (network endpoints of all outbound - /// dependencies) in the specified managed cluster. The operation returns - /// properties of each egress endpoint. - /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. /// + /// + /// The managed cluster to create or update. + /// /// /// Headers that will be added to request. /// @@ -2469,22 +3147,40 @@ internal ManagedClustersOperations(ContainerServiceClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListOutboundNetworkDependenciesEndpointsWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, ManagedCluster parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } if (resourceGroupName.Length < 1) { throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); @@ -2509,6 +3205,14 @@ internal ManagedClustersOperations(ContainerServiceClient client) throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$"); } } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2518,12 +3222,13 @@ internal ManagedClustersOperations(ContainerServiceClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListOutboundNetworkDependenciesEndpoints", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); @@ -2539,7 +3244,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.Method = new HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -2570,6 +3275,12 @@ internal ManagedClustersOperations(ContainerServiceClient client) // Serialize Request string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, 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) { @@ -2590,7 +3301,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200) + if ((int)_statusCode != 200 && (int)_statusCode != 201) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -2625,7 +3336,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -2638,7 +3349,25 @@ internal ManagedClustersOperations(ContainerServiceClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _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) { @@ -2658,16 +3387,16 @@ internal ManagedClustersOperations(ContainerServiceClient client) } /// - /// Creates or updates a managed cluster. + /// Updates tags on a managed cluster. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. /// - /// - /// The managed cluster to create or update. + /// + /// Resource tags. /// /// /// Headers that will be added to request. @@ -2690,22 +3419,40 @@ internal ManagedClustersOperations(ContainerServiceClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, ManagedCluster parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginUpdateTagsWithHttpMessagesAsync(string resourceGroupName, string resourceName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } if (resourceGroupName.Length < 1) { throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); @@ -2727,16 +3474,13 @@ internal ManagedClustersOperations(ContainerServiceClient client) } if (!System.Text.RegularExpressions.Regex.IsMatch(resourceName, "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$")) { - throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$"); - } - } - if (parameters == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$"); + } } - if (parameters != null) + TagsObject parameters = new TagsObject(); + if (tags != null) { - parameters.Validate(); + parameters.Tags = tags; } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -2749,7 +3493,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) tracingParameters.Add("resourceName", resourceName); tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdateTags", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; @@ -2769,7 +3513,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.Method = new HttpMethod("PATCH"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -2826,7 +3570,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 201) + if ((int)_statusCode != 200) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -2886,24 +3630,6 @@ internal ManagedClustersOperations(ContainerServiceClient client) 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); @@ -2912,16 +3638,17 @@ internal ManagedClustersOperations(ContainerServiceClient client) } /// - /// Updates tags on a managed cluster. + /// Deletes a managed cluster. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. /// - /// - /// Resource tags. + /// + /// ignore-pod-disruption-budget=true to delete those pods on a node without + /// considering Pod Disruption Budget /// /// /// Headers that will be added to request. @@ -2932,9 +3659,6 @@ internal ManagedClustersOperations(ContainerServiceClient client) /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when unable to deserialize the response - /// /// /// Thrown when a required parameter is null /// @@ -2944,22 +3668,40 @@ internal ManagedClustersOperations(ContainerServiceClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginUpdateTagsWithHttpMessagesAsync(string resourceGroupName, string resourceName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, bool? ignorePodDisruptionBudget = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } if (resourceGroupName.Length < 1) { throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); @@ -2984,11 +3726,6 @@ internal ManagedClustersOperations(ContainerServiceClient client) throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$"); } } - TagsObject parameters = new TagsObject(); - if (tags != null) - { - parameters.Tags = tags; - } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2998,9 +3735,9 @@ internal ManagedClustersOperations(ContainerServiceClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("resourceName", resourceName); - tracingParameters.Add("parameters", parameters); + tracingParameters.Add("ignorePodDisruptionBudget", ignorePodDisruptionBudget); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginUpdateTags", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; @@ -3013,6 +3750,10 @@ internal ManagedClustersOperations(ContainerServiceClient client) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } + if (ignorePodDisruptionBudget != null) + { + _queryParameters.Add(string.Format("ignore-pod-disruption-budget={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(ignorePodDisruptionBudget, Client.SerializationSettings).Trim('"')))); + } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); @@ -3020,7 +3761,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.Method = new HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -3051,12 +3792,6 @@ internal ManagedClustersOperations(ContainerServiceClient client) // Serialize Request string _requestContent = null; - if(parameters != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, 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) { @@ -3077,7 +3812,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200) + if ((int)_statusCode != 202 && (int)_statusCode != 204) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -3112,31 +3847,13 @@ internal ManagedClustersOperations(ContainerServiceClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + 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); @@ -3145,14 +3862,21 @@ internal ManagedClustersOperations(ContainerServiceClient client) } /// - /// Deletes a managed cluster. + /// Reset the Service Principal Profile of a managed cluster. /// + /// + /// This action cannot be performed on a cluster that is not using a service + /// principal + /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. /// + /// + /// The service principal profile to set on the managed cluster. + /// /// /// Headers that will be added to request. /// @@ -3171,22 +3895,40 @@ internal ManagedClustersOperations(ContainerServiceClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginResetServicePrincipalProfileWithHttpMessagesAsync(string resourceGroupName, string resourceName, ManagedClusterServicePrincipalProfile parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } if (resourceGroupName.Length < 1) { throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); @@ -3211,6 +3953,14 @@ internal ManagedClustersOperations(ContainerServiceClient client) throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$"); } } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -3220,12 +3970,13 @@ internal ManagedClustersOperations(ContainerServiceClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginResetServicePrincipalProfile", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); @@ -3241,7 +3992,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -3272,6 +4023,12 @@ internal ManagedClustersOperations(ContainerServiceClient client) // Serialize Request string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, 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) { @@ -3292,7 +4049,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 202 && (int)_statusCode != 204) + if ((int)_statusCode != 200 && (int)_statusCode != 202) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -3342,20 +4099,16 @@ internal ManagedClustersOperations(ContainerServiceClient client) } /// - /// Reset the Service Principal Profile of a managed cluster. + /// Reset the AAD Profile of a managed cluster. /// - /// - /// This action cannot be performed on a cluster that is not using a service - /// principal - /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. /// /// - /// The service principal profile to set on the managed cluster. + /// The AAD profile to set on the Managed Cluster /// /// /// Headers that will be added to request. @@ -3375,22 +4128,40 @@ internal ManagedClustersOperations(ContainerServiceClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginResetServicePrincipalProfileWithHttpMessagesAsync(string resourceGroupName, string resourceName, ManagedClusterServicePrincipalProfile parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginResetAADProfileWithHttpMessagesAsync(string resourceGroupName, string resourceName, ManagedClusterAADProfile parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } if (resourceGroupName.Length < 1) { throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); @@ -3419,10 +4190,6 @@ internal ManagedClustersOperations(ContainerServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); } - if (parameters != null) - { - parameters.Validate(); - } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -3434,11 +4201,11 @@ internal ManagedClustersOperations(ContainerServiceClient client) tracingParameters.Add("resourceName", resourceName); tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginResetServicePrincipalProfile", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginResetAADProfile", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); @@ -3561,17 +4328,19 @@ internal ManagedClustersOperations(ContainerServiceClient client) } /// - /// Reset the AAD Profile of a managed cluster. + /// Rotates the certificates of a managed cluster. /// + /// + /// See [Certificate + /// rotation](https://docs.microsoft.com/azure/aks/certificate-rotation) for + /// more details about rotating managed cluster certificates. + /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. /// - /// - /// The AAD profile to set on the Managed Cluster - /// /// /// Headers that will be added to request. /// @@ -3590,22 +4359,40 @@ internal ManagedClustersOperations(ContainerServiceClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginResetAADProfileWithHttpMessagesAsync(string resourceGroupName, string resourceName, ManagedClusterAADProfile parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginRotateClusterCertificatesWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } if (resourceGroupName.Length < 1) { throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); @@ -3630,10 +4417,6 @@ internal ManagedClustersOperations(ContainerServiceClient client) throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$"); } } - if (parameters == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); - } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -3643,13 +4426,12 @@ internal ManagedClustersOperations(ContainerServiceClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("resourceName", resourceName); - tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginResetAADProfile", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginRotateClusterCertificates", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); @@ -3696,12 +4478,6 @@ internal ManagedClustersOperations(ContainerServiceClient client) // Serialize Request string _requestContent = null; - if(parameters != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, 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) { @@ -3722,7 +4498,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 202) + if ((int)_statusCode != 202 && (int)_statusCode != 204) { var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -3772,15 +4548,10 @@ internal ManagedClustersOperations(ContainerServiceClient client) } /// - /// Rotates the certificates of a managed cluster. + /// Rotates the service account signing keys of a managed cluster. /// - /// - /// See [Certificate - /// rotation](https://docs.microsoft.com/azure/aks/certificate-rotation) for - /// more details about rotating managed cluster certificates. - /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -3803,22 +4574,40 @@ internal ManagedClustersOperations(ContainerServiceClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginRotateClusterCertificatesWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginRotateServiceAccountSigningKeysWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } if (resourceGroupName.Length < 1) { throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); @@ -3853,11 +4642,11 @@ internal ManagedClustersOperations(ContainerServiceClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("resourceName", resourceName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginRotateClusterCertificates", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginRotateServiceAccountSigningKeys", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateClusterCertificates").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateServiceAccountSigningKeys").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); @@ -3985,7 +4774,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) /// details about stopping a cluster. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -4014,16 +4803,34 @@ internal ManagedClustersOperations(ContainerServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } if (resourceGroupName.Length < 1) { throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); @@ -4187,7 +4994,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) /// details about starting a cluster. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -4216,16 +5023,34 @@ internal ManagedClustersOperations(ContainerServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } if (resourceGroupName.Length < 1) { throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); @@ -4389,7 +5214,7 @@ internal ManagedClustersOperations(ContainerServiceClient client) /// Command](https://docs.microsoft.com/azure/aks/private-clusters#aks-run-command-preview). /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -4424,16 +5249,34 @@ internal ManagedClustersOperations(ContainerServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } if (resourceGroupName.Length < 1) { throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/ManagedClustersOperationsExtensions.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/ManagedClustersOperationsExtensions.cs index 5a64e1e4c822..0230e702261b 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/ManagedClustersOperationsExtensions.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/ManagedClustersOperationsExtensions.cs @@ -30,7 +30,7 @@ public static partial class ManagedClustersOperationsExtensions /// The operations group for this extension method. /// /// - /// The name of a supported Azure region. + /// The name of Azure region. /// /// /// The resource type for which the OS options needs to be returned @@ -47,7 +47,7 @@ public static partial class ManagedClustersOperationsExtensions /// The operations group for this extension method. /// /// - /// The name of a supported Azure region. + /// The name of Azure region. /// /// /// The resource type for which the OS options needs to be returned @@ -98,7 +98,7 @@ public static IPage List(this IManagedClustersOperations operati /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// public static IPage ListByResourceGroup(this IManagedClustersOperations operations, string resourceGroupName) { @@ -112,7 +112,7 @@ public static IPage ListByResourceGroup(this IManagedClustersOpe /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The cancellation token. @@ -132,7 +132,7 @@ public static IPage ListByResourceGroup(this IManagedClustersOpe /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -149,7 +149,7 @@ public static ManagedClusterUpgradeProfile GetUpgradeProfile(this IManagedCluste /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -179,7 +179,7 @@ public static ManagedClusterUpgradeProfile GetUpgradeProfile(this IManagedCluste /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -207,7 +207,7 @@ public static ManagedClusterAccessProfile GetAccessProfile(this IManagedClusters /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -234,7 +234,7 @@ public static ManagedClusterAccessProfile GetAccessProfile(this IManagedClusters /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -254,7 +254,7 @@ public static ManagedClusterAccessProfile GetAccessProfile(this IManagedClusters /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -280,7 +280,7 @@ public static ManagedClusterAccessProfile GetAccessProfile(this IManagedClusters /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -288,9 +288,15 @@ public static ManagedClusterAccessProfile GetAccessProfile(this IManagedClusters /// /// server fqdn type for credentials to be returned /// - public static CredentialResults ListClusterUserCredentials(this IManagedClustersOperations operations, string resourceGroupName, string resourceName, string serverFqdn = default(string)) + /// + /// Only apply to AAD clusters, specifies the format of returned kubeconfig. + /// Format 'azure' will return azure auth-provider kubeconfig; format 'exec' + /// will return exec format kubeconfig, which requires kubelogin binary in the + /// path. Possible values include: 'azure', 'exec' + /// + public static CredentialResults ListClusterUserCredentials(this IManagedClustersOperations operations, string resourceGroupName, string resourceName, string serverFqdn = default(string), string format = default(string)) { - return operations.ListClusterUserCredentialsAsync(resourceGroupName, resourceName, serverFqdn).GetAwaiter().GetResult(); + return operations.ListClusterUserCredentialsAsync(resourceGroupName, resourceName, serverFqdn, format).GetAwaiter().GetResult(); } /// @@ -300,7 +306,7 @@ public static ManagedClusterAccessProfile GetAccessProfile(this IManagedClusters /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -308,12 +314,18 @@ public static ManagedClusterAccessProfile GetAccessProfile(this IManagedClusters /// /// server fqdn type for credentials to be returned /// + /// + /// Only apply to AAD clusters, specifies the format of returned kubeconfig. + /// Format 'azure' will return azure auth-provider kubeconfig; format 'exec' + /// will return exec format kubeconfig, which requires kubelogin binary in the + /// path. Possible values include: 'azure', 'exec' + /// /// /// The cancellation token. /// - public static async Task ListClusterUserCredentialsAsync(this IManagedClustersOperations operations, string resourceGroupName, string resourceName, string serverFqdn = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ListClusterUserCredentialsAsync(this IManagedClustersOperations operations, string resourceGroupName, string resourceName, string serverFqdn = default(string), string format = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListClusterUserCredentialsWithHttpMessagesAsync(resourceGroupName, resourceName, serverFqdn, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListClusterUserCredentialsWithHttpMessagesAsync(resourceGroupName, resourceName, serverFqdn, format, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -326,7 +338,7 @@ public static ManagedClusterAccessProfile GetAccessProfile(this IManagedClusters /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -346,7 +358,7 @@ public static ManagedClusterAccessProfile GetAccessProfile(this IManagedClusters /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -372,7 +384,7 @@ public static ManagedClusterAccessProfile GetAccessProfile(this IManagedClusters /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -389,7 +401,7 @@ public static ManagedCluster Get(this IManagedClustersOperations operations, str /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -412,7 +424,7 @@ public static ManagedCluster Get(this IManagedClustersOperations operations, str /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -432,7 +444,7 @@ public static ManagedCluster CreateOrUpdate(this IManagedClustersOperations oper /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -458,7 +470,7 @@ public static ManagedCluster CreateOrUpdate(this IManagedClustersOperations oper /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -478,7 +490,7 @@ public static ManagedCluster CreateOrUpdate(this IManagedClustersOperations oper /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -504,14 +516,18 @@ public static ManagedCluster CreateOrUpdate(this IManagedClustersOperations oper /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. /// - public static void Delete(this IManagedClustersOperations operations, string resourceGroupName, string resourceName) + /// + /// ignore-pod-disruption-budget=true to delete those pods on a node without + /// considering Pod Disruption Budget + /// + public static void Delete(this IManagedClustersOperations operations, string resourceGroupName, string resourceName, bool? ignorePodDisruptionBudget = default(bool?)) { - operations.DeleteAsync(resourceGroupName, resourceName).GetAwaiter().GetResult(); + operations.DeleteAsync(resourceGroupName, resourceName, ignorePodDisruptionBudget).GetAwaiter().GetResult(); } /// @@ -521,17 +537,21 @@ public static void Delete(this IManagedClustersOperations operations, string res /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. /// + /// + /// ignore-pod-disruption-budget=true to delete those pods on a node without + /// considering Pod Disruption Budget + /// /// /// The cancellation token. /// - public static async Task DeleteAsync(this IManagedClustersOperations operations, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task DeleteAsync(this IManagedClustersOperations operations, string resourceGroupName, string resourceName, bool? ignorePodDisruptionBudget = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, resourceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, resourceName, ignorePodDisruptionBudget, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -545,7 +565,7 @@ public static void Delete(this IManagedClustersOperations operations, string res /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -569,7 +589,7 @@ public static void ResetServicePrincipalProfile(this IManagedClustersOperations /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -592,7 +612,7 @@ public static void ResetServicePrincipalProfile(this IManagedClustersOperations /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -612,7 +632,7 @@ public static void ResetAADProfile(this IManagedClustersOperations operations, s /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -628,6 +648,59 @@ public static void ResetAADProfile(this IManagedClustersOperations operations, s (await operations.ResetAADProfileWithHttpMessagesAsync(resourceGroupName, resourceName, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); } + /// + /// Aborts last operation running on managed cluster. + /// + /// + /// Aborting last running operation on managed cluster. We return a 204 no + /// content code here to indicate that the operation has been accepted and an + /// abort will be attempted but is not guaranteed to complete successfully. + /// Please look up the provisioning state of the managed cluster to keep track + /// of whether it changes to Canceled. A canceled provisioning state indicates + /// that the abort was successful + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the managed cluster resource. + /// + public static void AbortLatestOperation(this IManagedClustersOperations operations, string resourceGroupName, string resourceName) + { + operations.AbortLatestOperationAsync(resourceGroupName, resourceName).GetAwaiter().GetResult(); + } + + /// + /// Aborts last operation running on managed cluster. + /// + /// + /// Aborting last running operation on managed cluster. We return a 204 no + /// content code here to indicate that the operation has been accepted and an + /// abort will be attempted but is not guaranteed to complete successfully. + /// Please look up the provisioning state of the managed cluster to keep track + /// of whether it changes to Canceled. A canceled provisioning state indicates + /// that the abort was successful + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// The cancellation token. + /// + public static async Task AbortLatestOperationAsync(this IManagedClustersOperations operations, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.AbortLatestOperationWithHttpMessagesAsync(resourceGroupName, resourceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// /// Rotates the certificates of a managed cluster. /// @@ -640,7 +713,7 @@ public static void ResetAADProfile(this IManagedClustersOperations operations, s /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -662,7 +735,7 @@ public static void RotateClusterCertificates(this IManagedClustersOperations ope /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -675,6 +748,43 @@ public static void RotateClusterCertificates(this IManagedClustersOperations ope (await operations.RotateClusterCertificatesWithHttpMessagesAsync(resourceGroupName, resourceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } + /// + /// Rotates the service account signing keys of a managed cluster. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the managed cluster resource. + /// + public static void RotateServiceAccountSigningKeys(this IManagedClustersOperations operations, string resourceGroupName, string resourceName) + { + operations.RotateServiceAccountSigningKeysAsync(resourceGroupName, resourceName).GetAwaiter().GetResult(); + } + + /// + /// Rotates the service account signing keys of a managed cluster. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// The cancellation token. + /// + public static async Task RotateServiceAccountSigningKeysAsync(this IManagedClustersOperations operations, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.RotateServiceAccountSigningKeysWithHttpMessagesAsync(resourceGroupName, resourceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// /// Stops a Managed Cluster /// @@ -690,7 +800,7 @@ public static void RotateClusterCertificates(this IManagedClustersOperations ope /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -715,7 +825,7 @@ public static void Stop(this IManagedClustersOperations operations, string resou /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -740,7 +850,7 @@ public static void Stop(this IManagedClustersOperations operations, string resou /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -762,7 +872,7 @@ public static void Start(this IManagedClustersOperations operations, string reso /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -787,7 +897,7 @@ public static void Start(this IManagedClustersOperations operations, string reso /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -812,7 +922,7 @@ public static RunCommandResult RunCommand(this IManagedClustersOperations operat /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -838,7 +948,7 @@ public static RunCommandResult RunCommand(this IManagedClustersOperations operat /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -858,7 +968,7 @@ public static RunCommandResult GetCommandResult(this IManagedClustersOperations /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -890,7 +1000,7 @@ public static RunCommandResult GetCommandResult(this IManagedClustersOperations /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -913,7 +1023,7 @@ public static IPage ListOutboundNetworkDependencies /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -936,7 +1046,7 @@ public static IPage ListOutboundNetworkDependencies /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -956,7 +1066,7 @@ public static ManagedCluster BeginCreateOrUpdate(this IManagedClustersOperations /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -982,7 +1092,7 @@ public static ManagedCluster BeginCreateOrUpdate(this IManagedClustersOperations /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -1002,7 +1112,7 @@ public static ManagedCluster BeginCreateOrUpdate(this IManagedClustersOperations /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -1028,14 +1138,18 @@ public static ManagedCluster BeginCreateOrUpdate(this IManagedClustersOperations /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. /// - public static void BeginDelete(this IManagedClustersOperations operations, string resourceGroupName, string resourceName) + /// + /// ignore-pod-disruption-budget=true to delete those pods on a node without + /// considering Pod Disruption Budget + /// + public static void BeginDelete(this IManagedClustersOperations operations, string resourceGroupName, string resourceName, bool? ignorePodDisruptionBudget = default(bool?)) { - operations.BeginDeleteAsync(resourceGroupName, resourceName).GetAwaiter().GetResult(); + operations.BeginDeleteAsync(resourceGroupName, resourceName, ignorePodDisruptionBudget).GetAwaiter().GetResult(); } /// @@ -1045,17 +1159,21 @@ public static void BeginDelete(this IManagedClustersOperations operations, strin /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. /// + /// + /// ignore-pod-disruption-budget=true to delete those pods on a node without + /// considering Pod Disruption Budget + /// /// /// The cancellation token. /// - public static async Task BeginDeleteAsync(this IManagedClustersOperations operations, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginDeleteAsync(this IManagedClustersOperations operations, string resourceGroupName, string resourceName, bool? ignorePodDisruptionBudget = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, resourceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, resourceName, ignorePodDisruptionBudget, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -1069,7 +1187,7 @@ public static void BeginDelete(this IManagedClustersOperations operations, strin /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -1093,7 +1211,7 @@ public static void BeginResetServicePrincipalProfile(this IManagedClustersOperat /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -1116,7 +1234,7 @@ public static void BeginResetServicePrincipalProfile(this IManagedClustersOperat /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -1136,7 +1254,7 @@ public static void BeginResetAADProfile(this IManagedClustersOperations operatio /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -1164,7 +1282,7 @@ public static void BeginResetAADProfile(this IManagedClustersOperations operatio /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -1186,7 +1304,7 @@ public static void BeginRotateClusterCertificates(this IManagedClustersOperation /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -1199,6 +1317,43 @@ public static void BeginRotateClusterCertificates(this IManagedClustersOperation (await operations.BeginRotateClusterCertificatesWithHttpMessagesAsync(resourceGroupName, resourceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } + /// + /// Rotates the service account signing keys of a managed cluster. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the managed cluster resource. + /// + public static void BeginRotateServiceAccountSigningKeys(this IManagedClustersOperations operations, string resourceGroupName, string resourceName) + { + operations.BeginRotateServiceAccountSigningKeysAsync(resourceGroupName, resourceName).GetAwaiter().GetResult(); + } + + /// + /// Rotates the service account signing keys of a managed cluster. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// The cancellation token. + /// + public static async Task BeginRotateServiceAccountSigningKeysAsync(this IManagedClustersOperations operations, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginRotateServiceAccountSigningKeysWithHttpMessagesAsync(resourceGroupName, resourceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// /// Stops a Managed Cluster /// @@ -1214,7 +1369,7 @@ public static void BeginRotateClusterCertificates(this IManagedClustersOperation /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -1239,7 +1394,7 @@ public static void BeginStop(this IManagedClustersOperations operations, string /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -1264,7 +1419,7 @@ public static void BeginStop(this IManagedClustersOperations operations, string /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -1286,7 +1441,7 @@ public static void BeginStart(this IManagedClustersOperations operations, string /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -1311,7 +1466,7 @@ public static void BeginStart(this IManagedClustersOperations operations, string /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -1336,7 +1491,7 @@ public static RunCommandResult BeginRunCommand(this IManagedClustersOperations o /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPool.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPool.cs index 490bb7791c19..d05e9ad29a1b 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPool.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPool.cs @@ -48,6 +48,10 @@ public AgentPool() /// 'Ephemeral' /// Possible values include: 'OS', /// 'Temporary' + /// Possible values include: + /// 'OCIContainer', 'WasmWasi' + /// Message of the day for Linux nodes, + /// base64-encoded. /// The ID of the subnet which agent pool /// nodes and optionally pods will join on startup. /// The ID of the subnet which pods will join @@ -57,7 +61,7 @@ public AgentPool() /// Possible values include: 'Linux', /// 'Windows' /// Possible values include: 'Ubuntu', - /// 'CBLMariner' + /// 'CBLMariner', 'Mariner', 'Windows2019', 'Windows2022' /// The maximum number of nodes for /// auto-scaling /// The minimum number of nodes for @@ -70,20 +74,24 @@ public AgentPool() /// 'VirtualMachineScaleSets', 'AvailabilitySet' /// Possible values include: 'System', /// 'User' - /// The version of Kubernetes running - /// on the Agent Pool. + /// The version of Kubernetes + /// specified by the user. + /// The version of Kubernetes + /// running on the Agent Pool. /// The version of node image /// Settings for upgrading the /// agentpool /// The current deployment or /// provisioning state. - /// Describes whether the Agent Pool is - /// Running or Stopped + /// Whether the Agent Pool is running or + /// stopped. /// The list of Availability zones to /// use for nodes. This can only be specified if the AgentPoolType /// property is 'VirtualMachineScaleSets'. /// Whether each node is allocated its /// own public IP. + /// Whether to enable Custom CA Trust + /// feature. /// The public IP prefix ID which VM /// nodes should use IPs from. /// The Virtual Machine Scale Set @@ -114,7 +122,19 @@ public AgentPool() /// GPUInstanceProfile to be used to /// specify GPU MIG instance profile for supported GPU VM SKU. Possible /// values include: 'MIG1g', 'MIG2g', 'MIG3g', 'MIG4g', 'MIG7g' - public AgentPool(string id = default(string), string name = default(string), string type = default(string), int? count = default(int?), string vmSize = default(string), int? osDiskSizeGB = default(int?), string osDiskType = default(string), string kubeletDiskType = default(string), string vnetSubnetID = default(string), string podSubnetID = default(string), int? maxPods = default(int?), string osType = default(string), string osSKU = default(string), int? maxCount = default(int?), int? minCount = default(int?), bool? enableAutoScaling = default(bool?), string scaleDownMode = default(string), string agentPoolType = default(string), string mode = default(string), string orchestratorVersion = default(string), string nodeImageVersion = default(string), AgentPoolUpgradeSettings upgradeSettings = default(AgentPoolUpgradeSettings), string provisioningState = default(string), PowerState powerState = default(PowerState), IList availabilityZones = default(IList), bool? enableNodePublicIP = default(bool?), string nodePublicIPPrefixID = default(string), string scaleSetPriority = default(string), string scaleSetEvictionPolicy = default(string), double? spotMaxPrice = default(double?), IDictionary tags = default(IDictionary), IDictionary nodeLabels = default(IDictionary), IList nodeTaints = default(IList), string proximityPlacementGroupID = default(string), KubeletConfig kubeletConfig = default(KubeletConfig), LinuxOSConfig linuxOSConfig = default(LinuxOSConfig), bool? enableEncryptionAtHost = default(bool?), bool? enableUltraSSD = default(bool?), bool? enableFIPS = default(bool?), string gpuInstanceProfile = default(string)) + /// CreationData to be used to specify the + /// source Snapshot ID if the node pool will be created/upgraded using + /// a snapshot. + /// AKS will associate the + /// specified agent pool with the Capacity Reservation Group. + /// The fully qualified resource ID of the + /// Dedicated Host Group to provision virtual machines from, used only + /// in creation scenario and not allowed to changed once set. + /// The Windows agent pool's specific + /// profile. + /// Network-related settings of an agent + /// pool. + public AgentPool(string id = default(string), string name = default(string), string type = default(string), int? count = default(int?), string vmSize = default(string), int? osDiskSizeGB = default(int?), string osDiskType = default(string), string kubeletDiskType = default(string), string workloadRuntime = default(string), string messageOfTheDay = default(string), string vnetSubnetID = default(string), string podSubnetID = default(string), int? maxPods = default(int?), string osType = default(string), string osSKU = default(string), int? maxCount = default(int?), int? minCount = default(int?), bool? enableAutoScaling = default(bool?), string scaleDownMode = default(string), string agentPoolType = default(string), string mode = default(string), string orchestratorVersion = default(string), string currentOrchestratorVersion = default(string), string nodeImageVersion = default(string), AgentPoolUpgradeSettings upgradeSettings = default(AgentPoolUpgradeSettings), string provisioningState = default(string), PowerState powerState = default(PowerState), IList availabilityZones = default(IList), bool? enableNodePublicIP = default(bool?), bool? enableCustomCATrust = default(bool?), string nodePublicIPPrefixID = default(string), string scaleSetPriority = default(string), string scaleSetEvictionPolicy = default(string), double? spotMaxPrice = default(double?), IDictionary tags = default(IDictionary), IDictionary nodeLabels = default(IDictionary), IList nodeTaints = default(IList), string proximityPlacementGroupID = default(string), KubeletConfig kubeletConfig = default(KubeletConfig), LinuxOSConfig linuxOSConfig = default(LinuxOSConfig), bool? enableEncryptionAtHost = default(bool?), bool? enableUltraSSD = default(bool?), bool? enableFIPS = default(bool?), string gpuInstanceProfile = default(string), CreationData creationData = default(CreationData), string capacityReservationGroupID = default(string), string hostGroupID = default(string), AgentPoolWindowsProfile windowsProfile = default(AgentPoolWindowsProfile), AgentPoolNetworkProfile networkProfile = default(AgentPoolNetworkProfile)) : base(id, name, type) { Count = count; @@ -122,6 +142,8 @@ public AgentPool() OsDiskSizeGB = osDiskSizeGB; OsDiskType = osDiskType; KubeletDiskType = kubeletDiskType; + WorkloadRuntime = workloadRuntime; + MessageOfTheDay = messageOfTheDay; VnetSubnetID = vnetSubnetID; PodSubnetID = podSubnetID; MaxPods = maxPods; @@ -134,12 +156,14 @@ public AgentPool() AgentPoolType = agentPoolType; Mode = mode; OrchestratorVersion = orchestratorVersion; + CurrentOrchestratorVersion = currentOrchestratorVersion; NodeImageVersion = nodeImageVersion; UpgradeSettings = upgradeSettings; ProvisioningState = provisioningState; PowerState = powerState; AvailabilityZones = availabilityZones; EnableNodePublicIP = enableNodePublicIP; + EnableCustomCATrust = enableCustomCATrust; NodePublicIPPrefixID = nodePublicIPPrefixID; ScaleSetPriority = scaleSetPriority; ScaleSetEvictionPolicy = scaleSetEvictionPolicy; @@ -154,6 +178,11 @@ public AgentPool() EnableUltraSSD = enableUltraSSD; EnableFIPS = enableFIPS; GpuInstanceProfile = gpuInstanceProfile; + CreationData = creationData; + CapacityReservationGroupID = capacityReservationGroupID; + HostGroupID = hostGroupID; + WindowsProfile = windowsProfile; + NetworkProfile = networkProfile; CustomInit(); } @@ -200,6 +229,25 @@ public AgentPool() [JsonProperty(PropertyName = "properties.kubeletDiskType")] public string KubeletDiskType { get; set; } + /// + /// Gets or sets possible values include: 'OCIContainer', 'WasmWasi' + /// + [JsonProperty(PropertyName = "properties.workloadRuntime")] + public string WorkloadRuntime { get; set; } + + /// + /// Gets or sets message of the day for Linux nodes, base64-encoded. + /// + /// + /// A base64-encoded string which will be written to /etc/motd after + /// decoding. This allows customization of the message of the day for + /// Linux nodes. It must not be specified for Windows nodes. It must be + /// a static string (i.e., will be printed raw and not be executed as a + /// script). + /// + [JsonProperty(PropertyName = "properties.messageOfTheDay")] + public string MessageOfTheDay { get; set; } + /// /// Gets or sets the ID of the subnet which agent pool nodes and /// optionally pods will join on startup. @@ -238,7 +286,8 @@ public AgentPool() public string OsType { get; set; } /// - /// Gets or sets possible values include: 'Ubuntu', 'CBLMariner' + /// Gets or sets possible values include: 'Ubuntu', 'CBLMariner', + /// 'Mariner', 'Windows2019', 'Windows2022' /// [JsonProperty(PropertyName = "properties.osSKU")] public string OsSKU { get; set; } @@ -287,20 +336,37 @@ public AgentPool() public string Mode { get; set; } /// - /// Gets or sets the version of Kubernetes running on the Agent Pool. + /// Gets or sets the version of Kubernetes specified by the user. /// /// - /// As a best practice, you should upgrade all node pools in an AKS - /// cluster to the same Kubernetes version. The node pool version must - /// have the same major version as the control plane. The node pool - /// minor version must be within two minor versions of the control - /// plane version. The node pool version cannot be greater than the - /// control plane version. For more information see [upgrading a node + /// Both patch version and are + /// supported. When is specified, the latest supported + /// patch version is chosen automatically. Updating the agent pool with + /// the same once it has been created will not trigger an + /// upgrade, even if a newer patch version is available. As a best + /// practice, you should upgrade all node pools in an AKS cluster to + /// the same Kubernetes version. The node pool version must have the + /// same major version as the control plane. The node pool minor + /// version must be within two minor versions of the control plane + /// version. The node pool version cannot be greater than the control + /// plane version. For more information see [upgrading a node /// pool](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#upgrade-a-node-pool). /// [JsonProperty(PropertyName = "properties.orchestratorVersion")] public string OrchestratorVersion { get; set; } + /// + /// Gets the version of Kubernetes running on the Agent Pool. + /// + /// + /// If orchestratorVersion was a fully specified version + /// , this field will be exactly equal to it. If + /// orchestratorVersion was , this field will contain the + /// full version being used. + /// + [JsonProperty(PropertyName = "properties.currentOrchestratorVersion")] + public string CurrentOrchestratorVersion { get; private set; } + /// /// Gets the version of node image /// @@ -320,10 +386,17 @@ public AgentPool() public string ProvisioningState { get; private set; } /// - /// Gets describes whether the Agent Pool is Running or Stopped + /// Gets or sets whether the Agent Pool is running or stopped. /// + /// + /// When an Agent Pool is first created it is initially Running. The + /// Agent Pool can be stopped by setting this field to Stopped. A + /// stopped Agent Pool stops all of its VMs and does not accrue billing + /// charges. An Agent Pool can only be stopped if it is Running and + /// provisioning state is Succeeded + /// [JsonProperty(PropertyName = "properties.powerState")] - public PowerState PowerState { get; private set; } + public PowerState PowerState { get; set; } /// /// Gets or sets the list of Availability zones to use for nodes. This @@ -348,6 +421,19 @@ public AgentPool() [JsonProperty(PropertyName = "properties.enableNodePublicIP")] public bool? EnableNodePublicIP { get; set; } + /// + /// Gets or sets whether to enable Custom CA Trust feature. + /// + /// + /// When set to true, AKS adds a label to the node indicating that the + /// feature is enabled and deploys a daemonset along with host services + /// to sync custom certificate authorities from user-provided list of + /// base64 encoded certificates into node trust stores. Defaults to + /// false. + /// + [JsonProperty(PropertyName = "properties.enableCustomCATrust")] + public bool? EnableCustomCATrust { get; set; } + /// /// Gets or sets the public IP prefix ID which VM nodes should use IPs /// from. @@ -469,6 +555,46 @@ public AgentPool() [JsonProperty(PropertyName = "properties.gpuInstanceProfile")] public string GpuInstanceProfile { get; set; } + /// + /// Gets or sets creationData to be used to specify the source Snapshot + /// ID if the node pool will be created/upgraded using a snapshot. + /// + [JsonProperty(PropertyName = "properties.creationData")] + public CreationData CreationData { get; set; } + + /// + /// Gets or sets AKS will associate the specified agent pool with the + /// Capacity Reservation Group. + /// + [JsonProperty(PropertyName = "properties.capacityReservationGroupID")] + public string CapacityReservationGroupID { get; set; } + + /// + /// Gets or sets the fully qualified resource ID of the Dedicated Host + /// Group to provision virtual machines from, used only in creation + /// scenario and not allowed to changed once set. + /// + /// + /// This is of the form: + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}. + /// For more information see [Azure dedicated + /// hosts](https://docs.microsoft.com/azure/virtual-machines/dedicated-hosts). + /// + [JsonProperty(PropertyName = "properties.hostGroupID")] + public string HostGroupID { get; set; } + + /// + /// Gets or sets the Windows agent pool's specific profile. + /// + [JsonProperty(PropertyName = "properties.windowsProfile")] + public AgentPoolWindowsProfile WindowsProfile { get; set; } + + /// + /// Gets or sets network-related settings of an agent pool. + /// + [JsonProperty(PropertyName = "properties.networkProfile")] + public AgentPoolNetworkProfile NetworkProfile { get; set; } + /// /// Validate the object. /// diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPoolNetworkProfile.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPoolNetworkProfile.cs new file mode 100644 index 000000000000..c8f3edb767e3 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPoolNetworkProfile.cs @@ -0,0 +1,75 @@ +// +// 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.ContainerService.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Network settings of an agent pool. + /// + public partial class AgentPoolNetworkProfile + { + /// + /// Initializes a new instance of the AgentPoolNetworkProfile class. + /// + public AgentPoolNetworkProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AgentPoolNetworkProfile class. + /// + /// IPTags of instance-level public + /// IPs. + /// The port ranges that are allowed to + /// access. The specified ranges are allowed to overlap. + /// The IDs of the application + /// security groups which agent pool will associate when + /// created. + public AgentPoolNetworkProfile(IList nodePublicIPTags = default(IList), IList allowedHostPorts = default(IList), IList applicationSecurityGroups = default(IList)) + { + NodePublicIPTags = nodePublicIPTags; + AllowedHostPorts = allowedHostPorts; + ApplicationSecurityGroups = applicationSecurityGroups; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets iPTags of instance-level public IPs. + /// + [JsonProperty(PropertyName = "nodePublicIPTags")] + public IList NodePublicIPTags { get; set; } + + /// + /// Gets or sets the port ranges that are allowed to access. The + /// specified ranges are allowed to overlap. + /// + [JsonProperty(PropertyName = "allowedHostPorts")] + public IList AllowedHostPorts { get; set; } + + /// + /// Gets or sets the IDs of the application security groups which agent + /// pool will associate when created. + /// + [JsonProperty(PropertyName = "applicationSecurityGroups")] + public IList ApplicationSecurityGroups { get; set; } + + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPoolWindowsProfile.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPoolWindowsProfile.cs new file mode 100644 index 000000000000..05f54ff22551 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPoolWindowsProfile.cs @@ -0,0 +1,57 @@ +// +// 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.ContainerService.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The Windows agent pool's specific profile. + /// + public partial class AgentPoolWindowsProfile + { + /// + /// Initializes a new instance of the AgentPoolWindowsProfile class. + /// + public AgentPoolWindowsProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AgentPoolWindowsProfile class. + /// + /// Whether to disable OutboundNAT in + /// windows nodes + public AgentPoolWindowsProfile(bool? disableOutboundNat = default(bool?)) + { + DisableOutboundNat = disableOutboundNat; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets whether to disable OutboundNAT in windows nodes + /// + /// + /// The default value is false. Outbound NAT can only be disabled if + /// the cluster outboundType is NAT Gateway and the Windows agent pool + /// does not have node public IP enabled. + /// + [JsonProperty(PropertyName = "disableOutboundNat")] + public bool? DisableOutboundNat { get; set; } + + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPoolsUpgradeNodeImageVersionHeaders.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPoolsUpgradeNodeImageVersionHeaders.cs new file mode 100644 index 000000000000..6b8f401fe88f --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AgentPoolsUpgradeNodeImageVersionHeaders.cs @@ -0,0 +1,54 @@ +// +// 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.ContainerService.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for UpgradeNodeImageVersion operation. + /// + public partial class AgentPoolsUpgradeNodeImageVersionHeaders + { + /// + /// Initializes a new instance of the + /// AgentPoolsUpgradeNodeImageVersionHeaders class. + /// + public AgentPoolsUpgradeNodeImageVersionHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// AgentPoolsUpgradeNodeImageVersionHeaders class. + /// + /// URL to query for status of the + /// operation. + public AgentPoolsUpgradeNodeImageVersionHeaders(string azureAsyncOperation = default(string)) + { + AzureAsyncOperation = azureAsyncOperation; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets URL to query for status of the operation. + /// + [JsonProperty(PropertyName = "Azure-AsyncOperation")] + public string AzureAsyncOperation { get; set; } + + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AzureEntityResource.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AzureEntityResource.cs new file mode 100644 index 000000000000..48921d711c78 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AzureEntityResource.cs @@ -0,0 +1,64 @@ +// +// 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.ContainerService.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Entity Resource + /// + /// + /// The resource model definition for an Azure Resource Manager resource + /// with an etag. + /// + public partial class AzureEntityResource : Resource + { + /// + /// Initializes a new instance of the AzureEntityResource class. + /// + public AzureEntityResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AzureEntityResource class. + /// + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// Resource Etag. + public AzureEntityResource(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string etag = default(string)) + : base(id, name, type, systemData) + { + Etag = etag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets resource Etag. + /// + [JsonProperty(PropertyName = "etag")] + public string Etag { get; private set; } + + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AzureKeyVaultKms.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AzureKeyVaultKms.cs new file mode 100644 index 000000000000..8529f513d7f1 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/AzureKeyVaultKms.cs @@ -0,0 +1,102 @@ +// +// 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.ContainerService.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Azure Key Vault key management service settings for the security + /// profile. + /// + public partial class AzureKeyVaultKms + { + /// + /// Initializes a new instance of the AzureKeyVaultKms class. + /// + public AzureKeyVaultKms() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AzureKeyVaultKms class. + /// + /// Whether to enable Azure Key Vault key + /// management service. The default is false. + /// Identifier of Azure Key Vault key. See [key + /// identifier + /// format](https://docs.microsoft.com/en-us/azure/key-vault/general/about-keys-secrets-certificates#vault-name-and-object-name) + /// for more details. When Azure Key Vault key management service is + /// enabled, this field is required and must be a valid key identifier. + /// When Azure Key Vault key management service is disabled, leave the + /// field empty. + /// Network access of the key + /// vault + /// Resource ID of key vault. When + /// keyVaultNetworkAccess is `Private`, this field is required and must + /// be a valid resource ID. When keyVaultNetworkAccess is `Public`, + /// leave the field empty. + public AzureKeyVaultKms(bool? enabled = default(bool?), string keyId = default(string), string keyVaultNetworkAccess = default(string), string keyVaultResourceId = default(string)) + { + Enabled = enabled; + KeyId = keyId; + KeyVaultNetworkAccess = keyVaultNetworkAccess; + KeyVaultResourceId = keyVaultResourceId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets whether to enable Azure Key Vault key management + /// service. The default is false. + /// + [JsonProperty(PropertyName = "enabled")] + public bool? Enabled { get; set; } + + /// + /// Gets or sets identifier of Azure Key Vault key. See [key identifier + /// format](https://docs.microsoft.com/en-us/azure/key-vault/general/about-keys-secrets-certificates#vault-name-and-object-name) + /// for more details. When Azure Key Vault key management service is + /// enabled, this field is required and must be a valid key identifier. + /// When Azure Key Vault key management service is disabled, leave the + /// field empty. + /// + [JsonProperty(PropertyName = "keyId")] + public string KeyId { get; set; } + + /// + /// Gets or sets network access of the key vault + /// + /// + /// Network access of key vault. The possible values are `Public` and + /// `Private`. `Public` means the key vault allows public access from + /// all networks. `Private` means the key vault disables public access + /// and enables private link. The default value is `Public`. Possible + /// values include: 'Public', 'Private' + /// + [JsonProperty(PropertyName = "keyVaultNetworkAccess")] + public string KeyVaultNetworkAccess { get; set; } + + /// + /// Gets or sets resource ID of key vault. When keyVaultNetworkAccess + /// is `Private`, this field is required and must be a valid resource + /// ID. When keyVaultNetworkAccess is `Public`, leave the field empty. + /// + [JsonProperty(PropertyName = "keyVaultResourceId")] + public string KeyVaultResourceId { get; set; } + + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/BackendPoolType.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/BackendPoolType.cs new file mode 100644 index 000000000000..0c912df8b6d9 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/BackendPoolType.cs @@ -0,0 +1,30 @@ +// +// 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.ContainerService.Models +{ + + /// + /// Defines values for BackendPoolType. + /// + public static class BackendPoolType + { + /// + /// The type of the managed inbound Load Balancer BackendPool. + /// https://cloud-provider-azure.sigs.k8s.io/topics/loadbalancer/#configure-load-balancer-backend. + /// + public const string NodeIPConfiguration = "NodeIPConfiguration"; + /// + /// The type of the managed inbound Load Balancer BackendPool. + /// https://cloud-provider-azure.sigs.k8s.io/topics/loadbalancer/#configure-load-balancer-backend. + /// + public const string NodeIP = "NodeIP"; + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ContainerServiceNetworkProfile.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ContainerServiceNetworkProfile.cs index 74371e2d92dd..cda1b838e57b 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ContainerServiceNetworkProfile.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ContainerServiceNetworkProfile.cs @@ -12,6 +12,8 @@ namespace Microsoft.Azure.Management.ContainerService.Models { using Microsoft.Rest; using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; using System.Linq; /// @@ -33,13 +35,18 @@ public ContainerServiceNetworkProfile() /// class. /// /// Network plugin used for building the - /// Kubernetes network. Possible values include: 'azure', - /// 'kubenet' + /// Kubernetes network. Possible values include: 'azure', 'kubenet', + /// 'none' + /// Network plugin mode used for + /// building the Kubernetes network. Possible values include: + /// 'Overlay' /// Network policy used for building the /// Kubernetes network. Possible values include: 'calico', /// 'azure' /// The network mode Azure CNI is configured /// with. + /// The eBPF dataplane used for building + /// the Kubernetes network. Possible values include: 'cilium' /// A CIDR notation IP range from which to assign /// pod IPs when kubenet is used. /// A CIDR notation IP range from which to @@ -59,11 +66,26 @@ public ContainerServiceNetworkProfile() /// balancer. /// Profile of the cluster NAT /// gateway. - public ContainerServiceNetworkProfile(string networkPlugin = default(string), string networkPolicy = default(string), string networkMode = default(string), string podCidr = default(string), string serviceCidr = default(string), string dnsServiceIP = default(string), string dockerBridgeCidr = default(string), string outboundType = default(string), string loadBalancerSku = default(string), ManagedClusterLoadBalancerProfile loadBalancerProfile = default(ManagedClusterLoadBalancerProfile), ManagedClusterNATGatewayProfile natGatewayProfile = default(ManagedClusterNATGatewayProfile)) + /// The CIDR notation IP ranges from which to + /// assign pod IPs. + /// The CIDR notation IP ranges from which + /// to assign service cluster IPs. + /// The IP families used to specify IP + /// versions available to the cluster. + /// Holds configuration customizations + /// for kube-proxy. Any values not defined will use the kube-proxy + /// defaulting behavior. See + /// https://v<version>.docs.kubernetes.io/docs/reference/command-line-tools-reference/kube-proxy/ + /// where <version> is represented by a <major + /// version>-<minor version> string. Kubernetes version 1.23 + /// would be '1-23'. + public ContainerServiceNetworkProfile(string networkPlugin = default(string), string networkPluginMode = default(string), string networkPolicy = default(string), string networkMode = default(string), string ebpfDataplane = default(string), string podCidr = default(string), string serviceCidr = default(string), string dnsServiceIP = default(string), string dockerBridgeCidr = default(string), string outboundType = default(string), string loadBalancerSku = default(string), ManagedClusterLoadBalancerProfile loadBalancerProfile = default(ManagedClusterLoadBalancerProfile), ManagedClusterNATGatewayProfile natGatewayProfile = default(ManagedClusterNATGatewayProfile), IList podCidrs = default(IList), IList serviceCidrs = default(IList), IList ipFamilies = default(IList), ContainerServiceNetworkProfileKubeProxyConfig kubeProxyConfig = default(ContainerServiceNetworkProfileKubeProxyConfig)) { NetworkPlugin = networkPlugin; + NetworkPluginMode = networkPluginMode; NetworkPolicy = networkPolicy; NetworkMode = networkMode; + EbpfDataplane = ebpfDataplane; PodCidr = podCidr; ServiceCidr = serviceCidr; DnsServiceIP = dnsServiceIP; @@ -72,6 +94,10 @@ public ContainerServiceNetworkProfile() LoadBalancerSku = loadBalancerSku; LoadBalancerProfile = loadBalancerProfile; NatGatewayProfile = natGatewayProfile; + PodCidrs = podCidrs; + ServiceCidrs = serviceCidrs; + IpFamilies = ipFamilies; + KubeProxyConfig = kubeProxyConfig; CustomInit(); } @@ -82,11 +108,18 @@ public ContainerServiceNetworkProfile() /// /// Gets or sets network plugin used for building the Kubernetes - /// network. Possible values include: 'azure', 'kubenet' + /// network. Possible values include: 'azure', 'kubenet', 'none' /// [JsonProperty(PropertyName = "networkPlugin")] public string NetworkPlugin { get; set; } + /// + /// Gets or sets network plugin mode used for building the Kubernetes + /// network. Possible values include: 'Overlay' + /// + [JsonProperty(PropertyName = "networkPluginMode")] + public string NetworkPluginMode { get; set; } + /// /// Gets or sets network policy used for building the Kubernetes /// network. Possible values include: 'calico', 'azure' @@ -104,6 +137,13 @@ public ContainerServiceNetworkProfile() [JsonProperty(PropertyName = "networkMode")] public string NetworkMode { get; set; } + /// + /// Gets or sets the eBPF dataplane used for building the Kubernetes + /// network. Possible values include: 'cilium' + /// + [JsonProperty(PropertyName = "ebpfDataplane")] + public string EbpfDataplane { get; set; } + /// /// Gets or sets a CIDR notation IP range from which to assign pod IPs /// when kubenet is used. @@ -171,6 +211,53 @@ public ContainerServiceNetworkProfile() [JsonProperty(PropertyName = "natGatewayProfile")] public ManagedClusterNATGatewayProfile NatGatewayProfile { get; set; } + /// + /// Gets or sets the CIDR notation IP ranges from which to assign pod + /// IPs. + /// + /// + /// One IPv4 CIDR is expected for single-stack networking. Two CIDRs, + /// one for each IP family (IPv4/IPv6), is expected for dual-stack + /// networking. + /// + [JsonProperty(PropertyName = "podCidrs")] + public IList PodCidrs { get; set; } + + /// + /// Gets or sets the CIDR notation IP ranges from which to assign + /// service cluster IPs. + /// + /// + /// One IPv4 CIDR is expected for single-stack networking. Two CIDRs, + /// one for each IP family (IPv4/IPv6), is expected for dual-stack + /// networking. They must not overlap with any Subnet IP ranges. + /// + [JsonProperty(PropertyName = "serviceCidrs")] + public IList ServiceCidrs { get; set; } + + /// + /// Gets or sets the IP families used to specify IP versions available + /// to the cluster. + /// + /// + /// IP families are used to determine single-stack or dual-stack + /// clusters. For single-stack, the expected value is IPv4. For + /// dual-stack, the expected values are IPv4 and IPv6. + /// + [JsonProperty(PropertyName = "ipFamilies")] + public IList IpFamilies { get; set; } + + /// + /// Gets or sets holds configuration customizations for kube-proxy. Any + /// values not defined will use the kube-proxy defaulting behavior. See + /// https://v&lt;version&gt;.docs.kubernetes.io/docs/reference/command-line-tools-reference/kube-proxy/ + /// where &lt;version&gt; is represented by a &lt;major + /// version&gt;-&lt;minor version&gt; string. Kubernetes + /// version 1.23 would be '1-23'. + /// + [JsonProperty(PropertyName = "kubeProxyConfig")] + public ContainerServiceNetworkProfileKubeProxyConfig KubeProxyConfig { get; set; } + /// /// Validate the object. /// diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ContainerServiceNetworkProfileKubeProxyConfig.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ContainerServiceNetworkProfileKubeProxyConfig.cs new file mode 100644 index 000000000000..a3bc645f821f --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ContainerServiceNetworkProfileKubeProxyConfig.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.ContainerService.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Holds configuration customizations for kube-proxy. Any values not + /// defined will use the kube-proxy defaulting behavior. See + /// https://v<version>.docs.kubernetes.io/docs/reference/command-line-tools-reference/kube-proxy/ + /// where <version> is represented by a <major + /// version>-<minor version> string. Kubernetes version 1.23 would + /// be '1-23'. + /// + public partial class ContainerServiceNetworkProfileKubeProxyConfig + { + /// + /// Initializes a new instance of the + /// ContainerServiceNetworkProfileKubeProxyConfig class. + /// + public ContainerServiceNetworkProfileKubeProxyConfig() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ContainerServiceNetworkProfileKubeProxyConfig class. + /// + /// Whether to enable on kube-proxy on the + /// cluster (if no 'kubeProxyConfig' exists, kube-proxy is enabled in + /// AKS by default without these customizations). + /// Specify which proxy mode to use ('IPTABLES' or + /// 'IPVS'). Possible values include: 'IPTABLES', 'IPVS' + /// Holds configuration customizations for + /// IPVS. May only be specified if 'mode' is set to 'IPVS'. + public ContainerServiceNetworkProfileKubeProxyConfig(bool? enabled = default(bool?), string mode = default(string), ContainerServiceNetworkProfileKubeProxyConfigIpvsConfig ipvsConfig = default(ContainerServiceNetworkProfileKubeProxyConfigIpvsConfig)) + { + Enabled = enabled; + Mode = mode; + IpvsConfig = ipvsConfig; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets whether to enable on kube-proxy on the cluster (if no + /// 'kubeProxyConfig' exists, kube-proxy is enabled in AKS by default + /// without these customizations). + /// + [JsonProperty(PropertyName = "enabled")] + public bool? Enabled { get; set; } + + /// + /// Gets or sets specify which proxy mode to use ('IPTABLES' or + /// 'IPVS'). Possible values include: 'IPTABLES', 'IPVS' + /// + [JsonProperty(PropertyName = "mode")] + public string Mode { get; set; } + + /// + /// Gets or sets holds configuration customizations for IPVS. May only + /// be specified if 'mode' is set to 'IPVS'. + /// + [JsonProperty(PropertyName = "ipvsConfig")] + public ContainerServiceNetworkProfileKubeProxyConfigIpvsConfig IpvsConfig { get; set; } + + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ContainerServiceNetworkProfileKubeProxyConfigIpvsConfig.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ContainerServiceNetworkProfileKubeProxyConfigIpvsConfig.cs new file mode 100644 index 000000000000..da74f8f2209a --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ContainerServiceNetworkProfileKubeProxyConfigIpvsConfig.cs @@ -0,0 +1,90 @@ +// +// 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.ContainerService.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Holds configuration customizations for IPVS. May only be specified if + /// 'mode' is set to 'IPVS'. + /// + public partial class ContainerServiceNetworkProfileKubeProxyConfigIpvsConfig + { + /// + /// Initializes a new instance of the + /// ContainerServiceNetworkProfileKubeProxyConfigIpvsConfig class. + /// + public ContainerServiceNetworkProfileKubeProxyConfigIpvsConfig() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ContainerServiceNetworkProfileKubeProxyConfigIpvsConfig class. + /// + /// IPVS scheduler, for more information please + /// see http://www.linuxvirtualserver.org/docs/scheduling.html. + /// Possible values include: 'RoundRobin', 'LeastConnection' + /// The timeout value used for idle + /// IPVS TCP sessions in seconds. Must be a positive integer + /// value. + /// The timeout value used for IPVS + /// TCP sessions after receiving a FIN in seconds. Must be a positive + /// integer value. + /// The timeout value used for IPVS UDP + /// packets in seconds. Must be a positive integer value. + public ContainerServiceNetworkProfileKubeProxyConfigIpvsConfig(string scheduler = default(string), int? tcpTimeoutSeconds = default(int?), int? tcpFinTimeoutSeconds = default(int?), int? udpTimeoutSeconds = default(int?)) + { + Scheduler = scheduler; + TcpTimeoutSeconds = tcpTimeoutSeconds; + TcpFinTimeoutSeconds = tcpFinTimeoutSeconds; + UdpTimeoutSeconds = udpTimeoutSeconds; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets IPVS scheduler, for more information please see + /// http://www.linuxvirtualserver.org/docs/scheduling.html. Possible + /// values include: 'RoundRobin', 'LeastConnection' + /// + [JsonProperty(PropertyName = "scheduler")] + public string Scheduler { get; set; } + + /// + /// Gets or sets the timeout value used for idle IPVS TCP sessions in + /// seconds. Must be a positive integer value. + /// + [JsonProperty(PropertyName = "tcpTimeoutSeconds")] + public int? TcpTimeoutSeconds { get; set; } + + /// + /// Gets or sets the timeout value used for IPVS TCP sessions after + /// receiving a FIN in seconds. Must be a positive integer value. + /// + [JsonProperty(PropertyName = "tcpFinTimeoutSeconds")] + public int? TcpFinTimeoutSeconds { get; set; } + + /// + /// Gets or sets the timeout value used for IPVS UDP packets in + /// seconds. Must be a positive integer value. + /// + [JsonProperty(PropertyName = "udpTimeoutSeconds")] + public int? UdpTimeoutSeconds { get; set; } + + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ControlledValues.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ControlledValues.cs new file mode 100644 index 000000000000..a6ae9b2523c4 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ControlledValues.cs @@ -0,0 +1,28 @@ +// +// 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.ContainerService.Models +{ + + /// + /// Defines values for ControlledValues. + /// + public static class ControlledValues + { + /// + /// Autoscaler will control resource requests and limits. + /// + public const string RequestsAndLimits = "RequestsAndLimits"; + /// + /// Autoscaler will control resource requests only. + /// + public const string RequestsOnly = "RequestsOnly"; + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/CreationData.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/CreationData.cs new file mode 100644 index 000000000000..64cdf5b5fc75 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/CreationData.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.ContainerService.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Data used when creating a target resource from a source resource. + /// + public partial class CreationData + { + /// + /// Initializes a new instance of the CreationData class. + /// + public CreationData() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CreationData class. + /// + /// This is the ARM ID of the source + /// object to be used to create the target object. + public CreationData(string sourceResourceId = default(string)) + { + SourceResourceId = sourceResourceId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets this is the ARM ID of the source object to be used to + /// create the target object. + /// + [JsonProperty(PropertyName = "sourceResourceId")] + public string SourceResourceId { get; set; } + + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/EbpfDataplane.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/EbpfDataplane.cs new file mode 100644 index 000000000000..0ec7d5687ac8 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/EbpfDataplane.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. +// +// 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.ContainerService.Models +{ + + /// + /// Defines values for EbpfDataplane. + /// + public static class EbpfDataplane + { + /// + /// Use Cilium for networking in the Kubernetes cluster. + /// + public const string Cilium = "cilium"; + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ErrorAdditionalInfo.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ErrorAdditionalInfo.cs new file mode 100644 index 000000000000..99db7d967885 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ErrorAdditionalInfo.cs @@ -0,0 +1,59 @@ +// +// 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.ContainerService.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The resource management error additional info. + /// + public partial class ErrorAdditionalInfo + { + /// + /// Initializes a new instance of the ErrorAdditionalInfo class. + /// + public ErrorAdditionalInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorAdditionalInfo class. + /// + /// The additional info type. + /// The additional info. + public ErrorAdditionalInfo(string type = default(string), object info = default(object)) + { + Type = type; + Info = info; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the additional info type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets the additional info. + /// + [JsonProperty(PropertyName = "info")] + public object Info { get; private set; } + + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ErrorDetail.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ErrorDetail.cs new file mode 100644 index 000000000000..d4c68c6ed4db --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ErrorDetail.cs @@ -0,0 +1,85 @@ +// +// 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.ContainerService.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The error detail. + /// + public partial class ErrorDetail + { + /// + /// Initializes a new instance of the ErrorDetail class. + /// + public ErrorDetail() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorDetail class. + /// + /// The error code. + /// The error message. + /// The error target. + /// The error details. + /// The error additional info. + public ErrorDetail(string code = default(string), string message = default(string), string target = default(string), IList details = default(IList), IList additionalInfo = default(IList)) + { + Code = code; + Message = message; + Target = target; + Details = details; + AdditionalInfo = additionalInfo; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the error code. + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; private set; } + + /// + /// Gets the error message. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; private set; } + + /// + /// Gets the error target. + /// + [JsonProperty(PropertyName = "target")] + public string Target { get; private set; } + + /// + /// Gets the error details. + /// + [JsonProperty(PropertyName = "details")] + public IList Details { get; private set; } + + /// + /// Gets the error additional info. + /// + [JsonProperty(PropertyName = "additionalInfo")] + public IList AdditionalInfo { get; private set; } + + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ErrorResponse.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ErrorResponse.cs new file mode 100644 index 000000000000..cc605a4ed497 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ErrorResponse.cs @@ -0,0 +1,56 @@ +// +// 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.ContainerService.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Error response + /// + /// + /// Common error response for all Azure Resource Manager APIs to return + /// error details for failed operations. (This also follows the OData error + /// response format.). + /// + public partial class ErrorResponse + { + /// + /// Initializes a new instance of the ErrorResponse class. + /// + public ErrorResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorResponse class. + /// + /// The error object. + public ErrorResponse(ErrorDetail error = default(ErrorDetail)) + { + Error = error; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the error object. + /// + [JsonProperty(PropertyName = "error")] + public ErrorDetail Error { get; set; } + + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ErrorResponseException.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ErrorResponseException.cs new file mode 100644 index 000000000000..4acc8f894d9f --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/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.ContainerService.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/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/Fleet.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/Fleet.cs new file mode 100644 index 000000000000..a3e4db122b8b --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/Fleet.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. +// +// 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.ContainerService.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The Fleet resource which contains multiple Kubernetes clusters as its + /// members. + /// + [Rest.Serialization.JsonTransformation] + public partial class Fleet : TrackedResource + { + /// + /// Initializes a new instance of the Fleet class. + /// + public Fleet() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Fleet class. + /// + /// The geo-location where the resource + /// lives + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// Resource tags. + /// Resource Etag. + /// The FleetHubProfile configures the Fleet's + /// hub. + /// The provisioning state of the last + /// accepted operation. Possible values include: 'Succeeded', 'Failed', + /// 'Canceled', 'Creating', 'Deleting', 'Updating' + public Fleet(string location, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), IDictionary tags = default(IDictionary), string etag = default(string), FleetHubProfile hubProfile = default(FleetHubProfile), string provisioningState = default(string)) + : base(location, id, name, type, systemData, tags) + { + Etag = etag; + HubProfile = hubProfile; + ProvisioningState = provisioningState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets resource Etag. + /// + [JsonProperty(PropertyName = "etag")] + public string Etag { get; private set; } + + /// + /// Gets or sets the FleetHubProfile configures the Fleet's hub. + /// + [JsonProperty(PropertyName = "properties.hubProfile")] + public FleetHubProfile HubProfile { get; set; } + + /// + /// Gets the provisioning state of the last accepted operation. + /// Possible values include: 'Succeeded', 'Failed', 'Canceled', + /// 'Creating', 'Deleting', 'Updating' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (HubProfile != null) + { + HubProfile.Validate(); + } + } + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/FleetCredentialResult.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/FleetCredentialResult.cs new file mode 100644 index 000000000000..d8740a7ba024 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/FleetCredentialResult.cs @@ -0,0 +1,60 @@ +// +// 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.ContainerService.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The credential result response. + /// + public partial class FleetCredentialResult + { + /// + /// Initializes a new instance of the FleetCredentialResult class. + /// + public FleetCredentialResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the FleetCredentialResult class. + /// + /// The name of the credential. + /// Base64-encoded Kubernetes configuration + /// file. + public FleetCredentialResult(string name = default(string), byte[] value = default(byte[])) + { + Name = name; + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the name of the credential. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets base64-encoded Kubernetes configuration file. + /// + [JsonProperty(PropertyName = "value")] + public byte[] Value { get; private set; } + + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/FleetCredentialResults.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/FleetCredentialResults.cs new file mode 100644 index 000000000000..fa62f4914c36 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/FleetCredentialResults.cs @@ -0,0 +1,54 @@ +// +// 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.ContainerService.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The list credential result response. + /// + public partial class FleetCredentialResults + { + /// + /// Initializes a new instance of the FleetCredentialResults class. + /// + public FleetCredentialResults() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the FleetCredentialResults class. + /// + /// Base64-encoded Kubernetes configuration + /// file. + public FleetCredentialResults(IList kubeconfigs = default(IList)) + { + Kubeconfigs = kubeconfigs; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets base64-encoded Kubernetes configuration file. + /// + [JsonProperty(PropertyName = "kubeconfigs")] + public IList Kubeconfigs { get; private set; } + + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/FleetHubProfile.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/FleetHubProfile.cs new file mode 100644 index 000000000000..3020b4bc26aa --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/FleetHubProfile.cs @@ -0,0 +1,94 @@ +// +// 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.ContainerService.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The FleetHubProfile configures the fleet hub. + /// + public partial class FleetHubProfile + { + /// + /// Initializes a new instance of the FleetHubProfile class. + /// + public FleetHubProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the FleetHubProfile class. + /// + /// DNS prefix used to create the FQDN for the + /// Fleet hub. + /// The FQDN of the Fleet hub. + /// The Kubernetes version of the Fleet + /// hub. + public FleetHubProfile(string dnsPrefix = default(string), string fqdn = default(string), string kubernetesVersion = default(string)) + { + DnsPrefix = dnsPrefix; + Fqdn = fqdn; + KubernetesVersion = kubernetesVersion; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets DNS prefix used to create the FQDN for the Fleet hub. + /// + [JsonProperty(PropertyName = "dnsPrefix")] + public string DnsPrefix { get; set; } + + /// + /// Gets the FQDN of the Fleet hub. + /// + [JsonProperty(PropertyName = "fqdn")] + public string Fqdn { get; private set; } + + /// + /// Gets the Kubernetes version of the Fleet hub. + /// + [JsonProperty(PropertyName = "kubernetesVersion")] + public string KubernetesVersion { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (DnsPrefix != null) + { + if (DnsPrefix.Length > 54) + { + throw new ValidationException(ValidationRules.MaxLength, "DnsPrefix", 54); + } + if (DnsPrefix.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "DnsPrefix", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(DnsPrefix, "^[a-zA-Z0-9]$|^[a-zA-Z0-9][a-zA-Z0-9-]{0,52}[a-zA-Z0-9]$")) + { + throw new ValidationException(ValidationRules.Pattern, "DnsPrefix", "^[a-zA-Z0-9]$|^[a-zA-Z0-9][a-zA-Z0-9-]{0,52}[a-zA-Z0-9]$"); + } + } + } + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/FleetMember.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/FleetMember.cs new file mode 100644 index 000000000000..750e9d5ea237 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/FleetMember.cs @@ -0,0 +1,81 @@ +// +// 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.ContainerService.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// A member of the Fleet. It contains a reference to an existing + /// Kubernetes cluster on Azure. + /// + [Rest.Serialization.JsonTransformation] + public partial class FleetMember : AzureEntityResource + { + /// + /// Initializes a new instance of the FleetMember class. + /// + public FleetMember() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the FleetMember class. + /// + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// Resource Etag. + /// The ARM resource id of the cluster + /// that joins the Fleet. Must be a valid Azure resource id. e.g.: + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{clusterName}'. + /// The provisioning state of the last + /// accepted operation. Possible values include: 'Succeeded', 'Failed', + /// 'Canceled', 'Joining', 'Leaving', 'Updating' + public FleetMember(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string etag = default(string), string clusterResourceId = default(string), string provisioningState = default(string)) + : base(id, name, type, systemData, etag) + { + ClusterResourceId = clusterResourceId; + ProvisioningState = provisioningState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the ARM resource id of the cluster that joins the + /// Fleet. Must be a valid Azure resource id. e.g.: + /// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{clusterName}'. + /// + [JsonProperty(PropertyName = "properties.clusterResourceId")] + public string ClusterResourceId { get; set; } + + /// + /// Gets the provisioning state of the last accepted operation. + /// Possible values include: 'Succeeded', 'Failed', 'Canceled', + /// 'Joining', 'Leaving', 'Updating' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/FleetMemberProvisioningState.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/FleetMemberProvisioningState.cs new file mode 100644 index 000000000000..169080396890 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/FleetMemberProvisioningState.cs @@ -0,0 +1,26 @@ +// +// 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.ContainerService.Models +{ + + /// + /// Defines values for FleetMemberProvisioningState. + /// + public static class FleetMemberProvisioningState + { + public const string Succeeded = "Succeeded"; + public const string Failed = "Failed"; + public const string Canceled = "Canceled"; + public const string Joining = "Joining"; + public const string Leaving = "Leaving"; + public const string Updating = "Updating"; + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/FleetMembersDeleteHeaders.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/FleetMembersDeleteHeaders.cs new file mode 100644 index 000000000000..f113703accf7 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/FleetMembersDeleteHeaders.cs @@ -0,0 +1,49 @@ +// +// 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.ContainerService.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Delete operation. + /// + public partial class FleetMembersDeleteHeaders + { + /// + /// Initializes a new instance of the FleetMembersDeleteHeaders class. + /// + public FleetMembersDeleteHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the FleetMembersDeleteHeaders class. + /// + public FleetMembersDeleteHeaders(string location = default(string)) + { + Location = location; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "Location")] + public string Location { get; set; } + + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/FleetPatch.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/FleetPatch.cs new file mode 100644 index 000000000000..16d5c748c4fa --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/FleetPatch.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.ContainerService.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Properties of a Fleet that can be patched. + /// + public partial class FleetPatch + { + /// + /// Initializes a new instance of the FleetPatch class. + /// + public FleetPatch() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the FleetPatch class. + /// + /// Resource tags. + public FleetPatch(IDictionary tags = default(IDictionary)) + { + Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource tags. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/FleetProvisioningState.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/FleetProvisioningState.cs new file mode 100644 index 000000000000..01a09f38377e --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/FleetProvisioningState.cs @@ -0,0 +1,26 @@ +// +// 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.ContainerService.Models +{ + + /// + /// Defines values for FleetProvisioningState. + /// + public static class FleetProvisioningState + { + public const string Succeeded = "Succeeded"; + public const string Failed = "Failed"; + public const string Canceled = "Canceled"; + public const string Creating = "Creating"; + public const string Deleting = "Deleting"; + public const string Updating = "Updating"; + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/FleetsDeleteHeaders.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/FleetsDeleteHeaders.cs new file mode 100644 index 000000000000..d3056efcaec6 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/FleetsDeleteHeaders.cs @@ -0,0 +1,49 @@ +// +// 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.ContainerService.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Delete operation. + /// + public partial class FleetsDeleteHeaders + { + /// + /// Initializes a new instance of the FleetsDeleteHeaders class. + /// + public FleetsDeleteHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the FleetsDeleteHeaders class. + /// + public FleetsDeleteHeaders(string location = default(string)) + { + Location = location; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "Location")] + public string Location { get; set; } + + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/Format.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/Format.cs new file mode 100644 index 000000000000..d2550ac1df32 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/Format.cs @@ -0,0 +1,30 @@ +// +// 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.ContainerService.Models +{ + + /// + /// Defines values for Format. + /// + public static class Format + { + /// + /// Return azure auth-provider kubeconfig. This format is deprecated in + /// 1.22 and will be fully removed in 1.25. + /// + public const string Azure = "azure"; + /// + /// Return exec format kubeconfig. This format requires kubelogin + /// binary in the path. + /// + public const string Exec = "exec"; + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/GuardrailsProfile.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/GuardrailsProfile.cs new file mode 100644 index 000000000000..5bf61edfe372 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/GuardrailsProfile.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. +// +// 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.ContainerService.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The Guardrails profile. + /// + public partial class GuardrailsProfile + { + /// + /// Initializes a new instance of the GuardrailsProfile class. + /// + public GuardrailsProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GuardrailsProfile class. + /// + /// The version of constraints to use + /// The guardrails level to be used. By default, + /// Guardrails is enabled for all namespaces except those that AKS + /// excludes via systemExcludedNamespaces. Possible values include: + /// 'Off', 'Warning', 'Enforcement' + /// List of namespaces specified + /// by AKS to be excluded from Guardrails + /// List of namespaces excluded from + /// guardrails checks + public GuardrailsProfile(string version, string level, IList systemExcludedNamespaces = default(IList), IList excludedNamespaces = default(IList)) + { + SystemExcludedNamespaces = systemExcludedNamespaces; + Version = version; + Level = level; + ExcludedNamespaces = excludedNamespaces; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets list of namespaces specified by AKS to be excluded from + /// Guardrails + /// + [JsonProperty(PropertyName = "systemExcludedNamespaces")] + public IList SystemExcludedNamespaces { get; private set; } + + /// + /// Gets or sets the version of constraints to use + /// + [JsonProperty(PropertyName = "version")] + public string Version { get; set; } + + /// + /// Gets or sets the guardrails level to be used. By default, + /// Guardrails is enabled for all namespaces except those that AKS + /// excludes via systemExcludedNamespaces. Possible values include: + /// 'Off', 'Warning', 'Enforcement' + /// + [JsonProperty(PropertyName = "level")] + public string Level { get; set; } + + /// + /// Gets or sets list of namespaces excluded from guardrails checks + /// + [JsonProperty(PropertyName = "excludedNamespaces")] + public IList ExcludedNamespaces { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Version == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Version"); + } + if (Level == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Level"); + } + } + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/IPTag.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/IPTag.cs new file mode 100644 index 000000000000..e6b7096d4492 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/IPTag.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.ContainerService.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Contains the IPTag associated with the object. + /// + public partial class IPTag + { + /// + /// Initializes a new instance of the IPTag class. + /// + public IPTag() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the IPTag class. + /// + /// The IP tag type. Example: + /// RoutingPreference. + /// The value of the IP tag associated with the + /// public IP. Example: Internet. + public IPTag(string ipTagType = default(string), string tag = default(string)) + { + IpTagType = ipTagType; + Tag = tag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the IP tag type. Example: RoutingPreference. + /// + [JsonProperty(PropertyName = "ipTagType")] + public string IpTagType { get; set; } + + /// + /// Gets or sets the value of the IP tag associated with the public IP. + /// Example: Internet. + /// + [JsonProperty(PropertyName = "tag")] + public string Tag { get; set; } + + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/IpFamily.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/IpFamily.cs new file mode 100644 index 000000000000..965f8846c9c8 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/IpFamily.cs @@ -0,0 +1,22 @@ +// +// 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.ContainerService.Models +{ + + /// + /// Defines values for IpFamily. + /// + public static class IpFamily + { + public const string IPv4 = "IPv4"; + public const string IPv6 = "IPv6"; + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/IpvsScheduler.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/IpvsScheduler.cs new file mode 100644 index 000000000000..40636b930d1a --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/IpvsScheduler.cs @@ -0,0 +1,28 @@ +// +// 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.ContainerService.Models +{ + + /// + /// Defines values for IpvsScheduler. + /// + public static class IpvsScheduler + { + /// + /// Round Robin + /// + public const string RoundRobin = "RoundRobin"; + /// + /// Least Connection + /// + public const string LeastConnection = "LeastConnection"; + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/KeyVaultNetworkAccessTypes.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/KeyVaultNetworkAccessTypes.cs new file mode 100644 index 000000000000..f9007ed0539b --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/KeyVaultNetworkAccessTypes.cs @@ -0,0 +1,22 @@ +// +// 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.ContainerService.Models +{ + + /// + /// Defines values for KeyVaultNetworkAccessTypes. + /// + public static class KeyVaultNetworkAccessTypes + { + public const string Public = "Public"; + public const string Private = "Private"; + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/Level.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/Level.cs new file mode 100644 index 000000000000..1f0ca1f497e8 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/Level.cs @@ -0,0 +1,23 @@ +// +// 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.ContainerService.Models +{ + + /// + /// Defines values for Level. + /// + public static class Level + { + public const string Off = "Off"; + public const string Warning = "Warning"; + public const string Enforcement = "Enforcement"; + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedCluster.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedCluster.cs index 459e63efc010..c9980a8cac37 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedCluster.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedCluster.cs @@ -21,7 +21,7 @@ namespace Microsoft.Azure.Management.ContainerService.Models /// Managed cluster. /// [Rest.Serialization.JsonTransformation] - public partial class ManagedCluster : Resource + public partial class ManagedCluster : TrackedResource { /// /// Initializes a new instance of the ManagedCluster class. @@ -34,11 +34,17 @@ public ManagedCluster() /// /// Initializes a new instance of the ManagedCluster class. /// - /// Resource location - /// Resource Id - /// Resource name - /// Resource type - /// Resource tags + /// The geo-location where the resource + /// lives + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// Resource tags. /// The managed cluster SKU. /// The extended location of the Virtual /// Machine. @@ -47,10 +53,15 @@ public ManagedCluster() /// The current provisioning /// state. /// The Power State of the cluster. + /// CreationData to be used to specify the + /// source Snapshot ID if the cluster will be created/upgraded using a + /// snapshot. /// The max number of agent pools for the /// managed cluster. /// The version of Kubernetes the - /// Managed Cluster is running. + /// Managed Cluster is requested to run. + /// The version of Kubernetes + /// the Managed Cluster is running. /// The DNS prefix of the Managed /// Cluster. /// The FQDN subdomain of the private @@ -72,6 +83,8 @@ public ManagedCluster() /// add-on. /// The pod identity profile of the /// Managed Cluster. + /// The OIDC issuer profile of the + /// Managed Cluster. /// The name of the resource group /// containing agent pool nodes. /// Whether to enable Kubernetes Role-Based @@ -80,6 +93,8 @@ public ManagedCluster() /// enable Kubernetes pod security policy (preview). This feature is /// set for removal on October 15th, 2020. Learn more at /// aka.ms/aks/azpodpolicy. + /// Enable namespace as Azure + /// resource. /// The network configuration /// profile. /// The Azure Active Directory @@ -102,16 +117,26 @@ public ManagedCluster() /// cluster with HTTP proxy servers. /// Security profile for the managed /// cluster. - public ManagedCluster(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), ManagedClusterSKU sku = default(ManagedClusterSKU), ExtendedLocation extendedLocation = default(ExtendedLocation), ManagedClusterIdentity identity = default(ManagedClusterIdentity), string provisioningState = default(string), PowerState powerState = default(PowerState), int? maxAgentPools = default(int?), string kubernetesVersion = default(string), string dnsPrefix = default(string), string fqdnSubdomain = default(string), string fqdn = default(string), string privateFQDN = default(string), string azurePortalFQDN = default(string), IList agentPoolProfiles = default(IList), ContainerServiceLinuxProfile linuxProfile = default(ContainerServiceLinuxProfile), ManagedClusterWindowsProfile windowsProfile = default(ManagedClusterWindowsProfile), ManagedClusterServicePrincipalProfile servicePrincipalProfile = default(ManagedClusterServicePrincipalProfile), IDictionary addonProfiles = default(IDictionary), ManagedClusterPodIdentityProfile podIdentityProfile = default(ManagedClusterPodIdentityProfile), string nodeResourceGroup = default(string), bool? enableRBAC = default(bool?), bool? enablePodSecurityPolicy = default(bool?), ContainerServiceNetworkProfile networkProfile = default(ContainerServiceNetworkProfile), ManagedClusterAADProfile aadProfile = default(ManagedClusterAADProfile), ManagedClusterAutoUpgradeProfile autoUpgradeProfile = default(ManagedClusterAutoUpgradeProfile), ManagedClusterPropertiesAutoScalerProfile autoScalerProfile = default(ManagedClusterPropertiesAutoScalerProfile), ManagedClusterAPIServerAccessProfile apiServerAccessProfile = default(ManagedClusterAPIServerAccessProfile), string diskEncryptionSetID = default(string), IDictionary identityProfile = default(IDictionary), IList privateLinkResources = default(IList), bool? disableLocalAccounts = default(bool?), ManagedClusterHTTPProxyConfig httpProxyConfig = default(ManagedClusterHTTPProxyConfig), ManagedClusterSecurityProfile securityProfile = default(ManagedClusterSecurityProfile)) - : base(location, id, name, type, tags) + /// Storage profile for the managed + /// cluster. + /// Ingress profile for the managed + /// cluster. + /// PublicNetworkAccess of the + /// managedCluster + /// The guardrails profile holds all + /// the guardrails information for a given cluster + public ManagedCluster(string location, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), IDictionary tags = default(IDictionary), ManagedClusterSKU sku = default(ManagedClusterSKU), ExtendedLocation extendedLocation = default(ExtendedLocation), ManagedClusterIdentity identity = default(ManagedClusterIdentity), string provisioningState = default(string), PowerState powerState = default(PowerState), CreationData creationData = default(CreationData), int? maxAgentPools = default(int?), string kubernetesVersion = default(string), string currentKubernetesVersion = default(string), string dnsPrefix = default(string), string fqdnSubdomain = default(string), string fqdn = default(string), string privateFQDN = default(string), string azurePortalFQDN = default(string), IList agentPoolProfiles = default(IList), ContainerServiceLinuxProfile linuxProfile = default(ContainerServiceLinuxProfile), ManagedClusterWindowsProfile windowsProfile = default(ManagedClusterWindowsProfile), ManagedClusterServicePrincipalProfile servicePrincipalProfile = default(ManagedClusterServicePrincipalProfile), IDictionary addonProfiles = default(IDictionary), ManagedClusterPodIdentityProfile podIdentityProfile = default(ManagedClusterPodIdentityProfile), ManagedClusterOIDCIssuerProfile oidcIssuerProfile = default(ManagedClusterOIDCIssuerProfile), string nodeResourceGroup = default(string), bool? enableRBAC = default(bool?), bool? enablePodSecurityPolicy = default(bool?), bool? enableNamespaceResources = default(bool?), ContainerServiceNetworkProfile networkProfile = default(ContainerServiceNetworkProfile), ManagedClusterAADProfile aadProfile = default(ManagedClusterAADProfile), ManagedClusterAutoUpgradeProfile autoUpgradeProfile = default(ManagedClusterAutoUpgradeProfile), ManagedClusterPropertiesAutoScalerProfile autoScalerProfile = default(ManagedClusterPropertiesAutoScalerProfile), ManagedClusterAPIServerAccessProfile apiServerAccessProfile = default(ManagedClusterAPIServerAccessProfile), string diskEncryptionSetID = default(string), IDictionary identityProfile = default(IDictionary), IList privateLinkResources = default(IList), bool? disableLocalAccounts = default(bool?), ManagedClusterHTTPProxyConfig httpProxyConfig = default(ManagedClusterHTTPProxyConfig), ManagedClusterSecurityProfile securityProfile = default(ManagedClusterSecurityProfile), ManagedClusterStorageProfile storageProfile = default(ManagedClusterStorageProfile), ManagedClusterIngressProfile ingressProfile = default(ManagedClusterIngressProfile), string publicNetworkAccess = default(string), ManagedClusterWorkloadAutoScalerProfile workloadAutoScalerProfile = default(ManagedClusterWorkloadAutoScalerProfile), ManagedClusterAzureMonitorProfile azureMonitorProfile = default(ManagedClusterAzureMonitorProfile), GuardrailsProfile guardrailsProfile = default(GuardrailsProfile)) + : base(location, id, name, type, systemData, tags) { Sku = sku; ExtendedLocation = extendedLocation; Identity = identity; ProvisioningState = provisioningState; PowerState = powerState; + CreationData = creationData; MaxAgentPools = maxAgentPools; KubernetesVersion = kubernetesVersion; + CurrentKubernetesVersion = currentKubernetesVersion; DnsPrefix = dnsPrefix; FqdnSubdomain = fqdnSubdomain; Fqdn = fqdn; @@ -123,9 +148,11 @@ public ManagedCluster() ServicePrincipalProfile = servicePrincipalProfile; AddonProfiles = addonProfiles; PodIdentityProfile = podIdentityProfile; + OidcIssuerProfile = oidcIssuerProfile; NodeResourceGroup = nodeResourceGroup; EnableRBAC = enableRBAC; EnablePodSecurityPolicy = enablePodSecurityPolicy; + EnableNamespaceResources = enableNamespaceResources; NetworkProfile = networkProfile; AadProfile = aadProfile; AutoUpgradeProfile = autoUpgradeProfile; @@ -137,6 +164,12 @@ public ManagedCluster() DisableLocalAccounts = disableLocalAccounts; HttpProxyConfig = httpProxyConfig; SecurityProfile = securityProfile; + StorageProfile = storageProfile; + IngressProfile = ingressProfile; + PublicNetworkAccess = publicNetworkAccess; + WorkloadAutoScalerProfile = workloadAutoScalerProfile; + AzureMonitorProfile = azureMonitorProfile; + GuardrailsProfile = guardrailsProfile; CustomInit(); } @@ -175,6 +208,13 @@ public ManagedCluster() [JsonProperty(PropertyName = "properties.powerState")] public PowerState PowerState { get; private set; } + /// + /// Gets or sets creationData to be used to specify the source Snapshot + /// ID if the cluster will be created/upgraded using a snapshot. + /// + [JsonProperty(PropertyName = "properties.creationData")] + public CreationData CreationData { get; set; } + /// /// Gets the max number of agent pools for the managed cluster. /// @@ -183,7 +223,7 @@ public ManagedCluster() /// /// Gets or sets the version of Kubernetes the Managed Cluster is - /// running. + /// requested to run. /// /// /// When you upgrade a supported AKS cluster, Kubernetes minor versions @@ -197,6 +237,12 @@ public ManagedCluster() [JsonProperty(PropertyName = "properties.kubernetesVersion")] public string KubernetesVersion { get; set; } + /// + /// Gets the version of Kubernetes the Managed Cluster is running. + /// + [JsonProperty(PropertyName = "properties.currentKubernetesVersion")] + public string CurrentKubernetesVersion { get; private set; } + /// /// Gets or sets the DNS prefix of the Managed Cluster. /// @@ -284,6 +330,12 @@ public ManagedCluster() [JsonProperty(PropertyName = "properties.podIdentityProfile")] public ManagedClusterPodIdentityProfile PodIdentityProfile { get; set; } + /// + /// Gets or sets the OIDC issuer profile of the Managed Cluster. + /// + [JsonProperty(PropertyName = "properties.oidcIssuerProfile")] + public ManagedClusterOIDCIssuerProfile OidcIssuerProfile { get; set; } + /// /// Gets or sets the name of the resource group containing agent pool /// nodes. @@ -306,6 +358,18 @@ public ManagedCluster() [JsonProperty(PropertyName = "properties.enablePodSecurityPolicy")] public bool? EnablePodSecurityPolicy { get; set; } + /// + /// Gets or sets enable namespace as Azure resource. + /// + /// + /// The default value is false. It can be enabled/disabled on creation + /// and updation of the managed cluster. See + /// [https://aka.ms/NamespaceARMResource](https://aka.ms/NamespaceARMResource) + /// for more details on Namespace as a ARM Resource. + /// + [JsonProperty(PropertyName = "properties.enableNamespaceResources")] + public bool? EnableNamespaceResources { get; set; } + /// /// Gets or sets the network configuration profile. /// @@ -386,6 +450,45 @@ public ManagedCluster() [JsonProperty(PropertyName = "properties.securityProfile")] public ManagedClusterSecurityProfile SecurityProfile { get; set; } + /// + /// Gets or sets storage profile for the managed cluster. + /// + [JsonProperty(PropertyName = "properties.storageProfile")] + public ManagedClusterStorageProfile StorageProfile { get; set; } + + /// + /// Gets or sets ingress profile for the managed cluster. + /// + [JsonProperty(PropertyName = "properties.ingressProfile")] + public ManagedClusterIngressProfile IngressProfile { get; set; } + + /// + /// Gets or sets publicNetworkAccess of the managedCluster + /// + /// + /// Allow or deny public network access for AKS. Possible values + /// include: 'Enabled', 'Disabled', 'SecuredByPerimeter' + /// + [JsonProperty(PropertyName = "properties.publicNetworkAccess")] + public string PublicNetworkAccess { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.workloadAutoScalerProfile")] + public ManagedClusterWorkloadAutoScalerProfile WorkloadAutoScalerProfile { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.azureMonitorProfile")] + public ManagedClusterAzureMonitorProfile AzureMonitorProfile { get; set; } + + /// + /// Gets or sets the guardrails profile holds all the guardrails + /// information for a given cluster + /// + [JsonProperty(PropertyName = "properties.guardrailsProfile")] + public GuardrailsProfile GuardrailsProfile { get; set; } + /// /// Validate the object. /// @@ -431,6 +534,18 @@ public override void Validate() { NetworkProfile.Validate(); } + if (WorkloadAutoScalerProfile != null) + { + WorkloadAutoScalerProfile.Validate(); + } + if (AzureMonitorProfile != null) + { + AzureMonitorProfile.Validate(); + } + if (GuardrailsProfile != null) + { + GuardrailsProfile.Validate(); + } } } } diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAPIServerAccessProfile.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAPIServerAccessProfile.cs index 25d25ef2cdfe..e44d6a0c3a28 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAPIServerAccessProfile.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAPIServerAccessProfile.cs @@ -41,12 +41,21 @@ public ManagedClusterAPIServerAccessProfile() /// cluster. /// Whether to create /// additional public FQDN for private cluster or not. - public ManagedClusterAPIServerAccessProfile(IList authorizedIPRanges = default(IList), bool? enablePrivateCluster = default(bool?), string privateDNSZone = default(string), bool? enablePrivateClusterPublicFQDN = default(bool?)) + /// Whether to disable run command for + /// the cluster or not. + /// Whether to enable apiserver + /// vnet integration for the cluster or not. + /// The subnet to be used when apiserver vnet + /// integration is enabled. + public ManagedClusterAPIServerAccessProfile(IList authorizedIPRanges = default(IList), bool? enablePrivateCluster = default(bool?), string privateDNSZone = default(string), bool? enablePrivateClusterPublicFQDN = default(bool?), bool? disableRunCommand = default(bool?), bool? enableVnetIntegration = default(bool?), string subnetId = default(string)) { AuthorizedIPRanges = authorizedIPRanges; EnablePrivateCluster = enablePrivateCluster; PrivateDNSZone = privateDNSZone; EnablePrivateClusterPublicFQDN = enablePrivateClusterPublicFQDN; + DisableRunCommand = disableRunCommand; + EnableVnetIntegration = enableVnetIntegration; + SubnetId = subnetId; CustomInit(); } @@ -98,5 +107,29 @@ public ManagedClusterAPIServerAccessProfile() [JsonProperty(PropertyName = "enablePrivateClusterPublicFQDN")] public bool? EnablePrivateClusterPublicFQDN { get; set; } + /// + /// Gets or sets whether to disable run command for the cluster or not. + /// + [JsonProperty(PropertyName = "disableRunCommand")] + public bool? DisableRunCommand { get; set; } + + /// + /// Gets or sets whether to enable apiserver vnet integration for the + /// cluster or not. + /// + [JsonProperty(PropertyName = "enableVnetIntegration")] + public bool? EnableVnetIntegration { get; set; } + + /// + /// Gets or sets the subnet to be used when apiserver vnet integration + /// is enabled. + /// + /// + /// It is required when: 1. creating a new cluster with BYO Vnet; 2. + /// updating an existing cluster to enable apiserver vnet integration. + /// + [JsonProperty(PropertyName = "subnetId")] + public string SubnetId { get; set; } + } } diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAccessProfile.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAccessProfile.cs index 637cec2e1169..acf1e2573f93 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAccessProfile.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAccessProfile.cs @@ -21,7 +21,7 @@ namespace Microsoft.Azure.Management.ContainerService.Models /// Managed cluster Access Profile. /// [Rest.Serialization.JsonTransformation] - public partial class ManagedClusterAccessProfile : Resource + public partial class ManagedClusterAccessProfile : TrackedResource { /// /// Initializes a new instance of the ManagedClusterAccessProfile @@ -36,15 +36,21 @@ public ManagedClusterAccessProfile() /// Initializes a new instance of the ManagedClusterAccessProfile /// class. /// - /// Resource location - /// Resource Id - /// Resource name - /// Resource type - /// Resource tags + /// The geo-location where the resource + /// lives + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// Resource tags. /// Base64-encoded Kubernetes configuration /// file. - public ManagedClusterAccessProfile(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), byte[] kubeConfig = default(byte[])) - : base(location, id, name, type, tags) + public ManagedClusterAccessProfile(string location, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), IDictionary tags = default(IDictionary), byte[] kubeConfig = default(byte[])) + : base(location, id, name, type, systemData, tags) { KubeConfig = kubeConfig; CustomInit(); diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfile.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfile.cs index 70c5b5386759..e89ab584f30a 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfile.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfile.cs @@ -45,6 +45,10 @@ public ManagedClusterAgentPoolProfile() /// 'Ephemeral' /// Possible values include: 'OS', /// 'Temporary' + /// Possible values include: + /// 'OCIContainer', 'WasmWasi' + /// Message of the day for Linux nodes, + /// base64-encoded. /// The ID of the subnet which agent pool /// nodes and optionally pods will join on startup. /// The ID of the subnet which pods will join @@ -54,7 +58,7 @@ public ManagedClusterAgentPoolProfile() /// Possible values include: 'Linux', /// 'Windows' /// Possible values include: 'Ubuntu', - /// 'CBLMariner' + /// 'CBLMariner', 'Mariner', 'Windows2019', 'Windows2022' /// The maximum number of nodes for /// auto-scaling /// The minimum number of nodes for @@ -67,20 +71,24 @@ public ManagedClusterAgentPoolProfile() /// 'VirtualMachineScaleSets', 'AvailabilitySet' /// Possible values include: 'System', /// 'User' - /// The version of Kubernetes running - /// on the Agent Pool. + /// The version of Kubernetes + /// specified by the user. + /// The version of Kubernetes + /// running on the Agent Pool. /// The version of node image /// Settings for upgrading the /// agentpool /// The current deployment or /// provisioning state. - /// Describes whether the Agent Pool is - /// Running or Stopped + /// Whether the Agent Pool is running or + /// stopped. /// The list of Availability zones to /// use for nodes. This can only be specified if the AgentPoolType /// property is 'VirtualMachineScaleSets'. /// Whether each node is allocated its /// own public IP. + /// Whether to enable Custom CA Trust + /// feature. /// The public IP prefix ID which VM /// nodes should use IPs from. /// The Virtual Machine Scale Set @@ -111,8 +119,20 @@ public ManagedClusterAgentPoolProfile() /// GPUInstanceProfile to be used to /// specify GPU MIG instance profile for supported GPU VM SKU. Possible /// values include: 'MIG1g', 'MIG2g', 'MIG3g', 'MIG4g', 'MIG7g' - public ManagedClusterAgentPoolProfile(string name, int? count = default(int?), string vmSize = default(string), int? osDiskSizeGB = default(int?), string osDiskType = default(string), string kubeletDiskType = default(string), string vnetSubnetID = default(string), string podSubnetID = default(string), int? maxPods = default(int?), string osType = default(string), string osSKU = default(string), int? maxCount = default(int?), int? minCount = default(int?), bool? enableAutoScaling = default(bool?), string scaleDownMode = default(string), string type = default(string), string mode = default(string), string orchestratorVersion = default(string), string nodeImageVersion = default(string), AgentPoolUpgradeSettings upgradeSettings = default(AgentPoolUpgradeSettings), string provisioningState = default(string), PowerState powerState = default(PowerState), IList availabilityZones = default(IList), bool? enableNodePublicIP = default(bool?), string nodePublicIPPrefixID = default(string), string scaleSetPriority = default(string), string scaleSetEvictionPolicy = default(string), double? spotMaxPrice = default(double?), IDictionary tags = default(IDictionary), IDictionary nodeLabels = default(IDictionary), IList nodeTaints = default(IList), string proximityPlacementGroupID = default(string), KubeletConfig kubeletConfig = default(KubeletConfig), LinuxOSConfig linuxOSConfig = default(LinuxOSConfig), bool? enableEncryptionAtHost = default(bool?), bool? enableUltraSSD = default(bool?), bool? enableFIPS = default(bool?), string gpuInstanceProfile = default(string)) - : base(count, vmSize, osDiskSizeGB, osDiskType, kubeletDiskType, vnetSubnetID, podSubnetID, maxPods, osType, osSKU, maxCount, minCount, enableAutoScaling, scaleDownMode, type, mode, orchestratorVersion, nodeImageVersion, upgradeSettings, provisioningState, powerState, availabilityZones, enableNodePublicIP, nodePublicIPPrefixID, scaleSetPriority, scaleSetEvictionPolicy, spotMaxPrice, tags, nodeLabels, nodeTaints, proximityPlacementGroupID, kubeletConfig, linuxOSConfig, enableEncryptionAtHost, enableUltraSSD, enableFIPS, gpuInstanceProfile) + /// CreationData to be used to specify the + /// source Snapshot ID if the node pool will be created/upgraded using + /// a snapshot. + /// AKS will associate the + /// specified agent pool with the Capacity Reservation Group. + /// The fully qualified resource ID of the + /// Dedicated Host Group to provision virtual machines from, used only + /// in creation scenario and not allowed to changed once set. + /// The Windows agent pool's specific + /// profile. + /// Network-related settings of an agent + /// pool. + public ManagedClusterAgentPoolProfile(string name, int? count = default(int?), string vmSize = default(string), int? osDiskSizeGB = default(int?), string osDiskType = default(string), string kubeletDiskType = default(string), string workloadRuntime = default(string), string messageOfTheDay = default(string), string vnetSubnetID = default(string), string podSubnetID = default(string), int? maxPods = default(int?), string osType = default(string), string osSKU = default(string), int? maxCount = default(int?), int? minCount = default(int?), bool? enableAutoScaling = default(bool?), string scaleDownMode = default(string), string type = default(string), string mode = default(string), string orchestratorVersion = default(string), string currentOrchestratorVersion = default(string), string nodeImageVersion = default(string), AgentPoolUpgradeSettings upgradeSettings = default(AgentPoolUpgradeSettings), string provisioningState = default(string), PowerState powerState = default(PowerState), IList availabilityZones = default(IList), bool? enableNodePublicIP = default(bool?), bool? enableCustomCATrust = default(bool?), string nodePublicIPPrefixID = default(string), string scaleSetPriority = default(string), string scaleSetEvictionPolicy = default(string), double? spotMaxPrice = default(double?), IDictionary tags = default(IDictionary), IDictionary nodeLabels = default(IDictionary), IList nodeTaints = default(IList), string proximityPlacementGroupID = default(string), KubeletConfig kubeletConfig = default(KubeletConfig), LinuxOSConfig linuxOSConfig = default(LinuxOSConfig), bool? enableEncryptionAtHost = default(bool?), bool? enableUltraSSD = default(bool?), bool? enableFIPS = default(bool?), string gpuInstanceProfile = default(string), CreationData creationData = default(CreationData), string capacityReservationGroupID = default(string), string hostGroupID = default(string), AgentPoolWindowsProfile windowsProfile = default(AgentPoolWindowsProfile), AgentPoolNetworkProfile networkProfile = default(AgentPoolNetworkProfile)) + : base(count, vmSize, osDiskSizeGB, osDiskType, kubeletDiskType, workloadRuntime, messageOfTheDay, vnetSubnetID, podSubnetID, maxPods, osType, osSKU, maxCount, minCount, enableAutoScaling, scaleDownMode, type, mode, orchestratorVersion, currentOrchestratorVersion, nodeImageVersion, upgradeSettings, provisioningState, powerState, availabilityZones, enableNodePublicIP, enableCustomCATrust, nodePublicIPPrefixID, scaleSetPriority, scaleSetEvictionPolicy, spotMaxPrice, tags, nodeLabels, nodeTaints, proximityPlacementGroupID, kubeletConfig, linuxOSConfig, enableEncryptionAtHost, enableUltraSSD, enableFIPS, gpuInstanceProfile, creationData, capacityReservationGroupID, hostGroupID, windowsProfile, networkProfile) { Name = name; CustomInit(); diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfileProperties.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfileProperties.cs index a53077222929..bb5b1da18137 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfileProperties.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfileProperties.cs @@ -42,6 +42,10 @@ public ManagedClusterAgentPoolProfileProperties() /// 'Ephemeral' /// Possible values include: 'OS', /// 'Temporary' + /// Possible values include: + /// 'OCIContainer', 'WasmWasi' + /// Message of the day for Linux nodes, + /// base64-encoded. /// The ID of the subnet which agent pool /// nodes and optionally pods will join on startup. /// The ID of the subnet which pods will join @@ -51,7 +55,7 @@ public ManagedClusterAgentPoolProfileProperties() /// Possible values include: 'Linux', /// 'Windows' /// Possible values include: 'Ubuntu', - /// 'CBLMariner' + /// 'CBLMariner', 'Mariner', 'Windows2019', 'Windows2022' /// The maximum number of nodes for /// auto-scaling /// The minimum number of nodes for @@ -64,20 +68,24 @@ public ManagedClusterAgentPoolProfileProperties() /// 'VirtualMachineScaleSets', 'AvailabilitySet' /// Possible values include: 'System', /// 'User' - /// The version of Kubernetes running - /// on the Agent Pool. + /// The version of Kubernetes + /// specified by the user. + /// The version of Kubernetes + /// running on the Agent Pool. /// The version of node image /// Settings for upgrading the /// agentpool /// The current deployment or /// provisioning state. - /// Describes whether the Agent Pool is - /// Running or Stopped + /// Whether the Agent Pool is running or + /// stopped. /// The list of Availability zones to /// use for nodes. This can only be specified if the AgentPoolType /// property is 'VirtualMachineScaleSets'. /// Whether each node is allocated its /// own public IP. + /// Whether to enable Custom CA Trust + /// feature. /// The public IP prefix ID which VM /// nodes should use IPs from. /// The Virtual Machine Scale Set @@ -108,13 +116,27 @@ public ManagedClusterAgentPoolProfileProperties() /// GPUInstanceProfile to be used to /// specify GPU MIG instance profile for supported GPU VM SKU. Possible /// values include: 'MIG1g', 'MIG2g', 'MIG3g', 'MIG4g', 'MIG7g' - public ManagedClusterAgentPoolProfileProperties(int? count = default(int?), string vmSize = default(string), int? osDiskSizeGB = default(int?), string osDiskType = default(string), string kubeletDiskType = default(string), string vnetSubnetID = default(string), string podSubnetID = default(string), int? maxPods = default(int?), string osType = default(string), string osSKU = default(string), int? maxCount = default(int?), int? minCount = default(int?), bool? enableAutoScaling = default(bool?), string scaleDownMode = default(string), string type = default(string), string mode = default(string), string orchestratorVersion = default(string), string nodeImageVersion = default(string), AgentPoolUpgradeSettings upgradeSettings = default(AgentPoolUpgradeSettings), string provisioningState = default(string), PowerState powerState = default(PowerState), IList availabilityZones = default(IList), bool? enableNodePublicIP = default(bool?), string nodePublicIPPrefixID = default(string), string scaleSetPriority = default(string), string scaleSetEvictionPolicy = default(string), double? spotMaxPrice = default(double?), IDictionary tags = default(IDictionary), IDictionary nodeLabels = default(IDictionary), IList nodeTaints = default(IList), string proximityPlacementGroupID = default(string), KubeletConfig kubeletConfig = default(KubeletConfig), LinuxOSConfig linuxOSConfig = default(LinuxOSConfig), bool? enableEncryptionAtHost = default(bool?), bool? enableUltraSSD = default(bool?), bool? enableFIPS = default(bool?), string gpuInstanceProfile = default(string)) + /// CreationData to be used to specify the + /// source Snapshot ID if the node pool will be created/upgraded using + /// a snapshot. + /// AKS will associate the + /// specified agent pool with the Capacity Reservation Group. + /// The fully qualified resource ID of the + /// Dedicated Host Group to provision virtual machines from, used only + /// in creation scenario and not allowed to changed once set. + /// The Windows agent pool's specific + /// profile. + /// Network-related settings of an agent + /// pool. + public ManagedClusterAgentPoolProfileProperties(int? count = default(int?), string vmSize = default(string), int? osDiskSizeGB = default(int?), string osDiskType = default(string), string kubeletDiskType = default(string), string workloadRuntime = default(string), string messageOfTheDay = default(string), string vnetSubnetID = default(string), string podSubnetID = default(string), int? maxPods = default(int?), string osType = default(string), string osSKU = default(string), int? maxCount = default(int?), int? minCount = default(int?), bool? enableAutoScaling = default(bool?), string scaleDownMode = default(string), string type = default(string), string mode = default(string), string orchestratorVersion = default(string), string currentOrchestratorVersion = default(string), string nodeImageVersion = default(string), AgentPoolUpgradeSettings upgradeSettings = default(AgentPoolUpgradeSettings), string provisioningState = default(string), PowerState powerState = default(PowerState), IList availabilityZones = default(IList), bool? enableNodePublicIP = default(bool?), bool? enableCustomCATrust = default(bool?), string nodePublicIPPrefixID = default(string), string scaleSetPriority = default(string), string scaleSetEvictionPolicy = default(string), double? spotMaxPrice = default(double?), IDictionary tags = default(IDictionary), IDictionary nodeLabels = default(IDictionary), IList nodeTaints = default(IList), string proximityPlacementGroupID = default(string), KubeletConfig kubeletConfig = default(KubeletConfig), LinuxOSConfig linuxOSConfig = default(LinuxOSConfig), bool? enableEncryptionAtHost = default(bool?), bool? enableUltraSSD = default(bool?), bool? enableFIPS = default(bool?), string gpuInstanceProfile = default(string), CreationData creationData = default(CreationData), string capacityReservationGroupID = default(string), string hostGroupID = default(string), AgentPoolWindowsProfile windowsProfile = default(AgentPoolWindowsProfile), AgentPoolNetworkProfile networkProfile = default(AgentPoolNetworkProfile)) { Count = count; VmSize = vmSize; OsDiskSizeGB = osDiskSizeGB; OsDiskType = osDiskType; KubeletDiskType = kubeletDiskType; + WorkloadRuntime = workloadRuntime; + MessageOfTheDay = messageOfTheDay; VnetSubnetID = vnetSubnetID; PodSubnetID = podSubnetID; MaxPods = maxPods; @@ -127,12 +149,14 @@ public ManagedClusterAgentPoolProfileProperties() Type = type; Mode = mode; OrchestratorVersion = orchestratorVersion; + CurrentOrchestratorVersion = currentOrchestratorVersion; NodeImageVersion = nodeImageVersion; UpgradeSettings = upgradeSettings; ProvisioningState = provisioningState; PowerState = powerState; AvailabilityZones = availabilityZones; EnableNodePublicIP = enableNodePublicIP; + EnableCustomCATrust = enableCustomCATrust; NodePublicIPPrefixID = nodePublicIPPrefixID; ScaleSetPriority = scaleSetPriority; ScaleSetEvictionPolicy = scaleSetEvictionPolicy; @@ -147,6 +171,11 @@ public ManagedClusterAgentPoolProfileProperties() EnableUltraSSD = enableUltraSSD; EnableFIPS = enableFIPS; GpuInstanceProfile = gpuInstanceProfile; + CreationData = creationData; + CapacityReservationGroupID = capacityReservationGroupID; + HostGroupID = hostGroupID; + WindowsProfile = windowsProfile; + NetworkProfile = networkProfile; CustomInit(); } @@ -193,6 +222,25 @@ public ManagedClusterAgentPoolProfileProperties() [JsonProperty(PropertyName = "kubeletDiskType")] public string KubeletDiskType { get; set; } + /// + /// Gets or sets possible values include: 'OCIContainer', 'WasmWasi' + /// + [JsonProperty(PropertyName = "workloadRuntime")] + public string WorkloadRuntime { get; set; } + + /// + /// Gets or sets message of the day for Linux nodes, base64-encoded. + /// + /// + /// A base64-encoded string which will be written to /etc/motd after + /// decoding. This allows customization of the message of the day for + /// Linux nodes. It must not be specified for Windows nodes. It must be + /// a static string (i.e., will be printed raw and not be executed as a + /// script). + /// + [JsonProperty(PropertyName = "messageOfTheDay")] + public string MessageOfTheDay { get; set; } + /// /// Gets or sets the ID of the subnet which agent pool nodes and /// optionally pods will join on startup. @@ -231,7 +279,8 @@ public ManagedClusterAgentPoolProfileProperties() public string OsType { get; set; } /// - /// Gets or sets possible values include: 'Ubuntu', 'CBLMariner' + /// Gets or sets possible values include: 'Ubuntu', 'CBLMariner', + /// 'Mariner', 'Windows2019', 'Windows2022' /// [JsonProperty(PropertyName = "osSKU")] public string OsSKU { get; set; } @@ -280,20 +329,37 @@ public ManagedClusterAgentPoolProfileProperties() public string Mode { get; set; } /// - /// Gets or sets the version of Kubernetes running on the Agent Pool. + /// Gets or sets the version of Kubernetes specified by the user. /// /// - /// As a best practice, you should upgrade all node pools in an AKS - /// cluster to the same Kubernetes version. The node pool version must - /// have the same major version as the control plane. The node pool - /// minor version must be within two minor versions of the control - /// plane version. The node pool version cannot be greater than the - /// control plane version. For more information see [upgrading a node + /// Both patch version and are + /// supported. When is specified, the latest supported + /// patch version is chosen automatically. Updating the agent pool with + /// the same once it has been created will not trigger an + /// upgrade, even if a newer patch version is available. As a best + /// practice, you should upgrade all node pools in an AKS cluster to + /// the same Kubernetes version. The node pool version must have the + /// same major version as the control plane. The node pool minor + /// version must be within two minor versions of the control plane + /// version. The node pool version cannot be greater than the control + /// plane version. For more information see [upgrading a node /// pool](https://docs.microsoft.com/azure/aks/use-multiple-node-pools#upgrade-a-node-pool). /// [JsonProperty(PropertyName = "orchestratorVersion")] public string OrchestratorVersion { get; set; } + /// + /// Gets the version of Kubernetes running on the Agent Pool. + /// + /// + /// If orchestratorVersion was a fully specified version + /// , this field will be exactly equal to it. If + /// orchestratorVersion was , this field will contain the + /// full version being used. + /// + [JsonProperty(PropertyName = "currentOrchestratorVersion")] + public string CurrentOrchestratorVersion { get; private set; } + /// /// Gets the version of node image /// @@ -313,10 +379,17 @@ public ManagedClusterAgentPoolProfileProperties() public string ProvisioningState { get; private set; } /// - /// Gets describes whether the Agent Pool is Running or Stopped + /// Gets or sets whether the Agent Pool is running or stopped. /// + /// + /// When an Agent Pool is first created it is initially Running. The + /// Agent Pool can be stopped by setting this field to Stopped. A + /// stopped Agent Pool stops all of its VMs and does not accrue billing + /// charges. An Agent Pool can only be stopped if it is Running and + /// provisioning state is Succeeded + /// [JsonProperty(PropertyName = "powerState")] - public PowerState PowerState { get; private set; } + public PowerState PowerState { get; set; } /// /// Gets or sets the list of Availability zones to use for nodes. This @@ -341,6 +414,19 @@ public ManagedClusterAgentPoolProfileProperties() [JsonProperty(PropertyName = "enableNodePublicIP")] public bool? EnableNodePublicIP { get; set; } + /// + /// Gets or sets whether to enable Custom CA Trust feature. + /// + /// + /// When set to true, AKS adds a label to the node indicating that the + /// feature is enabled and deploys a daemonset along with host services + /// to sync custom certificate authorities from user-provided list of + /// base64 encoded certificates into node trust stores. Defaults to + /// false. + /// + [JsonProperty(PropertyName = "enableCustomCATrust")] + public bool? EnableCustomCATrust { get; set; } + /// /// Gets or sets the public IP prefix ID which VM nodes should use IPs /// from. @@ -462,6 +548,46 @@ public ManagedClusterAgentPoolProfileProperties() [JsonProperty(PropertyName = "gpuInstanceProfile")] public string GpuInstanceProfile { get; set; } + /// + /// Gets or sets creationData to be used to specify the source Snapshot + /// ID if the node pool will be created/upgraded using a snapshot. + /// + [JsonProperty(PropertyName = "creationData")] + public CreationData CreationData { get; set; } + + /// + /// Gets or sets AKS will associate the specified agent pool with the + /// Capacity Reservation Group. + /// + [JsonProperty(PropertyName = "capacityReservationGroupID")] + public string CapacityReservationGroupID { get; set; } + + /// + /// Gets or sets the fully qualified resource ID of the Dedicated Host + /// Group to provision virtual machines from, used only in creation + /// scenario and not allowed to changed once set. + /// + /// + /// This is of the form: + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/hostGroups/{hostGroupName}. + /// For more information see [Azure dedicated + /// hosts](https://docs.microsoft.com/azure/virtual-machines/dedicated-hosts). + /// + [JsonProperty(PropertyName = "hostGroupID")] + public string HostGroupID { get; set; } + + /// + /// Gets or sets the Windows agent pool's specific profile. + /// + [JsonProperty(PropertyName = "windowsProfile")] + public AgentPoolWindowsProfile WindowsProfile { get; set; } + + /// + /// Gets or sets network-related settings of an agent pool. + /// + [JsonProperty(PropertyName = "networkProfile")] + public AgentPoolNetworkProfile NetworkProfile { get; set; } + /// /// Validate the object. /// diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAzureMonitorProfile.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAzureMonitorProfile.cs new file mode 100644 index 000000000000..aa4223e1a064 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAzureMonitorProfile.cs @@ -0,0 +1,64 @@ +// +// 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.ContainerService.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Prometheus addon profile for the container service cluster + /// + public partial class ManagedClusterAzureMonitorProfile + { + /// + /// Initializes a new instance of the ManagedClusterAzureMonitorProfile + /// class. + /// + public ManagedClusterAzureMonitorProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ManagedClusterAzureMonitorProfile + /// class. + /// + public ManagedClusterAzureMonitorProfile(ManagedClusterAzureMonitorProfileMetrics metrics = default(ManagedClusterAzureMonitorProfileMetrics)) + { + Metrics = metrics; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "metrics")] + public ManagedClusterAzureMonitorProfileMetrics Metrics { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Metrics != null) + { + Metrics.Validate(); + } + } + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAzureMonitorProfileKubeStateMetrics.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAzureMonitorProfileKubeStateMetrics.cs new file mode 100644 index 000000000000..6e745eb27e6e --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAzureMonitorProfileKubeStateMetrics.cs @@ -0,0 +1,68 @@ +// +// 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.ContainerService.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Kube State Metrics for prometheus addon profile for the container + /// service cluster + /// + public partial class ManagedClusterAzureMonitorProfileKubeStateMetrics + { + /// + /// Initializes a new instance of the + /// ManagedClusterAzureMonitorProfileKubeStateMetrics class. + /// + public ManagedClusterAzureMonitorProfileKubeStateMetrics() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ManagedClusterAzureMonitorProfileKubeStateMetrics class. + /// + /// Comma-separated list of + /// Kubernetes annotations keys that will be used in the resource's + /// labels metric. + /// Comma-separated list of + /// additional Kubernetes label keys that will be used in the + /// resource's labels metric. + public ManagedClusterAzureMonitorProfileKubeStateMetrics(string metricLabelsAllowlist = default(string), string metricAnnotationsAllowList = default(string)) + { + MetricLabelsAllowlist = metricLabelsAllowlist; + MetricAnnotationsAllowList = metricAnnotationsAllowList; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets comma-separated list of Kubernetes annotations keys + /// that will be used in the resource's labels metric. + /// + [JsonProperty(PropertyName = "metricLabelsAllowlist")] + public string MetricLabelsAllowlist { get; set; } + + /// + /// Gets or sets comma-separated list of additional Kubernetes label + /// keys that will be used in the resource's labels metric. + /// + [JsonProperty(PropertyName = "metricAnnotationsAllowList")] + public string MetricAnnotationsAllowList { get; set; } + + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAzureMonitorProfileMetrics.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAzureMonitorProfileMetrics.cs new file mode 100644 index 000000000000..4e5ea1bfdf41 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterAzureMonitorProfileMetrics.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.ContainerService.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Metrics profile for the prometheus service addon + /// + public partial class ManagedClusterAzureMonitorProfileMetrics + { + /// + /// Initializes a new instance of the + /// ManagedClusterAzureMonitorProfileMetrics class. + /// + public ManagedClusterAzureMonitorProfileMetrics() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ManagedClusterAzureMonitorProfileMetrics class. + /// + /// Whether to enable the Prometheus + /// collector + public ManagedClusterAzureMonitorProfileMetrics(bool enabled, ManagedClusterAzureMonitorProfileKubeStateMetrics kubeStateMetrics = default(ManagedClusterAzureMonitorProfileKubeStateMetrics)) + { + Enabled = enabled; + KubeStateMetrics = kubeStateMetrics; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets whether to enable the Prometheus collector + /// + [JsonProperty(PropertyName = "enabled")] + public bool Enabled { get; set; } + + /// + /// + [JsonProperty(PropertyName = "kubeStateMetrics")] + public ManagedClusterAzureMonitorProfileKubeStateMetrics KubeStateMetrics { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + } + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterHTTPProxyConfig.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterHTTPProxyConfig.cs index ae383cb864ec..b4259e42d0f4 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterHTTPProxyConfig.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterHTTPProxyConfig.cs @@ -39,13 +39,17 @@ public ManagedClusterHTTPProxyConfig() /// use. /// The endpoints that should not go through /// proxy. + /// A read-only list of all endpoints + /// for which traffic should not be sent to the proxy. This list is a + /// superset of noProxy and values injected by AKS. /// Alternative CA cert to use for connecting /// to proxy servers. - public ManagedClusterHTTPProxyConfig(string httpProxy = default(string), string httpsProxy = default(string), IList noProxy = default(IList), string trustedCa = default(string)) + public ManagedClusterHTTPProxyConfig(string httpProxy = default(string), string httpsProxy = default(string), IList noProxy = default(IList), IList effectiveNoProxy = default(IList), string trustedCa = default(string)) { HttpProxy = httpProxy; HttpsProxy = httpsProxy; NoProxy = noProxy; + EffectiveNoProxy = effectiveNoProxy; TrustedCa = trustedCa; CustomInit(); } @@ -73,6 +77,14 @@ public ManagedClusterHTTPProxyConfig() [JsonProperty(PropertyName = "noProxy")] public IList NoProxy { get; set; } + /// + /// Gets a read-only list of all endpoints for which traffic should not + /// be sent to the proxy. This list is a superset of noProxy and values + /// injected by AKS. + /// + [JsonProperty(PropertyName = "effectiveNoProxy")] + public IList EffectiveNoProxy { get; private set; } + /// /// Gets or sets alternative CA cert to use for connecting to proxy /// servers. diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterIngressProfile.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterIngressProfile.cs new file mode 100644 index 000000000000..1eefd399918f --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterIngressProfile.cs @@ -0,0 +1,54 @@ +// +// 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.ContainerService.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Ingress profile for the container service cluster. + /// + public partial class ManagedClusterIngressProfile + { + /// + /// Initializes a new instance of the ManagedClusterIngressProfile + /// class. + /// + public ManagedClusterIngressProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ManagedClusterIngressProfile + /// class. + /// + /// Web App Routing settings for the + /// ingress profile. + public ManagedClusterIngressProfile(ManagedClusterIngressProfileWebAppRouting webAppRouting = default(ManagedClusterIngressProfileWebAppRouting)) + { + WebAppRouting = webAppRouting; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets web App Routing settings for the ingress profile. + /// + [JsonProperty(PropertyName = "webAppRouting")] + public ManagedClusterIngressProfileWebAppRouting WebAppRouting { get; set; } + + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterIngressProfileWebAppRouting.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterIngressProfileWebAppRouting.cs new file mode 100644 index 000000000000..9429428268a2 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterIngressProfileWebAppRouting.cs @@ -0,0 +1,64 @@ +// +// 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.ContainerService.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Web App Routing settings for the ingress profile. + /// + public partial class ManagedClusterIngressProfileWebAppRouting + { + /// + /// Initializes a new instance of the + /// ManagedClusterIngressProfileWebAppRouting class. + /// + public ManagedClusterIngressProfileWebAppRouting() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ManagedClusterIngressProfileWebAppRouting class. + /// + /// Whether to enable Web App Routing. + /// Resource ID of the DNS Zone to be + /// associated with the web app. Used only when Web App Routing is + /// enabled. + public ManagedClusterIngressProfileWebAppRouting(bool? enabled = default(bool?), string dnsZoneResourceId = default(string)) + { + Enabled = enabled; + DnsZoneResourceId = dnsZoneResourceId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets whether to enable Web App Routing. + /// + [JsonProperty(PropertyName = "enabled")] + public bool? Enabled { get; set; } + + /// + /// Gets or sets resource ID of the DNS Zone to be associated with the + /// web app. Used only when Web App Routing is enabled. + /// + [JsonProperty(PropertyName = "dnsZoneResourceId")] + public string DnsZoneResourceId { get; set; } + + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfile.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfile.cs index fb6782d4bb34..d84c0735c2ce 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfile.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfile.cs @@ -49,7 +49,12 @@ public ManagedClusterLoadBalancerProfile() /// Desired outbound flow idle /// timeout in minutes. Allowed values are in the range of 4 to 120 /// (inclusive). The default value is 30 minutes. - public ManagedClusterLoadBalancerProfile(ManagedClusterLoadBalancerProfileManagedOutboundIPs managedOutboundIPs = default(ManagedClusterLoadBalancerProfileManagedOutboundIPs), ManagedClusterLoadBalancerProfileOutboundIPPrefixes outboundIPPrefixes = default(ManagedClusterLoadBalancerProfileOutboundIPPrefixes), ManagedClusterLoadBalancerProfileOutboundIPs outboundIPs = default(ManagedClusterLoadBalancerProfileOutboundIPs), IList effectiveOutboundIPs = default(IList), int? allocatedOutboundPorts = default(int?), int? idleTimeoutInMinutes = default(int?)) + /// Enable multiple + /// standard load balancers per AKS cluster or not. + /// The type of the managed inbound Load + /// Balancer BackendPool. Possible values include: + /// 'NodeIPConfiguration', 'NodeIP' + public ManagedClusterLoadBalancerProfile(ManagedClusterLoadBalancerProfileManagedOutboundIPs managedOutboundIPs = default(ManagedClusterLoadBalancerProfileManagedOutboundIPs), ManagedClusterLoadBalancerProfileOutboundIPPrefixes outboundIPPrefixes = default(ManagedClusterLoadBalancerProfileOutboundIPPrefixes), ManagedClusterLoadBalancerProfileOutboundIPs outboundIPs = default(ManagedClusterLoadBalancerProfileOutboundIPs), IList effectiveOutboundIPs = default(IList), int? allocatedOutboundPorts = default(int?), int? idleTimeoutInMinutes = default(int?), bool? enableMultipleStandardLoadBalancers = default(bool?), string backendPoolType = default(string)) { ManagedOutboundIPs = managedOutboundIPs; OutboundIPPrefixes = outboundIPPrefixes; @@ -57,6 +62,8 @@ public ManagedClusterLoadBalancerProfile() EffectiveOutboundIPs = effectiveOutboundIPs; AllocatedOutboundPorts = allocatedOutboundPorts; IdleTimeoutInMinutes = idleTimeoutInMinutes; + EnableMultipleStandardLoadBalancers = enableMultipleStandardLoadBalancers; + BackendPoolType = backendPoolType; CustomInit(); } @@ -110,6 +117,21 @@ public ManagedClusterLoadBalancerProfile() [JsonProperty(PropertyName = "idleTimeoutInMinutes")] public int? IdleTimeoutInMinutes { get; set; } + /// + /// Gets or sets enable multiple standard load balancers per AKS + /// cluster or not. + /// + [JsonProperty(PropertyName = "enableMultipleStandardLoadBalancers")] + public bool? EnableMultipleStandardLoadBalancers { get; set; } + + /// + /// Gets or sets the type of the managed inbound Load Balancer + /// BackendPool. Possible values include: 'NodeIPConfiguration', + /// 'NodeIP' + /// + [JsonProperty(PropertyName = "backendPoolType")] + public string BackendPoolType { get; set; } + /// /// Validate the object. /// diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileManagedOutboundIPs.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileManagedOutboundIPs.cs index 6e60275cc155..e68974dcd9c6 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileManagedOutboundIPs.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileManagedOutboundIPs.cs @@ -32,13 +32,18 @@ public ManagedClusterLoadBalancerProfileManagedOutboundIPs() /// Initializes a new instance of the /// ManagedClusterLoadBalancerProfileManagedOutboundIPs class. /// - /// The desired number of outbound IPs + /// The desired number of IPv4 outbound IPs /// created/managed by Azure for the cluster load balancer. Allowed /// values must be in the range of 1 to 100 (inclusive). The default /// value is 1. - public ManagedClusterLoadBalancerProfileManagedOutboundIPs(int? count = default(int?)) + /// The desired number of IPv6 outbound IPs + /// created/managed by Azure for the cluster load balancer. Allowed + /// values must be in the range of 1 to 100 (inclusive). The default + /// value is 0 for single-stack and 1 for dual-stack. + public ManagedClusterLoadBalancerProfileManagedOutboundIPs(int? count = default(int?), int? countIPv6 = default(int?)) { Count = count; + CountIPv6 = countIPv6; CustomInit(); } @@ -48,13 +53,23 @@ public ManagedClusterLoadBalancerProfileManagedOutboundIPs() partial void CustomInit(); /// - /// Gets or sets the desired number of outbound IPs created/managed by - /// Azure for the cluster load balancer. Allowed values must be in the - /// range of 1 to 100 (inclusive). The default value is 1. + /// Gets or sets the desired number of IPv4 outbound IPs + /// created/managed by Azure for the cluster load balancer. Allowed + /// values must be in the range of 1 to 100 (inclusive). The default + /// value is 1. /// [JsonProperty(PropertyName = "count")] public int? Count { get; set; } + /// + /// Gets or sets the desired number of IPv6 outbound IPs + /// created/managed by Azure for the cluster load balancer. Allowed + /// values must be in the range of 1 to 100 (inclusive). The default + /// value is 0 for single-stack and 1 for dual-stack. + /// + [JsonProperty(PropertyName = "countIPv6")] + public int? CountIPv6 { get; set; } + /// /// Validate the object. /// @@ -71,6 +86,14 @@ public virtual void Validate() { throw new ValidationException(ValidationRules.InclusiveMinimum, "Count", 1); } + if (CountIPv6 > 100) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "CountIPv6", 100); + } + if (CountIPv6 < 0) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "CountIPv6", 0); + } } } } diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterOIDCIssuerProfile.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterOIDCIssuerProfile.cs new file mode 100644 index 000000000000..741365683c29 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterOIDCIssuerProfile.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.ContainerService.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The OIDC issuer profile of the Managed Cluster. + /// + public partial class ManagedClusterOIDCIssuerProfile + { + /// + /// Initializes a new instance of the ManagedClusterOIDCIssuerProfile + /// class. + /// + public ManagedClusterOIDCIssuerProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ManagedClusterOIDCIssuerProfile + /// class. + /// + /// The OIDC issuer url of the Managed + /// Cluster. + /// Whether the OIDC issuer is enabled. + public ManagedClusterOIDCIssuerProfile(string issuerURL = default(string), bool? enabled = default(bool?)) + { + IssuerURL = issuerURL; + Enabled = enabled; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the OIDC issuer url of the Managed Cluster. + /// + [JsonProperty(PropertyName = "issuerURL")] + public string IssuerURL { get; private set; } + + /// + /// Gets or sets whether the OIDC issuer is enabled. + /// + [JsonProperty(PropertyName = "enabled")] + public bool? Enabled { get; set; } + + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterPropertiesForSnapshot.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterPropertiesForSnapshot.cs new file mode 100644 index 000000000000..b4a134ba7095 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterPropertiesForSnapshot.cs @@ -0,0 +1,81 @@ +// +// 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.ContainerService.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// managed cluster properties for snapshot, these properties are read + /// only. + /// + public partial class ManagedClusterPropertiesForSnapshot + { + /// + /// Initializes a new instance of the + /// ManagedClusterPropertiesForSnapshot class. + /// + public ManagedClusterPropertiesForSnapshot() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ManagedClusterPropertiesForSnapshot class. + /// + /// The current kubernetes + /// version. + /// The current managed cluster sku. + /// Whether the cluster has enabled Kubernetes + /// Role-Based Access Control or not. + /// The current network profile. + public ManagedClusterPropertiesForSnapshot(string kubernetesVersion = default(string), ManagedClusterSKU sku = default(ManagedClusterSKU), bool? enableRbac = default(bool?), NetworkProfileForSnapshot networkProfile = default(NetworkProfileForSnapshot)) + { + KubernetesVersion = kubernetesVersion; + Sku = sku; + EnableRbac = enableRbac; + NetworkProfile = networkProfile; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the current kubernetes version. + /// + [JsonProperty(PropertyName = "kubernetesVersion")] + public string KubernetesVersion { get; set; } + + /// + /// Gets or sets the current managed cluster sku. + /// + [JsonProperty(PropertyName = "sku")] + public ManagedClusterSKU Sku { get; set; } + + /// + /// Gets or sets whether the cluster has enabled Kubernetes Role-Based + /// Access Control or not. + /// + [JsonProperty(PropertyName = "enableRbac")] + public bool? EnableRbac { get; set; } + + /// + /// Gets or sets the current network profile. + /// + [JsonProperty(PropertyName = "networkProfile")] + public NetworkProfileForSnapshot NetworkProfile { get; set; } + + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterSecurityProfile.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterSecurityProfile.cs index aa5654dd20bc..5c9f7c0bb784 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterSecurityProfile.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterSecurityProfile.cs @@ -11,6 +11,8 @@ namespace Microsoft.Azure.Management.ContainerService.Models { using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; using System.Linq; /// @@ -31,11 +33,32 @@ public ManagedClusterSecurityProfile() /// Initializes a new instance of the ManagedClusterSecurityProfile /// class. /// - /// Azure Defender settings for the - /// security profile. - public ManagedClusterSecurityProfile(ManagedClusterSecurityProfileAzureDefender azureDefender = default(ManagedClusterSecurityProfileAzureDefender)) + /// Microsoft Defender settings for the security + /// profile. + /// Azure Key Vault [key management + /// service](https://kubernetes.io/docs/tasks/administer-cluster/kms-provider/) + /// settings for the security profile. + /// [Workload + /// Identity](https://azure.github.io/azure-workload-identity/docs/) + /// settings for the security profile. + /// ImageCleaner settings for the security + /// profile. + /// [Node + /// Restriction](https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/#noderestriction) + /// settings for the security profile. + /// A list of up to 10 base64 + /// encoded CAs that will be added to the trust store on nodes with the + /// Custom CA Trust feature enabled. For more information see [Custom + /// CA Trust + /// Certificates](https://learn.microsoft.com/en-us/azure/aks/custom-certificate-authority) + public ManagedClusterSecurityProfile(ManagedClusterSecurityProfileDefender defender = default(ManagedClusterSecurityProfileDefender), AzureKeyVaultKms azureKeyVaultKms = default(AzureKeyVaultKms), ManagedClusterSecurityProfileWorkloadIdentity workloadIdentity = default(ManagedClusterSecurityProfileWorkloadIdentity), ManagedClusterSecurityProfileImageCleaner imageCleaner = default(ManagedClusterSecurityProfileImageCleaner), ManagedClusterSecurityProfileNodeRestriction nodeRestriction = default(ManagedClusterSecurityProfileNodeRestriction), IList customCATrustCertificates = default(IList)) { - AzureDefender = azureDefender; + Defender = defender; + AzureKeyVaultKms = azureKeyVaultKms; + WorkloadIdentity = workloadIdentity; + ImageCleaner = imageCleaner; + NodeRestriction = nodeRestriction; + CustomCATrustCertificates = customCATrustCertificates; CustomInit(); } @@ -45,10 +68,49 @@ public ManagedClusterSecurityProfile() partial void CustomInit(); /// - /// Gets or sets azure Defender settings for the security profile. + /// Gets or sets microsoft Defender settings for the security profile. /// - [JsonProperty(PropertyName = "azureDefender")] - public ManagedClusterSecurityProfileAzureDefender AzureDefender { get; set; } + [JsonProperty(PropertyName = "defender")] + public ManagedClusterSecurityProfileDefender Defender { get; set; } + + /// + /// Gets or sets azure Key Vault [key management + /// service](https://kubernetes.io/docs/tasks/administer-cluster/kms-provider/) + /// settings for the security profile. + /// + [JsonProperty(PropertyName = "azureKeyVaultKms")] + public AzureKeyVaultKms AzureKeyVaultKms { get; set; } + + /// + /// Gets or sets [Workload + /// Identity](https://azure.github.io/azure-workload-identity/docs/) + /// settings for the security profile. + /// + [JsonProperty(PropertyName = "workloadIdentity")] + public ManagedClusterSecurityProfileWorkloadIdentity WorkloadIdentity { get; set; } + + /// + /// Gets or sets imageCleaner settings for the security profile. + /// + [JsonProperty(PropertyName = "imageCleaner")] + public ManagedClusterSecurityProfileImageCleaner ImageCleaner { get; set; } + + /// + /// Gets or sets [Node + /// Restriction](https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/#noderestriction) + /// settings for the security profile. + /// + [JsonProperty(PropertyName = "nodeRestriction")] + public ManagedClusterSecurityProfileNodeRestriction NodeRestriction { get; set; } + + /// + /// Gets or sets a list of up to 10 base64 encoded CAs that will be + /// added to the trust store on nodes with the Custom CA Trust feature + /// enabled. For more information see [Custom CA Trust + /// Certificates](https://learn.microsoft.com/en-us/azure/aks/custom-certificate-authority) + /// + [JsonProperty(PropertyName = "customCATrustCertificates")] + public IList CustomCATrustCertificates { get; set; } } } diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileAzureDefender.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileAzureDefender.cs deleted file mode 100644 index c5ed32338af1..000000000000 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileAzureDefender.cs +++ /dev/null @@ -1,68 +0,0 @@ -// -// 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.ContainerService.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Azure Defender settings for the security profile. - /// - public partial class ManagedClusterSecurityProfileAzureDefender - { - /// - /// Initializes a new instance of the - /// ManagedClusterSecurityProfileAzureDefender class. - /// - public ManagedClusterSecurityProfileAzureDefender() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// ManagedClusterSecurityProfileAzureDefender class. - /// - /// Whether to enable Azure Defender - /// Resource ID of the - /// Log Analytics workspace to be associated with Azure Defender. When - /// Azure Defender is enabled, this field is required and must be a - /// valid workspace resource ID. When Azure Defender is disabled, leave - /// the field empty. - public ManagedClusterSecurityProfileAzureDefender(bool? enabled = default(bool?), string logAnalyticsWorkspaceResourceId = default(string)) - { - Enabled = enabled; - LogAnalyticsWorkspaceResourceId = logAnalyticsWorkspaceResourceId; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets whether to enable Azure Defender - /// - [JsonProperty(PropertyName = "enabled")] - public bool? Enabled { get; set; } - - /// - /// Gets or sets resource ID of the Log Analytics workspace to be - /// associated with Azure Defender. When Azure Defender is enabled, - /// this field is required and must be a valid workspace resource ID. - /// When Azure Defender is disabled, leave the field empty. - /// - [JsonProperty(PropertyName = "logAnalyticsWorkspaceResourceId")] - public string LogAnalyticsWorkspaceResourceId { get; set; } - - } -} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileDefender.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileDefender.cs new file mode 100644 index 000000000000..2089b2353d85 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileDefender.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.ContainerService.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Microsoft Defender settings for the security profile. + /// + public partial class ManagedClusterSecurityProfileDefender + { + /// + /// Initializes a new instance of the + /// ManagedClusterSecurityProfileDefender class. + /// + public ManagedClusterSecurityProfileDefender() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ManagedClusterSecurityProfileDefender class. + /// + /// Resource ID of the + /// Log Analytics workspace to be associated with Microsoft Defender. + /// When Microsoft Defender is enabled, this field is required and must + /// be a valid workspace resource ID. When Microsoft Defender is + /// disabled, leave the field empty. + /// Microsoft Defender threat + /// detection for Cloud settings for the security profile. + public ManagedClusterSecurityProfileDefender(string logAnalyticsWorkspaceResourceId = default(string), ManagedClusterSecurityProfileDefenderSecurityMonitoring securityMonitoring = default(ManagedClusterSecurityProfileDefenderSecurityMonitoring)) + { + LogAnalyticsWorkspaceResourceId = logAnalyticsWorkspaceResourceId; + SecurityMonitoring = securityMonitoring; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource ID of the Log Analytics workspace to be + /// associated with Microsoft Defender. When Microsoft Defender is + /// enabled, this field is required and must be a valid workspace + /// resource ID. When Microsoft Defender is disabled, leave the field + /// empty. + /// + [JsonProperty(PropertyName = "logAnalyticsWorkspaceResourceId")] + public string LogAnalyticsWorkspaceResourceId { get; set; } + + /// + /// Gets or sets microsoft Defender threat detection for Cloud settings + /// for the security profile. + /// + [JsonProperty(PropertyName = "securityMonitoring")] + public ManagedClusterSecurityProfileDefenderSecurityMonitoring SecurityMonitoring { get; set; } + + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileDefenderSecurityMonitoring.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileDefenderSecurityMonitoring.cs new file mode 100644 index 000000000000..cef009a18f09 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileDefenderSecurityMonitoring.cs @@ -0,0 +1,54 @@ +// +// 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.ContainerService.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Microsoft Defender settings for the security profile threat detection. + /// + public partial class ManagedClusterSecurityProfileDefenderSecurityMonitoring + { + /// + /// Initializes a new instance of the + /// ManagedClusterSecurityProfileDefenderSecurityMonitoring class. + /// + public ManagedClusterSecurityProfileDefenderSecurityMonitoring() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ManagedClusterSecurityProfileDefenderSecurityMonitoring class. + /// + /// Whether to enable Defender threat + /// detection + public ManagedClusterSecurityProfileDefenderSecurityMonitoring(bool? enabled = default(bool?)) + { + Enabled = enabled; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets whether to enable Defender threat detection + /// + [JsonProperty(PropertyName = "enabled")] + public bool? Enabled { get; set; } + + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileImageCleaner.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileImageCleaner.cs new file mode 100644 index 000000000000..0cb24e0dacd8 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileImageCleaner.cs @@ -0,0 +1,64 @@ +// +// 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.ContainerService.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// ImageCleaner removes unused images from nodes, freeing up disk space + /// and helping to reduce attack surface area. Here are settings for the + /// security profile. + /// + public partial class ManagedClusterSecurityProfileImageCleaner + { + /// + /// Initializes a new instance of the + /// ManagedClusterSecurityProfileImageCleaner class. + /// + public ManagedClusterSecurityProfileImageCleaner() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ManagedClusterSecurityProfileImageCleaner class. + /// + /// Whether to enable ImageCleaner on AKS + /// cluster. + /// ImageCleaner scanning interval. + public ManagedClusterSecurityProfileImageCleaner(bool? enabled = default(bool?), int? intervalHours = default(int?)) + { + Enabled = enabled; + IntervalHours = intervalHours; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets whether to enable ImageCleaner on AKS cluster. + /// + [JsonProperty(PropertyName = "enabled")] + public bool? Enabled { get; set; } + + /// + /// Gets or sets imageCleaner scanning interval. + /// + [JsonProperty(PropertyName = "intervalHours")] + public int? IntervalHours { get; set; } + + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileNodeRestriction.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileNodeRestriction.cs new file mode 100644 index 000000000000..76dc09b21ad8 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileNodeRestriction.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.ContainerService.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Node Restriction settings for the security profile. + /// + public partial class ManagedClusterSecurityProfileNodeRestriction + { + /// + /// Initializes a new instance of the + /// ManagedClusterSecurityProfileNodeRestriction class. + /// + public ManagedClusterSecurityProfileNodeRestriction() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ManagedClusterSecurityProfileNodeRestriction class. + /// + /// Whether to enable Node Restriction + public ManagedClusterSecurityProfileNodeRestriction(bool? enabled = default(bool?)) + { + Enabled = enabled; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets whether to enable Node Restriction + /// + [JsonProperty(PropertyName = "enabled")] + public bool? Enabled { get; set; } + + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileWorkloadIdentity.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileWorkloadIdentity.cs new file mode 100644 index 000000000000..d588a5d8c8a8 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileWorkloadIdentity.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.ContainerService.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Workload Identity settings for the security profile. + /// + public partial class ManagedClusterSecurityProfileWorkloadIdentity + { + /// + /// Initializes a new instance of the + /// ManagedClusterSecurityProfileWorkloadIdentity class. + /// + public ManagedClusterSecurityProfileWorkloadIdentity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ManagedClusterSecurityProfileWorkloadIdentity class. + /// + /// Whether to enable Workload Identity + public ManagedClusterSecurityProfileWorkloadIdentity(bool? enabled = default(bool?)) + { + Enabled = enabled; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets whether to enable Workload Identity + /// + [JsonProperty(PropertyName = "enabled")] + public bool? Enabled { get; set; } + + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterSnapshot.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterSnapshot.cs new file mode 100644 index 000000000000..720823684341 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterSnapshot.cs @@ -0,0 +1,100 @@ +// +// 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.ContainerService.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A managed cluster snapshot resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class ManagedClusterSnapshot : TrackedResource + { + /// + /// Initializes a new instance of the ManagedClusterSnapshot class. + /// + public ManagedClusterSnapshot() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ManagedClusterSnapshot class. + /// + /// The geo-location where the resource + /// lives + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// Resource tags. + /// CreationData to be used to specify the + /// source resource ID to create this snapshot. + /// Possible values include: 'NodePool', + /// 'ManagedCluster' + /// What the properties + /// will be showed when getting managed cluster snapshot. Those + /// properties are read-only. + public ManagedClusterSnapshot(string location, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), IDictionary tags = default(IDictionary), CreationData creationData = default(CreationData), string snapshotType = default(string), ManagedClusterPropertiesForSnapshot managedClusterPropertiesReadOnly = default(ManagedClusterPropertiesForSnapshot)) + : base(location, id, name, type, systemData, tags) + { + CreationData = creationData; + SnapshotType = snapshotType; + ManagedClusterPropertiesReadOnly = managedClusterPropertiesReadOnly; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets creationData to be used to specify the source resource + /// ID to create this snapshot. + /// + [JsonProperty(PropertyName = "properties.creationData")] + public CreationData CreationData { get; set; } + + /// + /// Gets or sets possible values include: 'NodePool', 'ManagedCluster' + /// + [JsonProperty(PropertyName = "properties.snapshotType")] + public string SnapshotType { get; set; } + + /// + /// Gets or sets what the properties will be showed when getting + /// managed cluster snapshot. Those properties are read-only. + /// + [JsonProperty(PropertyName = "properties.managedClusterPropertiesReadOnly")] + public ManagedClusterPropertiesForSnapshot ManagedClusterPropertiesReadOnly { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterStorageProfile.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterStorageProfile.cs new file mode 100644 index 000000000000..690e37593365 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterStorageProfile.cs @@ -0,0 +1,81 @@ +// +// 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.ContainerService.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Storage profile for the container service cluster. + /// + public partial class ManagedClusterStorageProfile + { + /// + /// Initializes a new instance of the ManagedClusterStorageProfile + /// class. + /// + public ManagedClusterStorageProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ManagedClusterStorageProfile + /// class. + /// + /// AzureDisk CSI Driver settings for the + /// storage profile. + /// AzureFile CSI Driver settings for the + /// storage profile. + /// Snapshot Controller settings for + /// the storage profile. + /// AzureBlob CSI Driver settings for the + /// storage profile. + public ManagedClusterStorageProfile(ManagedClusterStorageProfileDiskCSIDriver diskCSIDriver = default(ManagedClusterStorageProfileDiskCSIDriver), ManagedClusterStorageProfileFileCSIDriver fileCSIDriver = default(ManagedClusterStorageProfileFileCSIDriver), ManagedClusterStorageProfileSnapshotController snapshotController = default(ManagedClusterStorageProfileSnapshotController), ManagedClusterStorageProfileBlobCSIDriver blobCSIDriver = default(ManagedClusterStorageProfileBlobCSIDriver)) + { + DiskCSIDriver = diskCSIDriver; + FileCSIDriver = fileCSIDriver; + SnapshotController = snapshotController; + BlobCSIDriver = blobCSIDriver; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets azureDisk CSI Driver settings for the storage profile. + /// + [JsonProperty(PropertyName = "diskCSIDriver")] + public ManagedClusterStorageProfileDiskCSIDriver DiskCSIDriver { get; set; } + + /// + /// Gets or sets azureFile CSI Driver settings for the storage profile. + /// + [JsonProperty(PropertyName = "fileCSIDriver")] + public ManagedClusterStorageProfileFileCSIDriver FileCSIDriver { get; set; } + + /// + /// Gets or sets snapshot Controller settings for the storage profile. + /// + [JsonProperty(PropertyName = "snapshotController")] + public ManagedClusterStorageProfileSnapshotController SnapshotController { get; set; } + + /// + /// Gets or sets azureBlob CSI Driver settings for the storage profile. + /// + [JsonProperty(PropertyName = "blobCSIDriver")] + public ManagedClusterStorageProfileBlobCSIDriver BlobCSIDriver { get; set; } + + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterStorageProfileBlobCSIDriver.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterStorageProfileBlobCSIDriver.cs new file mode 100644 index 000000000000..96715c9dc55f --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterStorageProfileBlobCSIDriver.cs @@ -0,0 +1,55 @@ +// +// 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.ContainerService.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// AzureBlob CSI Driver settings for the storage profile. + /// + public partial class ManagedClusterStorageProfileBlobCSIDriver + { + /// + /// Initializes a new instance of the + /// ManagedClusterStorageProfileBlobCSIDriver class. + /// + public ManagedClusterStorageProfileBlobCSIDriver() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ManagedClusterStorageProfileBlobCSIDriver class. + /// + /// Whether to enable AzureBlob CSI Driver. The + /// default value is false. + public ManagedClusterStorageProfileBlobCSIDriver(bool? enabled = default(bool?)) + { + Enabled = enabled; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets whether to enable AzureBlob CSI Driver. The default + /// value is false. + /// + [JsonProperty(PropertyName = "enabled")] + public bool? Enabled { get; set; } + + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterStorageProfileDiskCSIDriver.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterStorageProfileDiskCSIDriver.cs new file mode 100644 index 000000000000..cac39dae2302 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterStorageProfileDiskCSIDriver.cs @@ -0,0 +1,65 @@ +// +// 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.ContainerService.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// AzureDisk CSI Driver settings for the storage profile. + /// + public partial class ManagedClusterStorageProfileDiskCSIDriver + { + /// + /// Initializes a new instance of the + /// ManagedClusterStorageProfileDiskCSIDriver class. + /// + public ManagedClusterStorageProfileDiskCSIDriver() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ManagedClusterStorageProfileDiskCSIDriver class. + /// + /// Whether to enable AzureDisk CSI Driver. The + /// default value is true. + /// The version of AzureDisk CSI Driver. The + /// default value is v1. + public ManagedClusterStorageProfileDiskCSIDriver(bool? enabled = default(bool?), string version = default(string)) + { + Enabled = enabled; + Version = version; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets whether to enable AzureDisk CSI Driver. The default + /// value is true. + /// + [JsonProperty(PropertyName = "enabled")] + public bool? Enabled { get; set; } + + /// + /// Gets or sets the version of AzureDisk CSI Driver. The default value + /// is v1. + /// + [JsonProperty(PropertyName = "version")] + public string Version { get; set; } + + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterStorageProfileFileCSIDriver.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterStorageProfileFileCSIDriver.cs new file mode 100644 index 000000000000..0693a9f757a7 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterStorageProfileFileCSIDriver.cs @@ -0,0 +1,55 @@ +// +// 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.ContainerService.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// AzureFile CSI Driver settings for the storage profile. + /// + public partial class ManagedClusterStorageProfileFileCSIDriver + { + /// + /// Initializes a new instance of the + /// ManagedClusterStorageProfileFileCSIDriver class. + /// + public ManagedClusterStorageProfileFileCSIDriver() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ManagedClusterStorageProfileFileCSIDriver class. + /// + /// Whether to enable AzureFile CSI Driver. The + /// default value is true. + public ManagedClusterStorageProfileFileCSIDriver(bool? enabled = default(bool?)) + { + Enabled = enabled; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets whether to enable AzureFile CSI Driver. The default + /// value is true. + /// + [JsonProperty(PropertyName = "enabled")] + public bool? Enabled { get; set; } + + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterStorageProfileSnapshotController.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterStorageProfileSnapshotController.cs new file mode 100644 index 000000000000..3b6761c14246 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterStorageProfileSnapshotController.cs @@ -0,0 +1,55 @@ +// +// 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.ContainerService.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Snapshot Controller settings for the storage profile. + /// + public partial class ManagedClusterStorageProfileSnapshotController + { + /// + /// Initializes a new instance of the + /// ManagedClusterStorageProfileSnapshotController class. + /// + public ManagedClusterStorageProfileSnapshotController() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ManagedClusterStorageProfileSnapshotController class. + /// + /// Whether to enable Snapshot Controller. The + /// default value is true. + public ManagedClusterStorageProfileSnapshotController(bool? enabled = default(bool?)) + { + Enabled = enabled; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets whether to enable Snapshot Controller. The default + /// value is true. + /// + [JsonProperty(PropertyName = "enabled")] + public bool? Enabled { get; set; } + + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterWindowsProfile.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterWindowsProfile.cs index 6ea892e90faa..54bc1bf9d27a 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterWindowsProfile.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterWindowsProfile.cs @@ -58,12 +58,15 @@ public ManagedClusterWindowsProfile() /// for more details. Possible values include: 'None', /// 'Windows_Server' /// Whether to enable CSI proxy. - public ManagedClusterWindowsProfile(string adminUsername, string adminPassword = default(string), string licenseType = default(string), bool? enableCSIProxy = default(bool?)) + /// The Windows gMSA Profile in the Managed + /// Cluster. + public ManagedClusterWindowsProfile(string adminUsername, string adminPassword = default(string), string licenseType = default(string), bool? enableCSIProxy = default(bool?), WindowsGmsaProfile gmsaProfile = default(WindowsGmsaProfile)) { AdminUsername = adminUsername; AdminPassword = adminPassword; LicenseType = licenseType; EnableCSIProxy = enableCSIProxy; + GmsaProfile = gmsaProfile; CustomInit(); } @@ -123,6 +126,12 @@ public ManagedClusterWindowsProfile() [JsonProperty(PropertyName = "enableCSIProxy")] public bool? EnableCSIProxy { get; set; } + /// + /// Gets or sets the Windows gMSA Profile in the Managed Cluster. + /// + [JsonProperty(PropertyName = "gmsaProfile")] + public WindowsGmsaProfile GmsaProfile { get; set; } + /// /// Validate the object. /// diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterWorkloadAutoScalerProfile.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterWorkloadAutoScalerProfile.cs new file mode 100644 index 000000000000..4ac6aaabfc02 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterWorkloadAutoScalerProfile.cs @@ -0,0 +1,74 @@ +// +// 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.ContainerService.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Workload Auto-scaler profile for the container service cluster. + /// + public partial class ManagedClusterWorkloadAutoScalerProfile + { + /// + /// Initializes a new instance of the + /// ManagedClusterWorkloadAutoScalerProfile class. + /// + public ManagedClusterWorkloadAutoScalerProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ManagedClusterWorkloadAutoScalerProfile class. + /// + public ManagedClusterWorkloadAutoScalerProfile(ManagedClusterWorkloadAutoScalerProfileKeda keda = default(ManagedClusterWorkloadAutoScalerProfileKeda), ManagedClusterWorkloadAutoScalerProfileVerticalPodAutoscaler verticalPodAutoscaler = default(ManagedClusterWorkloadAutoScalerProfileVerticalPodAutoscaler)) + { + Keda = keda; + VerticalPodAutoscaler = verticalPodAutoscaler; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "keda")] + public ManagedClusterWorkloadAutoScalerProfileKeda Keda { get; set; } + + /// + /// + [JsonProperty(PropertyName = "verticalPodAutoscaler")] + public ManagedClusterWorkloadAutoScalerProfileVerticalPodAutoscaler VerticalPodAutoscaler { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Keda != null) + { + Keda.Validate(); + } + if (VerticalPodAutoscaler != null) + { + VerticalPodAutoscaler.Validate(); + } + } + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterWorkloadAutoScalerProfileKeda.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterWorkloadAutoScalerProfileKeda.cs new file mode 100644 index 000000000000..201f9629e965 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterWorkloadAutoScalerProfileKeda.cs @@ -0,0 +1,64 @@ +// +// 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.ContainerService.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// KEDA (Kubernetes Event-driven Autoscaling) settings for the workload + /// auto-scaler profile. + /// + public partial class ManagedClusterWorkloadAutoScalerProfileKeda + { + /// + /// Initializes a new instance of the + /// ManagedClusterWorkloadAutoScalerProfileKeda class. + /// + public ManagedClusterWorkloadAutoScalerProfileKeda() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ManagedClusterWorkloadAutoScalerProfileKeda class. + /// + /// Whether to enable KEDA. + public ManagedClusterWorkloadAutoScalerProfileKeda(bool enabled) + { + Enabled = enabled; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets whether to enable KEDA. + /// + [JsonProperty(PropertyName = "enabled")] + public bool Enabled { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + //Nothing to validate + } + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterWorkloadAutoScalerProfileVerticalPodAutoscaler.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterWorkloadAutoScalerProfileVerticalPodAutoscaler.cs new file mode 100644 index 000000000000..6def5ff9c8ee --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ManagedClusterWorkloadAutoScalerProfileVerticalPodAutoscaler.cs @@ -0,0 +1,99 @@ +// +// 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.ContainerService.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + public partial class ManagedClusterWorkloadAutoScalerProfileVerticalPodAutoscaler + { + /// + /// Initializes a new instance of the + /// ManagedClusterWorkloadAutoScalerProfileVerticalPodAutoscaler class. + /// + public ManagedClusterWorkloadAutoScalerProfileVerticalPodAutoscaler() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ManagedClusterWorkloadAutoScalerProfileVerticalPodAutoscaler class. + /// + /// Whether to enable VPA. Default value is + /// false. + /// Controls which resource value + /// autoscaler will change. Default value is RequestsAndLimits. + /// Possible values include: 'RequestsAndLimits', + /// 'RequestsOnly' + /// The update mode of the autoscaler. + public ManagedClusterWorkloadAutoScalerProfileVerticalPodAutoscaler(bool enabled, string controlledValues, string updateMode) + { + Enabled = enabled; + ControlledValues = controlledValues; + UpdateMode = updateMode; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets whether to enable VPA. Default value is false. + /// + [JsonProperty(PropertyName = "enabled")] + public bool Enabled { get; set; } + + /// + /// Gets or sets controls which resource value autoscaler will change. + /// Default value is RequestsAndLimits. Possible values include: + /// 'RequestsAndLimits', 'RequestsOnly' + /// + [JsonProperty(PropertyName = "controlledValues")] + public string ControlledValues { get; set; } + + /// + /// Gets or sets the update mode of the autoscaler. + /// + /// + /// Each update mode level is a superset of the lower levels. + /// Off + [JsonProperty(PropertyName = "updateMode")] + public string UpdateMode { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ControlledValues == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ControlledValues"); + } + if (UpdateMode == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "UpdateMode"); + } + } + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/Mode.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/Mode.cs new file mode 100644 index 000000000000..f465b6b76053 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/Mode.cs @@ -0,0 +1,28 @@ +// +// 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.ContainerService.Models +{ + + /// + /// Defines values for Mode. + /// + public static class Mode + { + /// + /// IPTables proxy mode + /// + public const string IPTABLES = "IPTABLES"; + /// + /// IPVS proxy mode. Must be using Kubernetes version >= 1.22. + /// + public const string IPVS = "IPVS"; + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/NetworkPlugin.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/NetworkPlugin.cs index 199686c7fcf0..2f0f8ce18c82 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/NetworkPlugin.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/NetworkPlugin.cs @@ -28,5 +28,10 @@ public static class NetworkPlugin /// for more information. /// public const string Kubenet = "kubenet"; + /// + /// Do not use a network plugin. A custom CNI will need to be installed + /// after cluster creation for networking functionality. + /// + public const string None = "none"; } } diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/NetworkPluginMode.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/NetworkPluginMode.cs new file mode 100644 index 000000000000..d399ab36a6fe --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/NetworkPluginMode.cs @@ -0,0 +1,26 @@ +// +// 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.ContainerService.Models +{ + + /// + /// Defines values for NetworkPluginMode. + /// + public static class NetworkPluginMode + { + /// + /// Pods are given IPs from the PodCIDR address space but use Azure + /// Routing Domains rather than Kubenet reference plugins host-local + /// and bridge. + /// + public const string Overlay = "Overlay"; + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/NetworkProfileForSnapshot.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/NetworkProfileForSnapshot.cs new file mode 100644 index 000000000000..e4e5d89fe05d --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/NetworkProfileForSnapshot.cs @@ -0,0 +1,95 @@ +// +// 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.ContainerService.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// network profile for managed cluster snapshot, these properties are read + /// only. + /// + public partial class NetworkProfileForSnapshot + { + /// + /// Initializes a new instance of the NetworkProfileForSnapshot class. + /// + public NetworkProfileForSnapshot() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NetworkProfileForSnapshot class. + /// + /// networkPlugin for managed cluster + /// snapshot. Possible values include: 'azure', 'kubenet', + /// 'none' + /// NetworkPluginMode for managed + /// cluster snapshot. Possible values include: 'Overlay' + /// networkPolicy for managed cluster + /// snapshot. Possible values include: 'calico', 'azure' + /// networkMode for managed cluster snapshot. + /// Possible values include: 'transparent', 'bridge' + /// loadBalancerSku for managed cluster + /// snapshot. Possible values include: 'standard', 'basic' + public NetworkProfileForSnapshot(string networkPlugin = default(string), string networkPluginMode = default(string), string networkPolicy = default(string), string networkMode = default(string), string loadBalancerSku = default(string)) + { + NetworkPlugin = networkPlugin; + NetworkPluginMode = networkPluginMode; + NetworkPolicy = networkPolicy; + NetworkMode = networkMode; + LoadBalancerSku = loadBalancerSku; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets networkPlugin for managed cluster snapshot. Possible + /// values include: 'azure', 'kubenet', 'none' + /// + [JsonProperty(PropertyName = "networkPlugin")] + public string NetworkPlugin { get; set; } + + /// + /// Gets or sets networkPluginMode for managed cluster snapshot. + /// Possible values include: 'Overlay' + /// + [JsonProperty(PropertyName = "networkPluginMode")] + public string NetworkPluginMode { get; set; } + + /// + /// Gets or sets networkPolicy for managed cluster snapshot. Possible + /// values include: 'calico', 'azure' + /// + [JsonProperty(PropertyName = "networkPolicy")] + public string NetworkPolicy { get; set; } + + /// + /// Gets or sets networkMode for managed cluster snapshot. Possible + /// values include: 'transparent', 'bridge' + /// + [JsonProperty(PropertyName = "networkMode")] + public string NetworkMode { get; set; } + + /// + /// Gets or sets loadBalancerSku for managed cluster snapshot. Possible + /// values include: 'standard', 'basic' + /// + [JsonProperty(PropertyName = "loadBalancerSku")] + public string LoadBalancerSku { get; set; } + + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/OSSKU.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/OSSKU.cs index f6ded12604b1..403627646c78 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/OSSKU.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/OSSKU.cs @@ -18,5 +18,8 @@ public static class OSSKU { public const string Ubuntu = "Ubuntu"; public const string CBLMariner = "CBLMariner"; + public const string Mariner = "Mariner"; + public const string Windows2019 = "Windows2019"; + public const string Windows2022 = "Windows2022"; } } diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/PortRange.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/PortRange.cs new file mode 100644 index 000000000000..da2c649cd45c --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/PortRange.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.ContainerService.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The port range. + /// + public partial class PortRange + { + /// + /// Initializes a new instance of the PortRange class. + /// + public PortRange() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PortRange class. + /// + /// The minimum port that is included in the + /// range. It should be ranged from 1 to 65535, and be less than or + /// equal to portEnd. + /// The maximum port that is included in the + /// range. It should be ranged from 1 to 65535, and be greater than or + /// equal to portStart. + /// The network protocol of the port. Possible + /// values include: 'TCP', 'UDP' + public PortRange(int? portStart = default(int?), int? portEnd = default(int?), string protocol = default(string)) + { + PortStart = portStart; + PortEnd = portEnd; + Protocol = protocol; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the minimum port that is included in the range. It + /// should be ranged from 1 to 65535, and be less than or equal to + /// portEnd. + /// + [JsonProperty(PropertyName = "portStart")] + public int? PortStart { get; set; } + + /// + /// Gets or sets the maximum port that is included in the range. It + /// should be ranged from 1 to 65535, and be greater than or equal to + /// portStart. + /// + [JsonProperty(PropertyName = "portEnd")] + public int? PortEnd { get; set; } + + /// + /// Gets or sets the network protocol of the port. Possible values + /// include: 'TCP', 'UDP' + /// + [JsonProperty(PropertyName = "protocol")] + public string Protocol { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (PortStart > 65535) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "PortStart", 65535); + } + if (PortStart < 1) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "PortStart", 1); + } + if (PortEnd > 65535) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "PortEnd", 65535); + } + if (PortEnd < 1) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "PortEnd", 1); + } + } + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/Protocol.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/Protocol.cs new file mode 100644 index 000000000000..e354ab36a625 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/Protocol.cs @@ -0,0 +1,28 @@ +// +// 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.ContainerService.Models +{ + + /// + /// Defines values for Protocol. + /// + public static class Protocol + { + /// + /// TCP protocol. + /// + public const string TCP = "TCP"; + /// + /// UDP protocol. + /// + public const string UDP = "UDP"; + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ProxyResource.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ProxyResource.cs new file mode 100644 index 000000000000..dd3e3fda2a0f --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/ProxyResource.cs @@ -0,0 +1,55 @@ +// +// 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.ContainerService.Models +{ + using System.Linq; + + /// + /// Proxy Resource + /// + /// + /// The resource model definition for a Azure Resource Manager proxy + /// resource. It will not have tags and a location + /// + public partial class ProxyResource : Resource + { + /// + /// Initializes a new instance of the ProxyResource class. + /// + public ProxyResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ProxyResource class. + /// + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + public ProxyResource(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData)) + : base(id, name, type, systemData) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/PublicNetworkAccess.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/PublicNetworkAccess.cs new file mode 100644 index 000000000000..8222d70d6531 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/PublicNetworkAccess.cs @@ -0,0 +1,34 @@ +// +// 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.ContainerService.Models +{ + + /// + /// Defines values for PublicNetworkAccess. + /// + public static class PublicNetworkAccess + { + /// + /// Inbound/Outbound to the managedCluster is allowed. + /// + public const string Enabled = "Enabled"; + /// + /// Inbound traffic to managedCluster is disabled, traffic from + /// managedCluster is allowed. + /// + public const string Disabled = "Disabled"; + /// + /// Inbound/Outbound traffic is managed by + /// Microsoft.Network/NetworkSecurityPerimeters. + /// + public const string SecuredByPerimeter = "SecuredByPerimeter"; + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/Resource.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/Resource.cs index 19d4fe92e47e..de5201216568 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/Resource.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/Resource.cs @@ -13,13 +13,15 @@ namespace Microsoft.Azure.Management.ContainerService.Models using Microsoft.Rest; using Microsoft.Rest.Azure; using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// - /// The Resource model definition. + /// Resource /// + /// + /// Common fields that are returned in the response for all Azure Resource + /// Manager resources + /// public partial class Resource : IResource { /// @@ -33,18 +35,20 @@ public Resource() /// /// Initializes a new instance of the Resource class. /// - /// Resource location - /// Resource Id - /// Resource name - /// Resource type - /// Resource tags - public Resource(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary)) + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + public Resource(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData)) { Id = id; Name = name; Type = type; - Location = location; - Tags = tags; + SystemData = systemData; CustomInit(); } @@ -54,47 +58,32 @@ public Resource() partial void CustomInit(); /// - /// Gets resource Id + /// Gets fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} /// [JsonProperty(PropertyName = "id")] public string Id { get; private set; } /// - /// Gets resource name + /// Gets the name of the resource /// [JsonProperty(PropertyName = "name")] public string Name { get; private set; } /// - /// Gets resource type + /// Gets the type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" /// [JsonProperty(PropertyName = "type")] public string Type { get; private set; } /// - /// Gets or sets resource location + /// Gets azure Resource Manager metadata containing createdBy and + /// modifiedBy information. /// - [JsonProperty(PropertyName = "location")] - public string Location { get; set; } + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; private set; } - /// - /// Gets or sets resource tags - /// - [JsonProperty(PropertyName = "tags")] - public IDictionary Tags { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Location == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Location"); - } - } } } diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/Snapshot.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/Snapshot.cs new file mode 100644 index 000000000000..354d5369ea30 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/Snapshot.cs @@ -0,0 +1,140 @@ +// +// 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.ContainerService.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A node pool snapshot resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class Snapshot : TrackedResource + { + /// + /// Initializes a new instance of the Snapshot class. + /// + public Snapshot() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Snapshot class. + /// + /// The geo-location where the resource + /// lives + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// Resource tags. + /// CreationData to be used to specify the + /// source agent pool resource ID to create this snapshot. + /// Possible values include: 'NodePool', + /// 'ManagedCluster' + /// The version of Kubernetes. + /// The version of node image. + /// Possible values include: 'Linux', + /// 'Windows' + /// Possible values include: 'Ubuntu', + /// 'CBLMariner', 'Mariner', 'Windows2019', 'Windows2022' + /// The size of the VM. + /// Whether to use a FIPS-enabled OS. + public Snapshot(string location, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), IDictionary tags = default(IDictionary), CreationData creationData = default(CreationData), string snapshotType = default(string), string kubernetesVersion = default(string), string nodeImageVersion = default(string), string osType = default(string), string osSku = default(string), string vmSize = default(string), bool? enableFIPS = default(bool?)) + : base(location, id, name, type, systemData, tags) + { + CreationData = creationData; + SnapshotType = snapshotType; + KubernetesVersion = kubernetesVersion; + NodeImageVersion = nodeImageVersion; + OsType = osType; + OsSku = osSku; + VmSize = vmSize; + EnableFIPS = enableFIPS; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets creationData to be used to specify the source agent + /// pool resource ID to create this snapshot. + /// + [JsonProperty(PropertyName = "properties.creationData")] + public CreationData CreationData { get; set; } + + /// + /// Gets or sets possible values include: 'NodePool', 'ManagedCluster' + /// + [JsonProperty(PropertyName = "properties.snapshotType")] + public string SnapshotType { get; set; } + + /// + /// Gets the version of Kubernetes. + /// + [JsonProperty(PropertyName = "properties.kubernetesVersion")] + public string KubernetesVersion { get; private set; } + + /// + /// Gets the version of node image. + /// + [JsonProperty(PropertyName = "properties.nodeImageVersion")] + public string NodeImageVersion { get; private set; } + + /// + /// Gets possible values include: 'Linux', 'Windows' + /// + [JsonProperty(PropertyName = "properties.osType")] + public string OsType { get; private set; } + + /// + /// Gets possible values include: 'Ubuntu', 'CBLMariner', 'Mariner', + /// 'Windows2019', 'Windows2022' + /// + [JsonProperty(PropertyName = "properties.osSku")] + public string OsSku { get; private set; } + + /// + /// Gets the size of the VM. + /// + [JsonProperty(PropertyName = "properties.vmSize")] + public string VmSize { get; private set; } + + /// + /// Gets whether to use a FIPS-enabled OS. + /// + [JsonProperty(PropertyName = "properties.enableFIPS")] + public bool? EnableFIPS { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/SnapshotType.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/SnapshotType.cs new file mode 100644 index 000000000000..13ba26640bd6 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/SnapshotType.cs @@ -0,0 +1,28 @@ +// +// 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.ContainerService.Models +{ + + /// + /// Defines values for SnapshotType. + /// + public static class SnapshotType + { + /// + /// The snapshot is a snapshot of a node pool. + /// + public const string NodePool = "NodePool"; + /// + /// The snapshot is a snapshot of a managed cluster. + /// + public const string ManagedCluster = "ManagedCluster"; + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/SystemData.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/SystemData.cs index c553ddd7e502..aad6e33d9909 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/SystemData.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/SystemData.cs @@ -34,15 +34,15 @@ public SystemData() /// The type of identity that created the /// resource. Possible values include: 'User', 'Application', /// 'ManagedIdentity', 'Key' - /// The UTC timestamp of resource - /// creation. + /// The timestamp of resource creation + /// (UTC). /// The identity that last modified the /// resource. /// The type of identity that last /// modified the resource. Possible values include: 'User', /// 'Application', 'ManagedIdentity', 'Key' - /// The type of identity that last - /// modified the resource. + /// The timestamp of resource last + /// modification (UTC) public SystemData(string createdBy = default(string), string createdByType = default(string), System.DateTime? createdAt = default(System.DateTime?), string lastModifiedBy = default(string), string lastModifiedByType = default(string), System.DateTime? lastModifiedAt = default(System.DateTime?)) { CreatedBy = createdBy; @@ -74,7 +74,7 @@ public SystemData() public string CreatedByType { get; set; } /// - /// Gets or sets the UTC timestamp of resource creation. + /// Gets or sets the timestamp of resource creation (UTC). /// [JsonProperty(PropertyName = "createdAt")] public System.DateTime? CreatedAt { get; set; } @@ -94,7 +94,7 @@ public SystemData() public string LastModifiedByType { get; set; } /// - /// Gets or sets the type of identity that last modified the resource. + /// Gets or sets the timestamp of resource last modification (UTC) /// [JsonProperty(PropertyName = "lastModifiedAt")] public System.DateTime? LastModifiedAt { get; set; } diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/TrackedResource.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/TrackedResource.cs new file mode 100644 index 000000000000..f36da4f4b9c0 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/TrackedResource.cs @@ -0,0 +1,89 @@ +// +// 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.ContainerService.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Tracked Resource + /// + /// + /// The resource model definition for an Azure Resource Manager tracked top + /// level resource which has 'tags' and a 'location' + /// + public partial class TrackedResource : Resource + { + /// + /// Initializes a new instance of the TrackedResource class. + /// + public TrackedResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TrackedResource class. + /// + /// The geo-location where the resource + /// lives + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// Resource tags. + public TrackedResource(string location, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), IDictionary tags = default(IDictionary)) + : base(id, name, type, systemData) + { + Tags = tags; + Location = location; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource tags. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// Gets or sets the geo-location where the resource lives + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Location"); + } + } + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/TrustedAccessRole.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/TrustedAccessRole.cs new file mode 100644 index 000000000000..f59ad66b7331 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/TrustedAccessRole.cs @@ -0,0 +1,75 @@ +// +// 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.ContainerService.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Trusted access role definition. + /// + public partial class TrustedAccessRole + { + /// + /// Initializes a new instance of the TrustedAccessRole class. + /// + public TrustedAccessRole() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TrustedAccessRole class. + /// + /// Resource type of Azure + /// resource + /// Name of role, name is unique under a source + /// resource type + /// List of rules for the role. This maps to + /// 'rules' property of [Kubernetes Cluster + /// Role](https://kubernetes.io/docs/reference/kubernetes-api/authorization-resources/cluster-role-v1/#ClusterRole). + public TrustedAccessRole(string sourceResourceType = default(string), string name = default(string), IList rules = default(IList)) + { + SourceResourceType = sourceResourceType; + Name = name; + Rules = rules; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets resource type of Azure resource + /// + [JsonProperty(PropertyName = "sourceResourceType")] + public string SourceResourceType { get; private set; } + + /// + /// Gets name of role, name is unique under a source resource type + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets list of rules for the role. This maps to 'rules' property of + /// [Kubernetes Cluster + /// Role](https://kubernetes.io/docs/reference/kubernetes-api/authorization-resources/cluster-role-v1/#ClusterRole). + /// + [JsonProperty(PropertyName = "rules")] + public IList Rules { get; private set; } + + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/TrustedAccessRoleBinding.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/TrustedAccessRoleBinding.cs new file mode 100644 index 000000000000..8cc97e3b8ed3 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/TrustedAccessRoleBinding.cs @@ -0,0 +1,108 @@ +// +// 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.ContainerService.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Defines binding between a resource and role + /// + [Rest.Serialization.JsonTransformation] + public partial class TrustedAccessRoleBinding : Resource + { + /// + /// Initializes a new instance of the TrustedAccessRoleBinding class. + /// + public TrustedAccessRoleBinding() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TrustedAccessRoleBinding class. + /// + /// The ARM resource ID of source + /// resource that trusted access is configured for. + /// A list of roles to bind, each item is a + /// resource type qualified role name. For example: + /// 'Microsoft.MachineLearningServices/workspaces/reader'. + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// The current provisioning state of + /// trusted access role binding. Possible values include: 'Succeeded', + /// 'Failed', 'Updating', 'Deleting' + public TrustedAccessRoleBinding(string sourceResourceId, IList roles, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string provisioningState = default(string)) + : base(id, name, type, systemData) + { + ProvisioningState = provisioningState; + SourceResourceId = sourceResourceId; + Roles = roles; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the current provisioning state of trusted access role binding. + /// Possible values include: 'Succeeded', 'Failed', 'Updating', + /// 'Deleting' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + /// + /// Gets or sets the ARM resource ID of source resource that trusted + /// access is configured for. + /// + [JsonProperty(PropertyName = "properties.sourceResourceId")] + public string SourceResourceId { get; set; } + + /// + /// Gets or sets a list of roles to bind, each item is a resource type + /// qualified role name. For example: + /// 'Microsoft.MachineLearningServices/workspaces/reader'. + /// + [JsonProperty(PropertyName = "properties.roles")] + public IList Roles { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (SourceResourceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "SourceResourceId"); + } + if (Roles == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Roles"); + } + } + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/TrustedAccessRoleBindingProvisioningState.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/TrustedAccessRoleBindingProvisioningState.cs new file mode 100644 index 000000000000..667727d6fac3 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/TrustedAccessRoleBindingProvisioningState.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. +// +// 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.ContainerService.Models +{ + + /// + /// Defines values for TrustedAccessRoleBindingProvisioningState. + /// + public static class TrustedAccessRoleBindingProvisioningState + { + public const string Succeeded = "Succeeded"; + public const string Failed = "Failed"; + public const string Updating = "Updating"; + public const string Deleting = "Deleting"; + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/TrustedAccessRoleRule.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/TrustedAccessRoleRule.cs new file mode 100644 index 000000000000..033dc1fad57d --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/TrustedAccessRoleRule.cs @@ -0,0 +1,86 @@ +// +// 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.ContainerService.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Rule for trusted access role + /// + public partial class TrustedAccessRoleRule + { + /// + /// Initializes a new instance of the TrustedAccessRoleRule class. + /// + public TrustedAccessRoleRule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TrustedAccessRoleRule class. + /// + /// List of allowed verbs + /// List of allowed apiGroups + /// List of allowed resources + /// List of allowed names + /// List of allowed + /// nonResourceURLs + public TrustedAccessRoleRule(IList verbs = default(IList), IList apiGroups = default(IList), IList resources = default(IList), IList resourceNames = default(IList), IList nonResourceURLs = default(IList)) + { + Verbs = verbs; + ApiGroups = apiGroups; + Resources = resources; + ResourceNames = resourceNames; + NonResourceURLs = nonResourceURLs; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets list of allowed verbs + /// + [JsonProperty(PropertyName = "verbs")] + public IList Verbs { get; private set; } + + /// + /// Gets list of allowed apiGroups + /// + [JsonProperty(PropertyName = "apiGroups")] + public IList ApiGroups { get; private set; } + + /// + /// Gets list of allowed resources + /// + [JsonProperty(PropertyName = "resources")] + public IList Resources { get; private set; } + + /// + /// Gets list of allowed names + /// + [JsonProperty(PropertyName = "resourceNames")] + public IList ResourceNames { get; private set; } + + /// + /// Gets list of allowed nonResourceURLs + /// + [JsonProperty(PropertyName = "nonResourceURLs")] + public IList NonResourceURLs { get; private set; } + + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/UpdateMode.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/UpdateMode.cs new file mode 100644 index 000000000000..26c27e96d8df --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/UpdateMode.cs @@ -0,0 +1,42 @@ +// +// 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.ContainerService.Models +{ + + /// + /// Defines values for UpdateMode. + /// + public static class UpdateMode + { + /// + /// Autoscaler never changes pod resources but provides + /// recommendations. + /// + public const string Off = "Off"; + /// + /// Autoscaler only assigns resources on pod creation and doesn't + /// change them during the lifetime of the pod. + /// + public const string Initial = "Initial"; + /// + /// Autoscaler assigns resources on pod creation and updates pods that + /// need further scaling during their lifetime by deleting and + /// recreating. + /// + public const string Recreate = "Recreate"; + /// + /// Autoscaler chooses the update mode. Autoscaler currently does the + /// same as Recreate. In the future, it may take advantage of + /// restart-free mechanisms once they are available. + /// + public const string Auto = "Auto"; + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/WindowsGmsaProfile.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/WindowsGmsaProfile.cs new file mode 100644 index 000000000000..23899966abbd --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/WindowsGmsaProfile.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.ContainerService.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Windows gMSA Profile in the managed cluster. + /// + public partial class WindowsGmsaProfile + { + /// + /// Initializes a new instance of the WindowsGmsaProfile class. + /// + public WindowsGmsaProfile() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the WindowsGmsaProfile class. + /// + /// Whether to enable Windows gMSA. + /// Specifies the DNS server for Windows gMSA. + /// <br><br> Set it to empty if you have configured the DNS + /// server in the vnet which is used to create the managed + /// cluster. + /// Specifies the root domain name for + /// Windows gMSA. <br><br> Set it to empty if you have + /// configured the DNS server in the vnet which is used to create the + /// managed cluster. + public WindowsGmsaProfile(bool? enabled = default(bool?), string dnsServer = default(string), string rootDomainName = default(string)) + { + Enabled = enabled; + DnsServer = dnsServer; + RootDomainName = rootDomainName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets whether to enable Windows gMSA. + /// + /// + /// Specifies whether to enable Windows gMSA in the managed cluster. + /// + [JsonProperty(PropertyName = "enabled")] + public bool? Enabled { get; set; } + + /// + /// Gets or sets specifies the DNS server for Windows gMSA. + /// &lt;br&gt;&lt;br&gt; Set it to empty if you have + /// configured the DNS server in the vnet which is used to create the + /// managed cluster. + /// + [JsonProperty(PropertyName = "dnsServer")] + public string DnsServer { get; set; } + + /// + /// Gets or sets specifies the root domain name for Windows gMSA. + /// &lt;br&gt;&lt;br&gt; Set it to empty if you have + /// configured the DNS server in the vnet which is used to create the + /// managed cluster. + /// + [JsonProperty(PropertyName = "rootDomainName")] + public string RootDomainName { get; set; } + + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/WorkloadRuntime.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/WorkloadRuntime.cs new file mode 100644 index 000000000000..c8419098fc8a --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Models/WorkloadRuntime.cs @@ -0,0 +1,29 @@ +// +// 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.ContainerService.Models +{ + + /// + /// Defines values for WorkloadRuntime. + /// + public static class WorkloadRuntime + { + /// + /// Nodes will use Kubelet to run standard OCI container workloads. + /// + public const string OCIContainer = "OCIContainer"; + /// + /// Nodes will use Krustlet to run WASM workloads using the WASI + /// provider (Preview). + /// + public const string WasmWasi = "WasmWasi"; + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Operations.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Operations.cs index bd9492924145..98084090f587 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Operations.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/Operations.cs @@ -80,6 +80,13 @@ internal Operations(ContainerServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/PrivateEndpointConnectionsOperations.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/PrivateEndpointConnectionsOperations.cs index 8e3b99ca6636..5827ac0a80ff 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/PrivateEndpointConnectionsOperations.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/PrivateEndpointConnectionsOperations.cs @@ -59,7 +59,7 @@ internal PrivateEndpointConnectionsOperations(ContainerServiceClient client) /// https://docs.microsoft.com/azure/aks/private-clusters /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -91,16 +91,34 @@ internal PrivateEndpointConnectionsOperations(ContainerServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } if (resourceGroupName.Length < 1) { throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); @@ -281,7 +299,7 @@ internal PrivateEndpointConnectionsOperations(ContainerServiceClient client) /// https://docs.microsoft.com/azure/aks/private-clusters /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -316,16 +334,34 @@ internal PrivateEndpointConnectionsOperations(ContainerServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } if (resourceGroupName.Length < 1) { throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); @@ -508,7 +544,7 @@ internal PrivateEndpointConnectionsOperations(ContainerServiceClient client) /// Updates a private endpoint connection. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -546,16 +582,34 @@ internal PrivateEndpointConnectionsOperations(ContainerServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } if (resourceGroupName.Length < 1) { throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); @@ -753,7 +807,7 @@ internal PrivateEndpointConnectionsOperations(ContainerServiceClient client) /// Deletes a private endpoint connection. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -778,7 +832,7 @@ internal PrivateEndpointConnectionsOperations(ContainerServiceClient client) /// Deletes a private endpoint connection. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -810,16 +864,34 @@ internal PrivateEndpointConnectionsOperations(ContainerServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } if (resourceGroupName.Length < 1) { throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/PrivateEndpointConnectionsOperationsExtensions.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/PrivateEndpointConnectionsOperationsExtensions.cs index 358740558945..3874f4627f83 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/PrivateEndpointConnectionsOperationsExtensions.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/PrivateEndpointConnectionsOperationsExtensions.cs @@ -33,7 +33,7 @@ public static partial class PrivateEndpointConnectionsOperationsExtensions /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -55,7 +55,7 @@ public static PrivateEndpointConnectionListResult List(this IPrivateEndpointConn /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -82,7 +82,7 @@ public static PrivateEndpointConnectionListResult List(this IPrivateEndpointConn /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -106,7 +106,7 @@ public static PrivateEndpointConnection Get(this IPrivateEndpointConnectionsOper /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -132,7 +132,7 @@ public static PrivateEndpointConnection Get(this IPrivateEndpointConnectionsOper /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -155,7 +155,7 @@ public static PrivateEndpointConnection Update(this IPrivateEndpointConnectionsO /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -184,7 +184,7 @@ public static PrivateEndpointConnection Update(this IPrivateEndpointConnectionsO /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -204,7 +204,7 @@ public static void Delete(this IPrivateEndpointConnectionsOperations operations, /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -227,7 +227,7 @@ public static void Delete(this IPrivateEndpointConnectionsOperations operations, /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -247,7 +247,7 @@ public static void BeginDelete(this IPrivateEndpointConnectionsOperations operat /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/PrivateLinkResourcesOperations.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/PrivateLinkResourcesOperations.cs index acaaf2a910c4..7f586159efc0 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/PrivateLinkResourcesOperations.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/PrivateLinkResourcesOperations.cs @@ -58,7 +58,7 @@ internal PrivateLinkResourcesOperations(ContainerServiceClient client) /// https://docs.microsoft.com/azure/aks/private-clusters /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -90,16 +90,34 @@ internal PrivateLinkResourcesOperations(ContainerServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } if (resourceGroupName.Length < 1) { throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/PrivateLinkResourcesOperationsExtensions.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/PrivateLinkResourcesOperationsExtensions.cs index 9d7637a8115a..5e310e534e7b 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/PrivateLinkResourcesOperationsExtensions.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/PrivateLinkResourcesOperationsExtensions.cs @@ -32,7 +32,7 @@ public static partial class PrivateLinkResourcesOperationsExtensions /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -53,7 +53,7 @@ public static PrivateLinkResourcesListResult List(this IPrivateLinkResourcesOper /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/ResolvePrivateLinkServiceIdOperations.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/ResolvePrivateLinkServiceIdOperations.cs index 0578d8853c68..fbcbc24d329a 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/ResolvePrivateLinkServiceIdOperations.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/ResolvePrivateLinkServiceIdOperations.cs @@ -54,7 +54,7 @@ internal ResolvePrivateLinkServiceIdOperations(ContainerServiceClient client) /// Gets the private link service ID for the specified managed cluster. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -89,16 +89,34 @@ internal ResolvePrivateLinkServiceIdOperations(ContainerServiceClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } if (resourceGroupName != null) { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } if (resourceGroupName.Length < 1) { throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/ResolvePrivateLinkServiceIdOperationsExtensions.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/ResolvePrivateLinkServiceIdOperationsExtensions.cs index f3a7c7e12c96..9943e4a69b79 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/ResolvePrivateLinkServiceIdOperationsExtensions.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/ResolvePrivateLinkServiceIdOperationsExtensions.cs @@ -28,7 +28,7 @@ public static partial class ResolvePrivateLinkServiceIdOperationsExtensions /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. @@ -48,7 +48,7 @@ public static PrivateLinkResource POST(this IResolvePrivateLinkServiceIdOperatio /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The name of the managed cluster resource. diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/SdkInfo_ContainerServiceClient.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/SdkInfo_ContainerServiceClient.cs index 278eafe1d436..1aa12ee29a95 100644 --- a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/SdkInfo_ContainerServiceClient.cs +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/SdkInfo_ContainerServiceClient.cs @@ -19,26 +19,21 @@ public static IEnumerable> ApiInfo_ContainerServic { return new Tuple[] { - new Tuple("ContainerService", "AgentPools", "2021-07-01"), - new Tuple("ContainerService", "MaintenanceConfigurations", "2021-07-01"), - new Tuple("ContainerService", "ManagedClusters", "2021-07-01"), - new Tuple("ContainerService", "Operations", "2021-07-01"), - new Tuple("ContainerService", "PrivateEndpointConnections", "2021-07-01"), - new Tuple("ContainerService", "PrivateLinkResources", "2021-07-01"), - new Tuple("ContainerService", "ResolvePrivateLinkServiceId", "2021-07-01"), + new Tuple("ContainerService", "AgentPools", "2022-09-02-preview"), + new Tuple("ContainerService", "FleetMembers", "2022-09-02-preview"), + new Tuple("ContainerService", "Fleets", "2022-09-02-preview"), + new Tuple("ContainerService", "MaintenanceConfigurations", "2022-09-02-preview"), + new Tuple("ContainerService", "ManagedClusterSnapshots", "2022-09-02-preview"), + new Tuple("ContainerService", "ManagedClusters", "2022-09-02-preview"), + new Tuple("ContainerService", "Operations", "2022-09-02-preview"), + new Tuple("ContainerService", "PrivateEndpointConnections", "2022-09-02-preview"), + new Tuple("ContainerService", "PrivateLinkResources", "2022-09-02-preview"), + new Tuple("ContainerService", "ResolvePrivateLinkServiceId", "2022-09-02-preview"), + new Tuple("ContainerService", "Snapshots", "2022-09-02-preview"), + new Tuple("ContainerService", "TrustedAccessRoleBindings", "2022-09-02-preview"), + new Tuple("ContainerService", "TrustedAccessRoles", "2022-09-02-preview"), }.AsEnumerable(); } } - // BEGIN: Code Generation Metadata Section - public static readonly String AutoRestVersion = "v2"; - public static readonly String AutoRestBootStrapperVersion = "autorest@2.0.4413"; - public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/containerservice/resource-manager/readme.md --csharp --version=v2 --reflect-api-versions --csharp-sdks-folder=C:\\Users\\kaiqz\\github\\kaiqzhan\\azure-sdk-for-net\\sdk"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "111fbceeeb7c2c4905b80fe2ab760e5564b3458a"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } - diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/SnapshotsOperations.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/SnapshotsOperations.cs new file mode 100644 index 000000000000..6d53de7c9943 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/SnapshotsOperations.cs @@ -0,0 +1,1778 @@ +// +// 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.ContainerService +{ + 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; + + /// + /// SnapshotsOperations operations. + /// + internal partial class SnapshotsOperations : IServiceOperations, ISnapshotsOperations + { + /// + /// Initializes a new instance of the SnapshotsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal SnapshotsOperations(ContainerServiceClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ContainerServiceClient + /// + public ContainerServiceClient Client { get; private set; } + + /// + /// Gets a list of snapshots in the specified subscription. + /// + /// + /// 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(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + 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}/providers/Microsoft.ContainerService/snapshots").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.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; + } + + /// + /// Lists snapshots in the specified subscription and resource group. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// 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>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.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; + } + + /// + /// Gets a snapshot. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// 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 resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (resourceName != null) + { + if (resourceName.Length > 63) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceName", 63); + } + if (resourceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceName, "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$"); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + 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/Microsoft.ContainerService/snapshots/{resourceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.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; + } + + /// + /// Creates or updates a snapshot. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// The snapshot to create or update. + /// + /// + /// 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 resourceName, Snapshot parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (resourceName != null) + { + if (resourceName.Length > 63) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceName", 63); + } + if (resourceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceName, "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$"); + } + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("parameters", parameters); + 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/Microsoft.ContainerService/snapshots/{resourceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.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(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, 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 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); + } + } + // 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; + } + + /// + /// Updates tags on a snapshot. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// Resource tags. + /// + /// + /// 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> UpdateTagsWithHttpMessagesAsync(string resourceGroupName, string resourceName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (resourceName != null) + { + if (resourceName.Length > 63) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceName", 63); + } + if (resourceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceName, "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$"); + } + } + TagsObject parameters = new TagsObject(); + if (tags != null) + { + parameters.Tags = tags; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "UpdateTags", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.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("PATCH"); + _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(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, 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) + { + 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; + } + + /// + /// Deletes a snapshot. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// 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 DeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (resourceName != null) + { + if (resourceName.Length > 63) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceName", 63); + } + if (resourceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceName, "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$"); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.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 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(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets a list of snapshots in the specified subscription. + /// + /// + /// 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; + } + + /// + /// Lists snapshots in the specified subscription and resource group. + /// + /// + /// 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>> ListByResourceGroupNextWithHttpMessagesAsync(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, "ListByResourceGroupNext", 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/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/SnapshotsOperationsExtensions.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/SnapshotsOperationsExtensions.cs new file mode 100644 index 000000000000..1d39909d96cc --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/SnapshotsOperationsExtensions.cs @@ -0,0 +1,326 @@ +// +// 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.ContainerService +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for SnapshotsOperations. + /// + public static partial class SnapshotsOperationsExtensions + { + /// + /// Gets a list of snapshots in the specified subscription. + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this ISnapshotsOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Gets a list of snapshots in the specified subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this ISnapshotsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists snapshots in the specified subscription and resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + public static IPage ListByResourceGroup(this ISnapshotsOperations operations, string resourceGroupName) + { + return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Lists snapshots in the specified subscription and resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupAsync(this ISnapshotsOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a snapshot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the managed cluster resource. + /// + public static Snapshot Get(this ISnapshotsOperations operations, string resourceGroupName, string resourceName) + { + return operations.GetAsync(resourceGroupName, resourceName).GetAwaiter().GetResult(); + } + + /// + /// Gets a snapshot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ISnapshotsOperations operations, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, resourceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates a snapshot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// The snapshot to create or update. + /// + public static Snapshot CreateOrUpdate(this ISnapshotsOperations operations, string resourceGroupName, string resourceName, Snapshot parameters) + { + return operations.CreateOrUpdateAsync(resourceGroupName, resourceName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a snapshot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// The snapshot to create or update. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this ISnapshotsOperations operations, string resourceGroupName, string resourceName, Snapshot parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, resourceName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates tags on a snapshot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// Resource tags. + /// + public static Snapshot UpdateTags(this ISnapshotsOperations operations, string resourceGroupName, string resourceName, IDictionary tags = default(IDictionary)) + { + return operations.UpdateTagsAsync(resourceGroupName, resourceName, tags).GetAwaiter().GetResult(); + } + + /// + /// Updates tags on a snapshot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// Resource tags. + /// + /// + /// The cancellation token. + /// + public static async Task UpdateTagsAsync(this ISnapshotsOperations operations, string resourceGroupName, string resourceName, IDictionary tags = default(IDictionary), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateTagsWithHttpMessagesAsync(resourceGroupName, resourceName, tags, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a snapshot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the managed cluster resource. + /// + public static void Delete(this ISnapshotsOperations operations, string resourceGroupName, string resourceName) + { + operations.DeleteAsync(resourceGroupName, resourceName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a snapshot. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this ISnapshotsOperations operations, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, resourceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets a list of snapshots in the specified subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this ISnapshotsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of snapshots in the specified subscription. + /// + /// + /// 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 ISnapshotsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists snapshots in the specified subscription and resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByResourceGroupNext(this ISnapshotsOperations operations, string nextPageLink) + { + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists snapshots in the specified subscription and resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupNextAsync(this ISnapshotsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/TrustedAccessRoleBindingsOperations.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/TrustedAccessRoleBindingsOperations.cs new file mode 100644 index 000000000000..63bd895947aa --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/TrustedAccessRoleBindingsOperations.cs @@ -0,0 +1,1228 @@ +// +// 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.ContainerService +{ + 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; + + /// + /// TrustedAccessRoleBindingsOperations operations. + /// + internal partial class TrustedAccessRoleBindingsOperations : IServiceOperations, ITrustedAccessRoleBindingsOperations + { + /// + /// Initializes a new instance of the TrustedAccessRoleBindingsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal TrustedAccessRoleBindingsOperations(ContainerServiceClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ContainerServiceClient + /// + public ContainerServiceClient Client { get; private set; } + + /// + /// List trusted access role bindings. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// 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 resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (resourceName != null) + { + if (resourceName.Length > 63) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceName", 63); + } + if (resourceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceName, "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$"); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + 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/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.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; + } + + /// + /// Get a trusted access role binding. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// The name of trusted access role binding. + /// + /// + /// 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 resourceName, string trustedAccessRoleBindingName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (resourceName != null) + { + if (resourceName.Length > 63) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceName", 63); + } + if (resourceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceName, "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$"); + } + } + if (trustedAccessRoleBindingName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "trustedAccessRoleBindingName"); + } + if (trustedAccessRoleBindingName != null) + { + if (trustedAccessRoleBindingName.Length > 36) + { + throw new ValidationException(ValidationRules.MaxLength, "trustedAccessRoleBindingName", 36); + } + if (trustedAccessRoleBindingName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "trustedAccessRoleBindingName", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("trustedAccessRoleBindingName", trustedAccessRoleBindingName); + 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/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _url = _url.Replace("{trustedAccessRoleBindingName}", System.Uri.EscapeDataString(trustedAccessRoleBindingName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.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; + } + + /// + /// Create or update a trusted access role binding + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// The name of trusted access role binding. + /// + /// + /// A trusted access role binding + /// + /// + /// 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 resourceName, string trustedAccessRoleBindingName, TrustedAccessRoleBinding trustedAccessRoleBinding, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (resourceName != null) + { + if (resourceName.Length > 63) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceName", 63); + } + if (resourceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceName, "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$"); + } + } + if (trustedAccessRoleBindingName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "trustedAccessRoleBindingName"); + } + if (trustedAccessRoleBindingName != null) + { + if (trustedAccessRoleBindingName.Length > 36) + { + throw new ValidationException(ValidationRules.MaxLength, "trustedAccessRoleBindingName", 36); + } + if (trustedAccessRoleBindingName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "trustedAccessRoleBindingName", 1); + } + } + if (trustedAccessRoleBinding == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "trustedAccessRoleBinding"); + } + if (trustedAccessRoleBinding != null) + { + trustedAccessRoleBinding.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("trustedAccessRoleBindingName", trustedAccessRoleBindingName); + tracingParameters.Add("trustedAccessRoleBinding", trustedAccessRoleBinding); + 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/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _url = _url.Replace("{trustedAccessRoleBindingName}", System.Uri.EscapeDataString(trustedAccessRoleBindingName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.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(trustedAccessRoleBinding != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(trustedAccessRoleBinding, 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) + { + 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; + } + + /// + /// Delete a trusted access role binding. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// The name of trusted access role binding. + /// + /// + /// 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 DeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, string trustedAccessRoleBindingName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (resourceName != null) + { + if (resourceName.Length > 63) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceName", 63); + } + if (resourceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceName, "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceName", "^[a-zA-Z0-9]$|^[a-zA-Z0-9][-_a-zA-Z0-9]{0,61}[a-zA-Z0-9]$"); + } + } + if (trustedAccessRoleBindingName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "trustedAccessRoleBindingName"); + } + if (trustedAccessRoleBindingName != null) + { + if (trustedAccessRoleBindingName.Length > 36) + { + throw new ValidationException(ValidationRules.MaxLength, "trustedAccessRoleBindingName", 36); + } + if (trustedAccessRoleBindingName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "trustedAccessRoleBindingName", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("trustedAccessRoleBindingName", trustedAccessRoleBindingName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _url = _url.Replace("{trustedAccessRoleBindingName}", System.Uri.EscapeDataString(trustedAccessRoleBindingName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.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 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(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// List trusted access role bindings. + /// + /// + /// 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/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/TrustedAccessRoleBindingsOperationsExtensions.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/TrustedAccessRoleBindingsOperationsExtensions.cs new file mode 100644 index 000000000000..0d1c9fe77a09 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/TrustedAccessRoleBindingsOperationsExtensions.cs @@ -0,0 +1,240 @@ +// +// 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.ContainerService +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for TrustedAccessRoleBindingsOperations. + /// + public static partial class TrustedAccessRoleBindingsOperationsExtensions + { + /// + /// List trusted access role bindings. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the managed cluster resource. + /// + public static IPage List(this ITrustedAccessRoleBindingsOperations operations, string resourceGroupName, string resourceName) + { + return operations.ListAsync(resourceGroupName, resourceName).GetAwaiter().GetResult(); + } + + /// + /// List trusted access role bindings. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this ITrustedAccessRoleBindingsOperations operations, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, resourceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get a trusted access role binding. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// The name of trusted access role binding. + /// + public static TrustedAccessRoleBinding Get(this ITrustedAccessRoleBindingsOperations operations, string resourceGroupName, string resourceName, string trustedAccessRoleBindingName) + { + return operations.GetAsync(resourceGroupName, resourceName, trustedAccessRoleBindingName).GetAwaiter().GetResult(); + } + + /// + /// Get a trusted access role binding. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// The name of trusted access role binding. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this ITrustedAccessRoleBindingsOperations operations, string resourceGroupName, string resourceName, string trustedAccessRoleBindingName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, resourceName, trustedAccessRoleBindingName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update a trusted access role binding + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// The name of trusted access role binding. + /// + /// + /// A trusted access role binding + /// + public static TrustedAccessRoleBinding CreateOrUpdate(this ITrustedAccessRoleBindingsOperations operations, string resourceGroupName, string resourceName, string trustedAccessRoleBindingName, TrustedAccessRoleBinding trustedAccessRoleBinding) + { + return operations.CreateOrUpdateAsync(resourceGroupName, resourceName, trustedAccessRoleBindingName, trustedAccessRoleBinding).GetAwaiter().GetResult(); + } + + /// + /// Create or update a trusted access role binding + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// The name of trusted access role binding. + /// + /// + /// A trusted access role binding + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this ITrustedAccessRoleBindingsOperations operations, string resourceGroupName, string resourceName, string trustedAccessRoleBindingName, TrustedAccessRoleBinding trustedAccessRoleBinding, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, resourceName, trustedAccessRoleBindingName, trustedAccessRoleBinding, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete a trusted access role binding. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// The name of trusted access role binding. + /// + public static void Delete(this ITrustedAccessRoleBindingsOperations operations, string resourceGroupName, string resourceName, string trustedAccessRoleBindingName) + { + operations.DeleteAsync(resourceGroupName, resourceName, trustedAccessRoleBindingName).GetAwaiter().GetResult(); + } + + /// + /// Delete a trusted access role binding. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// The name of the managed cluster resource. + /// + /// + /// The name of trusted access role binding. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this ITrustedAccessRoleBindingsOperations operations, string resourceGroupName, string resourceName, string trustedAccessRoleBindingName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, resourceName, trustedAccessRoleBindingName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// List trusted access role bindings. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this ITrustedAccessRoleBindingsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List trusted access role bindings. + /// + /// + /// 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 ITrustedAccessRoleBindingsOperations 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/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/TrustedAccessRolesOperations.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/TrustedAccessRolesOperations.cs new file mode 100644 index 000000000000..7c6079103e63 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/TrustedAccessRolesOperations.cs @@ -0,0 +1,435 @@ +// +// 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.ContainerService +{ + 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; + + /// + /// TrustedAccessRolesOperations operations. + /// + internal partial class TrustedAccessRolesOperations : IServiceOperations, ITrustedAccessRolesOperations + { + /// + /// Initializes a new instance of the TrustedAccessRolesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal TrustedAccessRolesOperations(ContainerServiceClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ContainerServiceClient + /// + public ContainerServiceClient Client { get; private set; } + + /// + /// List supported trusted access roles. + /// + /// + /// The name of Azure region. + /// + /// + /// 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 location, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + if (location != null) + { + if (location.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "location", 1); + } + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("location", location); + 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}/providers/Microsoft.ContainerService/locations/{location}/trustedAccessRoles").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.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 supported trusted access roles. + /// + /// + /// 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/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/TrustedAccessRolesOperationsExtensions.cs b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/TrustedAccessRolesOperationsExtensions.cs new file mode 100644 index 000000000000..634f6a3c3023 --- /dev/null +++ b/sdk/containerservice/Microsoft.Azure.Management.ContainerService/src/Generated/TrustedAccessRolesOperationsExtensions.cs @@ -0,0 +1,93 @@ +// +// 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.ContainerService +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for TrustedAccessRolesOperations. + /// + public static partial class TrustedAccessRolesOperationsExtensions + { + /// + /// List supported trusted access roles. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of Azure region. + /// + public static IPage List(this ITrustedAccessRolesOperations operations, string location) + { + return operations.ListAsync(location).GetAwaiter().GetResult(); + } + + /// + /// List supported trusted access roles. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of Azure region. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this ITrustedAccessRolesOperations operations, string location, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(location, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// List supported trusted access roles. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this ITrustedAccessRolesOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List supported trusted access roles. + /// + /// + /// 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 ITrustedAccessRolesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +}