diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiDiagnosticOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiDiagnosticOperations.cs index adb2243e4b0f2..065af6278a09a 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiDiagnosticOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiDiagnosticOperations.cs @@ -128,11 +128,14 @@ internal ApiDiagnosticOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.MinLength, "apiId", 1); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -144,7 +147,6 @@ internal ApiDiagnosticOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("apiId", apiId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByService", tracingParameters); } @@ -164,9 +166,9 @@ internal ApiDiagnosticOperations(ApiManagementClient client) _queryParameters.Add(_odataFilter); } } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -383,11 +385,14 @@ internal ApiDiagnosticOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "diagnosticId", "^[^*#&+:<>?]+$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -399,7 +404,6 @@ internal ApiDiagnosticOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("apiId", apiId); tracingParameters.Add("diagnosticId", diagnosticId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetEntityTag", tracingParameters); } @@ -412,9 +416,9 @@ internal ApiDiagnosticOperations(ApiManagementClient client) _url = _url.Replace("{diagnosticId}", System.Uri.EscapeDataString(diagnosticId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -628,11 +632,14 @@ internal ApiDiagnosticOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "diagnosticId", "^[^*#&+:<>?]+$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -644,7 +651,6 @@ internal ApiDiagnosticOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("apiId", apiId); tracingParameters.Add("diagnosticId", diagnosticId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -657,9 +663,9 @@ internal ApiDiagnosticOperations(ApiManagementClient client) _url = _url.Replace("{diagnosticId}", System.Uri.EscapeDataString(diagnosticId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -906,11 +912,14 @@ internal ApiDiagnosticOperations(ApiManagementClient client) { parameters.Validate(); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -924,7 +933,6 @@ internal ApiDiagnosticOperations(ApiManagementClient client) tracingParameters.Add("diagnosticId", diagnosticId); tracingParameters.Add("parameters", parameters); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } @@ -937,9 +945,9 @@ internal ApiDiagnosticOperations(ApiManagementClient client) _url = _url.Replace("{diagnosticId}", System.Uri.EscapeDataString(diagnosticId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1141,6 +1149,9 @@ internal ApiDiagnosticOperations(ApiManagementClient client) /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// @@ -1150,7 +1161,7 @@ internal ApiDiagnosticOperations(ApiManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string apiId, string diagnosticId, DiagnosticContract parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string apiId, string diagnosticId, DiagnosticContract parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -1217,11 +1228,14 @@ internal ApiDiagnosticOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1235,7 +1249,6 @@ internal ApiDiagnosticOperations(ApiManagementClient client) tracingParameters.Add("diagnosticId", diagnosticId); tracingParameters.Add("parameters", parameters); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); } @@ -1248,9 +1261,9 @@ internal ApiDiagnosticOperations(ApiManagementClient client) _url = _url.Replace("{diagnosticId}", System.Uri.EscapeDataString(diagnosticId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1324,7 +1337,7 @@ internal ApiDiagnosticOperations(ApiManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 204) + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -1354,13 +1367,44 @@ internal ApiDiagnosticOperations(ApiManagementClient 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); + } + } + 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); @@ -1471,11 +1515,14 @@ internal ApiDiagnosticOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1488,7 +1535,6 @@ internal ApiDiagnosticOperations(ApiManagementClient client) tracingParameters.Add("apiId", apiId); tracingParameters.Add("diagnosticId", diagnosticId); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } @@ -1501,9 +1547,9 @@ internal ApiDiagnosticOperations(ApiManagementClient client) _url = _url.Replace("{diagnosticId}", System.Uri.EscapeDataString(diagnosticId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiDiagnosticOperationsExtensions.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiDiagnosticOperationsExtensions.cs index 14d1c79f6ff91..7d8ff6ad9cb6b 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiDiagnosticOperationsExtensions.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiDiagnosticOperationsExtensions.cs @@ -289,9 +289,9 @@ public static DiagnosticContract Get(this IApiDiagnosticOperations operations, s /// header response of the GET request or it should be * for unconditional /// update. /// - public static void Update(this IApiDiagnosticOperations operations, string resourceGroupName, string serviceName, string apiId, string diagnosticId, DiagnosticContract parameters, string ifMatch) + public static DiagnosticContract Update(this IApiDiagnosticOperations operations, string resourceGroupName, string serviceName, string apiId, string diagnosticId, DiagnosticContract parameters, string ifMatch) { - operations.UpdateAsync(resourceGroupName, serviceName, apiId, diagnosticId, parameters, ifMatch).GetAwaiter().GetResult(); + return operations.UpdateAsync(resourceGroupName, serviceName, apiId, diagnosticId, parameters, ifMatch).GetAwaiter().GetResult(); } /// @@ -326,9 +326,12 @@ public static void Update(this IApiDiagnosticOperations operations, string resou /// /// The cancellation token. /// - public static async Task UpdateAsync(this IApiDiagnosticOperations operations, string resourceGroupName, string serviceName, string apiId, string diagnosticId, DiagnosticContract parameters, string ifMatch, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task UpdateAsync(this IApiDiagnosticOperations operations, string resourceGroupName, string serviceName, string apiId, string diagnosticId, DiagnosticContract parameters, string ifMatch, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.UpdateWithHttpMessagesAsync(resourceGroupName, serviceName, apiId, diagnosticId, parameters, ifMatch, null, cancellationToken).ConfigureAwait(false)).Dispose(); + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, serviceName, apiId, diagnosticId, parameters, ifMatch, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiExportOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiExportOperations.cs index 60d0322d2ae8f..2d7f92833e359 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiExportOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiExportOperations.cs @@ -139,12 +139,15 @@ internal ApiExportOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "format"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string export = "true"; - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -157,7 +160,6 @@ internal ApiExportOperations(ApiManagementClient client) tracingParameters.Add("apiId", apiId); tracingParameters.Add("format", format); tracingParameters.Add("export", export); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -177,9 +179,9 @@ internal ApiExportOperations(ApiManagementClient client) { _queryParameters.Add(string.Format("export={0}", System.Uri.EscapeDataString(export))); } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiIssueAttachmentOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiIssueAttachmentOperations.cs index 7d2e18fafa590..9091d14c3a0cd 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiIssueAttachmentOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiIssueAttachmentOperations.cs @@ -151,11 +151,14 @@ internal ApiIssueAttachmentOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "issueId", "^[^*#&+:<>?]+$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -168,7 +171,6 @@ internal ApiIssueAttachmentOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("apiId", apiId); tracingParameters.Add("issueId", issueId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByService", tracingParameters); } @@ -189,9 +191,9 @@ internal ApiIssueAttachmentOperations(ApiManagementClient client) _queryParameters.Add(_odataFilter); } } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -430,11 +432,14 @@ internal ApiIssueAttachmentOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "attachmentId", "^[^*#&+:<>?]+$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -447,7 +452,6 @@ internal ApiIssueAttachmentOperations(ApiManagementClient client) tracingParameters.Add("apiId", apiId); tracingParameters.Add("issueId", issueId); tracingParameters.Add("attachmentId", attachmentId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetEntityTag", tracingParameters); } @@ -461,9 +465,9 @@ internal ApiIssueAttachmentOperations(ApiManagementClient client) _url = _url.Replace("{attachmentId}", System.Uri.EscapeDataString(attachmentId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -700,11 +704,14 @@ internal ApiIssueAttachmentOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "attachmentId", "^[^*#&+:<>?]+$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -717,7 +724,6 @@ internal ApiIssueAttachmentOperations(ApiManagementClient client) tracingParameters.Add("apiId", apiId); tracingParameters.Add("issueId", issueId); tracingParameters.Add("attachmentId", attachmentId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -731,9 +737,9 @@ internal ApiIssueAttachmentOperations(ApiManagementClient client) _url = _url.Replace("{attachmentId}", System.Uri.EscapeDataString(attachmentId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1003,11 +1009,14 @@ internal ApiIssueAttachmentOperations(ApiManagementClient client) { parameters.Validate(); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1022,7 +1031,6 @@ internal ApiIssueAttachmentOperations(ApiManagementClient client) tracingParameters.Add("attachmentId", attachmentId); tracingParameters.Add("parameters", parameters); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } @@ -1036,9 +1044,9 @@ internal ApiIssueAttachmentOperations(ApiManagementClient client) _url = _url.Replace("{attachmentId}", System.Uri.EscapeDataString(attachmentId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1330,11 +1338,14 @@ internal ApiIssueAttachmentOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1348,7 +1359,6 @@ internal ApiIssueAttachmentOperations(ApiManagementClient client) tracingParameters.Add("issueId", issueId); tracingParameters.Add("attachmentId", attachmentId); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } @@ -1362,9 +1372,9 @@ internal ApiIssueAttachmentOperations(ApiManagementClient client) _url = _url.Replace("{attachmentId}", System.Uri.EscapeDataString(attachmentId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiIssueCommentOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiIssueCommentOperations.cs index 2c91c0557ebcf..a8088f010398f 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiIssueCommentOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiIssueCommentOperations.cs @@ -151,11 +151,14 @@ internal ApiIssueCommentOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "issueId", "^[^*#&+:<>?]+$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -168,7 +171,6 @@ internal ApiIssueCommentOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("apiId", apiId); tracingParameters.Add("issueId", issueId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByService", tracingParameters); } @@ -189,9 +191,9 @@ internal ApiIssueCommentOperations(ApiManagementClient client) _queryParameters.Add(_odataFilter); } } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -430,11 +432,14 @@ internal ApiIssueCommentOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "commentId", "^[^*#&+:<>?]+$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -447,7 +452,6 @@ internal ApiIssueCommentOperations(ApiManagementClient client) tracingParameters.Add("apiId", apiId); tracingParameters.Add("issueId", issueId); tracingParameters.Add("commentId", commentId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetEntityTag", tracingParameters); } @@ -461,9 +465,9 @@ internal ApiIssueCommentOperations(ApiManagementClient client) _url = _url.Replace("{commentId}", System.Uri.EscapeDataString(commentId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -700,11 +704,14 @@ internal ApiIssueCommentOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "commentId", "^[^*#&+:<>?]+$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -717,7 +724,6 @@ internal ApiIssueCommentOperations(ApiManagementClient client) tracingParameters.Add("apiId", apiId); tracingParameters.Add("issueId", issueId); tracingParameters.Add("commentId", commentId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -731,9 +737,9 @@ internal ApiIssueCommentOperations(ApiManagementClient client) _url = _url.Replace("{commentId}", System.Uri.EscapeDataString(commentId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1002,11 +1008,14 @@ internal ApiIssueCommentOperations(ApiManagementClient client) { parameters.Validate(); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1021,7 +1030,6 @@ internal ApiIssueCommentOperations(ApiManagementClient client) tracingParameters.Add("commentId", commentId); tracingParameters.Add("parameters", parameters); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } @@ -1035,9 +1043,9 @@ internal ApiIssueCommentOperations(ApiManagementClient client) _url = _url.Replace("{commentId}", System.Uri.EscapeDataString(commentId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1329,11 +1337,14 @@ internal ApiIssueCommentOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1347,7 +1358,6 @@ internal ApiIssueCommentOperations(ApiManagementClient client) tracingParameters.Add("issueId", issueId); tracingParameters.Add("commentId", commentId); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } @@ -1361,9 +1371,9 @@ internal ApiIssueCommentOperations(ApiManagementClient client) _url = _url.Replace("{commentId}", System.Uri.EscapeDataString(commentId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiIssueOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiIssueOperations.cs index 8dfc033201d24..db47719997c1d 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiIssueOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiIssueOperations.cs @@ -131,11 +131,14 @@ internal ApiIssueOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.MinLength, "apiId", 1); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -148,7 +151,6 @@ internal ApiIssueOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("apiId", apiId); tracingParameters.Add("expandCommentsAttachments", expandCommentsAttachments); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByService", tracingParameters); } @@ -172,9 +174,9 @@ internal ApiIssueOperations(ApiManagementClient client) { _queryParameters.Add(string.Format("expandCommentsAttachments={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(expandCommentsAttachments, Client.SerializationSettings).Trim('"')))); } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -391,11 +393,14 @@ internal ApiIssueOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "issueId", "^[^*#&+:<>?]+$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -407,7 +412,6 @@ internal ApiIssueOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("apiId", apiId); tracingParameters.Add("issueId", issueId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetEntityTag", tracingParameters); } @@ -420,9 +424,9 @@ internal ApiIssueOperations(ApiManagementClient client) _url = _url.Replace("{issueId}", System.Uri.EscapeDataString(issueId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -639,11 +643,14 @@ internal ApiIssueOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "issueId", "^[^*#&+:<>?]+$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -656,7 +663,6 @@ internal ApiIssueOperations(ApiManagementClient client) tracingParameters.Add("apiId", apiId); tracingParameters.Add("issueId", issueId); tracingParameters.Add("expandCommentsAttachments", expandCommentsAttachments); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -673,9 +679,9 @@ internal ApiIssueOperations(ApiManagementClient client) { _queryParameters.Add(string.Format("expandCommentsAttachments={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(expandCommentsAttachments, Client.SerializationSettings).Trim('"')))); } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -922,11 +928,14 @@ internal ApiIssueOperations(ApiManagementClient client) { parameters.Validate(); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -940,7 +949,6 @@ internal ApiIssueOperations(ApiManagementClient client) tracingParameters.Add("issueId", issueId); tracingParameters.Add("parameters", parameters); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } @@ -953,9 +961,9 @@ internal ApiIssueOperations(ApiManagementClient client) _url = _url.Replace("{issueId}", System.Uri.EscapeDataString(issueId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1156,6 +1164,9 @@ internal ApiIssueOperations(ApiManagementClient client) /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// @@ -1165,7 +1176,7 @@ internal ApiIssueOperations(ApiManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string apiId, string issueId, IssueUpdateContract parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string apiId, string issueId, IssueUpdateContract parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -1232,11 +1243,14 @@ internal ApiIssueOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1250,7 +1264,6 @@ internal ApiIssueOperations(ApiManagementClient client) tracingParameters.Add("issueId", issueId); tracingParameters.Add("parameters", parameters); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); } @@ -1263,9 +1276,9 @@ internal ApiIssueOperations(ApiManagementClient client) _url = _url.Replace("{issueId}", System.Uri.EscapeDataString(issueId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1339,7 +1352,7 @@ internal ApiIssueOperations(ApiManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 204) + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -1369,13 +1382,44 @@ internal ApiIssueOperations(ApiManagementClient 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); + } + } + 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); @@ -1486,11 +1530,14 @@ internal ApiIssueOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1503,7 +1550,6 @@ internal ApiIssueOperations(ApiManagementClient client) tracingParameters.Add("apiId", apiId); tracingParameters.Add("issueId", issueId); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } @@ -1516,9 +1562,9 @@ internal ApiIssueOperations(ApiManagementClient client) _url = _url.Replace("{issueId}", System.Uri.EscapeDataString(issueId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiIssueOperationsExtensions.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiIssueOperationsExtensions.cs index 5dea01ca09f2b..28f62034c4e32 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiIssueOperationsExtensions.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiIssueOperationsExtensions.cs @@ -300,9 +300,9 @@ public static ApiIssueGetEntityTagHeaders GetEntityTag(this IApiIssueOperations /// header response of the GET request or it should be * for unconditional /// update. /// - public static void Update(this IApiIssueOperations operations, string resourceGroupName, string serviceName, string apiId, string issueId, IssueUpdateContract parameters, string ifMatch) + public static IssueContract Update(this IApiIssueOperations operations, string resourceGroupName, string serviceName, string apiId, string issueId, IssueUpdateContract parameters, string ifMatch) { - operations.UpdateAsync(resourceGroupName, serviceName, apiId, issueId, parameters, ifMatch).GetAwaiter().GetResult(); + return operations.UpdateAsync(resourceGroupName, serviceName, apiId, issueId, parameters, ifMatch).GetAwaiter().GetResult(); } /// @@ -336,9 +336,12 @@ public static void Update(this IApiIssueOperations operations, string resourceGr /// /// The cancellation token. /// - public static async Task UpdateAsync(this IApiIssueOperations operations, string resourceGroupName, string serviceName, string apiId, string issueId, IssueUpdateContract parameters, string ifMatch, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task UpdateAsync(this IApiIssueOperations operations, string resourceGroupName, string serviceName, string apiId, string issueId, IssueUpdateContract parameters, string ifMatch, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.UpdateWithHttpMessagesAsync(resourceGroupName, serviceName, apiId, issueId, parameters, ifMatch, null, cancellationToken).ConfigureAwait(false)).Dispose(); + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, serviceName, apiId, issueId, parameters, ifMatch, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiManagementClient.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiManagementClient.cs index c1305552bcb20..c560a3034d6bd 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiManagementClient.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiManagementClient.cs @@ -151,11 +151,6 @@ public partial class ApiManagementClient : ServiceClient, I /// public virtual IOperationOperations Operation { get; private set; } - /// - /// Gets the IApiExportOperations. - /// - public virtual IApiExportOperations ApiExport { get; private set; } - /// /// Gets the IApiVersionSetOperations. /// @@ -181,6 +176,21 @@ public partial class ApiManagementClient : ServiceClient, I /// public virtual ICertificateOperations Certificate { get; private set; } + /// + /// Gets the IContentTypeOperations. + /// + public virtual IContentTypeOperations ContentType { get; private set; } + + /// + /// Gets the IContentItemOperations. + /// + public virtual IContentItemOperations ContentItem { get; private set; } + + /// + /// Gets the IDeletedServicesOperations. + /// + public virtual IDeletedServicesOperations DeletedServices { get; private set; } + /// /// Gets the IApiManagementOperations. /// @@ -396,6 +406,11 @@ public partial class ApiManagementClient : ServiceClient, I /// public virtual IUserConfirmationPasswordOperations UserConfirmationPassword { get; private set; } + /// + /// Gets the IApiExportOperations. + /// + public virtual IApiExportOperations ApiExport { get; private set; } + /// /// Initializes a new instance of the ApiManagementClient class. /// @@ -652,12 +667,14 @@ private void Initialize() ApiIssueAttachment = new ApiIssueAttachmentOperations(this); ApiTagDescription = new ApiTagDescriptionOperations(this); Operation = new OperationOperations(this); - ApiExport = new ApiExportOperations(this); ApiVersionSet = new ApiVersionSetOperations(this); AuthorizationServer = new AuthorizationServerOperations(this); Backend = new BackendOperations(this); Cache = new CacheOperations(this); Certificate = new CertificateOperations(this); + ContentType = new ContentTypeOperations(this); + ContentItem = new ContentItemOperations(this); + DeletedServices = new DeletedServicesOperations(this); ApiManagementOperations = new ApiManagementOperations(this); ApiManagementServiceSkus = new ApiManagementServiceSkusOperations(this); ApiManagementService = new ApiManagementServiceOperations(this); @@ -701,8 +718,9 @@ private void Initialize() UserSubscription = new UserSubscriptionOperations(this); UserIdentities = new UserIdentitiesOperations(this); UserConfirmationPassword = new UserConfirmationPasswordOperations(this); + ApiExport = new ApiExportOperations(this); BaseUri = new System.Uri("https://management.azure.com"); - ApiVersion = "2019-12-01"; + ApiVersion = "2020-06-01-preview"; AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; GenerateClientRequestId = true; diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiManagementOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiManagementOperations.cs index 3d769e81740f7..f48d6492f328d 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiManagementOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiManagementOperations.cs @@ -66,12 +66,21 @@ internal ApiManagementOperations(ApiManagementClient client) /// /// 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)) { - string apiVersion = "2019-12-01"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -79,7 +88,6 @@ internal ApiManagementOperations(ApiManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } @@ -87,9 +95,9 @@ internal ApiManagementOperations(ApiManagementClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.ApiManagement/operations").ToString(); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiManagementServiceOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiManagementServiceOperations.cs index 9265e525e0549..2434d5cfd4dfe 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiManagementServiceOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiManagementServiceOperations.cs @@ -211,11 +211,14 @@ internal ApiManagementServiceOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -225,7 +228,6 @@ internal ApiManagementServiceOperations(ApiManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -236,9 +238,9 @@ internal ApiManagementServiceOperations(ApiManagementClient client) _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -415,11 +417,14 @@ internal ApiManagementServiceOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -428,7 +433,6 @@ internal ApiManagementServiceOperations(ApiManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); } @@ -438,9 +442,9 @@ internal ApiManagementServiceOperations(ApiManagementClient client) _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -588,11 +592,14 @@ internal ApiManagementServiceOperations(ApiManagementClient client) /// 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.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -600,7 +607,6 @@ internal ApiManagementServiceOperations(ApiManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } @@ -609,9 +615,9 @@ internal ApiManagementServiceOperations(ApiManagementClient client) var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/service").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -794,11 +800,14 @@ internal ApiManagementServiceOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -808,7 +817,6 @@ internal ApiManagementServiceOperations(ApiManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetSsoToken", tracingParameters); } @@ -819,9 +827,9 @@ internal ApiManagementServiceOperations(ApiManagementClient client) _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -981,11 +989,14 @@ internal ApiManagementServiceOperations(ApiManagementClient client) { parameters.Validate(); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -994,7 +1005,6 @@ internal ApiManagementServiceOperations(ApiManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CheckNameAvailability", tracingParameters); } @@ -1003,9 +1013,9 @@ internal ApiManagementServiceOperations(ApiManagementClient client) var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/checkNameAvailability").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1231,11 +1241,14 @@ internal ApiManagementServiceOperations(ApiManagementClient client) { parameters.Validate(); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1246,7 +1259,6 @@ internal ApiManagementServiceOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginRestore", tracingParameters); } @@ -1257,9 +1269,9 @@ internal ApiManagementServiceOperations(ApiManagementClient client) _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1455,11 +1467,14 @@ internal ApiManagementServiceOperations(ApiManagementClient client) { parameters.Validate(); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1470,7 +1485,6 @@ internal ApiManagementServiceOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginBackup", tracingParameters); } @@ -1481,9 +1495,9 @@ internal ApiManagementServiceOperations(ApiManagementClient client) _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1678,11 +1692,14 @@ internal ApiManagementServiceOperations(ApiManagementClient client) { parameters.Validate(); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1693,7 +1710,6 @@ internal ApiManagementServiceOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); } @@ -1704,9 +1720,9 @@ internal ApiManagementServiceOperations(ApiManagementClient client) _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1914,11 +1930,14 @@ internal ApiManagementServiceOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1929,7 +1948,6 @@ internal ApiManagementServiceOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); } @@ -1940,9 +1958,9 @@ internal ApiManagementServiceOperations(ApiManagementClient client) _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -2125,11 +2143,14 @@ internal ApiManagementServiceOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2139,7 +2160,6 @@ internal ApiManagementServiceOperations(ApiManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); } @@ -2150,9 +2170,9 @@ internal ApiManagementServiceOperations(ApiManagementClient client) _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -2336,11 +2356,14 @@ internal ApiManagementServiceOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2351,7 +2374,6 @@ internal ApiManagementServiceOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginApplyNetworkConfigurationUpdates", tracingParameters); } @@ -2362,9 +2384,9 @@ internal ApiManagementServiceOperations(ApiManagementClient client) _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiManagementServiceSkusOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiManagementServiceSkusOperations.cs index eaa655665a4c3..9d697c4b85486 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiManagementServiceSkusOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiManagementServiceSkusOperations.cs @@ -108,11 +108,14 @@ internal ApiManagementServiceSkusOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -122,7 +125,6 @@ internal ApiManagementServiceSkusOperations(ApiManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListAvailableServiceSkus", tracingParameters); } @@ -133,9 +135,9 @@ internal ApiManagementServiceSkusOperations(ApiManagementClient client) _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiOperationOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiOperationOperations.cs index 3ed6cc3840cca..e3a7050f1b63e 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiOperationOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiOperationOperations.cs @@ -136,11 +136,14 @@ internal ApiOperationOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "apiId", "^[^*#&+:<>?]+$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -153,7 +156,6 @@ internal ApiOperationOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("apiId", apiId); tracingParameters.Add("tags", tags); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByApi", tracingParameters); } @@ -177,9 +179,9 @@ internal ApiOperationOperations(ApiManagementClient client) { _queryParameters.Add(string.Format("tags={0}", System.Uri.EscapeDataString(tags))); } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -397,11 +399,14 @@ internal ApiOperationOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.MinLength, "operationId", 1); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -413,7 +418,6 @@ internal ApiOperationOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("apiId", apiId); tracingParameters.Add("operationId", operationId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetEntityTag", tracingParameters); } @@ -426,9 +430,9 @@ internal ApiOperationOperations(ApiManagementClient client) _url = _url.Replace("{operationId}", System.Uri.EscapeDataString(operationId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -643,11 +647,14 @@ internal ApiOperationOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.MinLength, "operationId", 1); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -659,7 +666,6 @@ internal ApiOperationOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("apiId", apiId); tracingParameters.Add("operationId", operationId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -672,9 +678,9 @@ internal ApiOperationOperations(ApiManagementClient client) _url = _url.Replace("{operationId}", System.Uri.EscapeDataString(operationId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -922,11 +928,14 @@ internal ApiOperationOperations(ApiManagementClient client) { parameters.Validate(); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -940,7 +949,6 @@ internal ApiOperationOperations(ApiManagementClient client) tracingParameters.Add("operationId", operationId); tracingParameters.Add("parameters", parameters); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } @@ -953,9 +961,9 @@ internal ApiOperationOperations(ApiManagementClient client) _url = _url.Replace("{operationId}", System.Uri.EscapeDataString(operationId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1158,6 +1166,9 @@ internal ApiOperationOperations(ApiManagementClient client) /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// @@ -1167,7 +1178,7 @@ internal ApiOperationOperations(ApiManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string apiId, string operationId, OperationUpdateContract parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string apiId, string operationId, OperationUpdateContract parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -1234,11 +1245,14 @@ internal ApiOperationOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1252,7 +1266,6 @@ internal ApiOperationOperations(ApiManagementClient client) tracingParameters.Add("operationId", operationId); tracingParameters.Add("parameters", parameters); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); } @@ -1265,9 +1278,9 @@ internal ApiOperationOperations(ApiManagementClient client) _url = _url.Replace("{operationId}", System.Uri.EscapeDataString(operationId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1341,7 +1354,7 @@ internal ApiOperationOperations(ApiManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 204) + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -1371,13 +1384,44 @@ internal ApiOperationOperations(ApiManagementClient 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); + } + } + 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); @@ -1489,11 +1533,14 @@ internal ApiOperationOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1506,7 +1553,6 @@ internal ApiOperationOperations(ApiManagementClient client) tracingParameters.Add("apiId", apiId); tracingParameters.Add("operationId", operationId); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } @@ -1519,9 +1565,9 @@ internal ApiOperationOperations(ApiManagementClient client) _url = _url.Replace("{operationId}", System.Uri.EscapeDataString(operationId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiOperationOperationsExtensions.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiOperationOperationsExtensions.cs index bc1bfe9a09855..6b4252619c961 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiOperationOperationsExtensions.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiOperationOperationsExtensions.cs @@ -304,9 +304,9 @@ public static OperationContract Get(this IApiOperationOperations operations, str /// header response of the GET request or it should be * for unconditional /// update. /// - public static void Update(this IApiOperationOperations operations, string resourceGroupName, string serviceName, string apiId, string operationId, OperationUpdateContract parameters, string ifMatch) + public static OperationContract Update(this IApiOperationOperations operations, string resourceGroupName, string serviceName, string apiId, string operationId, OperationUpdateContract parameters, string ifMatch) { - operations.UpdateAsync(resourceGroupName, serviceName, apiId, operationId, parameters, ifMatch).GetAwaiter().GetResult(); + return operations.UpdateAsync(resourceGroupName, serviceName, apiId, operationId, parameters, ifMatch).GetAwaiter().GetResult(); } /// @@ -342,9 +342,12 @@ public static void Update(this IApiOperationOperations operations, string resour /// /// The cancellation token. /// - public static async Task UpdateAsync(this IApiOperationOperations operations, string resourceGroupName, string serviceName, string apiId, string operationId, OperationUpdateContract parameters, string ifMatch, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task UpdateAsync(this IApiOperationOperations operations, string resourceGroupName, string serviceName, string apiId, string operationId, OperationUpdateContract parameters, string ifMatch, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.UpdateWithHttpMessagesAsync(resourceGroupName, serviceName, apiId, operationId, parameters, ifMatch, null, cancellationToken).ConfigureAwait(false)).Dispose(); + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, serviceName, apiId, operationId, parameters, ifMatch, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiOperationPolicyOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiOperationPolicyOperations.cs index de29d46dee433..838eeb91ee6fc 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiOperationPolicyOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiOperationPolicyOperations.cs @@ -148,11 +148,14 @@ internal ApiOperationPolicyOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.MinLength, "operationId", 1); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -164,7 +167,6 @@ internal ApiOperationPolicyOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("apiId", apiId); tracingParameters.Add("operationId", operationId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByOperation", tracingParameters); } @@ -177,9 +179,9 @@ internal ApiOperationPolicyOperations(ApiManagementClient client) _url = _url.Replace("{operationId}", System.Uri.EscapeDataString(operationId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -397,12 +399,15 @@ internal ApiOperationPolicyOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.MinLength, "operationId", 1); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string policyId = "policy"; - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -415,7 +420,6 @@ internal ApiOperationPolicyOperations(ApiManagementClient client) tracingParameters.Add("apiId", apiId); tracingParameters.Add("operationId", operationId); tracingParameters.Add("policyId", policyId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetEntityTag", tracingParameters); } @@ -429,9 +433,9 @@ internal ApiOperationPolicyOperations(ApiManagementClient client) _url = _url.Replace("{policyId}", System.Uri.EscapeDataString(policyId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -649,12 +653,15 @@ internal ApiOperationPolicyOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.MinLength, "operationId", 1); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string policyId = "policy"; - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -668,7 +675,6 @@ internal ApiOperationPolicyOperations(ApiManagementClient client) tracingParameters.Add("operationId", operationId); tracingParameters.Add("format", format); tracingParameters.Add("policyId", policyId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -686,9 +692,9 @@ internal ApiOperationPolicyOperations(ApiManagementClient client) { _queryParameters.Add(string.Format("format={0}", System.Uri.EscapeDataString(format))); } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -936,12 +942,15 @@ internal ApiOperationPolicyOperations(ApiManagementClient client) { parameters.Validate(); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string policyId = "policy"; - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -956,7 +965,6 @@ internal ApiOperationPolicyOperations(ApiManagementClient client) tracingParameters.Add("policyId", policyId); tracingParameters.Add("parameters", parameters); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } @@ -970,9 +978,9 @@ internal ApiOperationPolicyOperations(ApiManagementClient client) _url = _url.Replace("{policyId}", System.Uri.EscapeDataString(policyId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1243,12 +1251,15 @@ internal ApiOperationPolicyOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string policyId = "policy"; - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1262,7 +1273,6 @@ internal ApiOperationPolicyOperations(ApiManagementClient client) tracingParameters.Add("operationId", operationId); tracingParameters.Add("policyId", policyId); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } @@ -1276,9 +1286,9 @@ internal ApiOperationPolicyOperations(ApiManagementClient client) _url = _url.Replace("{policyId}", System.Uri.EscapeDataString(policyId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiOperations.cs index 15f61b21fc4a2..06ce89468be8a 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiOperations.cs @@ -116,11 +116,14 @@ internal ApiOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -133,7 +136,6 @@ internal ApiOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("tags", tags); tracingParameters.Add("expandApiVersionSet", expandApiVersionSet); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByService", tracingParameters); } @@ -160,9 +162,9 @@ internal ApiOperations(ApiManagementClient client) { _queryParameters.Add(string.Format("expandApiVersionSet={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(expandApiVersionSet, Client.SerializationSettings).Trim('"')))); } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -361,11 +363,14 @@ internal ApiOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "apiId", "^[^*#&+:<>?]+$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -376,7 +381,6 @@ internal ApiOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("apiId", apiId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetEntityTag", tracingParameters); } @@ -388,9 +392,9 @@ internal ApiOperations(ApiManagementClient client) _url = _url.Replace("{apiId}", System.Uri.EscapeDataString(apiId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -586,11 +590,14 @@ internal ApiOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "apiId", "^[^*#&+:<>?]+$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -601,7 +608,6 @@ internal ApiOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("apiId", apiId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -613,9 +619,9 @@ internal ApiOperations(ApiManagementClient client) _url = _url.Replace("{apiId}", System.Uri.EscapeDataString(apiId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -816,6 +822,9 @@ internal ApiOperations(ApiManagementClient client) /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// @@ -825,7 +834,7 @@ internal ApiOperations(ApiManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string apiId, ApiUpdateContract parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string apiId, ApiUpdateContract parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -877,11 +886,14 @@ internal ApiOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -894,7 +906,6 @@ internal ApiOperations(ApiManagementClient client) tracingParameters.Add("apiId", apiId); tracingParameters.Add("parameters", parameters); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); } @@ -906,9 +917,9 @@ internal ApiOperations(ApiManagementClient client) _url = _url.Replace("{apiId}", System.Uri.EscapeDataString(apiId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -982,7 +993,7 @@ internal ApiOperations(ApiManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 204) + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -1012,13 +1023,44 @@ internal ApiOperations(ApiManagementClient 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); + } + } + 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); @@ -1114,11 +1156,14 @@ internal ApiOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1131,7 +1176,6 @@ internal ApiOperations(ApiManagementClient client) tracingParameters.Add("apiId", apiId); tracingParameters.Add("deleteRevisions", deleteRevisions); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } @@ -1147,9 +1191,9 @@ internal ApiOperations(ApiManagementClient client) { _queryParameters.Add(string.Format("deleteRevisions={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(deleteRevisions, Client.SerializationSettings).Trim('"')))); } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1322,11 +1366,14 @@ internal ApiOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1338,7 +1385,6 @@ internal ApiOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("includeNotTaggedApis", includeNotTaggedApis); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByTags", tracingParameters); } @@ -1361,9 +1407,9 @@ internal ApiOperations(ApiManagementClient client) { _queryParameters.Add(string.Format("includeNotTaggedApis={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(includeNotTaggedApis, Client.SerializationSettings).Trim('"')))); } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1580,11 +1626,14 @@ internal ApiOperations(ApiManagementClient client) { parameters.Validate(); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1597,7 +1646,6 @@ internal ApiOperations(ApiManagementClient client) tracingParameters.Add("apiId", apiId); tracingParameters.Add("parameters", parameters); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); } @@ -1609,9 +1657,9 @@ internal ApiOperations(ApiManagementClient client) _url = _url.Replace("{apiId}", System.Uri.EscapeDataString(apiId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiOperationsExtensions.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiOperationsExtensions.cs index 612881babc54d..98a2691e952bf 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiOperationsExtensions.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiOperationsExtensions.cs @@ -275,9 +275,9 @@ public static ApiContract Get(this IApiOperations operations, string resourceGro /// header response of the GET request or it should be * for unconditional /// update. /// - public static void Update(this IApiOperations operations, string resourceGroupName, string serviceName, string apiId, ApiUpdateContract parameters, string ifMatch) + public static ApiContract Update(this IApiOperations operations, string resourceGroupName, string serviceName, string apiId, ApiUpdateContract parameters, string ifMatch) { - operations.UpdateAsync(resourceGroupName, serviceName, apiId, parameters, ifMatch).GetAwaiter().GetResult(); + return operations.UpdateAsync(resourceGroupName, serviceName, apiId, parameters, ifMatch).GetAwaiter().GetResult(); } /// @@ -308,9 +308,12 @@ public static void Update(this IApiOperations operations, string resourceGroupNa /// /// The cancellation token. /// - public static async Task UpdateAsync(this IApiOperations operations, string resourceGroupName, string serviceName, string apiId, ApiUpdateContract parameters, string ifMatch, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task UpdateAsync(this IApiOperations operations, string resourceGroupName, string serviceName, string apiId, ApiUpdateContract parameters, string ifMatch, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.UpdateWithHttpMessagesAsync(resourceGroupName, serviceName, apiId, parameters, ifMatch, null, cancellationToken).ConfigureAwait(false)).Dispose(); + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, serviceName, apiId, parameters, ifMatch, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiPolicyOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiPolicyOperations.cs index 2aed07b6a63ba..0d94d9e73df59 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiPolicyOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiPolicyOperations.cs @@ -129,11 +129,14 @@ internal ApiPolicyOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "apiId", "^[^*#&+:<>?]+$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -144,7 +147,6 @@ internal ApiPolicyOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("apiId", apiId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByApi", tracingParameters); } @@ -156,9 +158,9 @@ internal ApiPolicyOperations(ApiManagementClient client) _url = _url.Replace("{apiId}", System.Uri.EscapeDataString(apiId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -357,12 +359,15 @@ internal ApiPolicyOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "apiId", "^[^*#&+:<>?]+$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string policyId = "policy"; - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -374,7 +379,6 @@ internal ApiPolicyOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("apiId", apiId); tracingParameters.Add("policyId", policyId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetEntityTag", tracingParameters); } @@ -387,9 +391,9 @@ internal ApiPolicyOperations(ApiManagementClient client) _url = _url.Replace("{policyId}", System.Uri.EscapeDataString(policyId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -588,12 +592,15 @@ internal ApiPolicyOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "apiId", "^[^*#&+:<>?]+$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string policyId = "policy"; - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -606,7 +613,6 @@ internal ApiPolicyOperations(ApiManagementClient client) tracingParameters.Add("apiId", apiId); tracingParameters.Add("policyId", policyId); tracingParameters.Add("format", format); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -623,9 +629,9 @@ internal ApiPolicyOperations(ApiManagementClient client) { _queryParameters.Add(string.Format("format={0}", System.Uri.EscapeDataString(format))); } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -854,12 +860,15 @@ internal ApiPolicyOperations(ApiManagementClient client) { parameters.Validate(); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string policyId = "policy"; - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -873,7 +882,6 @@ internal ApiPolicyOperations(ApiManagementClient client) tracingParameters.Add("policyId", policyId); tracingParameters.Add("parameters", parameters); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } @@ -886,9 +894,9 @@ internal ApiPolicyOperations(ApiManagementClient client) _url = _url.Replace("{policyId}", System.Uri.EscapeDataString(policyId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1140,12 +1148,15 @@ internal ApiPolicyOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string policyId = "policy"; - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1158,7 +1169,6 @@ internal ApiPolicyOperations(ApiManagementClient client) tracingParameters.Add("apiId", apiId); tracingParameters.Add("policyId", policyId); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } @@ -1171,9 +1181,9 @@ internal ApiPolicyOperations(ApiManagementClient client) _url = _url.Replace("{policyId}", System.Uri.EscapeDataString(policyId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiProductOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiProductOperations.cs index 255be550cfdae..223d6a0319999 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiProductOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiProductOperations.cs @@ -128,11 +128,14 @@ internal ApiProductOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.MinLength, "apiId", 1); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -144,7 +147,6 @@ internal ApiProductOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("apiId", apiId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByApis", tracingParameters); } @@ -164,9 +166,9 @@ internal ApiProductOperations(ApiManagementClient client) _queryParameters.Add(_odataFilter); } } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiReleaseOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiReleaseOperations.cs index 7b43fec251fb8..17637edacc088 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiReleaseOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiReleaseOperations.cs @@ -131,11 +131,14 @@ internal ApiReleaseOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.MinLength, "apiId", 1); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -147,7 +150,6 @@ internal ApiReleaseOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("apiId", apiId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByService", tracingParameters); } @@ -167,9 +169,9 @@ internal ApiReleaseOperations(ApiManagementClient client) _queryParameters.Add(_odataFilter); } } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -385,11 +387,14 @@ internal ApiReleaseOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "releaseId", "^[^*#&+:<>?]+$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -401,7 +406,6 @@ internal ApiReleaseOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("apiId", apiId); tracingParameters.Add("releaseId", releaseId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetEntityTag", tracingParameters); } @@ -414,9 +418,9 @@ internal ApiReleaseOperations(ApiManagementClient client) _url = _url.Replace("{releaseId}", System.Uri.EscapeDataString(releaseId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -630,11 +634,14 @@ internal ApiReleaseOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "releaseId", "^[^*#&+:<>?]+$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -646,7 +653,6 @@ internal ApiReleaseOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("apiId", apiId); tracingParameters.Add("releaseId", releaseId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -659,9 +665,9 @@ internal ApiReleaseOperations(ApiManagementClient client) _url = _url.Replace("{releaseId}", System.Uri.EscapeDataString(releaseId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -904,11 +910,14 @@ internal ApiReleaseOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -922,7 +931,6 @@ internal ApiReleaseOperations(ApiManagementClient client) tracingParameters.Add("releaseId", releaseId); tracingParameters.Add("parameters", parameters); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } @@ -935,9 +943,9 @@ internal ApiReleaseOperations(ApiManagementClient client) _url = _url.Replace("{releaseId}", System.Uri.EscapeDataString(releaseId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1138,6 +1146,9 @@ internal ApiReleaseOperations(ApiManagementClient client) /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// @@ -1147,7 +1158,7 @@ internal ApiReleaseOperations(ApiManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string apiId, string releaseId, ApiReleaseContract parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string apiId, string releaseId, ApiReleaseContract parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -1214,11 +1225,14 @@ internal ApiReleaseOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1232,7 +1246,6 @@ internal ApiReleaseOperations(ApiManagementClient client) tracingParameters.Add("releaseId", releaseId); tracingParameters.Add("parameters", parameters); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); } @@ -1245,9 +1258,9 @@ internal ApiReleaseOperations(ApiManagementClient client) _url = _url.Replace("{releaseId}", System.Uri.EscapeDataString(releaseId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1321,7 +1334,7 @@ internal ApiReleaseOperations(ApiManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 204) + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -1351,13 +1364,44 @@ internal ApiReleaseOperations(ApiManagementClient 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); + } + } + 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); @@ -1468,11 +1512,14 @@ internal ApiReleaseOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1485,7 +1532,6 @@ internal ApiReleaseOperations(ApiManagementClient client) tracingParameters.Add("apiId", apiId); tracingParameters.Add("releaseId", releaseId); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } @@ -1498,9 +1544,9 @@ internal ApiReleaseOperations(ApiManagementClient client) _url = _url.Replace("{releaseId}", System.Uri.EscapeDataString(releaseId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiReleaseOperationsExtensions.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiReleaseOperationsExtensions.cs index 3514fafd69260..2cb57bf7691a8 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiReleaseOperationsExtensions.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiReleaseOperationsExtensions.cs @@ -292,9 +292,9 @@ public static ApiReleaseContract Get(this IApiReleaseOperations operations, stri /// header response of the GET request or it should be * for unconditional /// update. /// - public static void Update(this IApiReleaseOperations operations, string resourceGroupName, string serviceName, string apiId, string releaseId, ApiReleaseContract parameters, string ifMatch) + public static ApiReleaseContract Update(this IApiReleaseOperations operations, string resourceGroupName, string serviceName, string apiId, string releaseId, ApiReleaseContract parameters, string ifMatch) { - operations.UpdateAsync(resourceGroupName, serviceName, apiId, releaseId, parameters, ifMatch).GetAwaiter().GetResult(); + return operations.UpdateAsync(resourceGroupName, serviceName, apiId, releaseId, parameters, ifMatch).GetAwaiter().GetResult(); } /// @@ -328,9 +328,12 @@ public static void Update(this IApiReleaseOperations operations, string resource /// /// The cancellation token. /// - public static async Task UpdateAsync(this IApiReleaseOperations operations, string resourceGroupName, string serviceName, string apiId, string releaseId, ApiReleaseContract parameters, string ifMatch, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task UpdateAsync(this IApiReleaseOperations operations, string resourceGroupName, string serviceName, string apiId, string releaseId, ApiReleaseContract parameters, string ifMatch, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.UpdateWithHttpMessagesAsync(resourceGroupName, serviceName, apiId, releaseId, parameters, ifMatch, null, cancellationToken).ConfigureAwait(false)).Dispose(); + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, serviceName, apiId, releaseId, parameters, ifMatch, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiRevisionOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiRevisionOperations.cs index 8342d8b7d6fbb..d0d6c826a4f04 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiRevisionOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiRevisionOperations.cs @@ -128,11 +128,14 @@ internal ApiRevisionOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.MinLength, "apiId", 1); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -144,7 +147,6 @@ internal ApiRevisionOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("apiId", apiId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByService", tracingParameters); } @@ -164,9 +166,9 @@ internal ApiRevisionOperations(ApiManagementClient client) _queryParameters.Add(_odataFilter); } } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiSchemaOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiSchemaOperations.cs index d92171e676493..3dffc0888ef5f 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiSchemaOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiSchemaOperations.cs @@ -65,11 +65,11 @@ internal ApiSchemaOperations(ApiManagementClient client) /// the revision number. /// /// - /// | Field | Usage | Supported operators | Supported - /// functions + /// | Field | Usage | Supported operators | + /// Supported functions /// |</br>|-------------|-------------|-------------|-------------|</br>| /// contentType | filter | ge, le, eq, ne, gt, lt | substringof, contains, - /// startswith, endswith | </br> + /// startswith, endswith |</br> /// /// /// Number of records to return. @@ -150,11 +150,14 @@ internal ApiSchemaOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.InclusiveMinimum, "skip", 0); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -168,7 +171,6 @@ internal ApiSchemaOperations(ApiManagementClient client) tracingParameters.Add("filter", filter); tracingParameters.Add("top", top); tracingParameters.Add("skip", skip); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByApi", tracingParameters); } @@ -192,9 +194,9 @@ internal ApiSchemaOperations(ApiManagementClient client) { _queryParameters.Add(string.Format("$skip={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(skip, Client.SerializationSettings).Trim('"')))); } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -416,11 +418,14 @@ internal ApiSchemaOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "schemaId", "^[^*#&+:<>?]+$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -432,7 +437,6 @@ internal ApiSchemaOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("apiId", apiId); tracingParameters.Add("schemaId", schemaId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetEntityTag", tracingParameters); } @@ -445,9 +449,9 @@ internal ApiSchemaOperations(ApiManagementClient client) _url = _url.Replace("{schemaId}", System.Uri.EscapeDataString(schemaId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -666,11 +670,14 @@ internal ApiSchemaOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "schemaId", "^[^*#&+:<>?]+$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -682,7 +689,6 @@ internal ApiSchemaOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("apiId", apiId); tracingParameters.Add("schemaId", schemaId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -695,9 +701,9 @@ internal ApiSchemaOperations(ApiManagementClient client) _url = _url.Replace("{schemaId}", System.Uri.EscapeDataString(schemaId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -981,11 +987,14 @@ internal ApiSchemaOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -999,7 +1008,6 @@ internal ApiSchemaOperations(ApiManagementClient client) tracingParameters.Add("schemaId", schemaId); tracingParameters.Add("force", force); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } @@ -1016,9 +1024,9 @@ internal ApiSchemaOperations(ApiManagementClient client) { _queryParameters.Add(string.Format("force={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(force, Client.SerializationSettings).Trim('"')))); } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1247,11 +1255,14 @@ internal ApiSchemaOperations(ApiManagementClient client) { parameters.Validate(); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1265,7 +1276,6 @@ internal ApiSchemaOperations(ApiManagementClient client) tracingParameters.Add("schemaId", schemaId); tracingParameters.Add("parameters", parameters); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); } @@ -1278,9 +1288,9 @@ internal ApiSchemaOperations(ApiManagementClient client) _url = _url.Replace("{schemaId}", System.Uri.EscapeDataString(schemaId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiSchemaOperationsExtensions.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiSchemaOperationsExtensions.cs index 6bbea3e1cb31b..3a6aa229b0846 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiSchemaOperationsExtensions.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiSchemaOperationsExtensions.cs @@ -39,11 +39,11 @@ public static partial class ApiSchemaOperationsExtensions /// the revision number. /// /// - /// | Field | Usage | Supported operators | Supported - /// functions + /// | Field | Usage | Supported operators | + /// Supported functions /// |</br>|-------------|-------------|-------------|-------------|</br>| /// contentType | filter | ge, le, eq, ne, gt, lt | substringof, contains, - /// startswith, endswith | </br> + /// startswith, endswith |</br> /// /// /// Number of records to return. @@ -74,11 +74,11 @@ public static partial class ApiSchemaOperationsExtensions /// the revision number. /// /// - /// | Field | Usage | Supported operators | Supported - /// functions + /// | Field | Usage | Supported operators | + /// Supported functions /// |</br>|-------------|-------------|-------------|-------------|</br>| /// contentType | filter | ge, le, eq, ne, gt, lt | substringof, contains, - /// startswith, endswith | </br> + /// startswith, endswith |</br> /// /// /// Number of records to return. diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiTagDescriptionOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiTagDescriptionOperations.cs index f39700a340956..74c35d5e26e68 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiTagDescriptionOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiTagDescriptionOperations.cs @@ -135,11 +135,14 @@ internal ApiTagDescriptionOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "apiId", "^[^*#&+:<>?]+$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -151,7 +154,6 @@ internal ApiTagDescriptionOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("apiId", apiId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByService", tracingParameters); } @@ -171,9 +173,9 @@ internal ApiTagDescriptionOperations(ApiManagementClient client) _queryParameters.Add(_odataFilter); } } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -394,11 +396,14 @@ internal ApiTagDescriptionOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "tagDescriptionId", "^[^*#&+:<>?]+$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -410,7 +415,6 @@ internal ApiTagDescriptionOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("apiId", apiId); tracingParameters.Add("tagDescriptionId", tagDescriptionId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetEntityTag", tracingParameters); } @@ -423,9 +427,9 @@ internal ApiTagDescriptionOperations(ApiManagementClient client) _url = _url.Replace("{tagDescriptionId}", System.Uri.EscapeDataString(tagDescriptionId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -644,11 +648,14 @@ internal ApiTagDescriptionOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "tagDescriptionId", "^[^*#&+:<>?]+$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -660,7 +667,6 @@ internal ApiTagDescriptionOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("apiId", apiId); tracingParameters.Add("tagDescriptionId", tagDescriptionId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -673,9 +679,9 @@ internal ApiTagDescriptionOperations(ApiManagementClient client) _url = _url.Replace("{tagDescriptionId}", System.Uri.EscapeDataString(tagDescriptionId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -923,11 +929,18 @@ internal ApiTagDescriptionOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); } + if (parameters != null) + { + parameters.Validate(); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -941,7 +954,6 @@ internal ApiTagDescriptionOperations(ApiManagementClient client) tracingParameters.Add("tagDescriptionId", tagDescriptionId); tracingParameters.Add("parameters", parameters); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } @@ -954,9 +966,9 @@ internal ApiTagDescriptionOperations(ApiManagementClient client) _url = _url.Replace("{tagDescriptionId}", System.Uri.EscapeDataString(tagDescriptionId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1231,11 +1243,14 @@ internal ApiTagDescriptionOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1248,7 +1263,6 @@ internal ApiTagDescriptionOperations(ApiManagementClient client) tracingParameters.Add("apiId", apiId); tracingParameters.Add("tagDescriptionId", tagDescriptionId); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } @@ -1261,9 +1275,9 @@ internal ApiTagDescriptionOperations(ApiManagementClient client) _url = _url.Replace("{tagDescriptionId}", System.Uri.EscapeDataString(tagDescriptionId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiVersionSetOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiVersionSetOperations.cs index 3805a7dd84015..090b3e57173a0 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiVersionSetOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiVersionSetOperations.cs @@ -109,11 +109,14 @@ internal ApiVersionSetOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -124,7 +127,6 @@ internal ApiVersionSetOperations(ApiManagementClient client) tracingParameters.Add("odataQuery", odataQuery); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByService", tracingParameters); } @@ -143,9 +145,9 @@ internal ApiVersionSetOperations(ApiManagementClient client) _queryParameters.Add(_odataFilter); } } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -343,11 +345,14 @@ internal ApiVersionSetOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "versionSetId", "^[^*#&+:<>?]+$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -358,7 +363,6 @@ internal ApiVersionSetOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("versionSetId", versionSetId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetEntityTag", tracingParameters); } @@ -370,9 +374,9 @@ internal ApiVersionSetOperations(ApiManagementClient client) _url = _url.Replace("{versionSetId}", System.Uri.EscapeDataString(versionSetId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -567,11 +571,14 @@ internal ApiVersionSetOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "versionSetId", "^[^*#&+:<>?]+$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -582,7 +589,6 @@ internal ApiVersionSetOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("versionSetId", versionSetId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -594,9 +600,9 @@ internal ApiVersionSetOperations(ApiManagementClient client) _url = _url.Replace("{versionSetId}", System.Uri.EscapeDataString(versionSetId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -824,11 +830,14 @@ internal ApiVersionSetOperations(ApiManagementClient client) { parameters.Validate(); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -841,7 +850,6 @@ internal ApiVersionSetOperations(ApiManagementClient client) tracingParameters.Add("versionSetId", versionSetId); tracingParameters.Add("parameters", parameters); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } @@ -853,9 +861,9 @@ internal ApiVersionSetOperations(ApiManagementClient client) _url = _url.Replace("{versionSetId}", System.Uri.EscapeDataString(versionSetId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1052,6 +1060,9 @@ internal ApiVersionSetOperations(ApiManagementClient client) /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// @@ -1061,7 +1072,7 @@ internal ApiVersionSetOperations(ApiManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string versionSetId, ApiVersionSetUpdateParameters parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string versionSetId, ApiVersionSetUpdateParameters parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -1113,11 +1124,14 @@ internal ApiVersionSetOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1130,7 +1144,6 @@ internal ApiVersionSetOperations(ApiManagementClient client) tracingParameters.Add("versionSetId", versionSetId); tracingParameters.Add("parameters", parameters); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); } @@ -1142,9 +1155,9 @@ internal ApiVersionSetOperations(ApiManagementClient client) _url = _url.Replace("{versionSetId}", System.Uri.EscapeDataString(versionSetId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1218,7 +1231,7 @@ internal ApiVersionSetOperations(ApiManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 204) + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -1248,13 +1261,44 @@ internal ApiVersionSetOperations(ApiManagementClient 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); + } + } + 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); @@ -1346,11 +1390,14 @@ internal ApiVersionSetOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1362,7 +1409,6 @@ internal ApiVersionSetOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("versionSetId", versionSetId); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } @@ -1374,9 +1420,9 @@ internal ApiVersionSetOperations(ApiManagementClient client) _url = _url.Replace("{versionSetId}", System.Uri.EscapeDataString(versionSetId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiVersionSetOperationsExtensions.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiVersionSetOperationsExtensions.cs index 69951294111cd..61b51e0b7bc1d 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiVersionSetOperationsExtensions.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiVersionSetOperationsExtensions.cs @@ -252,9 +252,9 @@ public static ApiVersionSetContract Get(this IApiVersionSetOperations operations /// header response of the GET request or it should be * for unconditional /// update. /// - public static void Update(this IApiVersionSetOperations operations, string resourceGroupName, string serviceName, string versionSetId, ApiVersionSetUpdateParameters parameters, string ifMatch) + public static ApiVersionSetContract Update(this IApiVersionSetOperations operations, string resourceGroupName, string serviceName, string versionSetId, ApiVersionSetUpdateParameters parameters, string ifMatch) { - operations.UpdateAsync(resourceGroupName, serviceName, versionSetId, parameters, ifMatch).GetAwaiter().GetResult(); + return operations.UpdateAsync(resourceGroupName, serviceName, versionSetId, parameters, ifMatch).GetAwaiter().GetResult(); } /// @@ -284,9 +284,12 @@ public static void Update(this IApiVersionSetOperations operations, string resou /// /// The cancellation token. /// - public static async Task UpdateAsync(this IApiVersionSetOperations operations, string resourceGroupName, string serviceName, string versionSetId, ApiVersionSetUpdateParameters parameters, string ifMatch, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task UpdateAsync(this IApiVersionSetOperations operations, string resourceGroupName, string serviceName, string versionSetId, ApiVersionSetUpdateParameters parameters, string ifMatch, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.UpdateWithHttpMessagesAsync(resourceGroupName, serviceName, versionSetId, parameters, ifMatch, null, cancellationToken).ConfigureAwait(false)).Dispose(); + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, serviceName, versionSetId, parameters, ifMatch, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/AuthorizationServerOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/AuthorizationServerOperations.cs index cb7b14e9b450d..ebadc79e30e77 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/AuthorizationServerOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/AuthorizationServerOperations.cs @@ -110,11 +110,14 @@ internal AuthorizationServerOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -125,7 +128,6 @@ internal AuthorizationServerOperations(ApiManagementClient client) tracingParameters.Add("odataQuery", odataQuery); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByService", tracingParameters); } @@ -144,9 +146,9 @@ internal AuthorizationServerOperations(ApiManagementClient client) _queryParameters.Add(_odataFilter); } } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -343,11 +345,14 @@ internal AuthorizationServerOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "authsid", "^[^*#&+:<>?]+$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -358,7 +363,6 @@ internal AuthorizationServerOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("authsid", authsid); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetEntityTag", tracingParameters); } @@ -370,9 +374,9 @@ internal AuthorizationServerOperations(ApiManagementClient client) _url = _url.Replace("{authsid}", System.Uri.EscapeDataString(authsid)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -566,11 +570,14 @@ internal AuthorizationServerOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "authsid", "^[^*#&+:<>?]+$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -581,7 +588,6 @@ internal AuthorizationServerOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("authsid", authsid); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -593,9 +599,9 @@ internal AuthorizationServerOperations(ApiManagementClient client) _url = _url.Replace("{authsid}", System.Uri.EscapeDataString(authsid)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -823,11 +829,14 @@ internal AuthorizationServerOperations(ApiManagementClient client) { parameters.Validate(); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -840,7 +849,6 @@ internal AuthorizationServerOperations(ApiManagementClient client) tracingParameters.Add("authsid", authsid); tracingParameters.Add("parameters", parameters); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } @@ -852,9 +860,9 @@ internal AuthorizationServerOperations(ApiManagementClient client) _url = _url.Replace("{authsid}", System.Uri.EscapeDataString(authsid)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1051,6 +1059,9 @@ internal AuthorizationServerOperations(ApiManagementClient client) /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// @@ -1060,7 +1071,7 @@ internal AuthorizationServerOperations(ApiManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string authsid, AuthorizationServerUpdateContract parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string authsid, AuthorizationServerUpdateContract parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -1112,11 +1123,14 @@ internal AuthorizationServerOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1129,7 +1143,6 @@ internal AuthorizationServerOperations(ApiManagementClient client) tracingParameters.Add("authsid", authsid); tracingParameters.Add("parameters", parameters); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); } @@ -1141,9 +1154,9 @@ internal AuthorizationServerOperations(ApiManagementClient client) _url = _url.Replace("{authsid}", System.Uri.EscapeDataString(authsid)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1217,7 +1230,7 @@ internal AuthorizationServerOperations(ApiManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 204) + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -1247,13 +1260,44 @@ internal AuthorizationServerOperations(ApiManagementClient 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); + } + } + 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); @@ -1344,11 +1388,14 @@ internal AuthorizationServerOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1360,7 +1407,6 @@ internal AuthorizationServerOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("authsid", authsid); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } @@ -1372,9 +1418,9 @@ internal AuthorizationServerOperations(ApiManagementClient client) _url = _url.Replace("{authsid}", System.Uri.EscapeDataString(authsid)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1519,7 +1565,7 @@ internal AuthorizationServerOperations(ApiManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> ListSecretsWithHttpMessagesAsync(string resourceGroupName, string serviceName, string authsid, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ListSecretsWithHttpMessagesAsync(string resourceGroupName, string serviceName, string authsid, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -1563,11 +1609,14 @@ internal AuthorizationServerOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "authsid", "^[^*#&+:<>?]+$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1578,7 +1627,6 @@ internal AuthorizationServerOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("authsid", authsid); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListSecrets", tracingParameters); } @@ -1590,9 +1638,9 @@ internal AuthorizationServerOperations(ApiManagementClient client) _url = _url.Replace("{authsid}", System.Uri.EscapeDataString(authsid)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1682,7 +1730,7 @@ internal AuthorizationServerOperations(ApiManagementClient 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")) @@ -1695,7 +1743,7 @@ internal AuthorizationServerOperations(ApiManagementClient 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) { @@ -1707,6 +1755,19 @@ internal AuthorizationServerOperations(ApiManagementClient 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/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/AuthorizationServerOperationsExtensions.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/AuthorizationServerOperationsExtensions.cs index 77e0a9164cad7..254f1586d6d1f 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/AuthorizationServerOperationsExtensions.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/AuthorizationServerOperationsExtensions.cs @@ -250,9 +250,9 @@ public static AuthorizationServerContract Get(this IAuthorizationServerOperation /// header response of the GET request or it should be * for unconditional /// update. /// - public static void Update(this IAuthorizationServerOperations operations, string resourceGroupName, string serviceName, string authsid, AuthorizationServerUpdateContract parameters, string ifMatch) + public static AuthorizationServerContract Update(this IAuthorizationServerOperations operations, string resourceGroupName, string serviceName, string authsid, AuthorizationServerUpdateContract parameters, string ifMatch) { - operations.UpdateAsync(resourceGroupName, serviceName, authsid, parameters, ifMatch).GetAwaiter().GetResult(); + return operations.UpdateAsync(resourceGroupName, serviceName, authsid, parameters, ifMatch).GetAwaiter().GetResult(); } /// @@ -282,9 +282,12 @@ public static void Update(this IAuthorizationServerOperations operations, string /// /// The cancellation token. /// - public static async Task UpdateAsync(this IAuthorizationServerOperations operations, string resourceGroupName, string serviceName, string authsid, AuthorizationServerUpdateContract parameters, string ifMatch, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task UpdateAsync(this IAuthorizationServerOperations operations, string resourceGroupName, string serviceName, string authsid, AuthorizationServerUpdateContract parameters, string ifMatch, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.UpdateWithHttpMessagesAsync(resourceGroupName, serviceName, authsid, parameters, ifMatch, null, cancellationToken).ConfigureAwait(false)).Dispose(); + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, serviceName, authsid, parameters, ifMatch, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// @@ -355,7 +358,7 @@ public static void Delete(this IAuthorizationServerOperations operations, string /// /// Identifier of the authorization server. /// - public static ClientSecretContract ListSecrets(this IAuthorizationServerOperations operations, string resourceGroupName, string serviceName, string authsid) + public static AuthorizationServerSecretsContract ListSecrets(this IAuthorizationServerOperations operations, string resourceGroupName, string serviceName, string authsid) { return operations.ListSecretsAsync(resourceGroupName, serviceName, authsid).GetAwaiter().GetResult(); } @@ -378,7 +381,7 @@ public static ClientSecretContract ListSecrets(this IAuthorizationServerOperatio /// /// The cancellation token. /// - public static async Task ListSecretsAsync(this IAuthorizationServerOperations operations, string resourceGroupName, string serviceName, string authsid, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ListSecretsAsync(this IAuthorizationServerOperations operations, string resourceGroupName, string serviceName, string authsid, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListSecretsWithHttpMessagesAsync(resourceGroupName, serviceName, authsid, null, cancellationToken).ConfigureAwait(false)) { diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/BackendOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/BackendOperations.cs index 6ef7e6da501b6..16f6ed529764d 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/BackendOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/BackendOperations.cs @@ -109,11 +109,14 @@ internal BackendOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -124,7 +127,6 @@ internal BackendOperations(ApiManagementClient client) tracingParameters.Add("odataQuery", odataQuery); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByService", tracingParameters); } @@ -143,9 +145,9 @@ internal BackendOperations(ApiManagementClient client) _queryParameters.Add(_odataFilter); } } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -339,11 +341,14 @@ internal BackendOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.MinLength, "backendId", 1); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -354,7 +359,6 @@ internal BackendOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("backendId", backendId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetEntityTag", tracingParameters); } @@ -366,9 +370,9 @@ internal BackendOperations(ApiManagementClient client) _url = _url.Replace("{backendId}", System.Uri.EscapeDataString(backendId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -559,11 +563,14 @@ internal BackendOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.MinLength, "backendId", 1); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -574,7 +581,6 @@ internal BackendOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("backendId", backendId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -586,9 +592,9 @@ internal BackendOperations(ApiManagementClient client) _url = _url.Replace("{backendId}", System.Uri.EscapeDataString(backendId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -812,11 +818,14 @@ internal BackendOperations(ApiManagementClient client) { parameters.Validate(); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -829,7 +838,6 @@ internal BackendOperations(ApiManagementClient client) tracingParameters.Add("backendId", backendId); tracingParameters.Add("parameters", parameters); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } @@ -841,9 +849,9 @@ internal BackendOperations(ApiManagementClient client) _url = _url.Replace("{backendId}", System.Uri.EscapeDataString(backendId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1040,6 +1048,9 @@ internal BackendOperations(ApiManagementClient client) /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// @@ -1049,7 +1060,7 @@ internal BackendOperations(ApiManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string backendId, BackendUpdateParameters parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string backendId, BackendUpdateParameters parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -1097,11 +1108,14 @@ internal BackendOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1114,7 +1128,6 @@ internal BackendOperations(ApiManagementClient client) tracingParameters.Add("backendId", backendId); tracingParameters.Add("parameters", parameters); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); } @@ -1126,9 +1139,9 @@ internal BackendOperations(ApiManagementClient client) _url = _url.Replace("{backendId}", System.Uri.EscapeDataString(backendId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1202,7 +1215,7 @@ internal BackendOperations(ApiManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 204) + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -1232,13 +1245,44 @@ internal BackendOperations(ApiManagementClient 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); + } + } + 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); @@ -1326,11 +1370,14 @@ internal BackendOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1342,7 +1389,6 @@ internal BackendOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("backendId", backendId); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } @@ -1354,9 +1400,9 @@ internal BackendOperations(ApiManagementClient client) _url = _url.Replace("{backendId}", System.Uri.EscapeDataString(backendId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1544,11 +1590,14 @@ internal BackendOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.MinLength, "backendId", 1); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1560,7 +1609,6 @@ internal BackendOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("backendId", backendId); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Reconnect", tracingParameters); } @@ -1572,9 +1620,9 @@ internal BackendOperations(ApiManagementClient client) _url = _url.Replace("{backendId}", System.Uri.EscapeDataString(backendId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/BackendOperationsExtensions.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/BackendOperationsExtensions.cs index 8d5843d5d0b07..d104981653f6f 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/BackendOperationsExtensions.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/BackendOperationsExtensions.cs @@ -252,9 +252,9 @@ public static BackendContract Get(this IBackendOperations operations, string res /// header response of the GET request or it should be * for unconditional /// update. /// - public static void Update(this IBackendOperations operations, string resourceGroupName, string serviceName, string backendId, BackendUpdateParameters parameters, string ifMatch) + public static BackendContract Update(this IBackendOperations operations, string resourceGroupName, string serviceName, string backendId, BackendUpdateParameters parameters, string ifMatch) { - operations.UpdateAsync(resourceGroupName, serviceName, backendId, parameters, ifMatch).GetAwaiter().GetResult(); + return operations.UpdateAsync(resourceGroupName, serviceName, backendId, parameters, ifMatch).GetAwaiter().GetResult(); } /// @@ -284,9 +284,12 @@ public static void Update(this IBackendOperations operations, string resourceGro /// /// The cancellation token. /// - public static async Task UpdateAsync(this IBackendOperations operations, string resourceGroupName, string serviceName, string backendId, BackendUpdateParameters parameters, string ifMatch, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task UpdateAsync(this IBackendOperations operations, string resourceGroupName, string serviceName, string backendId, BackendUpdateParameters parameters, string ifMatch, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.UpdateWithHttpMessagesAsync(resourceGroupName, serviceName, backendId, parameters, ifMatch, null, cancellationToken).ConfigureAwait(false)).Dispose(); + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, serviceName, backendId, parameters, ifMatch, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/CacheOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/CacheOperations.cs index f0f5b291db314..f400465d74c01 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/CacheOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/CacheOperations.cs @@ -120,11 +120,14 @@ internal CacheOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.InclusiveMinimum, "skip", 0); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -136,7 +139,6 @@ internal CacheOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("top", top); tracingParameters.Add("skip", skip); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByService", tracingParameters); } @@ -155,9 +157,9 @@ internal CacheOperations(ApiManagementClient client) { _queryParameters.Add(string.Format("$skip={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(skip, Client.SerializationSettings).Trim('"')))); } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -355,11 +357,14 @@ internal CacheOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "cacheId", "^[^*#&+:<>?]+$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -370,7 +375,6 @@ internal CacheOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("cacheId", cacheId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetEntityTag", tracingParameters); } @@ -382,9 +386,9 @@ internal CacheOperations(ApiManagementClient client) _url = _url.Replace("{cacheId}", System.Uri.EscapeDataString(cacheId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -579,11 +583,14 @@ internal CacheOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "cacheId", "^[^*#&+:<>?]+$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -594,7 +601,6 @@ internal CacheOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("cacheId", cacheId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -606,9 +612,9 @@ internal CacheOperations(ApiManagementClient client) _url = _url.Replace("{cacheId}", System.Uri.EscapeDataString(cacheId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -837,11 +843,14 @@ internal CacheOperations(ApiManagementClient client) { parameters.Validate(); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -854,7 +863,6 @@ internal CacheOperations(ApiManagementClient client) tracingParameters.Add("cacheId", cacheId); tracingParameters.Add("parameters", parameters); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } @@ -866,9 +874,9 @@ internal CacheOperations(ApiManagementClient client) _url = _url.Replace("{cacheId}", System.Uri.EscapeDataString(cacheId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1065,6 +1073,9 @@ internal CacheOperations(ApiManagementClient client) /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// @@ -1074,7 +1085,7 @@ internal CacheOperations(ApiManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string cacheId, CacheUpdateParameters parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string cacheId, CacheUpdateParameters parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -1126,11 +1137,14 @@ internal CacheOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1143,7 +1157,6 @@ internal CacheOperations(ApiManagementClient client) tracingParameters.Add("cacheId", cacheId); tracingParameters.Add("parameters", parameters); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); } @@ -1155,9 +1168,9 @@ internal CacheOperations(ApiManagementClient client) _url = _url.Replace("{cacheId}", System.Uri.EscapeDataString(cacheId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1231,7 +1244,7 @@ internal CacheOperations(ApiManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 204) + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -1261,13 +1274,44 @@ internal CacheOperations(ApiManagementClient 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); + } + } + 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); @@ -1359,11 +1403,14 @@ internal CacheOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1375,7 +1422,6 @@ internal CacheOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("cacheId", cacheId); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } @@ -1387,9 +1433,9 @@ internal CacheOperations(ApiManagementClient client) _url = _url.Replace("{cacheId}", System.Uri.EscapeDataString(cacheId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/CacheOperationsExtensions.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/CacheOperationsExtensions.cs index eb5d630314b51..691f9c32bf5e3 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/CacheOperationsExtensions.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/CacheOperationsExtensions.cs @@ -261,9 +261,9 @@ public static CacheContract Get(this ICacheOperations operations, string resourc /// header response of the GET request or it should be * for unconditional /// update. /// - public static void Update(this ICacheOperations operations, string resourceGroupName, string serviceName, string cacheId, CacheUpdateParameters parameters, string ifMatch) + public static CacheContract Update(this ICacheOperations operations, string resourceGroupName, string serviceName, string cacheId, CacheUpdateParameters parameters, string ifMatch) { - operations.UpdateAsync(resourceGroupName, serviceName, cacheId, parameters, ifMatch).GetAwaiter().GetResult(); + return operations.UpdateAsync(resourceGroupName, serviceName, cacheId, parameters, ifMatch).GetAwaiter().GetResult(); } /// @@ -293,9 +293,12 @@ public static void Update(this ICacheOperations operations, string resourceGroup /// /// The cancellation token. /// - public static async Task UpdateAsync(this ICacheOperations operations, string resourceGroupName, string serviceName, string cacheId, CacheUpdateParameters parameters, string ifMatch, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task UpdateAsync(this ICacheOperations operations, string resourceGroupName, string serviceName, string cacheId, CacheUpdateParameters parameters, string ifMatch, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.UpdateWithHttpMessagesAsync(resourceGroupName, serviceName, cacheId, parameters, ifMatch, null, cancellationToken).ConfigureAwait(false)).Dispose(); + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, serviceName, cacheId, parameters, ifMatch, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/CertificateOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/CertificateOperations.cs index 61ecc43b1ed25..fe3db72028b63 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/CertificateOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/CertificateOperations.cs @@ -109,11 +109,14 @@ internal CertificateOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -124,7 +127,6 @@ internal CertificateOperations(ApiManagementClient client) tracingParameters.Add("odataQuery", odataQuery); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByService", tracingParameters); } @@ -143,9 +145,9 @@ internal CertificateOperations(ApiManagementClient client) _queryParameters.Add(_odataFilter); } } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -343,11 +345,14 @@ internal CertificateOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "certificateId", "^[^*#&+:<>?]+$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -358,7 +363,6 @@ internal CertificateOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("certificateId", certificateId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetEntityTag", tracingParameters); } @@ -370,9 +374,9 @@ internal CertificateOperations(ApiManagementClient client) _url = _url.Replace("{certificateId}", System.Uri.EscapeDataString(certificateId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -567,11 +571,14 @@ internal CertificateOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "certificateId", "^[^*#&+:<>?]+$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -582,7 +589,6 @@ internal CertificateOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("certificateId", certificateId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -594,9 +600,9 @@ internal CertificateOperations(ApiManagementClient client) _url = _url.Replace("{certificateId}", System.Uri.EscapeDataString(certificateId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -822,15 +828,14 @@ internal CertificateOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); } - if (parameters != null) + if (Client.ApiVersion == null) { - parameters.Validate(); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -843,7 +848,6 @@ internal CertificateOperations(ApiManagementClient client) tracingParameters.Add("certificateId", certificateId); tracingParameters.Add("parameters", parameters); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } @@ -855,9 +859,9 @@ internal CertificateOperations(ApiManagementClient client) _url = _url.Replace("{certificateId}", System.Uri.EscapeDataString(certificateId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1108,11 +1112,14 @@ internal CertificateOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1124,7 +1131,6 @@ internal CertificateOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("certificateId", certificateId); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } @@ -1136,9 +1142,9 @@ internal CertificateOperations(ApiManagementClient client) _url = _url.Replace("{certificateId}", System.Uri.EscapeDataString(certificateId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ContentItemOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ContentItemOperations.cs new file mode 100644 index 0000000000000..f1060905eb7d9 --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ContentItemOperations.cs @@ -0,0 +1,1478 @@ +// +// 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.ApiManagement +{ + 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; + + /// + /// ContentItemOperations operations. + /// + internal partial class ContentItemOperations : IServiceOperations, IContentItemOperations + { + /// + /// Initializes a new instance of the ContentItemOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ContentItemOperations(ApiManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ApiManagementClient + /// + public ApiManagementClient Client { get; private set; } + + /// + /// Returns list of content items + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Content type identifier. + /// + /// + /// 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>> ListByServiceWithHttpMessagesAsync(string resourceGroupName, string serviceName, string contentTypeId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serviceName"); + } + if (serviceName != null) + { + if (serviceName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "serviceName", 50); + } + if (serviceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "serviceName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(serviceName, "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$")) + { + throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); + } + } + if (contentTypeId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "contentTypeId"); + } + if (contentTypeId != null) + { + if (contentTypeId.Length > 80) + { + throw new ValidationException(ValidationRules.MaxLength, "contentTypeId", 80); + } + if (contentTypeId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "contentTypeId", 1); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serviceName", serviceName); + tracingParameters.Add("contentTypeId", contentTypeId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByService", 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.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}/contentItems").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); + _url = _url.Replace("{contentTypeId}", System.Uri.EscapeDataString(contentTypeId)); + _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; + } + + /// + /// Returns content item metadata + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Content type identifier. + /// + /// + /// Content item identifier. + /// + /// + /// 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> GetEntityTagWithHttpMessagesAsync(string resourceGroupName, string serviceName, string contentTypeId, string contentItemId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serviceName"); + } + if (serviceName != null) + { + if (serviceName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "serviceName", 50); + } + if (serviceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "serviceName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(serviceName, "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$")) + { + throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); + } + } + if (contentTypeId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "contentTypeId"); + } + if (contentTypeId != null) + { + if (contentTypeId.Length > 80) + { + throw new ValidationException(ValidationRules.MaxLength, "contentTypeId", 80); + } + if (contentTypeId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "contentTypeId", 1); + } + } + if (contentItemId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "contentItemId"); + } + if (contentItemId != null) + { + if (contentItemId.Length > 80) + { + throw new ValidationException(ValidationRules.MaxLength, "contentItemId", 80); + } + if (contentItemId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "contentItemId", 1); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serviceName", serviceName); + tracingParameters.Add("contentTypeId", contentTypeId); + tracingParameters.Add("contentItemId", contentItemId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetEntityTag", 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.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}/contentItems/{contentItemId}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); + _url = _url.Replace("{contentTypeId}", System.Uri.EscapeDataString(contentTypeId)); + _url = _url.Replace("{contentItemId}", System.Uri.EscapeDataString(contentItemId)); + _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("HEAD"); + _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, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, 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 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; + } + + /// + /// Returns content item details + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Content type identifier. + /// + /// + /// Content item identifier. + /// + /// + /// 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 serviceName, string contentTypeId, string contentItemId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serviceName"); + } + if (serviceName != null) + { + if (serviceName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "serviceName", 50); + } + if (serviceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "serviceName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(serviceName, "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$")) + { + throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); + } + } + if (contentTypeId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "contentTypeId"); + } + if (contentTypeId != null) + { + if (contentTypeId.Length > 80) + { + throw new ValidationException(ValidationRules.MaxLength, "contentTypeId", 80); + } + if (contentTypeId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "contentTypeId", 1); + } + } + if (contentItemId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "contentItemId"); + } + if (contentItemId != null) + { + if (contentItemId.Length > 80) + { + throw new ValidationException(ValidationRules.MaxLength, "contentItemId", 80); + } + if (contentItemId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "contentItemId", 1); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serviceName", serviceName); + tracingParameters.Add("contentTypeId", contentTypeId); + tracingParameters.Add("contentItemId", contentItemId); + 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.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}/contentItems/{contentItemId}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); + _url = _url.Replace("{contentTypeId}", System.Uri.EscapeDataString(contentTypeId)); + _url = _url.Replace("{contentItemId}", System.Uri.EscapeDataString(contentItemId)); + _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); + } + } + 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; + } + + /// + /// Creates new content item + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Content type identifier. + /// + /// + /// Content item identifier. + /// + /// + /// ETag of the Entity. Not required when creating an entity, but required when + /// updating an entity. + /// + /// + /// 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 serviceName, string contentTypeId, string contentItemId, string ifMatch = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serviceName"); + } + if (serviceName != null) + { + if (serviceName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "serviceName", 50); + } + if (serviceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "serviceName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(serviceName, "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$")) + { + throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); + } + } + if (contentTypeId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "contentTypeId"); + } + if (contentTypeId != null) + { + if (contentTypeId.Length > 80) + { + throw new ValidationException(ValidationRules.MaxLength, "contentTypeId", 80); + } + if (contentTypeId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "contentTypeId", 1); + } + } + if (contentItemId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "contentItemId"); + } + if (contentItemId != null) + { + if (contentItemId.Length > 80) + { + throw new ValidationException(ValidationRules.MaxLength, "contentItemId", 80); + } + if (contentItemId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "contentItemId", 1); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serviceName", serviceName); + tracingParameters.Add("contentTypeId", contentTypeId); + tracingParameters.Add("contentItemId", contentItemId); + tracingParameters.Add("ifMatch", ifMatch); + 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.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}/contentItems/{contentItemId}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); + _url = _url.Replace("{contentTypeId}", System.Uri.EscapeDataString(contentTypeId)); + _url = _url.Replace("{contentItemId}", System.Uri.EscapeDataString(contentItemId)); + _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("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 (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 != 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); + } + } + 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; + } + + /// + /// Removes specified content item. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Content type identifier. + /// + /// + /// Content item identifier. + /// + /// + /// ETag of the Entity. ETag should match the current entity state from the + /// header response of the GET request or it should be * for unconditional + /// update. + /// + /// + /// 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 serviceName, string contentTypeId, string contentItemId, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serviceName"); + } + if (serviceName != null) + { + if (serviceName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "serviceName", 50); + } + if (serviceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "serviceName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(serviceName, "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$")) + { + throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); + } + } + if (contentTypeId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "contentTypeId"); + } + if (contentTypeId != null) + { + if (contentTypeId.Length > 80) + { + throw new ValidationException(ValidationRules.MaxLength, "contentTypeId", 80); + } + if (contentTypeId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "contentTypeId", 1); + } + } + if (contentItemId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "contentItemId"); + } + if (contentItemId != null) + { + if (contentItemId.Length > 80) + { + throw new ValidationException(ValidationRules.MaxLength, "contentItemId", 80); + } + if (contentItemId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "contentItemId", 1); + } + } + if (ifMatch == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serviceName", serviceName); + tracingParameters.Add("contentTypeId", contentTypeId); + tracingParameters.Add("contentItemId", contentItemId); + tracingParameters.Add("ifMatch", ifMatch); + 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.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}/contentItems/{contentItemId}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); + _url = _url.Replace("{contentTypeId}", System.Uri.EscapeDataString(contentTypeId)); + _url = _url.Replace("{contentItemId}", System.Uri.EscapeDataString(contentItemId)); + _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("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 != 204) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Returns list of content items + /// + /// + /// 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>> ListByServiceNextWithHttpMessagesAsync(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, "ListByServiceNext", 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/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ContentItemOperationsExtensions.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ContentItemOperationsExtensions.cs new file mode 100644 index 0000000000000..cef891fba478d --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ContentItemOperationsExtensions.cs @@ -0,0 +1,328 @@ +// +// 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.ApiManagement +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ContentItemOperations. + /// + public static partial class ContentItemOperationsExtensions + { + /// + /// Returns list of content items + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Content type identifier. + /// + public static IPage ListByService(this IContentItemOperations operations, string resourceGroupName, string serviceName, string contentTypeId) + { + return operations.ListByServiceAsync(resourceGroupName, serviceName, contentTypeId).GetAwaiter().GetResult(); + } + + /// + /// Returns list of content items + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Content type identifier. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByServiceAsync(this IContentItemOperations operations, string resourceGroupName, string serviceName, string contentTypeId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByServiceWithHttpMessagesAsync(resourceGroupName, serviceName, contentTypeId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Returns content item metadata + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Content type identifier. + /// + /// + /// Content item identifier. + /// + public static ContentItemGetEntityTagHeaders GetEntityTag(this IContentItemOperations operations, string resourceGroupName, string serviceName, string contentTypeId, string contentItemId) + { + return operations.GetEntityTagAsync(resourceGroupName, serviceName, contentTypeId, contentItemId).GetAwaiter().GetResult(); + } + + /// + /// Returns content item metadata + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Content type identifier. + /// + /// + /// Content item identifier. + /// + /// + /// The cancellation token. + /// + public static async Task GetEntityTagAsync(this IContentItemOperations operations, string resourceGroupName, string serviceName, string contentTypeId, string contentItemId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetEntityTagWithHttpMessagesAsync(resourceGroupName, serviceName, contentTypeId, contentItemId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Headers; + } + } + + /// + /// Returns content item details + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Content type identifier. + /// + /// + /// Content item identifier. + /// + public static ContentItemContract Get(this IContentItemOperations operations, string resourceGroupName, string serviceName, string contentTypeId, string contentItemId) + { + return operations.GetAsync(resourceGroupName, serviceName, contentTypeId, contentItemId).GetAwaiter().GetResult(); + } + + /// + /// Returns content item details + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Content type identifier. + /// + /// + /// Content item identifier. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IContentItemOperations operations, string resourceGroupName, string serviceName, string contentTypeId, string contentItemId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serviceName, contentTypeId, contentItemId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates new content item + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Content type identifier. + /// + /// + /// Content item identifier. + /// + /// + /// ETag of the Entity. Not required when creating an entity, but required when + /// updating an entity. + /// + public static ContentItemContract CreateOrUpdate(this IContentItemOperations operations, string resourceGroupName, string serviceName, string contentTypeId, string contentItemId, string ifMatch = default(string)) + { + return operations.CreateOrUpdateAsync(resourceGroupName, serviceName, contentTypeId, contentItemId, ifMatch).GetAwaiter().GetResult(); + } + + /// + /// Creates new content item + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Content type identifier. + /// + /// + /// Content item identifier. + /// + /// + /// ETag of the Entity. Not required when creating an entity, but required when + /// updating an entity. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IContentItemOperations operations, string resourceGroupName, string serviceName, string contentTypeId, string contentItemId, string ifMatch = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serviceName, contentTypeId, contentItemId, ifMatch, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Removes specified content item. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Content type identifier. + /// + /// + /// Content item identifier. + /// + /// + /// ETag of the Entity. ETag should match the current entity state from the + /// header response of the GET request or it should be * for unconditional + /// update. + /// + public static void Delete(this IContentItemOperations operations, string resourceGroupName, string serviceName, string contentTypeId, string contentItemId, string ifMatch) + { + operations.DeleteAsync(resourceGroupName, serviceName, contentTypeId, contentItemId, ifMatch).GetAwaiter().GetResult(); + } + + /// + /// Removes specified content item. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Content type identifier. + /// + /// + /// Content item identifier. + /// + /// + /// ETag of the Entity. ETag should match the current entity state from the + /// header response of the GET request or it should be * for unconditional + /// update. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IContentItemOperations operations, string resourceGroupName, string serviceName, string contentTypeId, string contentItemId, string ifMatch, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, serviceName, contentTypeId, contentItemId, ifMatch, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Returns list of content items + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByServiceNext(this IContentItemOperations operations, string nextPageLink) + { + return operations.ListByServiceNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Returns list of content items + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByServiceNextAsync(this IContentItemOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByServiceNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ContentTypeOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ContentTypeOperations.cs new file mode 100644 index 0000000000000..5dd6afc52b196 --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ContentTypeOperations.cs @@ -0,0 +1,1160 @@ +// +// 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.ApiManagement +{ + 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; + + /// + /// ContentTypeOperations operations. + /// + internal partial class ContentTypeOperations : IServiceOperations, IContentTypeOperations + { + /// + /// Initializes a new instance of the ContentTypeOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ContentTypeOperations(ApiManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ApiManagementClient + /// + public ApiManagementClient Client { get; private set; } + + /// + /// Returns list of content types + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// 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>> ListByServiceWithHttpMessagesAsync(string resourceGroupName, string serviceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serviceName"); + } + if (serviceName != null) + { + if (serviceName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "serviceName", 50); + } + if (serviceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "serviceName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(serviceName, "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$")) + { + throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serviceName", serviceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByService", 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.ApiManagement/service/{serviceName}/contentTypes").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); + _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; + } + + /// + /// Gets API Management content type details. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Content type identifier. + /// + /// + /// 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 serviceName, string contentTypeId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serviceName"); + } + if (serviceName != null) + { + if (serviceName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "serviceName", 50); + } + if (serviceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "serviceName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(serviceName, "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$")) + { + throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); + } + } + if (contentTypeId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "contentTypeId"); + } + if (contentTypeId != null) + { + if (contentTypeId.Length > 80) + { + throw new ValidationException(ValidationRules.MaxLength, "contentTypeId", 80); + } + if (contentTypeId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "contentTypeId", 1); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serviceName", serviceName); + tracingParameters.Add("contentTypeId", contentTypeId); + 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.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); + _url = _url.Replace("{contentTypeId}", System.Uri.EscapeDataString(contentTypeId)); + _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); + } + } + 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; + } + + /// + /// Creates or updates an Content Type. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Content type identifier. + /// + /// + /// ETag of the Entity. Not required when creating an entity, but required when + /// updating an entity. + /// + /// + /// 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 serviceName, string contentTypeId, string ifMatch = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serviceName"); + } + if (serviceName != null) + { + if (serviceName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "serviceName", 50); + } + if (serviceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "serviceName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(serviceName, "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$")) + { + throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); + } + } + if (contentTypeId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "contentTypeId"); + } + if (contentTypeId != null) + { + if (contentTypeId.Length > 80) + { + throw new ValidationException(ValidationRules.MaxLength, "contentTypeId", 80); + } + if (contentTypeId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "contentTypeId", 1); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serviceName", serviceName); + tracingParameters.Add("contentTypeId", contentTypeId); + tracingParameters.Add("ifMatch", ifMatch); + 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.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); + _url = _url.Replace("{contentTypeId}", System.Uri.EscapeDataString(contentTypeId)); + _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("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 (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 != 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); + } + } + 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; + } + + /// + /// Removes specified content type. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Content type identifier. + /// + /// + /// ETag of the Entity. ETag should match the current entity state from the + /// header response of the GET request or it should be * for unconditional + /// update. + /// + /// + /// 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 serviceName, string contentTypeId, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (serviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serviceName"); + } + if (serviceName != null) + { + if (serviceName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "serviceName", 50); + } + if (serviceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "serviceName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(serviceName, "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$")) + { + throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); + } + } + if (contentTypeId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "contentTypeId"); + } + if (contentTypeId != null) + { + if (contentTypeId.Length > 80) + { + throw new ValidationException(ValidationRules.MaxLength, "contentTypeId", 80); + } + if (contentTypeId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "contentTypeId", 1); + } + } + if (ifMatch == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("serviceName", serviceName); + tracingParameters.Add("contentTypeId", contentTypeId); + tracingParameters.Add("ifMatch", ifMatch); + 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.ApiManagement/service/{serviceName}/contentTypes/{contentTypeId}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); + _url = _url.Replace("{contentTypeId}", System.Uri.EscapeDataString(contentTypeId)); + _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("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 != 204) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Returns list of content types + /// + /// + /// 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>> ListByServiceNextWithHttpMessagesAsync(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, "ListByServiceNext", 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/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ContentTypeOperationsExtensions.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ContentTypeOperationsExtensions.cs new file mode 100644 index 0000000000000..290c052fdbdd3 --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ContentTypeOperationsExtensions.cs @@ -0,0 +1,252 @@ +// +// 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.ApiManagement +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ContentTypeOperations. + /// + public static partial class ContentTypeOperationsExtensions + { + /// + /// Returns list of content types + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + public static IPage ListByService(this IContentTypeOperations operations, string resourceGroupName, string serviceName) + { + return operations.ListByServiceAsync(resourceGroupName, serviceName).GetAwaiter().GetResult(); + } + + /// + /// Returns list of content types + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByServiceAsync(this IContentTypeOperations operations, string resourceGroupName, string serviceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByServiceWithHttpMessagesAsync(resourceGroupName, serviceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets API Management content type details. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Content type identifier. + /// + public static ContentTypeContract Get(this IContentTypeOperations operations, string resourceGroupName, string serviceName, string contentTypeId) + { + return operations.GetAsync(resourceGroupName, serviceName, contentTypeId).GetAwaiter().GetResult(); + } + + /// + /// Gets API Management content type details. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Content type identifier. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IContentTypeOperations operations, string resourceGroupName, string serviceName, string contentTypeId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serviceName, contentTypeId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates an Content Type. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Content type identifier. + /// + /// + /// ETag of the Entity. Not required when creating an entity, but required when + /// updating an entity. + /// + public static ContentTypeContract CreateOrUpdate(this IContentTypeOperations operations, string resourceGroupName, string serviceName, string contentTypeId, string ifMatch = default(string)) + { + return operations.CreateOrUpdateAsync(resourceGroupName, serviceName, contentTypeId, ifMatch).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates an Content Type. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Content type identifier. + /// + /// + /// ETag of the Entity. Not required when creating an entity, but required when + /// updating an entity. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IContentTypeOperations operations, string resourceGroupName, string serviceName, string contentTypeId, string ifMatch = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serviceName, contentTypeId, ifMatch, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Removes specified content type. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Content type identifier. + /// + /// + /// ETag of the Entity. ETag should match the current entity state from the + /// header response of the GET request or it should be * for unconditional + /// update. + /// + public static void Delete(this IContentTypeOperations operations, string resourceGroupName, string serviceName, string contentTypeId, string ifMatch) + { + operations.DeleteAsync(resourceGroupName, serviceName, contentTypeId, ifMatch).GetAwaiter().GetResult(); + } + + /// + /// Removes specified content type. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Content type identifier. + /// + /// + /// ETag of the Entity. ETag should match the current entity state from the + /// header response of the GET request or it should be * for unconditional + /// update. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IContentTypeOperations operations, string resourceGroupName, string serviceName, string contentTypeId, string ifMatch, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, serviceName, contentTypeId, ifMatch, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Returns list of content types + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByServiceNext(this IContentTypeOperations operations, string nextPageLink) + { + return operations.ListByServiceNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Returns list of content types + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByServiceNextAsync(this IContentTypeOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByServiceNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/DelegationSettingsOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/DelegationSettingsOperations.cs index 701eaf6c3e035..ff58ec28a5570 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/DelegationSettingsOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/DelegationSettingsOperations.cs @@ -102,11 +102,14 @@ internal DelegationSettingsOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -116,7 +119,6 @@ internal DelegationSettingsOperations(ApiManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetEntityTag", tracingParameters); } @@ -127,9 +129,9 @@ internal DelegationSettingsOperations(ApiManagementClient client) _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -301,11 +303,14 @@ internal DelegationSettingsOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -315,7 +320,6 @@ internal DelegationSettingsOperations(ApiManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -326,9 +330,9 @@ internal DelegationSettingsOperations(ApiManagementClient client) _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -531,11 +535,14 @@ internal DelegationSettingsOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -547,7 +554,6 @@ internal DelegationSettingsOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("parameters", parameters); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); } @@ -558,9 +564,9 @@ internal DelegationSettingsOperations(ApiManagementClient client) _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -744,11 +750,14 @@ internal DelegationSettingsOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -760,7 +769,6 @@ internal DelegationSettingsOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("parameters", parameters); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } @@ -771,9 +779,9 @@ internal DelegationSettingsOperations(ApiManagementClient client) _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -964,11 +972,14 @@ internal DelegationSettingsOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -978,7 +989,6 @@ internal DelegationSettingsOperations(ApiManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListSecrets", tracingParameters); } @@ -989,9 +999,9 @@ internal DelegationSettingsOperations(ApiManagementClient client) _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/DeletedServicesOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/DeletedServicesOperations.cs new file mode 100644 index 0000000000000..df35cbe167625 --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/DeletedServicesOperations.cs @@ -0,0 +1,809 @@ +// +// 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.ApiManagement +{ + 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; + + /// + /// DeletedServicesOperations operations. + /// + internal partial class DeletedServicesOperations : IServiceOperations, IDeletedServicesOperations + { + /// + /// Initializes a new instance of the DeletedServicesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal DeletedServicesOperations(ApiManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ApiManagementClient + /// + public ApiManagementClient Client { get; private set; } + + /// + /// Lists all soft-deleted services available for undelete for the given + /// 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>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // 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, "ListBySubscription", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/deletedservices").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; + } + + /// + /// Get soft-deleted Api Management Service by name. + /// + /// + /// The name of the API Management service. + /// + /// + /// The location of the deleted API Management service. + /// + /// + /// 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> GetByNameWithHttpMessagesAsync(string serviceName, string location, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (serviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serviceName"); + } + if (serviceName != null) + { + if (serviceName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "serviceName", 50); + } + if (serviceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "serviceName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(serviceName, "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$")) + { + throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("serviceName", serviceName); + tracingParameters.Add("location", location); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetByName", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/locations/{location}/deletedservices/{serviceName}").ToString(); + _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); + _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 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; + } + + /// + /// Purges Api Management Service (deletes it with no option to undelete). + /// + /// + /// The name of the API Management service. + /// + /// + /// The location of the deleted API Management service. + /// + /// + /// 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> PurgeWithHttpMessagesAsync(string serviceName, string location, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (serviceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "serviceName"); + } + if (serviceName != null) + { + if (serviceName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "serviceName", 50); + } + if (serviceName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "serviceName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(serviceName, "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$")) + { + throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "location"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("serviceName", serviceName); + tracingParameters.Add("location", location); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Purge", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/locations/{location}/deletedservices/{serviceName}").ToString(); + _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); + _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("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 != 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 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 == 202) + { + _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 all soft-deleted services available for undelete for the given + /// 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>> ListBySubscriptionNextWithHttpMessagesAsync(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, "ListBySubscriptionNext", 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/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/DeletedServicesOperationsExtensions.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/DeletedServicesOperationsExtensions.cs new file mode 100644 index 0000000000000..fba9e85075680 --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/DeletedServicesOperationsExtensions.cs @@ -0,0 +1,171 @@ +// +// 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.ApiManagement +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for DeletedServicesOperations. + /// + public static partial class DeletedServicesOperationsExtensions + { + /// + /// Lists all soft-deleted services available for undelete for the given + /// subscription. + /// + /// + /// The operations group for this extension method. + /// + public static IPage ListBySubscription(this IDeletedServicesOperations operations) + { + return operations.ListBySubscriptionAsync().GetAwaiter().GetResult(); + } + + /// + /// Lists all soft-deleted services available for undelete for the given + /// subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySubscriptionAsync(this IDeletedServicesOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get soft-deleted Api Management Service by name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the API Management service. + /// + /// + /// The location of the deleted API Management service. + /// + public static DeletedServiceContract GetByName(this IDeletedServicesOperations operations, string serviceName, string location) + { + return operations.GetByNameAsync(serviceName, location).GetAwaiter().GetResult(); + } + + /// + /// Get soft-deleted Api Management Service by name. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the API Management service. + /// + /// + /// The location of the deleted API Management service. + /// + /// + /// The cancellation token. + /// + public static async Task GetByNameAsync(this IDeletedServicesOperations operations, string serviceName, string location, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetByNameWithHttpMessagesAsync(serviceName, location, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Purges Api Management Service (deletes it with no option to undelete). + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the API Management service. + /// + /// + /// The location of the deleted API Management service. + /// + public static DeletedServiceContract Purge(this IDeletedServicesOperations operations, string serviceName, string location) + { + return operations.PurgeAsync(serviceName, location).GetAwaiter().GetResult(); + } + + /// + /// Purges Api Management Service (deletes it with no option to undelete). + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the API Management service. + /// + /// + /// The location of the deleted API Management service. + /// + /// + /// The cancellation token. + /// + public static async Task PurgeAsync(this IDeletedServicesOperations operations, string serviceName, string location, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.PurgeWithHttpMessagesAsync(serviceName, location, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all soft-deleted services available for undelete for the given + /// subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListBySubscriptionNext(this IDeletedServicesOperations operations, string nextPageLink) + { + return operations.ListBySubscriptionNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all soft-deleted services available for undelete for the given + /// 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> ListBySubscriptionNextAsync(this IDeletedServicesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/DiagnosticOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/DiagnosticOperations.cs index f06c1425be859..4bcfbdfcd9b86 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/DiagnosticOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/DiagnosticOperations.cs @@ -109,11 +109,14 @@ internal DiagnosticOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -124,7 +127,6 @@ internal DiagnosticOperations(ApiManagementClient client) tracingParameters.Add("odataQuery", odataQuery); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByService", tracingParameters); } @@ -143,9 +145,9 @@ internal DiagnosticOperations(ApiManagementClient client) _queryParameters.Add(_odataFilter); } } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -343,11 +345,14 @@ internal DiagnosticOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "diagnosticId", "^[^*#&+:<>?]+$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -358,7 +363,6 @@ internal DiagnosticOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("diagnosticId", diagnosticId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetEntityTag", tracingParameters); } @@ -370,9 +374,9 @@ internal DiagnosticOperations(ApiManagementClient client) _url = _url.Replace("{diagnosticId}", System.Uri.EscapeDataString(diagnosticId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -567,11 +571,14 @@ internal DiagnosticOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "diagnosticId", "^[^*#&+:<>?]+$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -582,7 +589,6 @@ internal DiagnosticOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("diagnosticId", diagnosticId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -594,9 +600,9 @@ internal DiagnosticOperations(ApiManagementClient client) _url = _url.Replace("{diagnosticId}", System.Uri.EscapeDataString(diagnosticId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -824,11 +830,14 @@ internal DiagnosticOperations(ApiManagementClient client) { parameters.Validate(); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -841,7 +850,6 @@ internal DiagnosticOperations(ApiManagementClient client) tracingParameters.Add("diagnosticId", diagnosticId); tracingParameters.Add("parameters", parameters); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } @@ -853,9 +861,9 @@ internal DiagnosticOperations(ApiManagementClient client) _url = _url.Replace("{diagnosticId}", System.Uri.EscapeDataString(diagnosticId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1052,6 +1060,9 @@ internal DiagnosticOperations(ApiManagementClient client) /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// @@ -1061,7 +1072,7 @@ internal DiagnosticOperations(ApiManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string diagnosticId, DiagnosticContract parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string diagnosticId, DiagnosticContract parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -1113,11 +1124,14 @@ internal DiagnosticOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1130,7 +1144,6 @@ internal DiagnosticOperations(ApiManagementClient client) tracingParameters.Add("diagnosticId", diagnosticId); tracingParameters.Add("parameters", parameters); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); } @@ -1142,9 +1155,9 @@ internal DiagnosticOperations(ApiManagementClient client) _url = _url.Replace("{diagnosticId}", System.Uri.EscapeDataString(diagnosticId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1218,7 +1231,7 @@ internal DiagnosticOperations(ApiManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 204) + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -1248,13 +1261,44 @@ internal DiagnosticOperations(ApiManagementClient 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); + } + } + 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); @@ -1346,11 +1390,14 @@ internal DiagnosticOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1362,7 +1409,6 @@ internal DiagnosticOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("diagnosticId", diagnosticId); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } @@ -1374,9 +1420,9 @@ internal DiagnosticOperations(ApiManagementClient client) _url = _url.Replace("{diagnosticId}", System.Uri.EscapeDataString(diagnosticId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/DiagnosticOperationsExtensions.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/DiagnosticOperationsExtensions.cs index b4b047f121590..c4455dd36aa58 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/DiagnosticOperationsExtensions.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/DiagnosticOperationsExtensions.cs @@ -252,9 +252,9 @@ public static DiagnosticContract Get(this IDiagnosticOperations operations, stri /// header response of the GET request or it should be * for unconditional /// update. /// - public static void Update(this IDiagnosticOperations operations, string resourceGroupName, string serviceName, string diagnosticId, DiagnosticContract parameters, string ifMatch) + public static DiagnosticContract Update(this IDiagnosticOperations operations, string resourceGroupName, string serviceName, string diagnosticId, DiagnosticContract parameters, string ifMatch) { - operations.UpdateAsync(resourceGroupName, serviceName, diagnosticId, parameters, ifMatch).GetAwaiter().GetResult(); + return operations.UpdateAsync(resourceGroupName, serviceName, diagnosticId, parameters, ifMatch).GetAwaiter().GetResult(); } /// @@ -284,9 +284,12 @@ public static void Update(this IDiagnosticOperations operations, string resource /// /// The cancellation token. /// - public static async Task UpdateAsync(this IDiagnosticOperations operations, string resourceGroupName, string serviceName, string diagnosticId, DiagnosticContract parameters, string ifMatch, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task UpdateAsync(this IDiagnosticOperations operations, string resourceGroupName, string serviceName, string diagnosticId, DiagnosticContract parameters, string ifMatch, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.UpdateWithHttpMessagesAsync(resourceGroupName, serviceName, diagnosticId, parameters, ifMatch, null, cancellationToken).ConfigureAwait(false)).Dispose(); + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, serviceName, diagnosticId, parameters, ifMatch, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/EmailTemplateOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/EmailTemplateOperations.cs index 15192160c9156..7f0cec1c6e97d 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/EmailTemplateOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/EmailTemplateOperations.cs @@ -51,7 +51,7 @@ internal EmailTemplateOperations(ApiManagementClient client) public ApiManagementClient Client { get; private set; } /// - /// Lists a collection of properties defined within a service instance. + /// Gets all email templates /// /// /// The name of the resource group. @@ -60,11 +60,11 @@ internal EmailTemplateOperations(ApiManagementClient client) /// The name of the API Management service. /// /// - /// | Field | Usage | Supported operators | Supported - /// functions + /// | Field | Usage | Supported operators | + /// Supported functions /// |</br>|-------------|-------------|-------------|-------------|</br>| /// name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, - /// endswith | </br> + /// endswith |</br> /// /// /// Number of records to return. @@ -126,11 +126,14 @@ internal EmailTemplateOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.InclusiveMinimum, "skip", 0); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -143,7 +146,6 @@ internal EmailTemplateOperations(ApiManagementClient client) tracingParameters.Add("filter", filter); tracingParameters.Add("top", top); tracingParameters.Add("skip", skip); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByService", tracingParameters); } @@ -166,9 +168,9 @@ internal EmailTemplateOperations(ApiManagementClient client) { _queryParameters.Add(string.Format("$skip={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(skip, Client.SerializationSettings).Trim('"')))); } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -358,11 +360,14 @@ internal EmailTemplateOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "templateName"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -373,7 +378,6 @@ internal EmailTemplateOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("templateName", templateName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetEntityTag", tracingParameters); } @@ -385,9 +389,9 @@ internal EmailTemplateOperations(ApiManagementClient client) _url = _url.Replace("{templateName}", System.Uri.EscapeDataString(templateName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -574,11 +578,14 @@ internal EmailTemplateOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "templateName"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -589,7 +596,6 @@ internal EmailTemplateOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("templateName", templateName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -601,9 +607,9 @@ internal EmailTemplateOperations(ApiManagementClient client) _url = _url.Replace("{templateName}", System.Uri.EscapeDataString(templateName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -819,11 +825,18 @@ internal EmailTemplateOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); } + if (parameters != null) + { + parameters.Validate(); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -836,7 +849,6 @@ internal EmailTemplateOperations(ApiManagementClient client) tracingParameters.Add("templateName", templateName); tracingParameters.Add("parameters", parameters); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } @@ -848,9 +860,9 @@ internal EmailTemplateOperations(ApiManagementClient client) _url = _url.Replace("{templateName}", System.Uri.EscapeDataString(templateName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1005,7 +1017,7 @@ internal EmailTemplateOperations(ApiManagementClient client) } /// - /// Updates the specific Email Template. + /// Updates API Management email template /// /// /// The name of the resource group. @@ -1024,14 +1036,14 @@ internal EmailTemplateOperations(ApiManagementClient client) /// 'passwordResetByAdminNotificationMessage', /// 'rejectDeveloperNotificationMessage', 'requestDeveloperNotificationMessage' /// - /// - /// Update parameters. - /// /// /// ETag of the Entity. ETag should match the current entity state from the /// header response of the GET request or it should be * for unconditional /// update. /// + /// + /// Update parameters. + /// /// /// Headers that will be added to request. /// @@ -1041,6 +1053,9 @@ internal EmailTemplateOperations(ApiManagementClient client) /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// @@ -1050,7 +1065,7 @@ internal EmailTemplateOperations(ApiManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string templateName, EmailTemplateUpdateParameters parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string templateName, string ifMatch, EmailTemplateUpdateParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -1079,19 +1094,22 @@ internal EmailTemplateOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "templateName"); } + if (ifMatch == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); + } if (parameters == null) { throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); } - if (ifMatch == null) + if (Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1102,9 +1120,8 @@ internal EmailTemplateOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("templateName", templateName); - tracingParameters.Add("parameters", parameters); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); } @@ -1116,9 +1133,9 @@ internal EmailTemplateOperations(ApiManagementClient client) _url = _url.Replace("{templateName}", System.Uri.EscapeDataString(templateName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1192,7 +1209,7 @@ internal EmailTemplateOperations(ApiManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 204) + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -1222,13 +1239,44 @@ internal EmailTemplateOperations(ApiManagementClient 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); + } + } + 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); @@ -1313,11 +1361,14 @@ internal EmailTemplateOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1329,7 +1380,6 @@ internal EmailTemplateOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("templateName", templateName); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } @@ -1341,9 +1391,9 @@ internal EmailTemplateOperations(ApiManagementClient client) _url = _url.Replace("{templateName}", System.Uri.EscapeDataString(templateName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1456,7 +1506,7 @@ internal EmailTemplateOperations(ApiManagementClient client) } /// - /// Lists a collection of properties defined within a service instance. + /// Gets all email templates /// /// /// The NextLink from the previous successful call to List operation. diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/EmailTemplateOperationsExtensions.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/EmailTemplateOperationsExtensions.cs index 76eabb2d87aab..340308ff0db16 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/EmailTemplateOperationsExtensions.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/EmailTemplateOperationsExtensions.cs @@ -22,7 +22,7 @@ namespace Microsoft.Azure.Management.ApiManagement public static partial class EmailTemplateOperationsExtensions { /// - /// Lists a collection of properties defined within a service instance. + /// Gets all email templates /// /// /// The operations group for this extension method. @@ -34,11 +34,11 @@ public static partial class EmailTemplateOperationsExtensions /// The name of the API Management service. /// /// - /// | Field | Usage | Supported operators | Supported - /// functions + /// | Field | Usage | Supported operators | + /// Supported functions /// |</br>|-------------|-------------|-------------|-------------|</br>| /// name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, - /// endswith | </br> + /// endswith |</br> /// /// /// Number of records to return. @@ -52,7 +52,7 @@ public static partial class EmailTemplateOperationsExtensions } /// - /// Lists a collection of properties defined within a service instance. + /// Gets all email templates /// /// /// The operations group for this extension method. @@ -64,11 +64,11 @@ public static partial class EmailTemplateOperationsExtensions /// The name of the API Management service. /// /// - /// | Field | Usage | Supported operators | Supported - /// functions + /// | Field | Usage | Supported operators | + /// Supported functions /// |</br>|-------------|-------------|-------------|-------------|</br>| /// name | filter | ge, le, eq, ne, gt, lt | substringof, contains, startswith, - /// endswith | </br> + /// endswith |</br> /// /// /// Number of records to return. @@ -290,7 +290,7 @@ public static EmailTemplateContract Get(this IEmailTemplateOperations operations } /// - /// Updates the specific Email Template. + /// Updates API Management email template /// /// /// The operations group for this extension method. @@ -312,21 +312,21 @@ public static EmailTemplateContract Get(this IEmailTemplateOperations operations /// 'passwordResetByAdminNotificationMessage', /// 'rejectDeveloperNotificationMessage', 'requestDeveloperNotificationMessage' /// - /// - /// Update parameters. - /// /// /// ETag of the Entity. ETag should match the current entity state from the /// header response of the GET request or it should be * for unconditional /// update. /// - public static void Update(this IEmailTemplateOperations operations, string resourceGroupName, string serviceName, string templateName, EmailTemplateUpdateParameters parameters, string ifMatch) + /// + /// Update parameters. + /// + public static EmailTemplateContract Update(this IEmailTemplateOperations operations, string resourceGroupName, string serviceName, string templateName, string ifMatch, EmailTemplateUpdateParameters parameters) { - operations.UpdateAsync(resourceGroupName, serviceName, templateName, parameters, ifMatch).GetAwaiter().GetResult(); + return operations.UpdateAsync(resourceGroupName, serviceName, templateName, ifMatch, parameters).GetAwaiter().GetResult(); } /// - /// Updates the specific Email Template. + /// Updates API Management email template /// /// /// The operations group for this extension method. @@ -348,20 +348,23 @@ public static void Update(this IEmailTemplateOperations operations, string resou /// 'passwordResetByAdminNotificationMessage', /// 'rejectDeveloperNotificationMessage', 'requestDeveloperNotificationMessage' /// - /// - /// Update parameters. - /// /// /// ETag of the Entity. ETag should match the current entity state from the /// header response of the GET request or it should be * for unconditional /// update. /// + /// + /// Update parameters. + /// /// /// The cancellation token. /// - public static async Task UpdateAsync(this IEmailTemplateOperations operations, string resourceGroupName, string serviceName, string templateName, EmailTemplateUpdateParameters parameters, string ifMatch, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task UpdateAsync(this IEmailTemplateOperations operations, string resourceGroupName, string serviceName, string templateName, string ifMatch, EmailTemplateUpdateParameters parameters, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.UpdateWithHttpMessagesAsync(resourceGroupName, serviceName, templateName, parameters, ifMatch, null, cancellationToken).ConfigureAwait(false)).Dispose(); + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, serviceName, templateName, ifMatch, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// @@ -436,7 +439,7 @@ public static void Delete(this IEmailTemplateOperations operations, string resou } /// - /// Lists a collection of properties defined within a service instance. + /// Gets all email templates /// /// /// The operations group for this extension method. @@ -450,7 +453,7 @@ public static IPage ListByServiceNext(this IEmailTemplate } /// - /// Lists a collection of properties defined within a service instance. + /// Gets all email templates /// /// /// The operations group for this extension method. diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/GatewayApiOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/GatewayApiOperations.cs index 8ed9d1d43c994..0b3a27cc38fed 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/GatewayApiOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/GatewayApiOperations.cs @@ -12,6 +12,7 @@ namespace Microsoft.Azure.Management.ApiManagement { using Microsoft.Rest; using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; using Models; using Newtonsoft.Json; using System.Collections; @@ -63,11 +64,8 @@ internal GatewayApiOperations(ApiManagementClient client) /// Gateway entity identifier. Must be unique in the current API Management /// service instance. Must not have value 'managed' /// - /// - /// Number of records to return. - /// - /// - /// Number of records to skip. + /// + /// OData parameters to apply to the operation. /// /// /// Headers that will be added to request. @@ -90,7 +88,7 @@ internal GatewayApiOperations(ApiManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByServiceWithHttpMessagesAsync(string resourceGroupName, string serviceName, string gatewayId, int? top = default(int?), int? skip = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByServiceWithHttpMessagesAsync(string resourceGroupName, string serviceName, string gatewayId, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -130,19 +128,14 @@ internal GatewayApiOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.MinLength, "gatewayId", 1); } } - if (top < 1) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "top", 1); - } - if (skip < 0) + if (Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.InclusiveMinimum, "skip", 0); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -150,12 +143,10 @@ internal GatewayApiOperations(ApiManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("odataQuery", odataQuery); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("gatewayId", gatewayId); - tracingParameters.Add("top", top); - tracingParameters.Add("skip", skip); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByService", tracingParameters); } @@ -167,17 +158,17 @@ internal GatewayApiOperations(ApiManagementClient client) _url = _url.Replace("{gatewayId}", System.Uri.EscapeDataString(gatewayId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (top != null) + if (odataQuery != null) { - _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); - } - if (skip != null) - { - _queryParameters.Add(string.Format("$skip={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(skip, Client.SerializationSettings).Trim('"')))); + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -390,11 +381,14 @@ internal GatewayApiOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.MinLength, "apiId", 1); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -406,7 +400,6 @@ internal GatewayApiOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("gatewayId", gatewayId); tracingParameters.Add("apiId", apiId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetEntityTag", tracingParameters); } @@ -419,9 +412,9 @@ internal GatewayApiOperations(ApiManagementClient client) _url = _url.Replace("{apiId}", System.Uri.EscapeDataString(apiId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -633,11 +626,14 @@ internal GatewayApiOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.MinLength, "apiId", 1); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -649,7 +645,6 @@ internal GatewayApiOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("gatewayId", gatewayId); tracingParameters.Add("apiId", apiId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); @@ -663,9 +658,9 @@ internal GatewayApiOperations(ApiManagementClient client) _url = _url.Replace("{apiId}", System.Uri.EscapeDataString(apiId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -901,11 +896,14 @@ internal GatewayApiOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.MinLength, "apiId", 1); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -917,7 +915,6 @@ internal GatewayApiOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("gatewayId", gatewayId); tracingParameters.Add("apiId", apiId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } @@ -930,9 +927,9 @@ internal GatewayApiOperations(ApiManagementClient client) _url = _url.Replace("{apiId}", System.Uri.EscapeDataString(apiId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/GatewayApiOperationsExtensions.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/GatewayApiOperationsExtensions.cs index 33f73f3650d56..92779780d2685 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/GatewayApiOperationsExtensions.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/GatewayApiOperationsExtensions.cs @@ -12,6 +12,7 @@ namespace Microsoft.Azure.Management.ApiManagement { using Microsoft.Rest; using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; using Models; using System.Threading; using System.Threading.Tasks; @@ -37,15 +38,12 @@ public static partial class GatewayApiOperationsExtensions /// Gateway entity identifier. Must be unique in the current API Management /// service instance. Must not have value 'managed' /// - /// - /// Number of records to return. + /// + /// OData parameters to apply to the operation. /// - /// - /// Number of records to skip. - /// - public static IPage ListByService(this IGatewayApiOperations operations, string resourceGroupName, string serviceName, string gatewayId, int? top = default(int?), int? skip = default(int?)) + public static IPage ListByService(this IGatewayApiOperations operations, string resourceGroupName, string serviceName, string gatewayId, ODataQuery odataQuery = default(ODataQuery)) { - return operations.ListByServiceAsync(resourceGroupName, serviceName, gatewayId, top, skip).GetAwaiter().GetResult(); + return operations.ListByServiceAsync(resourceGroupName, serviceName, gatewayId, odataQuery).GetAwaiter().GetResult(); } /// @@ -64,18 +62,15 @@ public static partial class GatewayApiOperationsExtensions /// Gateway entity identifier. Must be unique in the current API Management /// service instance. Must not have value 'managed' /// - /// - /// Number of records to return. - /// - /// - /// Number of records to skip. + /// + /// OData parameters to apply to the operation. /// /// /// The cancellation token. /// - public static async Task> ListByServiceAsync(this IGatewayApiOperations operations, string resourceGroupName, string serviceName, string gatewayId, int? top = default(int?), int? skip = default(int?), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByServiceAsync(this IGatewayApiOperations operations, string resourceGroupName, string serviceName, string gatewayId, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByServiceWithHttpMessagesAsync(resourceGroupName, serviceName, gatewayId, top, skip, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByServiceWithHttpMessagesAsync(resourceGroupName, serviceName, gatewayId, odataQuery, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/GatewayHostnameConfigurationOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/GatewayHostnameConfigurationOperations.cs index 32aad85886e43..6e8fef68ad078 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/GatewayHostnameConfigurationOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/GatewayHostnameConfigurationOperations.cs @@ -12,6 +12,7 @@ namespace Microsoft.Azure.Management.ApiManagement { using Microsoft.Rest; using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; using Models; using Newtonsoft.Json; using System.Collections; @@ -63,11 +64,8 @@ internal GatewayHostnameConfigurationOperations(ApiManagementClient client) /// Gateway entity identifier. Must be unique in the current API Management /// service instance. Must not have value 'managed' /// - /// - /// Number of records to return. - /// - /// - /// Number of records to skip. + /// + /// OData parameters to apply to the operation. /// /// /// Headers that will be added to request. @@ -90,7 +88,7 @@ internal GatewayHostnameConfigurationOperations(ApiManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByServiceWithHttpMessagesAsync(string resourceGroupName, string serviceName, string gatewayId, int? top = default(int?), int? skip = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByServiceWithHttpMessagesAsync(string resourceGroupName, string serviceName, string gatewayId, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -130,19 +128,14 @@ internal GatewayHostnameConfigurationOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.MinLength, "gatewayId", 1); } } - if (top < 1) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "top", 1); - } - if (skip < 0) + if (Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.InclusiveMinimum, "skip", 0); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -150,12 +143,10 @@ internal GatewayHostnameConfigurationOperations(ApiManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("odataQuery", odataQuery); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("gatewayId", gatewayId); - tracingParameters.Add("top", top); - tracingParameters.Add("skip", skip); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByService", tracingParameters); } @@ -167,17 +158,17 @@ internal GatewayHostnameConfigurationOperations(ApiManagementClient client) _url = _url.Replace("{gatewayId}", System.Uri.EscapeDataString(gatewayId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (top != null) - { - _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); - } - if (skip != null) + if (odataQuery != null) { - _queryParameters.Add(string.Format("$skip={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(skip, Client.SerializationSettings).Trim('"')))); + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -390,11 +381,14 @@ internal GatewayHostnameConfigurationOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.MinLength, "hcId", 1); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -406,7 +400,6 @@ internal GatewayHostnameConfigurationOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("gatewayId", gatewayId); tracingParameters.Add("hcId", hcId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetEntityTag", tracingParameters); } @@ -419,9 +412,9 @@ internal GatewayHostnameConfigurationOperations(ApiManagementClient client) _url = _url.Replace("{hcId}", System.Uri.EscapeDataString(hcId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -539,8 +532,7 @@ internal GatewayHostnameConfigurationOperations(ApiManagementClient client) } /// - /// Gets the details of the Gateway hostname configuration specified by its - /// identifier. + /// Get details of a hostname configuration /// /// /// The name of the resource group. @@ -632,11 +624,14 @@ internal GatewayHostnameConfigurationOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.MinLength, "hcId", 1); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -648,7 +643,6 @@ internal GatewayHostnameConfigurationOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("gatewayId", gatewayId); tracingParameters.Add("hcId", hcId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -661,9 +655,9 @@ internal GatewayHostnameConfigurationOperations(ApiManagementClient client) _url = _url.Replace("{hcId}", System.Uri.EscapeDataString(hcId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -817,6 +811,10 @@ internal GatewayHostnameConfigurationOperations(ApiManagementClient client) /// /// /// + /// + /// ETag of the Entity. Not required when creating an entity, but required when + /// updating an entity. + /// /// /// Headers that will be added to request. /// @@ -838,7 +836,7 @@ internal GatewayHostnameConfigurationOperations(ApiManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string gatewayId, string hcId, GatewayHostnameConfigurationContract parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string gatewayId, string hcId, GatewayHostnameConfigurationContract parameters, string ifMatch = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -893,15 +891,18 @@ internal GatewayHostnameConfigurationOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.MinLength, "hcId", 1); } } - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } if (parameters == null) { throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); } - string apiVersion = "2019-12-01"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -913,7 +914,7 @@ internal GatewayHostnameConfigurationOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("gatewayId", gatewayId); tracingParameters.Add("hcId", hcId); - tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("ifMatch", ifMatch); tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); @@ -927,9 +928,9 @@ internal GatewayHostnameConfigurationOperations(ApiManagementClient client) _url = _url.Replace("{hcId}", System.Uri.EscapeDataString(hcId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -945,6 +946,14 @@ internal GatewayHostnameConfigurationOperations(ApiManagementClient client) { _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")) @@ -1105,6 +1114,11 @@ internal GatewayHostnameConfigurationOperations(ApiManagementClient client) /// Gateway hostname configuration identifier. Must be unique in the scope of /// parent Gateway entity. /// + /// + /// ETag of the Entity. ETag should match the current entity state from the + /// header response of the GET request or it should be * for unconditional + /// update. + /// /// /// Headers that will be added to request. /// @@ -1123,7 +1137,7 @@ internal GatewayHostnameConfigurationOperations(ApiManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string serviceName, string gatewayId, string hcId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string serviceName, string gatewayId, string hcId, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -1178,11 +1192,18 @@ internal GatewayHostnameConfigurationOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.MinLength, "hcId", 1); } } + if (ifMatch == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1194,7 +1215,7 @@ internal GatewayHostnameConfigurationOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("gatewayId", gatewayId); tracingParameters.Add("hcId", hcId); - tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("ifMatch", ifMatch); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } @@ -1207,9 +1228,9 @@ internal GatewayHostnameConfigurationOperations(ApiManagementClient client) _url = _url.Replace("{hcId}", System.Uri.EscapeDataString(hcId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1225,6 +1246,14 @@ internal GatewayHostnameConfigurationOperations(ApiManagementClient client) { _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")) diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/GatewayHostnameConfigurationOperationsExtensions.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/GatewayHostnameConfigurationOperationsExtensions.cs index 0e1d4c8c068f4..efcfef9d6499b 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/GatewayHostnameConfigurationOperationsExtensions.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/GatewayHostnameConfigurationOperationsExtensions.cs @@ -12,6 +12,7 @@ namespace Microsoft.Azure.Management.ApiManagement { using Microsoft.Rest; using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; using Models; using System.Threading; using System.Threading.Tasks; @@ -37,15 +38,12 @@ public static partial class GatewayHostnameConfigurationOperationsExtensions /// Gateway entity identifier. Must be unique in the current API Management /// service instance. Must not have value 'managed' /// - /// - /// Number of records to return. + /// + /// OData parameters to apply to the operation. /// - /// - /// Number of records to skip. - /// - public static IPage ListByService(this IGatewayHostnameConfigurationOperations operations, string resourceGroupName, string serviceName, string gatewayId, int? top = default(int?), int? skip = default(int?)) + public static IPage ListByService(this IGatewayHostnameConfigurationOperations operations, string resourceGroupName, string serviceName, string gatewayId, ODataQuery odataQuery = default(ODataQuery)) { - return operations.ListByServiceAsync(resourceGroupName, serviceName, gatewayId, top, skip).GetAwaiter().GetResult(); + return operations.ListByServiceAsync(resourceGroupName, serviceName, gatewayId, odataQuery).GetAwaiter().GetResult(); } /// @@ -64,18 +62,15 @@ public static partial class GatewayHostnameConfigurationOperationsExtensions /// Gateway entity identifier. Must be unique in the current API Management /// service instance. Must not have value 'managed' /// - /// - /// Number of records to return. - /// - /// - /// Number of records to skip. + /// + /// OData parameters to apply to the operation. /// /// /// The cancellation token. /// - public static async Task> ListByServiceAsync(this IGatewayHostnameConfigurationOperations operations, string resourceGroupName, string serviceName, string gatewayId, int? top = default(int?), int? skip = default(int?), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByServiceAsync(this IGatewayHostnameConfigurationOperations operations, string resourceGroupName, string serviceName, string gatewayId, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByServiceWithHttpMessagesAsync(resourceGroupName, serviceName, gatewayId, top, skip, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByServiceWithHttpMessagesAsync(resourceGroupName, serviceName, gatewayId, odataQuery, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -140,8 +135,7 @@ public static GatewayHostnameConfigurationGetEntityTagHeaders GetEntityTag(this } /// - /// Gets the details of the Gateway hostname configuration specified by its - /// identifier. + /// Get details of a hostname configuration /// /// /// The operations group for this extension method. @@ -166,8 +160,7 @@ public static GatewayHostnameConfigurationContract Get(this IGatewayHostnameConf } /// - /// Gets the details of the Gateway hostname configuration specified by its - /// identifier. + /// Get details of a hostname configuration /// /// /// The operations group for this extension method. @@ -219,9 +212,13 @@ public static GatewayHostnameConfigurationContract Get(this IGatewayHostnameConf /// /// /// - public static GatewayHostnameConfigurationContract CreateOrUpdate(this IGatewayHostnameConfigurationOperations operations, string resourceGroupName, string serviceName, string gatewayId, string hcId, GatewayHostnameConfigurationContract parameters) + /// + /// ETag of the Entity. Not required when creating an entity, but required when + /// updating an entity. + /// + public static GatewayHostnameConfigurationContract CreateOrUpdate(this IGatewayHostnameConfigurationOperations operations, string resourceGroupName, string serviceName, string gatewayId, string hcId, GatewayHostnameConfigurationContract parameters, string ifMatch = default(string)) { - return operations.CreateOrUpdateAsync(resourceGroupName, serviceName, gatewayId, hcId, parameters).GetAwaiter().GetResult(); + return operations.CreateOrUpdateAsync(resourceGroupName, serviceName, gatewayId, hcId, parameters, ifMatch).GetAwaiter().GetResult(); } /// @@ -246,12 +243,16 @@ public static GatewayHostnameConfigurationContract CreateOrUpdate(this IGatewayH /// /// /// + /// + /// ETag of the Entity. Not required when creating an entity, but required when + /// updating an entity. + /// /// /// The cancellation token. /// - public static async Task CreateOrUpdateAsync(this IGatewayHostnameConfigurationOperations operations, string resourceGroupName, string serviceName, string gatewayId, string hcId, GatewayHostnameConfigurationContract parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CreateOrUpdateAsync(this IGatewayHostnameConfigurationOperations operations, string resourceGroupName, string serviceName, string gatewayId, string hcId, GatewayHostnameConfigurationContract parameters, string ifMatch = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serviceName, gatewayId, hcId, parameters, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serviceName, gatewayId, hcId, parameters, ifMatch, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -277,9 +278,14 @@ public static GatewayHostnameConfigurationContract CreateOrUpdate(this IGatewayH /// Gateway hostname configuration identifier. Must be unique in the scope of /// parent Gateway entity. /// - public static void Delete(this IGatewayHostnameConfigurationOperations operations, string resourceGroupName, string serviceName, string gatewayId, string hcId) + /// + /// ETag of the Entity. ETag should match the current entity state from the + /// header response of the GET request or it should be * for unconditional + /// update. + /// + public static void Delete(this IGatewayHostnameConfigurationOperations operations, string resourceGroupName, string serviceName, string gatewayId, string hcId, string ifMatch) { - operations.DeleteAsync(resourceGroupName, serviceName, gatewayId, hcId).GetAwaiter().GetResult(); + operations.DeleteAsync(resourceGroupName, serviceName, gatewayId, hcId, ifMatch).GetAwaiter().GetResult(); } /// @@ -302,12 +308,17 @@ public static void Delete(this IGatewayHostnameConfigurationOperations operation /// Gateway hostname configuration identifier. Must be unique in the scope of /// parent Gateway entity. /// + /// + /// ETag of the Entity. ETag should match the current entity state from the + /// header response of the GET request or it should be * for unconditional + /// update. + /// /// /// The cancellation token. /// - public static async Task DeleteAsync(this IGatewayHostnameConfigurationOperations operations, string resourceGroupName, string serviceName, string gatewayId, string hcId, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task DeleteAsync(this IGatewayHostnameConfigurationOperations operations, string resourceGroupName, string serviceName, string gatewayId, string hcId, string ifMatch, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, serviceName, gatewayId, hcId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, serviceName, gatewayId, hcId, ifMatch, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/GatewayOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/GatewayOperations.cs index 14f31d47a622a..e5d5377db89f4 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/GatewayOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/GatewayOperations.cs @@ -12,6 +12,7 @@ namespace Microsoft.Azure.Management.ApiManagement { using Microsoft.Rest; using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; using Models; using Newtonsoft.Json; using System.Collections; @@ -59,11 +60,8 @@ internal GatewayOperations(ApiManagementClient client) /// /// The name of the API Management service. /// - /// - /// Number of records to return. - /// - /// - /// Number of records to skip. + /// + /// OData parameters to apply to the operation. /// /// /// Headers that will be added to request. @@ -86,7 +84,7 @@ internal GatewayOperations(ApiManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByServiceWithHttpMessagesAsync(string resourceGroupName, string serviceName, int? top = default(int?), int? skip = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByServiceWithHttpMessagesAsync(string resourceGroupName, string serviceName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -111,19 +109,14 @@ internal GatewayOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); } } - if (top < 1) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "top", 1); - } - if (skip < 0) + if (Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.InclusiveMinimum, "skip", 0); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -131,11 +124,9 @@ internal GatewayOperations(ApiManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("odataQuery", odataQuery); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); - tracingParameters.Add("top", top); - tracingParameters.Add("skip", skip); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByService", tracingParameters); } @@ -146,17 +137,17 @@ internal GatewayOperations(ApiManagementClient client) _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (top != null) - { - _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); - } - if (skip != null) + if (odataQuery != null) { - _queryParameters.Add(string.Format("$skip={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(skip, Client.SerializationSettings).Trim('"')))); + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -350,11 +341,14 @@ internal GatewayOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.MinLength, "gatewayId", 1); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -365,7 +359,6 @@ internal GatewayOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("gatewayId", gatewayId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetEntityTag", tracingParameters); } @@ -377,9 +370,9 @@ internal GatewayOperations(ApiManagementClient client) _url = _url.Replace("{gatewayId}", System.Uri.EscapeDataString(gatewayId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -570,11 +563,14 @@ internal GatewayOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.MinLength, "gatewayId", 1); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -585,7 +581,6 @@ internal GatewayOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("gatewayId", gatewayId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -597,9 +592,9 @@ internal GatewayOperations(ApiManagementClient client) _url = _url.Replace("{gatewayId}", System.Uri.EscapeDataString(gatewayId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -822,11 +817,14 @@ internal GatewayOperations(ApiManagementClient client) { parameters.Validate(); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -839,7 +837,6 @@ internal GatewayOperations(ApiManagementClient client) tracingParameters.Add("gatewayId", gatewayId); tracingParameters.Add("parameters", parameters); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } @@ -851,9 +848,9 @@ internal GatewayOperations(ApiManagementClient client) _url = _url.Replace("{gatewayId}", System.Uri.EscapeDataString(gatewayId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1049,6 +1046,9 @@ internal GatewayOperations(ApiManagementClient client) /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// @@ -1058,7 +1058,7 @@ internal GatewayOperations(ApiManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string gatewayId, GatewayContract parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string gatewayId, GatewayContract parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -1106,11 +1106,14 @@ internal GatewayOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1123,7 +1126,6 @@ internal GatewayOperations(ApiManagementClient client) tracingParameters.Add("gatewayId", gatewayId); tracingParameters.Add("parameters", parameters); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); } @@ -1135,9 +1137,9 @@ internal GatewayOperations(ApiManagementClient client) _url = _url.Replace("{gatewayId}", System.Uri.EscapeDataString(gatewayId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1211,7 +1213,7 @@ internal GatewayOperations(ApiManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 204) + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -1241,13 +1243,44 @@ internal GatewayOperations(ApiManagementClient 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); + } + } + 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); @@ -1335,11 +1368,14 @@ internal GatewayOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1351,7 +1387,6 @@ internal GatewayOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("gatewayId", gatewayId); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } @@ -1363,9 +1398,9 @@ internal GatewayOperations(ApiManagementClient client) _url = _url.Replace("{gatewayId}", System.Uri.EscapeDataString(gatewayId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1551,11 +1586,14 @@ internal GatewayOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.MinLength, "gatewayId", 1); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1566,7 +1604,6 @@ internal GatewayOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("gatewayId", gatewayId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListKeys", tracingParameters); } @@ -1578,9 +1615,9 @@ internal GatewayOperations(ApiManagementClient client) _url = _url.Replace("{gatewayId}", System.Uri.EscapeDataString(gatewayId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1788,10 +1825,6 @@ internal GatewayOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.MinLength, "gatewayId", 1); } } - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } if (parameters == null) { throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); @@ -1800,7 +1833,14 @@ internal GatewayOperations(ApiManagementClient client) { parameters.Validate(); } - string apiVersion = "2019-12-01"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1811,7 +1851,6 @@ internal GatewayOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("gatewayId", gatewayId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "RegenerateKey", tracingParameters); @@ -1824,9 +1863,9 @@ internal GatewayOperations(ApiManagementClient client) _url = _url.Replace("{gatewayId}", System.Uri.EscapeDataString(gatewayId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -2020,11 +2059,14 @@ internal GatewayOperations(ApiManagementClient client) { parameters.Validate(); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2036,7 +2078,6 @@ internal GatewayOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("gatewayId", gatewayId); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GenerateToken", tracingParameters); } @@ -2048,9 +2089,9 @@ internal GatewayOperations(ApiManagementClient client) _url = _url.Replace("{gatewayId}", System.Uri.EscapeDataString(gatewayId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/GatewayOperationsExtensions.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/GatewayOperationsExtensions.cs index 4a697667d6747..394006246c9c5 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/GatewayOperationsExtensions.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/GatewayOperationsExtensions.cs @@ -12,6 +12,7 @@ namespace Microsoft.Azure.Management.ApiManagement { using Microsoft.Rest; using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; using Models; using System.Threading; using System.Threading.Tasks; @@ -33,15 +34,12 @@ public static partial class GatewayOperationsExtensions /// /// The name of the API Management service. /// - /// - /// Number of records to return. + /// + /// OData parameters to apply to the operation. /// - /// - /// Number of records to skip. - /// - public static IPage ListByService(this IGatewayOperations operations, string resourceGroupName, string serviceName, int? top = default(int?), int? skip = default(int?)) + public static IPage ListByService(this IGatewayOperations operations, string resourceGroupName, string serviceName, ODataQuery odataQuery = default(ODataQuery)) { - return operations.ListByServiceAsync(resourceGroupName, serviceName, top, skip).GetAwaiter().GetResult(); + return operations.ListByServiceAsync(resourceGroupName, serviceName, odataQuery).GetAwaiter().GetResult(); } /// @@ -56,18 +54,15 @@ public static partial class GatewayOperationsExtensions /// /// The name of the API Management service. /// - /// - /// Number of records to return. - /// - /// - /// Number of records to skip. + /// + /// OData parameters to apply to the operation. /// /// /// The cancellation token. /// - public static async Task> ListByServiceAsync(this IGatewayOperations operations, string resourceGroupName, string serviceName, int? top = default(int?), int? skip = default(int?), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByServiceAsync(this IGatewayOperations operations, string resourceGroupName, string serviceName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByServiceWithHttpMessagesAsync(resourceGroupName, serviceName, top, skip, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByServiceWithHttpMessagesAsync(resourceGroupName, serviceName, odataQuery, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -254,9 +249,9 @@ public static GatewayContract Get(this IGatewayOperations operations, string res /// header response of the GET request or it should be * for unconditional /// update. /// - public static void Update(this IGatewayOperations operations, string resourceGroupName, string serviceName, string gatewayId, GatewayContract parameters, string ifMatch) + public static GatewayContract Update(this IGatewayOperations operations, string resourceGroupName, string serviceName, string gatewayId, GatewayContract parameters, string ifMatch) { - operations.UpdateAsync(resourceGroupName, serviceName, gatewayId, parameters, ifMatch).GetAwaiter().GetResult(); + return operations.UpdateAsync(resourceGroupName, serviceName, gatewayId, parameters, ifMatch).GetAwaiter().GetResult(); } /// @@ -285,9 +280,12 @@ public static void Update(this IGatewayOperations operations, string resourceGro /// /// The cancellation token. /// - public static async Task UpdateAsync(this IGatewayOperations operations, string resourceGroupName, string serviceName, string gatewayId, GatewayContract parameters, string ifMatch, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task UpdateAsync(this IGatewayOperations operations, string resourceGroupName, string serviceName, string gatewayId, GatewayContract parameters, string ifMatch, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.UpdateWithHttpMessagesAsync(resourceGroupName, serviceName, gatewayId, parameters, ifMatch, null, cancellationToken).ConfigureAwait(false)).Dispose(); + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, serviceName, gatewayId, parameters, ifMatch, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/GroupOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/GroupOperations.cs index f49c1dfa9a9ca..0694f1e70a061 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/GroupOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/GroupOperations.cs @@ -110,11 +110,14 @@ internal GroupOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -125,7 +128,6 @@ internal GroupOperations(ApiManagementClient client) tracingParameters.Add("odataQuery", odataQuery); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByService", tracingParameters); } @@ -144,9 +146,9 @@ internal GroupOperations(ApiManagementClient client) _queryParameters.Add(_odataFilter); } } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -340,11 +342,14 @@ internal GroupOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.MinLength, "groupId", 1); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -355,7 +360,6 @@ internal GroupOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("groupId", groupId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetEntityTag", tracingParameters); } @@ -367,9 +371,9 @@ internal GroupOperations(ApiManagementClient client) _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(groupId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -560,11 +564,14 @@ internal GroupOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.MinLength, "groupId", 1); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -575,7 +582,6 @@ internal GroupOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("groupId", groupId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -587,9 +593,9 @@ internal GroupOperations(ApiManagementClient client) _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(groupId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -813,11 +819,14 @@ internal GroupOperations(ApiManagementClient client) { parameters.Validate(); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -830,7 +839,6 @@ internal GroupOperations(ApiManagementClient client) tracingParameters.Add("groupId", groupId); tracingParameters.Add("parameters", parameters); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } @@ -842,9 +850,9 @@ internal GroupOperations(ApiManagementClient client) _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(groupId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1041,6 +1049,9 @@ internal GroupOperations(ApiManagementClient client) /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// @@ -1050,7 +1061,7 @@ internal GroupOperations(ApiManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string groupId, GroupUpdateParameters parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string groupId, GroupUpdateParameters parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -1098,11 +1109,14 @@ internal GroupOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1115,7 +1129,6 @@ internal GroupOperations(ApiManagementClient client) tracingParameters.Add("groupId", groupId); tracingParameters.Add("parameters", parameters); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); } @@ -1127,9 +1140,9 @@ internal GroupOperations(ApiManagementClient client) _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(groupId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1203,7 +1216,7 @@ internal GroupOperations(ApiManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 204) + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -1233,13 +1246,44 @@ internal GroupOperations(ApiManagementClient 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); + } + } + 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); @@ -1327,11 +1371,14 @@ internal GroupOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1343,7 +1390,6 @@ internal GroupOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("groupId", groupId); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } @@ -1355,9 +1401,9 @@ internal GroupOperations(ApiManagementClient client) _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(groupId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/GroupOperationsExtensions.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/GroupOperationsExtensions.cs index 2dae03ec35f6e..d06ef7d8d822e 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/GroupOperationsExtensions.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/GroupOperationsExtensions.cs @@ -254,9 +254,9 @@ public static GroupContract Get(this IGroupOperations operations, string resourc /// header response of the GET request or it should be * for unconditional /// update. /// - public static void Update(this IGroupOperations operations, string resourceGroupName, string serviceName, string groupId, GroupUpdateParameters parameters, string ifMatch) + public static GroupContract Update(this IGroupOperations operations, string resourceGroupName, string serviceName, string groupId, GroupUpdateParameters parameters, string ifMatch) { - operations.UpdateAsync(resourceGroupName, serviceName, groupId, parameters, ifMatch).GetAwaiter().GetResult(); + return operations.UpdateAsync(resourceGroupName, serviceName, groupId, parameters, ifMatch).GetAwaiter().GetResult(); } /// @@ -286,9 +286,12 @@ public static void Update(this IGroupOperations operations, string resourceGroup /// /// The cancellation token. /// - public static async Task UpdateAsync(this IGroupOperations operations, string resourceGroupName, string serviceName, string groupId, GroupUpdateParameters parameters, string ifMatch, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task UpdateAsync(this IGroupOperations operations, string resourceGroupName, string serviceName, string groupId, GroupUpdateParameters parameters, string ifMatch, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.UpdateWithHttpMessagesAsync(resourceGroupName, serviceName, groupId, parameters, ifMatch, null, cancellationToken).ConfigureAwait(false)).Dispose(); + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, serviceName, groupId, parameters, ifMatch, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/GroupUserOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/GroupUserOperations.cs index 84538e5d3e4ff..c0747d82bd554 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/GroupUserOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/GroupUserOperations.cs @@ -128,11 +128,14 @@ internal GroupUserOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.MinLength, "groupId", 1); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -144,7 +147,6 @@ internal GroupUserOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("groupId", groupId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } @@ -164,9 +166,9 @@ internal GroupUserOperations(ApiManagementClient client) _queryParameters.Add(_odataFilter); } } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -379,11 +381,14 @@ internal GroupUserOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.MinLength, "userId", 1); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -395,7 +400,6 @@ internal GroupUserOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("groupId", groupId); tracingParameters.Add("userId", userId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CheckEntityExists", tracingParameters); } @@ -408,9 +412,9 @@ internal GroupUserOperations(ApiManagementClient client) _url = _url.Replace("{userId}", System.Uri.EscapeDataString(userId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -608,11 +612,14 @@ internal GroupUserOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.MinLength, "userId", 1); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -624,7 +631,6 @@ internal GroupUserOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("groupId", groupId); tracingParameters.Add("userId", userId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); } @@ -637,9 +643,9 @@ internal GroupUserOperations(ApiManagementClient client) _url = _url.Replace("{userId}", System.Uri.EscapeDataString(userId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -869,11 +875,14 @@ internal GroupUserOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.MinLength, "userId", 1); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -885,7 +894,6 @@ internal GroupUserOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("groupId", groupId); tracingParameters.Add("userId", userId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } @@ -898,9 +906,9 @@ internal GroupUserOperations(ApiManagementClient client) _url = _url.Replace("{userId}", System.Uri.EscapeDataString(userId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IApiDiagnosticOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IApiDiagnosticOperations.cs index cb1588ad34efe..8a690d422a738 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IApiDiagnosticOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IApiDiagnosticOperations.cs @@ -196,10 +196,13 @@ public partial interface IApiDiagnosticOperations /// /// 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 serviceName, string apiId, string diagnosticId, DiagnosticContract parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string apiId, string diagnosticId, DiagnosticContract parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Deletes the specified Diagnostic from an API. /// diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IApiIssueOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IApiIssueOperations.cs index e8943bde687e5..f93e8a4aa4d2a 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IApiIssueOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IApiIssueOperations.cs @@ -201,10 +201,13 @@ public partial interface IApiIssueOperations /// /// 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 serviceName, string apiId, string issueId, IssueUpdateContract parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string apiId, string issueId, IssueUpdateContract parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Deletes the specified Issue from an API. /// diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IApiManagementClient.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IApiManagementClient.cs index ed6b29d6bd8f6..ffe68657f5a47 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IApiManagementClient.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IApiManagementClient.cs @@ -146,11 +146,6 @@ public partial interface IApiManagementClient : System.IDisposable /// IOperationOperations Operation { get; } - /// - /// Gets the IApiExportOperations. - /// - IApiExportOperations ApiExport { get; } - /// /// Gets the IApiVersionSetOperations. /// @@ -176,6 +171,21 @@ public partial interface IApiManagementClient : System.IDisposable /// ICertificateOperations Certificate { get; } + /// + /// Gets the IContentTypeOperations. + /// + IContentTypeOperations ContentType { get; } + + /// + /// Gets the IContentItemOperations. + /// + IContentItemOperations ContentItem { get; } + + /// + /// Gets the IDeletedServicesOperations. + /// + IDeletedServicesOperations DeletedServices { get; } + /// /// Gets the IApiManagementOperations. /// @@ -391,5 +401,10 @@ public partial interface IApiManagementClient : System.IDisposable /// IUserConfirmationPasswordOperations UserConfirmationPassword { get; } + /// + /// Gets the IApiExportOperations. + /// + IApiExportOperations ApiExport { get; } + } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IApiOperationOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IApiOperationOperations.cs index 16723838dc3d2..a35df8f262798 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IApiOperationOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IApiOperationOperations.cs @@ -203,10 +203,13 @@ public partial interface IApiOperationOperations /// /// 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 serviceName, string apiId, string operationId, OperationUpdateContract parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string apiId, string operationId, OperationUpdateContract parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Deletes the specified operation in the API. /// diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IApiOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IApiOperations.cs index 8912cc0f7c09b..6a4d83b7e7291 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IApiOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IApiOperations.cs @@ -186,10 +186,13 @@ public partial interface IApiOperations /// /// 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 serviceName, string apiId, ApiUpdateContract parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string apiId, ApiUpdateContract parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Deletes the specified API of the API Management service instance. /// diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IApiReleaseOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IApiReleaseOperations.cs index 89a362870dc8a..eedbfd5ef7fa0 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IApiReleaseOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IApiReleaseOperations.cs @@ -197,10 +197,13 @@ public partial interface IApiReleaseOperations /// /// 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 serviceName, string apiId, string releaseId, ApiReleaseContract parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string apiId, string releaseId, ApiReleaseContract parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Deletes the specified release in the API. /// diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IApiSchemaOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IApiSchemaOperations.cs index 36b04281fafe3..2489af713cecb 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IApiSchemaOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IApiSchemaOperations.cs @@ -38,11 +38,11 @@ public partial interface IApiSchemaOperations /// suffix where n is the revision number. /// /// - /// | Field | Usage | Supported operators | + /// | Field | Usage | Supported operators | /// Supported functions /// |</br>|-------------|-------------|-------------|-------------|</br>| /// contentType | filter | ge, le, eq, ne, gt, lt | substringof, - /// contains, startswith, endswith | </br> + /// contains, startswith, endswith |</br> /// /// /// Number of records to return. diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IApiVersionSetOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IApiVersionSetOperations.cs index 44dd8b1845f3d..fc56becca5e3b 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IApiVersionSetOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IApiVersionSetOperations.cs @@ -177,10 +177,13 @@ public partial interface IApiVersionSetOperations /// /// 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 serviceName, string versionSetId, ApiVersionSetUpdateParameters parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string versionSetId, ApiVersionSetUpdateParameters parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Deletes specific Api Version Set. /// diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IAuthorizationServerOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IAuthorizationServerOperations.cs index 95d05f9f40ffa..73a4e826067af 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IAuthorizationServerOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IAuthorizationServerOperations.cs @@ -174,10 +174,13 @@ public partial interface IAuthorizationServerOperations /// /// 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 serviceName, string authsid, AuthorizationServerUpdateContract parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string authsid, AuthorizationServerUpdateContract parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Deletes specific authorization server instance. /// @@ -235,7 +238,7 @@ public partial interface IAuthorizationServerOperations /// /// Thrown when a required parameter is null /// - Task> ListSecretsWithHttpMessagesAsync(string resourceGroupName, string serviceName, string authsid, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ListSecretsWithHttpMessagesAsync(string resourceGroupName, string serviceName, string authsid, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists a collection of authorization servers defined within a /// service instance. diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IBackendOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IBackendOperations.cs index 73af2d8d0cd28..9dc8e3dfb467b 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IBackendOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IBackendOperations.cs @@ -174,10 +174,13 @@ public partial interface IBackendOperations /// /// 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 serviceName, string backendId, BackendUpdateParameters parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string backendId, BackendUpdateParameters parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Deletes the specified backend. /// diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ICacheOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ICacheOperations.cs index 9e1aa0fa49dbf..0c793324c6f73 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ICacheOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ICacheOperations.cs @@ -179,10 +179,13 @@ public partial interface ICacheOperations /// /// 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 serviceName, string cacheId, CacheUpdateParameters parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string cacheId, CacheUpdateParameters parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Deletes specific Cache. /// diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IContentItemOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IContentItemOperations.cs new file mode 100644 index 0000000000000..670f6505a5127 --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IContentItemOperations.cs @@ -0,0 +1,204 @@ +// +// 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.ApiManagement +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ContentItemOperations operations. + /// + public partial interface IContentItemOperations + { + /// + /// Returns list of content items + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Content type identifier. + /// + /// + /// 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>> ListByServiceWithHttpMessagesAsync(string resourceGroupName, string serviceName, string contentTypeId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns content item metadata + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Content type identifier. + /// + /// + /// Content item identifier. + /// + /// + /// 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> GetEntityTagWithHttpMessagesAsync(string resourceGroupName, string serviceName, string contentTypeId, string contentItemId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns content item details + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Content type identifier. + /// + /// + /// Content item identifier. + /// + /// + /// 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 serviceName, string contentTypeId, string contentItemId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates new content item + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Content type identifier. + /// + /// + /// Content item identifier. + /// + /// + /// ETag of the Entity. Not required when creating an entity, but + /// required when updating an entity. + /// + /// + /// 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 serviceName, string contentTypeId, string contentItemId, string ifMatch = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Removes specified content item. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Content type identifier. + /// + /// + /// Content item identifier. + /// + /// + /// ETag of the Entity. ETag should match the current entity state from + /// the header response of the GET request or it should be * for + /// unconditional update. + /// + /// + /// 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 serviceName, string contentTypeId, string contentItemId, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns list of content items + /// + /// + /// 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>> ListByServiceNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IContentTypeOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IContentTypeOperations.cs new file mode 100644 index 0000000000000..808d09e27d40b --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IContentTypeOperations.cs @@ -0,0 +1,164 @@ +// +// 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.ApiManagement +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ContentTypeOperations operations. + /// + public partial interface IContentTypeOperations + { + /// + /// Returns list of content types + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// 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>> ListByServiceWithHttpMessagesAsync(string resourceGroupName, string serviceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets API Management content type details. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Content type identifier. + /// + /// + /// 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 serviceName, string contentTypeId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates or updates an Content Type. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Content type identifier. + /// + /// + /// ETag of the Entity. Not required when creating an entity, but + /// required when updating an entity. + /// + /// + /// 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 serviceName, string contentTypeId, string ifMatch = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Removes specified content type. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Content type identifier. + /// + /// + /// ETag of the Entity. ETag should match the current entity state from + /// the header response of the GET request or it should be * for + /// unconditional update. + /// + /// + /// 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 serviceName, string contentTypeId, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns list of content types + /// + /// + /// 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>> ListByServiceNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IDeletedServicesOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IDeletedServicesOperations.cs new file mode 100644 index 0000000000000..1f337017a7a05 --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IDeletedServicesOperations.cs @@ -0,0 +1,121 @@ +// +// 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.ApiManagement +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DeletedServicesOperations operations. + /// + public partial interface IDeletedServicesOperations + { + /// + /// Lists all soft-deleted services available for undelete for the + /// given 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>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get soft-deleted Api Management Service by name. + /// + /// + /// The name of the API Management service. + /// + /// + /// The location of the deleted API Management service. + /// + /// + /// 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> GetByNameWithHttpMessagesAsync(string serviceName, string location, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Purges Api Management Service (deletes it with no option to + /// undelete). + /// + /// + /// The name of the API Management service. + /// + /// + /// The location of the deleted API Management service. + /// + /// + /// 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> PurgeWithHttpMessagesAsync(string serviceName, string location, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists all soft-deleted services available for undelete for the + /// given 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>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IDiagnosticOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IDiagnosticOperations.cs index c2d8347411cc1..5aaa15833bd2a 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IDiagnosticOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IDiagnosticOperations.cs @@ -174,10 +174,13 @@ public partial interface IDiagnosticOperations /// /// 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 serviceName, string diagnosticId, DiagnosticContract parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string diagnosticId, DiagnosticContract parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Deletes the specified Diagnostic. /// diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IEmailTemplateOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IEmailTemplateOperations.cs index 91bd3a5a41d45..fd96a4136f07d 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IEmailTemplateOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IEmailTemplateOperations.cs @@ -24,7 +24,7 @@ namespace Microsoft.Azure.Management.ApiManagement public partial interface IEmailTemplateOperations { /// - /// Lists a collection of properties defined within a service instance. + /// Gets all email templates /// /// /// The name of the resource group. @@ -33,11 +33,11 @@ public partial interface IEmailTemplateOperations /// The name of the API Management service. /// /// - /// | Field | Usage | Supported operators | + /// | Field | Usage | Supported operators | /// Supported functions /// |</br>|-------------|-------------|-------------|-------------|</br>| /// name | filter | ge, le, eq, ne, gt, lt | substringof, contains, - /// startswith, endswith | </br> + /// startswith, endswith |</br> /// /// /// Number of records to return. @@ -181,7 +181,7 @@ public partial interface IEmailTemplateOperations /// Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string templateName, EmailTemplateUpdateParameters parameters, string ifMatch = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Updates the specific Email Template. + /// Updates API Management email template /// /// /// The name of the resource group. @@ -202,14 +202,14 @@ public partial interface IEmailTemplateOperations /// 'rejectDeveloperNotificationMessage', /// 'requestDeveloperNotificationMessage' /// - /// - /// Update parameters. - /// /// /// ETag of the Entity. ETag should match the current entity state from /// the header response of the GET request or it should be * for /// unconditional update. /// + /// + /// Update parameters. + /// /// /// The headers that will be added to request. /// @@ -219,10 +219,13 @@ public partial interface IEmailTemplateOperations /// /// 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 serviceName, string templateName, EmailTemplateUpdateParameters parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string templateName, string ifMatch, EmailTemplateUpdateParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Reset the Email Template to default template provided by the API /// Management service instance. @@ -265,7 +268,7 @@ public partial interface IEmailTemplateOperations /// Task DeleteWithHttpMessagesAsync(string resourceGroupName, string serviceName, string templateName, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Lists a collection of properties defined within a service instance. + /// Gets all email templates /// /// /// The NextLink from the previous successful call to List operation. diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IGatewayApiOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IGatewayApiOperations.cs index 6edd34e78f5a2..c1c8a256dc0aa 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IGatewayApiOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IGatewayApiOperations.cs @@ -12,6 +12,7 @@ namespace Microsoft.Azure.Management.ApiManagement { using Microsoft.Rest; using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; using Models; using System.Collections; using System.Collections.Generic; @@ -36,11 +37,8 @@ public partial interface IGatewayApiOperations /// Gateway entity identifier. Must be unique in the current API /// Management service instance. Must not have value 'managed' /// - /// - /// Number of records to return. - /// - /// - /// Number of records to skip. + /// + /// OData parameters to apply to the operation. /// /// /// The headers that will be added to request. @@ -57,7 +55,7 @@ public partial interface IGatewayApiOperations /// /// Thrown when a required parameter is null /// - Task>> ListByServiceWithHttpMessagesAsync(string resourceGroupName, string serviceName, string gatewayId, int? top = default(int?), int? skip = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByServiceWithHttpMessagesAsync(string resourceGroupName, string serviceName, string gatewayId, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Checks that API entity specified by identifier is associated with /// the Gateway entity. diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IGatewayHostnameConfigurationOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IGatewayHostnameConfigurationOperations.cs index c79db75bc5563..c7d71cf18a029 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IGatewayHostnameConfigurationOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IGatewayHostnameConfigurationOperations.cs @@ -12,6 +12,7 @@ namespace Microsoft.Azure.Management.ApiManagement { using Microsoft.Rest; using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; using Models; using System.Collections; using System.Collections.Generic; @@ -37,11 +38,8 @@ public partial interface IGatewayHostnameConfigurationOperations /// Gateway entity identifier. Must be unique in the current API /// Management service instance. Must not have value 'managed' /// - /// - /// Number of records to return. - /// - /// - /// Number of records to skip. + /// + /// OData parameters to apply to the operation. /// /// /// The headers that will be added to request. @@ -58,7 +56,7 @@ public partial interface IGatewayHostnameConfigurationOperations /// /// Thrown when a required parameter is null /// - Task>> ListByServiceWithHttpMessagesAsync(string resourceGroupName, string serviceName, string gatewayId, int? top = default(int?), int? skip = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByServiceWithHttpMessagesAsync(string resourceGroupName, string serviceName, string gatewayId, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Checks that hostname configuration entity specified by identifier /// exists for specified Gateway entity. @@ -91,8 +89,7 @@ public partial interface IGatewayHostnameConfigurationOperations /// Task> GetEntityTagWithHttpMessagesAsync(string resourceGroupName, string serviceName, string gatewayId, string hcId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets the details of the Gateway hostname configuration specified by - /// its identifier. + /// Get details of a hostname configuration /// /// /// The name of the resource group. @@ -143,6 +140,10 @@ public partial interface IGatewayHostnameConfigurationOperations /// /// /// + /// + /// ETag of the Entity. Not required when creating an entity, but + /// required when updating an entity. + /// /// /// The headers that will be added to request. /// @@ -158,7 +159,7 @@ public partial interface IGatewayHostnameConfigurationOperations /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string gatewayId, string hcId, GatewayHostnameConfigurationContract parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string gatewayId, string hcId, GatewayHostnameConfigurationContract parameters, string ifMatch = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Deletes the specified hostname configuration from the specified /// Gateway. @@ -177,6 +178,11 @@ public partial interface IGatewayHostnameConfigurationOperations /// Gateway hostname configuration identifier. Must be unique in the /// scope of parent Gateway entity. /// + /// + /// ETag of the Entity. ETag should match the current entity state from + /// the header response of the GET request or it should be * for + /// unconditional update. + /// /// /// The headers that will be added to request. /// @@ -189,7 +195,7 @@ public partial interface IGatewayHostnameConfigurationOperations /// /// Thrown when a required parameter is null /// - Task DeleteWithHttpMessagesAsync(string resourceGroupName, string serviceName, string gatewayId, string hcId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string serviceName, string gatewayId, string hcId, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists the collection of hostname configurations for the specified /// gateway. diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IGatewayOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IGatewayOperations.cs index 7a4df22ea6766..618e21b49fc6e 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IGatewayOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IGatewayOperations.cs @@ -12,6 +12,7 @@ namespace Microsoft.Azure.Management.ApiManagement { using Microsoft.Rest; using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; using Models; using System.Collections; using System.Collections.Generic; @@ -32,11 +33,8 @@ public partial interface IGatewayOperations /// /// The name of the API Management service. /// - /// - /// Number of records to return. - /// - /// - /// Number of records to skip. + /// + /// OData parameters to apply to the operation. /// /// /// The headers that will be added to request. @@ -53,7 +51,7 @@ public partial interface IGatewayOperations /// /// Thrown when a required parameter is null /// - Task>> ListByServiceWithHttpMessagesAsync(string resourceGroupName, string serviceName, int? top = default(int?), int? skip = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByServiceWithHttpMessagesAsync(string resourceGroupName, string serviceName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets the entity state (Etag) version of the Gateway specified by /// its identifier. @@ -174,10 +172,13 @@ public partial interface IGatewayOperations /// /// 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 serviceName, string gatewayId, GatewayContract parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string gatewayId, GatewayContract parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Deletes specific Gateway. /// diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IGroupOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IGroupOperations.cs index 2f661b326d49a..6f955a3167030 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IGroupOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IGroupOperations.cs @@ -175,10 +175,13 @@ public partial interface IGroupOperations /// /// 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 serviceName, string groupId, GroupUpdateParameters parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string groupId, GroupUpdateParameters parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Deletes specific group of the API Management service instance. /// diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IIdentityProviderOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IIdentityProviderOperations.cs index 021090af3731f..4bfcc4f850b00 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IIdentityProviderOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IIdentityProviderOperations.cs @@ -173,10 +173,13 @@ public partial interface IIdentityProviderOperations /// /// 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 serviceName, string identityProviderName, IdentityProviderUpdateParameters parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string identityProviderName, IdentityProviderUpdateParameters parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Deletes the specified identity provider configuration. /// @@ -236,7 +239,7 @@ public partial interface IIdentityProviderOperations /// /// Thrown when a required parameter is null /// - Task> ListSecretsWithHttpMessagesAsync(string resourceGroupName, string serviceName, string identityProviderName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ListSecretsWithHttpMessagesAsync(string resourceGroupName, string serviceName, string identityProviderName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists a collection of Identity Provider configured in the specified /// service instance. diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ILoggerOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ILoggerOperations.cs index e8e9e80537532..261db7a13f8fd 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ILoggerOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ILoggerOperations.cs @@ -175,10 +175,13 @@ public partial interface ILoggerOperations /// /// 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 serviceName, string loggerId, LoggerUpdateContract parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string loggerId, LoggerUpdateContract parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Deletes the specified logger. /// @@ -197,9 +200,6 @@ public partial interface ILoggerOperations /// the header response of the GET request or it should be * for /// unconditional update. /// - /// - /// Force deletion even if diagnostic is attached. - /// /// /// The headers that will be added to request. /// @@ -212,7 +212,7 @@ public partial interface ILoggerOperations /// /// Thrown when a required parameter is null /// - Task DeleteWithHttpMessagesAsync(string resourceGroupName, string serviceName, string loggerId, string ifMatch, bool? force = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string serviceName, string loggerId, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists a collection of loggers in the specified service instance. /// diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/INamedValueOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/INamedValueOperations.cs index b695f960bc379..b57ea1f936e54 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/INamedValueOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/INamedValueOperations.cs @@ -25,7 +25,7 @@ namespace Microsoft.Azure.Management.ApiManagement public partial interface INamedValueOperations { /// - /// Lists a collection of NamedValues defined within a service + /// Lists a collection of named values defined within a service /// instance. /// /// @@ -55,8 +55,8 @@ public partial interface INamedValueOperations /// Task>> ListByServiceWithHttpMessagesAsync(string resourceGroupName, string serviceName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets the entity state (Etag) version of the NamedValue specified by - /// its identifier. + /// Gets the entity state (Etag) version of the named value specified + /// by its identifier. /// /// /// The name of the resource group. @@ -81,7 +81,7 @@ public partial interface INamedValueOperations /// Task> GetEntityTagWithHttpMessagesAsync(string resourceGroupName, string serviceName, string namedValueId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets the details of the NamedValue specified by its identifier. + /// Gets the details of the named value specified by its identifier. /// /// /// The name of the resource group. @@ -109,7 +109,7 @@ public partial interface INamedValueOperations /// Task> GetWithHttpMessagesAsync(string resourceGroupName, string serviceName, string namedValueId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Creates or updates a NamedValue. + /// Creates or updates named value. /// /// /// The name of the resource group. @@ -144,7 +144,7 @@ public partial interface INamedValueOperations /// Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string namedValueId, NamedValueCreateContract parameters, string ifMatch = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Updates the specific NamedValue. + /// Updates the specific named value. /// /// /// The name of the resource group. @@ -180,7 +180,7 @@ public partial interface INamedValueOperations /// Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string namedValueId, NamedValueUpdateParameters parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Deletes specific NamedValue from the API Management service + /// Deletes specific named value from the API Management service /// instance. /// /// @@ -211,7 +211,7 @@ public partial interface INamedValueOperations /// Task DeleteWithHttpMessagesAsync(string resourceGroupName, string serviceName, string namedValueId, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets the secret value of the NamedValue. + /// Gets the secret of the named value specified by its identifier. /// /// /// The name of the resource group. @@ -237,9 +237,9 @@ public partial interface INamedValueOperations /// /// Thrown when a required parameter is null /// - Task> ListValueWithHttpMessagesAsync(string resourceGroupName, string serviceName, string namedValueId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ListValueWithHttpMessagesAsync(string resourceGroupName, string serviceName, string namedValueId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Creates or updates a NamedValue. + /// Creates or updates named value. /// /// /// The name of the resource group. @@ -274,7 +274,7 @@ public partial interface INamedValueOperations /// Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string namedValueId, NamedValueCreateContract parameters, string ifMatch = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Updates the specific NamedValue. + /// Updates the specific named value. /// /// /// The name of the resource group. @@ -310,7 +310,7 @@ public partial interface INamedValueOperations /// Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string namedValueId, NamedValueUpdateParameters parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Lists a collection of NamedValues defined within a service + /// Lists a collection of named values defined within a service /// instance. /// /// diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IOpenIdConnectProviderOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IOpenIdConnectProviderOperations.cs index 90ed33ed8fd6f..e91f228c52932 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IOpenIdConnectProviderOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IOpenIdConnectProviderOperations.cs @@ -79,7 +79,7 @@ public partial interface IOpenIdConnectProviderOperations /// Task> GetEntityTagWithHttpMessagesAsync(string resourceGroupName, string serviceName, string opid, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets specific OpenID Connect Provider. + /// Gets specific OpenID Connect Provider without secrets. /// /// /// The name of the resource group. @@ -170,10 +170,13 @@ public partial interface IOpenIdConnectProviderOperations /// /// 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 serviceName, string opid, OpenidConnectProviderUpdateContract parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string opid, OpenidConnectProviderUpdateContract parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Deletes specific OpenID Connect Provider of the API Management /// service instance. @@ -232,7 +235,7 @@ public partial interface IOpenIdConnectProviderOperations /// /// Thrown when a required parameter is null /// - Task> ListSecretsWithHttpMessagesAsync(string resourceGroupName, string serviceName, string opid, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ListSecretsWithHttpMessagesAsync(string resourceGroupName, string serviceName, string opid, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists of all the OpenId Connect Providers. /// diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IProductOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IProductOperations.cs index b26137e42470c..0f1a339acdb7e 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IProductOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IProductOperations.cs @@ -181,10 +181,13 @@ public partial interface IProductOperations /// /// 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 serviceName, string productId, ProductUpdateParameters parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string productId, ProductUpdateParameters parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Delete product. /// diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IQuotaByCounterKeysOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IQuotaByCounterKeysOperations.cs index ce516ed2b48a5..16477abfc65ab 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IQuotaByCounterKeysOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IQuotaByCounterKeysOperations.cs @@ -89,9 +89,12 @@ public partial interface IQuotaByCounterKeysOperations /// /// 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 serviceName, string quotaCounterKey, QuotaCounterValueUpdateContract parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string quotaCounterKey, QuotaCounterValueUpdateContract parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IQuotaByPeriodKeysOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IQuotaByPeriodKeysOperations.cs index 3f25e286111fd..39031e6348514 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IQuotaByPeriodKeysOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IQuotaByPeriodKeysOperations.cs @@ -93,9 +93,12 @@ public partial interface IQuotaByPeriodKeysOperations /// /// 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 serviceName, string quotaCounterKey, string quotaPeriodKey, QuotaCounterValueUpdateContract parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string quotaCounterKey, string quotaPeriodKey, QuotaCounterValueUpdateContract parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ISubscriptionOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ISubscriptionOperations.cs index e6bcee54fde41..7bdbc2099315b 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ISubscriptionOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ISubscriptionOperations.cs @@ -136,6 +136,11 @@ public partial interface ISubscriptionOperations /// ETag of the Entity. Not required when creating an entity, but /// required when updating an entity. /// + /// + /// Determines the type of application which send the create user + /// request. Default is legacy publisher portal. Possible values + /// include: 'portal', 'developerPortal' + /// /// /// The headers that will be added to request. /// @@ -151,7 +156,7 @@ public partial interface ISubscriptionOperations /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string sid, SubscriptionCreateParameters parameters, bool? notify = default(bool?), string ifMatch = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string sid, SubscriptionCreateParameters parameters, bool? notify = default(bool?), string ifMatch = default(string), string appType = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Updates the details of a subscription specified by its identifier. /// @@ -180,6 +185,11 @@ public partial interface ISubscriptionOperations /// - If true, send email notification of change of state of /// subscription /// + /// + /// Determines the type of application which send the create user + /// request. Default is legacy publisher portal. Possible values + /// include: 'portal', 'developerPortal' + /// /// /// The headers that will be added to request. /// @@ -189,10 +199,13 @@ public partial interface ISubscriptionOperations /// /// 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 serviceName, string sid, SubscriptionUpdateParameters parameters, string ifMatch, bool? notify = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string sid, SubscriptionUpdateParameters parameters, string ifMatch, bool? notify = default(bool?), string appType = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Deletes the specified subscription. /// @@ -279,7 +292,7 @@ public partial interface ISubscriptionOperations /// Task RegenerateSecondaryKeyWithHttpMessagesAsync(string resourceGroupName, string serviceName, string sid, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Gets the subscription keys. + /// Gets the specified Subscription keys. /// /// /// The name of the resource group. @@ -306,7 +319,7 @@ public partial interface ISubscriptionOperations /// /// Thrown when a required parameter is null /// - Task> ListSecretsWithHttpMessagesAsync(string resourceGroupName, string serviceName, string sid, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> ListSecretsWithHttpMessagesAsync(string resourceGroupName, string serviceName, string sid, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists all subscriptions of the API Management service instance. /// diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ITagOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ITagOperations.cs index 1a276d1654fbd..a28e67338f96f 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ITagOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ITagOperations.cs @@ -684,10 +684,13 @@ public partial interface ITagOperations /// /// 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 serviceName, string tagId, TagCreateUpdateParameters parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string tagId, TagCreateUpdateParameters parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Deletes specific tag of the API Management service instance. /// diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ITenantAccessOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ITenantAccessOperations.cs index 8b435ddc6dccc..9ad42ef8a56e8 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ITenantAccessOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ITenantAccessOperations.cs @@ -96,10 +96,13 @@ public partial interface ITenantAccessOperations /// /// 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 serviceName, AccessInformationUpdateParameters parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, AccessInformationUpdateParameters parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Regenerate primary access key /// diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IUserConfirmationPasswordOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IUserConfirmationPasswordOperations.cs index eaaaa43ad080a..a3bc34fe53410 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IUserConfirmationPasswordOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IUserConfirmationPasswordOperations.cs @@ -36,6 +36,11 @@ public partial interface IUserConfirmationPasswordOperations /// User identifier. Must be unique in the current API Management /// service instance. /// + /// + /// Determines the type of application which send the create user + /// request. Default is legacy publisher portal. Possible values + /// include: 'portal', 'developerPortal' + /// /// /// The headers that will be added to request. /// @@ -48,6 +53,6 @@ public partial interface IUserConfirmationPasswordOperations /// /// Thrown when a required parameter is null /// - Task SendWithHttpMessagesAsync(string resourceGroupName, string serviceName, string userId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task SendWithHttpMessagesAsync(string resourceGroupName, string serviceName, string userId, string appType = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IUserOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IUserOperations.cs index 09d9cd1bd1455..0826181cc25aa 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IUserOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IUserOperations.cs @@ -128,6 +128,9 @@ public partial interface IUserOperations /// /// Create or update parameters. /// + /// + /// Send an Email notification to the User. + /// /// /// ETag of the Entity. Not required when creating an entity, but /// required when updating an entity. @@ -147,7 +150,7 @@ public partial interface IUserOperations /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string userId, UserCreateParameters parameters, string ifMatch = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string userId, UserCreateParameters parameters, bool? notify = default(bool?), string ifMatch = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Updates the details of the user specified by its identifier. /// @@ -178,10 +181,13 @@ public partial interface IUserOperations /// /// 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 serviceName, string userId, UserUpdateParameters parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string userId, UserUpdateParameters parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Deletes specific user. /// @@ -206,6 +212,11 @@ public partial interface IUserOperations /// /// Send an Account Closed Email notification to the User. /// + /// + /// Determines the type of application which send the create user + /// request. Default is legacy publisher portal. Possible values + /// include: 'portal', 'developerPortal' + /// /// /// The headers that will be added to request. /// @@ -218,7 +229,7 @@ public partial interface IUserOperations /// /// Thrown when a required parameter is null /// - Task DeleteWithHttpMessagesAsync(string resourceGroupName, string serviceName, string userId, string ifMatch, bool? deleteSubscriptions = default(bool?), bool? notify = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string serviceName, string userId, string ifMatch, bool? deleteSubscriptions = default(bool?), bool? notify = default(bool?), string appType = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Retrieves a redirection URL containing an authentication token for /// signing a given user into the developer portal. diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IdentityProviderOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IdentityProviderOperations.cs index 9ffb3fad10a0b..8b22a027411c0 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IdentityProviderOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IdentityProviderOperations.cs @@ -107,11 +107,14 @@ internal IdentityProviderOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -121,7 +124,6 @@ internal IdentityProviderOperations(ApiManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByService", tracingParameters); } @@ -132,9 +134,9 @@ internal IdentityProviderOperations(ApiManagementClient client) _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -317,11 +319,14 @@ internal IdentityProviderOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "identityProviderName"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -332,7 +337,6 @@ internal IdentityProviderOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("identityProviderName", identityProviderName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetEntityTag", tracingParameters); } @@ -344,9 +348,9 @@ internal IdentityProviderOperations(ApiManagementClient client) _url = _url.Replace("{identityProviderName}", System.Uri.EscapeDataString(identityProviderName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -527,11 +531,14 @@ internal IdentityProviderOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "identityProviderName"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -542,7 +549,6 @@ internal IdentityProviderOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("identityProviderName", identityProviderName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -554,9 +560,9 @@ internal IdentityProviderOperations(ApiManagementClient client) _url = _url.Replace("{identityProviderName}", System.Uri.EscapeDataString(identityProviderName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -769,11 +775,14 @@ internal IdentityProviderOperations(ApiManagementClient client) { parameters.Validate(); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -786,7 +795,6 @@ internal IdentityProviderOperations(ApiManagementClient client) tracingParameters.Add("identityProviderName", identityProviderName); tracingParameters.Add("parameters", parameters); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } @@ -798,9 +806,9 @@ internal IdentityProviderOperations(ApiManagementClient client) _url = _url.Replace("{identityProviderName}", System.Uri.EscapeDataString(identityProviderName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -997,6 +1005,9 @@ internal IdentityProviderOperations(ApiManagementClient client) /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// @@ -1006,7 +1017,7 @@ internal IdentityProviderOperations(ApiManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string identityProviderName, IdentityProviderUpdateParameters parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string identityProviderName, IdentityProviderUpdateParameters parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -1043,11 +1054,14 @@ internal IdentityProviderOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1060,7 +1074,6 @@ internal IdentityProviderOperations(ApiManagementClient client) tracingParameters.Add("identityProviderName", identityProviderName); tracingParameters.Add("parameters", parameters); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); } @@ -1072,9 +1085,9 @@ internal IdentityProviderOperations(ApiManagementClient client) _url = _url.Replace("{identityProviderName}", System.Uri.EscapeDataString(identityProviderName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1148,7 +1161,7 @@ internal IdentityProviderOperations(ApiManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 204) + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -1178,13 +1191,44 @@ internal IdentityProviderOperations(ApiManagementClient 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); + } + } + 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); @@ -1261,11 +1305,14 @@ internal IdentityProviderOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1277,7 +1324,6 @@ internal IdentityProviderOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("identityProviderName", identityProviderName); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } @@ -1289,9 +1335,9 @@ internal IdentityProviderOperations(ApiManagementClient client) _url = _url.Replace("{identityProviderName}", System.Uri.EscapeDataString(identityProviderName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1437,7 +1483,7 @@ internal IdentityProviderOperations(ApiManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> ListSecretsWithHttpMessagesAsync(string resourceGroupName, string serviceName, string identityProviderName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ListSecretsWithHttpMessagesAsync(string resourceGroupName, string serviceName, string identityProviderName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -1466,11 +1512,14 @@ internal IdentityProviderOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "identityProviderName"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1481,7 +1530,6 @@ internal IdentityProviderOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("identityProviderName", identityProviderName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListSecrets", tracingParameters); } @@ -1493,9 +1541,9 @@ internal IdentityProviderOperations(ApiManagementClient client) _url = _url.Replace("{identityProviderName}", System.Uri.EscapeDataString(identityProviderName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1585,7 +1633,7 @@ internal IdentityProviderOperations(ApiManagementClient 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")) @@ -1610,6 +1658,19 @@ internal IdentityProviderOperations(ApiManagementClient 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/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IdentityProviderOperationsExtensions.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IdentityProviderOperationsExtensions.cs index e00fcf8085d63..213d3c3b88100 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IdentityProviderOperationsExtensions.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IdentityProviderOperationsExtensions.cs @@ -251,9 +251,9 @@ public static IdentityProviderContract Get(this IIdentityProviderOperations oper /// header response of the GET request or it should be * for unconditional /// update. /// - public static void Update(this IIdentityProviderOperations operations, string resourceGroupName, string serviceName, string identityProviderName, IdentityProviderUpdateParameters parameters, string ifMatch) + public static IdentityProviderContract Update(this IIdentityProviderOperations operations, string resourceGroupName, string serviceName, string identityProviderName, IdentityProviderUpdateParameters parameters, string ifMatch) { - operations.UpdateAsync(resourceGroupName, serviceName, identityProviderName, parameters, ifMatch).GetAwaiter().GetResult(); + return operations.UpdateAsync(resourceGroupName, serviceName, identityProviderName, parameters, ifMatch).GetAwaiter().GetResult(); } /// @@ -283,9 +283,12 @@ public static void Update(this IIdentityProviderOperations operations, string re /// /// The cancellation token. /// - public static async Task UpdateAsync(this IIdentityProviderOperations operations, string resourceGroupName, string serviceName, string identityProviderName, IdentityProviderUpdateParameters parameters, string ifMatch, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task UpdateAsync(this IIdentityProviderOperations operations, string resourceGroupName, string serviceName, string identityProviderName, IdentityProviderUpdateParameters parameters, string ifMatch, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.UpdateWithHttpMessagesAsync(resourceGroupName, serviceName, identityProviderName, parameters, ifMatch, null, cancellationToken).ConfigureAwait(false)).Dispose(); + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, serviceName, identityProviderName, parameters, ifMatch, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IssueOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IssueOperations.cs index 98864eeef5ff0..3a092a601fa51 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IssueOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IssueOperations.cs @@ -109,11 +109,14 @@ internal IssueOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -124,7 +127,6 @@ internal IssueOperations(ApiManagementClient client) tracingParameters.Add("odataQuery", odataQuery); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByService", tracingParameters); } @@ -143,9 +145,9 @@ internal IssueOperations(ApiManagementClient client) _queryParameters.Add(_odataFilter); } } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -345,11 +347,14 @@ internal IssueOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "issueId", "^[^*#&+:<>?]+$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -360,7 +365,6 @@ internal IssueOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("issueId", issueId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -372,9 +376,9 @@ internal IssueOperations(ApiManagementClient client) _url = _url.Replace("{issueId}", System.Uri.EscapeDataString(issueId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/LoggerOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/LoggerOperations.cs index 06a4e875962b9..57c27730014bf 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/LoggerOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/LoggerOperations.cs @@ -110,11 +110,14 @@ internal LoggerOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -125,7 +128,6 @@ internal LoggerOperations(ApiManagementClient client) tracingParameters.Add("odataQuery", odataQuery); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByService", tracingParameters); } @@ -144,9 +146,9 @@ internal LoggerOperations(ApiManagementClient client) _queryParameters.Add(_odataFilter); } } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -339,11 +341,14 @@ internal LoggerOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "loggerId", "^[^*#&+:<>?]+$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -354,7 +359,6 @@ internal LoggerOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("loggerId", loggerId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetEntityTag", tracingParameters); } @@ -366,9 +370,9 @@ internal LoggerOperations(ApiManagementClient client) _url = _url.Replace("{loggerId}", System.Uri.EscapeDataString(loggerId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -558,11 +562,14 @@ internal LoggerOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "loggerId", "^[^*#&+:<>?]+$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -573,7 +580,6 @@ internal LoggerOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("loggerId", loggerId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -585,9 +591,9 @@ internal LoggerOperations(ApiManagementClient client) _url = _url.Replace("{loggerId}", System.Uri.EscapeDataString(loggerId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -810,11 +816,14 @@ internal LoggerOperations(ApiManagementClient client) { parameters.Validate(); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -827,7 +836,6 @@ internal LoggerOperations(ApiManagementClient client) tracingParameters.Add("loggerId", loggerId); tracingParameters.Add("parameters", parameters); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } @@ -839,9 +847,9 @@ internal LoggerOperations(ApiManagementClient client) _url = _url.Replace("{loggerId}", System.Uri.EscapeDataString(loggerId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1037,6 +1045,9 @@ internal LoggerOperations(ApiManagementClient client) /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// @@ -1046,7 +1057,7 @@ internal LoggerOperations(ApiManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string loggerId, LoggerUpdateContract parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string loggerId, LoggerUpdateContract parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -1094,11 +1105,14 @@ internal LoggerOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1111,7 +1125,6 @@ internal LoggerOperations(ApiManagementClient client) tracingParameters.Add("loggerId", loggerId); tracingParameters.Add("parameters", parameters); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); } @@ -1123,9 +1136,9 @@ internal LoggerOperations(ApiManagementClient client) _url = _url.Replace("{loggerId}", System.Uri.EscapeDataString(loggerId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1199,7 +1212,7 @@ internal LoggerOperations(ApiManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 204) + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -1229,13 +1242,44 @@ internal LoggerOperations(ApiManagementClient 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); + } + } + 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); @@ -1260,9 +1304,6 @@ internal LoggerOperations(ApiManagementClient client) /// header response of the GET request or it should be * for unconditional /// update. /// - /// - /// Force deletion even if diagnostic is attached. - /// /// /// Headers that will be added to request. /// @@ -1281,7 +1322,7 @@ internal LoggerOperations(ApiManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string serviceName, string loggerId, string ifMatch, bool? force = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string serviceName, string loggerId, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -1325,11 +1366,14 @@ internal LoggerOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1341,8 +1385,6 @@ internal LoggerOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("loggerId", loggerId); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("force", force); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } @@ -1354,13 +1396,9 @@ internal LoggerOperations(ApiManagementClient client) _url = _url.Replace("{loggerId}", System.Uri.EscapeDataString(loggerId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (force != null) - { - _queryParameters.Add(string.Format("force={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(force, Client.SerializationSettings).Trim('"')))); - } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/LoggerOperationsExtensions.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/LoggerOperationsExtensions.cs index a2f83603eac6c..977c9aa67e5b8 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/LoggerOperationsExtensions.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/LoggerOperationsExtensions.cs @@ -247,9 +247,9 @@ public static LoggerContract Get(this ILoggerOperations operations, string resou /// header response of the GET request or it should be * for unconditional /// update. /// - public static void Update(this ILoggerOperations operations, string resourceGroupName, string serviceName, string loggerId, LoggerUpdateContract parameters, string ifMatch) + public static LoggerContract Update(this ILoggerOperations operations, string resourceGroupName, string serviceName, string loggerId, LoggerUpdateContract parameters, string ifMatch) { - operations.UpdateAsync(resourceGroupName, serviceName, loggerId, parameters, ifMatch).GetAwaiter().GetResult(); + return operations.UpdateAsync(resourceGroupName, serviceName, loggerId, parameters, ifMatch).GetAwaiter().GetResult(); } /// @@ -278,9 +278,12 @@ public static void Update(this ILoggerOperations operations, string resourceGrou /// /// The cancellation token. /// - public static async Task UpdateAsync(this ILoggerOperations operations, string resourceGroupName, string serviceName, string loggerId, LoggerUpdateContract parameters, string ifMatch, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task UpdateAsync(this ILoggerOperations operations, string resourceGroupName, string serviceName, string loggerId, LoggerUpdateContract parameters, string ifMatch, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.UpdateWithHttpMessagesAsync(resourceGroupName, serviceName, loggerId, parameters, ifMatch, null, cancellationToken).ConfigureAwait(false)).Dispose(); + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, serviceName, loggerId, parameters, ifMatch, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// @@ -303,12 +306,9 @@ public static void Update(this ILoggerOperations operations, string resourceGrou /// header response of the GET request or it should be * for unconditional /// update. /// - /// - /// Force deletion even if diagnostic is attached. - /// - public static void Delete(this ILoggerOperations operations, string resourceGroupName, string serviceName, string loggerId, string ifMatch, bool? force = default(bool?)) + public static void Delete(this ILoggerOperations operations, string resourceGroupName, string serviceName, string loggerId, string ifMatch) { - operations.DeleteAsync(resourceGroupName, serviceName, loggerId, ifMatch, force).GetAwaiter().GetResult(); + operations.DeleteAsync(resourceGroupName, serviceName, loggerId, ifMatch).GetAwaiter().GetResult(); } /// @@ -331,15 +331,12 @@ public static void Update(this ILoggerOperations operations, string resourceGrou /// header response of the GET request or it should be * for unconditional /// update. /// - /// - /// Force deletion even if diagnostic is attached. - /// /// /// The cancellation token. /// - public static async Task DeleteAsync(this ILoggerOperations operations, string resourceGroupName, string serviceName, string loggerId, string ifMatch, bool? force = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task DeleteAsync(this ILoggerOperations operations, string resourceGroupName, string serviceName, string loggerId, string ifMatch, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, serviceName, loggerId, ifMatch, force, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, serviceName, loggerId, ifMatch, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/AdditionalLocation.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/AdditionalLocation.cs index 429d0ca8ad786..bd8c57af87bb3 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/AdditionalLocation.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/AdditionalLocation.cs @@ -36,13 +36,17 @@ public AdditionalLocation() /// among Azure Data center regions. /// SKU properties of the API Management /// service. + /// A list of availability zones denoting where the + /// resource needs to come from. /// Public Static Load Balanced IP /// addresses of the API Management service in the additional location. - /// Available only for Basic, Standard and Premium SKU. + /// Available only for Basic, Standard, Premium and Isolated + /// SKU. /// Private Static Load Balanced IP /// addresses of the API Management service which is deployed in an /// Internal Virtual Network in a particular additional location. - /// Available only for Basic, Standard and Premium SKU. + /// Available only for Basic, Standard, Premium and Isolated + /// SKU. /// Virtual network /// configuration for the location. /// Gateway URL of the API Management @@ -50,10 +54,11 @@ public AdditionalLocation() /// Property only valid for an Api /// Management service deployed in multiple locations. This can be used /// to disable the gateway in this additional location. - public AdditionalLocation(string location, ApiManagementServiceSkuProperties sku, IList publicIPAddresses = default(IList), IList privateIPAddresses = default(IList), VirtualNetworkConfiguration virtualNetworkConfiguration = default(VirtualNetworkConfiguration), string gatewayRegionalUrl = default(string), bool? disableGateway = default(bool?)) + public AdditionalLocation(string location, ApiManagementServiceSkuProperties sku, IList zones = default(IList), IList publicIPAddresses = default(IList), IList privateIPAddresses = default(IList), VirtualNetworkConfiguration virtualNetworkConfiguration = default(VirtualNetworkConfiguration), string gatewayRegionalUrl = default(string), bool? disableGateway = default(bool?)) { Location = location; Sku = sku; + Zones = zones; PublicIPAddresses = publicIPAddresses; PrivateIPAddresses = privateIPAddresses; VirtualNetworkConfiguration = virtualNetworkConfiguration; @@ -80,10 +85,17 @@ public AdditionalLocation() [JsonProperty(PropertyName = "sku")] public ApiManagementServiceSkuProperties Sku { get; set; } + /// + /// Gets or sets a list of availability zones denoting where the + /// resource needs to come from. + /// + [JsonProperty(PropertyName = "zones")] + public IList Zones { get; set; } + /// /// Gets public Static Load Balanced IP addresses of the API Management /// service in the additional location. Available only for Basic, - /// Standard and Premium SKU. + /// Standard, Premium and Isolated SKU. /// [JsonProperty(PropertyName = "publicIPAddresses")] public IList PublicIPAddresses { get; private set; } @@ -92,7 +104,7 @@ public AdditionalLocation() /// Gets private Static Load Balanced IP addresses of the API /// Management service which is deployed in an Internal Virtual Network /// in a particular additional location. Available only for Basic, - /// Standard and Premium SKU. + /// Standard, Premium and Isolated SKU. /// [JsonProperty(PropertyName = "privateIPAddresses")] public IList PrivateIPAddresses { get; private set; } @@ -137,6 +149,10 @@ public virtual void Validate() { Sku.Validate(); } + if (VirtualNetworkConfiguration != null) + { + VirtualNetworkConfiguration.Validate(); + } } } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiContract.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiContract.cs index b1262826c0a55..c9ef93de9951e 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiContract.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiContract.cs @@ -235,6 +235,71 @@ public virtual void Validate() { throw new ValidationException(ValidationRules.CannotBeNull, "Path"); } + if (ApiRevision != null) + { + if (ApiRevision.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "ApiRevision", 100); + } + if (ApiRevision.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "ApiRevision", 1); + } + } + if (ApiVersion != null) + { + if (ApiVersion.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "ApiVersion", 100); + } + } + if (ApiRevisionDescription != null) + { + if (ApiRevisionDescription.Length > 256) + { + throw new ValidationException(ValidationRules.MaxLength, "ApiRevisionDescription", 256); + } + } + if (ApiVersionDescription != null) + { + if (ApiVersionDescription.Length > 256) + { + throw new ValidationException(ValidationRules.MaxLength, "ApiVersionDescription", 256); + } + } + if (DisplayName != null) + { + if (DisplayName.Length > 300) + { + throw new ValidationException(ValidationRules.MaxLength, "DisplayName", 300); + } + if (DisplayName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "DisplayName", 1); + } + } + if (ServiceUrl != null) + { + if (ServiceUrl.Length > 2000) + { + throw new ValidationException(ValidationRules.MaxLength, "ServiceUrl", 2000); + } + if (ServiceUrl.Length < 0) + { + throw new ValidationException(ValidationRules.MinLength, "ServiceUrl", 0); + } + } + if (Path != null) + { + if (Path.Length > 400) + { + throw new ValidationException(ValidationRules.MaxLength, "Path", 400); + } + if (Path.Length < 0) + { + throw new ValidationException(ValidationRules.MinLength, "Path", 0); + } + } } } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiContractProperties.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiContractProperties.cs index 420f8fe49c47d..abfb457626dd7 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiContractProperties.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiContractProperties.cs @@ -134,12 +134,46 @@ public ApiContractProperties() /// /// Thrown if validation fails /// - public virtual void Validate() + public override void Validate() { + base.Validate(); if (Path == null) { throw new ValidationException(ValidationRules.CannotBeNull, "Path"); } + if (DisplayName != null) + { + if (DisplayName.Length > 300) + { + throw new ValidationException(ValidationRules.MaxLength, "DisplayName", 300); + } + if (DisplayName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "DisplayName", 1); + } + } + if (ServiceUrl != null) + { + if (ServiceUrl.Length > 2000) + { + throw new ValidationException(ValidationRules.MaxLength, "ServiceUrl", 2000); + } + if (ServiceUrl.Length < 0) + { + throw new ValidationException(ValidationRules.MinLength, "ServiceUrl", 0); + } + } + if (Path != null) + { + if (Path.Length > 400) + { + throw new ValidationException(ValidationRules.MaxLength, "Path", 400); + } + if (Path.Length < 0) + { + throw new ValidationException(ValidationRules.MinLength, "Path", 0); + } + } } } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiCreateOrUpdateParameter.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiCreateOrUpdateParameter.cs index 56f2fed931b13..80b4ad63367b4 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiCreateOrUpdateParameter.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiCreateOrUpdateParameter.cs @@ -277,6 +277,71 @@ public virtual void Validate() { throw new ValidationException(ValidationRules.CannotBeNull, "Path"); } + if (ApiRevision != null) + { + if (ApiRevision.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "ApiRevision", 100); + } + if (ApiRevision.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "ApiRevision", 1); + } + } + if (ApiVersion != null) + { + if (ApiVersion.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "ApiVersion", 100); + } + } + if (ApiRevisionDescription != null) + { + if (ApiRevisionDescription.Length > 256) + { + throw new ValidationException(ValidationRules.MaxLength, "ApiRevisionDescription", 256); + } + } + if (ApiVersionDescription != null) + { + if (ApiVersionDescription.Length > 256) + { + throw new ValidationException(ValidationRules.MaxLength, "ApiVersionDescription", 256); + } + } + if (DisplayName != null) + { + if (DisplayName.Length > 300) + { + throw new ValidationException(ValidationRules.MaxLength, "DisplayName", 300); + } + if (DisplayName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "DisplayName", 1); + } + } + if (ServiceUrl != null) + { + if (ServiceUrl.Length > 2000) + { + throw new ValidationException(ValidationRules.MaxLength, "ServiceUrl", 2000); + } + if (ServiceUrl.Length < 0) + { + throw new ValidationException(ValidationRules.MinLength, "ServiceUrl", 0); + } + } + if (Path != null) + { + if (Path.Length > 400) + { + throw new ValidationException(ValidationRules.MaxLength, "Path", 400); + } + if (Path.Length < 0) + { + throw new ValidationException(ValidationRules.MinLength, "Path", 0); + } + } } } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiDiagnosticUpdateHeaders.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiDiagnosticUpdateHeaders.cs new file mode 100644 index 0000000000000..f39006614763a --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiDiagnosticUpdateHeaders.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.ApiManagement.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Update operation. + /// + public partial class ApiDiagnosticUpdateHeaders + { + /// + /// Initializes a new instance of the ApiDiagnosticUpdateHeaders class. + /// + public ApiDiagnosticUpdateHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ApiDiagnosticUpdateHeaders class. + /// + /// Current entity state version. Should be treated + /// as opaque and used to make conditional HTTP requests. + public ApiDiagnosticUpdateHeaders(string eTag = default(string)) + { + ETag = eTag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets current entity state version. Should be treated as + /// opaque and used to make conditional HTTP requests. + /// + [JsonProperty(PropertyName = "ETag")] + public string ETag { get; set; } + + } +} diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiEntityBaseContract.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiEntityBaseContract.cs index 440f615e2af77..3a36440534594 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiEntityBaseContract.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiEntityBaseContract.cs @@ -10,6 +10,7 @@ namespace Microsoft.Azure.Management.ApiManagement.Models { + using Microsoft.Rest; using Newtonsoft.Json; using System.Linq; @@ -152,5 +153,46 @@ public ApiEntityBaseContract() [JsonProperty(PropertyName = "subscriptionRequired")] public bool? SubscriptionRequired { get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ApiRevision != null) + { + if (ApiRevision.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "ApiRevision", 100); + } + if (ApiRevision.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "ApiRevision", 1); + } + } + if (ApiVersion != null) + { + if (ApiVersion.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "ApiVersion", 100); + } + } + if (ApiRevisionDescription != null) + { + if (ApiRevisionDescription.Length > 256) + { + throw new ValidationException(ValidationRules.MaxLength, "ApiRevisionDescription", 256); + } + } + if (ApiVersionDescription != null) + { + if (ApiVersionDescription.Length > 256) + { + throw new ValidationException(ValidationRules.MaxLength, "ApiVersionDescription", 256); + } + } + } } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiIssueUpdateHeaders.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiIssueUpdateHeaders.cs new file mode 100644 index 0000000000000..37ded5f49c09c --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiIssueUpdateHeaders.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.ApiManagement.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Update operation. + /// + public partial class ApiIssueUpdateHeaders + { + /// + /// Initializes a new instance of the ApiIssueUpdateHeaders class. + /// + public ApiIssueUpdateHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ApiIssueUpdateHeaders class. + /// + /// Current entity state version. Should be treated + /// as opaque and used to make conditional HTTP requests. + public ApiIssueUpdateHeaders(string eTag = default(string)) + { + ETag = eTag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets current entity state version. Should be treated as + /// opaque and used to make conditional HTTP requests. + /// + [JsonProperty(PropertyName = "ETag")] + public string ETag { get; set; } + + } +} diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiManagementServiceBaseProperties.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiManagementServiceBaseProperties.cs index 1a83eb9b2fde8..9c56553e638e6 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiManagementServiceBaseProperties.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiManagementServiceBaseProperties.cs @@ -10,6 +10,7 @@ namespace Microsoft.Azure.Management.ApiManagement.Models { + using Microsoft.Rest; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; @@ -61,11 +62,12 @@ public ApiManagementServiceBaseProperties() /// of the API Management service. /// Public Static Load Balanced IP /// addresses of the API Management service in Primary region. - /// Available only for Basic, Standard and Premium SKU. + /// Available only for Basic, Standard, Premium and Isolated + /// SKU. /// Private Static Load Balanced IP /// addresses of the API Management service in Primary region which is /// deployed in an Internal Virtual Network. Available only for Basic, - /// Standard and Premium SKU. + /// Standard, Premium and Isolated SKU. /// Virtual network /// configuration of the API Management service. /// Additional datacenter locations @@ -129,7 +131,10 @@ public ApiManagementServiceBaseProperties() /// values include: 'None', 'External', 'Internal' /// Control Plane Apis version /// constraint for the API Management service. - public ApiManagementServiceBaseProperties(string notificationSenderEmail = default(string), string provisioningState = default(string), string targetProvisioningState = default(string), System.DateTime? createdAtUtc = default(System.DateTime?), string gatewayUrl = default(string), string gatewayRegionalUrl = default(string), string portalUrl = default(string), string managementApiUrl = default(string), string scmUrl = default(string), string developerPortalUrl = default(string), IList hostnameConfigurations = default(IList), IList publicIPAddresses = default(IList), IList privateIPAddresses = default(IList), VirtualNetworkConfiguration virtualNetworkConfiguration = default(VirtualNetworkConfiguration), IList additionalLocations = default(IList), IDictionary customProperties = default(IDictionary), IList certificates = default(IList), bool? enableClientCertificate = default(bool?), bool? disableGateway = default(bool?), string virtualNetworkType = default(string), ApiVersionConstraint apiVersionConstraint = default(ApiVersionConstraint)) + /// Undelete Api Management Service if it was + /// previously soft-deleted. If this flag is specified and set to True + /// all other properties will be ignored. + public ApiManagementServiceBaseProperties(string notificationSenderEmail = default(string), string provisioningState = default(string), string targetProvisioningState = default(string), System.DateTime? createdAtUtc = default(System.DateTime?), string gatewayUrl = default(string), string gatewayRegionalUrl = default(string), string portalUrl = default(string), string managementApiUrl = default(string), string scmUrl = default(string), string developerPortalUrl = default(string), IList hostnameConfigurations = default(IList), IList publicIPAddresses = default(IList), IList privateIPAddresses = default(IList), VirtualNetworkConfiguration virtualNetworkConfiguration = default(VirtualNetworkConfiguration), IList additionalLocations = default(IList), IDictionary customProperties = default(IDictionary), IList certificates = default(IList), bool? enableClientCertificate = default(bool?), bool? disableGateway = default(bool?), string virtualNetworkType = default(string), ApiVersionConstraint apiVersionConstraint = default(ApiVersionConstraint), bool? restore = default(bool?)) { NotificationSenderEmail = notificationSenderEmail; ProvisioningState = provisioningState; @@ -152,6 +157,7 @@ public ApiManagementServiceBaseProperties() DisableGateway = disableGateway; VirtualNetworkType = virtualNetworkType; ApiVersionConstraint = apiVersionConstraint; + Restore = restore; CustomInit(); } @@ -236,8 +242,8 @@ public ApiManagementServiceBaseProperties() /// /// Gets public Static Load Balanced IP addresses of the API Management - /// service in Primary region. Available only for Basic, Standard and - /// Premium SKU. + /// service in Primary region. Available only for Basic, Standard, + /// Premium and Isolated SKU. /// [JsonProperty(PropertyName = "publicIPAddresses")] public IList PublicIPAddresses { get; private set; } @@ -245,8 +251,8 @@ public ApiManagementServiceBaseProperties() /// /// Gets private Static Load Balanced IP addresses of the API /// Management service in Primary region which is deployed in an - /// Internal Virtual Network. Available only for Basic, Standard and - /// Premium SKU. + /// Internal Virtual Network. Available only for Basic, Standard, + /// Premium and Isolated SKU. /// [JsonProperty(PropertyName = "privateIPAddresses")] public IList PrivateIPAddresses { get; private set; } @@ -353,5 +359,63 @@ public ApiManagementServiceBaseProperties() [JsonProperty(PropertyName = "apiVersionConstraint")] public ApiVersionConstraint ApiVersionConstraint { get; set; } + /// + /// Gets or sets undelete Api Management Service if it was previously + /// soft-deleted. If this flag is specified and set to True all other + /// properties will be ignored. + /// + [JsonProperty(PropertyName = "restore")] + public bool? Restore { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (NotificationSenderEmail != null) + { + if (NotificationSenderEmail.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "NotificationSenderEmail", 100); + } + } + if (HostnameConfigurations != null) + { + foreach (var element in HostnameConfigurations) + { + if (element != null) + { + element.Validate(); + } + } + } + if (VirtualNetworkConfiguration != null) + { + VirtualNetworkConfiguration.Validate(); + } + if (AdditionalLocations != null) + { + foreach (var element1 in AdditionalLocations) + { + if (element1 != null) + { + element1.Validate(); + } + } + } + if (Certificates != null) + { + foreach (var element2 in Certificates) + { + if (element2 != null) + { + element2.Validate(); + } + } + } + } } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiManagementServiceResource.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiManagementServiceResource.cs index fa1d11c616711..08d4384bb709a 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiManagementServiceResource.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiManagementServiceResource.cs @@ -74,11 +74,12 @@ public ApiManagementServiceResource() /// of the API Management service. /// Public Static Load Balanced IP /// addresses of the API Management service in Primary region. - /// Available only for Basic, Standard and Premium SKU. + /// Available only for Basic, Standard, Premium and Isolated + /// SKU. /// Private Static Load Balanced IP /// addresses of the API Management service in Primary region which is /// deployed in an Internal Virtual Network. Available only for Basic, - /// Standard and Premium SKU. + /// Standard, Premium and Isolated SKU. /// Virtual network /// configuration of the API Management service. /// Additional datacenter locations @@ -142,10 +143,15 @@ public ApiManagementServiceResource() /// values include: 'None', 'External', 'Internal' /// Control Plane Apis version /// constraint for the API Management service. + /// Undelete Api Management Service if it was + /// previously soft-deleted. If this flag is specified and set to True + /// all other properties will be ignored. /// Managed service identity of the Api /// Management service. /// ETag of the resource. - public ApiManagementServiceResource(string publisherEmail, string publisherName, ApiManagementServiceSkuProperties sku, string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string notificationSenderEmail = default(string), string provisioningState = default(string), string targetProvisioningState = default(string), System.DateTime? createdAtUtc = default(System.DateTime?), string gatewayUrl = default(string), string gatewayRegionalUrl = default(string), string portalUrl = default(string), string managementApiUrl = default(string), string scmUrl = default(string), string developerPortalUrl = default(string), IList hostnameConfigurations = default(IList), IList publicIPAddresses = default(IList), IList privateIPAddresses = default(IList), VirtualNetworkConfiguration virtualNetworkConfiguration = default(VirtualNetworkConfiguration), IList additionalLocations = default(IList), IDictionary customProperties = default(IDictionary), IList certificates = default(IList), bool? enableClientCertificate = default(bool?), bool? disableGateway = default(bool?), string virtualNetworkType = default(string), ApiVersionConstraint apiVersionConstraint = default(ApiVersionConstraint), ApiManagementServiceIdentity identity = default(ApiManagementServiceIdentity), string etag = default(string)) + /// A list of availability zones denoting where the + /// resource needs to come from. + public ApiManagementServiceResource(string publisherEmail, string publisherName, ApiManagementServiceSkuProperties sku, string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string notificationSenderEmail = default(string), string provisioningState = default(string), string targetProvisioningState = default(string), System.DateTime? createdAtUtc = default(System.DateTime?), string gatewayUrl = default(string), string gatewayRegionalUrl = default(string), string portalUrl = default(string), string managementApiUrl = default(string), string scmUrl = default(string), string developerPortalUrl = default(string), IList hostnameConfigurations = default(IList), IList publicIPAddresses = default(IList), IList privateIPAddresses = default(IList), VirtualNetworkConfiguration virtualNetworkConfiguration = default(VirtualNetworkConfiguration), IList additionalLocations = default(IList), IDictionary customProperties = default(IDictionary), IList certificates = default(IList), bool? enableClientCertificate = default(bool?), bool? disableGateway = default(bool?), string virtualNetworkType = default(string), ApiVersionConstraint apiVersionConstraint = default(ApiVersionConstraint), bool? restore = default(bool?), ApiManagementServiceIdentity identity = default(ApiManagementServiceIdentity), string etag = default(string), IList zones = default(IList)) : base(id, name, type, tags) { NotificationSenderEmail = notificationSenderEmail; @@ -169,12 +175,14 @@ public ApiManagementServiceResource() DisableGateway = disableGateway; VirtualNetworkType = virtualNetworkType; ApiVersionConstraint = apiVersionConstraint; + Restore = restore; PublisherEmail = publisherEmail; PublisherName = publisherName; Sku = sku; Identity = identity; Location = location; Etag = etag; + Zones = zones; CustomInit(); } @@ -259,8 +267,8 @@ public ApiManagementServiceResource() /// /// Gets public Static Load Balanced IP addresses of the API Management - /// service in Primary region. Available only for Basic, Standard and - /// Premium SKU. + /// service in Primary region. Available only for Basic, Standard, + /// Premium and Isolated SKU. /// [JsonProperty(PropertyName = "properties.publicIPAddresses")] public IList PublicIPAddresses { get; private set; } @@ -268,8 +276,8 @@ public ApiManagementServiceResource() /// /// Gets private Static Load Balanced IP addresses of the API /// Management service in Primary region which is deployed in an - /// Internal Virtual Network. Available only for Basic, Standard and - /// Premium SKU. + /// Internal Virtual Network. Available only for Basic, Standard, + /// Premium and Isolated SKU. /// [JsonProperty(PropertyName = "properties.privateIPAddresses")] public IList PrivateIPAddresses { get; private set; } @@ -376,6 +384,14 @@ public ApiManagementServiceResource() [JsonProperty(PropertyName = "properties.apiVersionConstraint")] public ApiVersionConstraint ApiVersionConstraint { get; set; } + /// + /// Gets or sets undelete Api Management Service if it was previously + /// soft-deleted. If this flag is specified and set to True all other + /// properties will be ignored. + /// + [JsonProperty(PropertyName = "properties.restore")] + public bool? Restore { get; set; } + /// /// Gets or sets publisher email. /// @@ -413,6 +429,13 @@ public ApiManagementServiceResource() [JsonProperty(PropertyName = "etag")] public string Etag { get; private set; } + /// + /// Gets or sets a list of availability zones denoting where the + /// resource needs to come from. + /// + [JsonProperty(PropertyName = "zones")] + public IList Zones { get; set; } + /// /// Validate the object. /// @@ -437,6 +460,13 @@ public virtual void Validate() { throw new ValidationException(ValidationRules.CannotBeNull, "Location"); } + if (NotificationSenderEmail != null) + { + if (NotificationSenderEmail.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "NotificationSenderEmail", 100); + } + } if (HostnameConfigurations != null) { foreach (var element in HostnameConfigurations) @@ -447,6 +477,10 @@ public virtual void Validate() } } } + if (VirtualNetworkConfiguration != null) + { + VirtualNetworkConfiguration.Validate(); + } if (AdditionalLocations != null) { foreach (var element1 in AdditionalLocations) @@ -467,6 +501,20 @@ public virtual void Validate() } } } + if (PublisherEmail != null) + { + if (PublisherEmail.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "PublisherEmail", 100); + } + } + if (PublisherName != null) + { + if (PublisherName.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "PublisherName", 100); + } + } if (Sku != null) { Sku.Validate(); diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiManagementServiceSkuProperties.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiManagementServiceSkuProperties.cs index 270eb09014717..aa90ae35ac8d9 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiManagementServiceSkuProperties.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiManagementServiceSkuProperties.cs @@ -33,7 +33,8 @@ public ApiManagementServiceSkuProperties() /// class. /// /// Name of the Sku. Possible values include: - /// 'Developer', 'Standard', 'Premium', 'Basic', 'Consumption' + /// 'Developer', 'Standard', 'Premium', 'Basic', 'Consumption', + /// 'Isolated' /// Capacity of the SKU (number of deployed /// units of the SKU). For Consumption SKU capacity must be specified /// as 0. @@ -51,7 +52,7 @@ public ApiManagementServiceSkuProperties(string name, int capacity) /// /// Gets or sets name of the Sku. Possible values include: 'Developer', - /// 'Standard', 'Premium', 'Basic', 'Consumption' + /// 'Standard', 'Premium', 'Basic', 'Consumption', 'Isolated' /// [JsonProperty(PropertyName = "name")] public string Name { get; set; } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiManagementServiceUpdateParameters.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiManagementServiceUpdateParameters.cs index 9d4cdeda2abf7..47145e4df0a85 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiManagementServiceUpdateParameters.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiManagementServiceUpdateParameters.cs @@ -69,11 +69,12 @@ public ApiManagementServiceUpdateParameters() /// of the API Management service. /// Public Static Load Balanced IP /// addresses of the API Management service in Primary region. - /// Available only for Basic, Standard and Premium SKU. + /// Available only for Basic, Standard, Premium and Isolated + /// SKU. /// Private Static Load Balanced IP /// addresses of the API Management service in Primary region which is /// deployed in an Internal Virtual Network. Available only for Basic, - /// Standard and Premium SKU. + /// Standard, Premium and Isolated SKU. /// Virtual network /// configuration of the API Management service. /// Additional datacenter locations @@ -137,6 +138,9 @@ public ApiManagementServiceUpdateParameters() /// values include: 'None', 'External', 'Internal' /// Control Plane Apis version /// constraint for the API Management service. + /// Undelete Api Management Service if it was + /// previously soft-deleted. If this flag is specified and set to True + /// all other properties will be ignored. /// Publisher email. /// Publisher name. /// SKU properties of the API Management @@ -144,7 +148,7 @@ public ApiManagementServiceUpdateParameters() /// Managed service identity of the Api /// Management service. /// ETag of the resource. - public ApiManagementServiceUpdateParameters(string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string notificationSenderEmail = default(string), string provisioningState = default(string), string targetProvisioningState = default(string), System.DateTime? createdAtUtc = default(System.DateTime?), string gatewayUrl = default(string), string gatewayRegionalUrl = default(string), string portalUrl = default(string), string managementApiUrl = default(string), string scmUrl = default(string), string developerPortalUrl = default(string), IList hostnameConfigurations = default(IList), IList publicIPAddresses = default(IList), IList privateIPAddresses = default(IList), VirtualNetworkConfiguration virtualNetworkConfiguration = default(VirtualNetworkConfiguration), IList additionalLocations = default(IList), IDictionary customProperties = default(IDictionary), IList certificates = default(IList), bool? enableClientCertificate = default(bool?), bool? disableGateway = default(bool?), string virtualNetworkType = default(string), ApiVersionConstraint apiVersionConstraint = default(ApiVersionConstraint), string publisherEmail = default(string), string publisherName = default(string), ApiManagementServiceSkuProperties sku = default(ApiManagementServiceSkuProperties), ApiManagementServiceIdentity identity = default(ApiManagementServiceIdentity), string etag = default(string)) + public ApiManagementServiceUpdateParameters(string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string notificationSenderEmail = default(string), string provisioningState = default(string), string targetProvisioningState = default(string), System.DateTime? createdAtUtc = default(System.DateTime?), string gatewayUrl = default(string), string gatewayRegionalUrl = default(string), string portalUrl = default(string), string managementApiUrl = default(string), string scmUrl = default(string), string developerPortalUrl = default(string), IList hostnameConfigurations = default(IList), IList publicIPAddresses = default(IList), IList privateIPAddresses = default(IList), VirtualNetworkConfiguration virtualNetworkConfiguration = default(VirtualNetworkConfiguration), IList additionalLocations = default(IList), IDictionary customProperties = default(IDictionary), IList certificates = default(IList), bool? enableClientCertificate = default(bool?), bool? disableGateway = default(bool?), string virtualNetworkType = default(string), ApiVersionConstraint apiVersionConstraint = default(ApiVersionConstraint), bool? restore = default(bool?), string publisherEmail = default(string), string publisherName = default(string), ApiManagementServiceSkuProperties sku = default(ApiManagementServiceSkuProperties), ApiManagementServiceIdentity identity = default(ApiManagementServiceIdentity), string etag = default(string)) : base(id, name, type, tags) { NotificationSenderEmail = notificationSenderEmail; @@ -168,6 +172,7 @@ public ApiManagementServiceUpdateParameters() DisableGateway = disableGateway; VirtualNetworkType = virtualNetworkType; ApiVersionConstraint = apiVersionConstraint; + Restore = restore; PublisherEmail = publisherEmail; PublisherName = publisherName; Sku = sku; @@ -257,8 +262,8 @@ public ApiManagementServiceUpdateParameters() /// /// Gets public Static Load Balanced IP addresses of the API Management - /// service in Primary region. Available only for Basic, Standard and - /// Premium SKU. + /// service in Primary region. Available only for Basic, Standard, + /// Premium and Isolated SKU. /// [JsonProperty(PropertyName = "properties.publicIPAddresses")] public IList PublicIPAddresses { get; private set; } @@ -266,8 +271,8 @@ public ApiManagementServiceUpdateParameters() /// /// Gets private Static Load Balanced IP addresses of the API /// Management service in Primary region which is deployed in an - /// Internal Virtual Network. Available only for Basic, Standard and - /// Premium SKU. + /// Internal Virtual Network. Available only for Basic, Standard, + /// Premium and Isolated SKU. /// [JsonProperty(PropertyName = "properties.privateIPAddresses")] public IList PrivateIPAddresses { get; private set; } @@ -374,6 +379,14 @@ public ApiManagementServiceUpdateParameters() [JsonProperty(PropertyName = "properties.apiVersionConstraint")] public ApiVersionConstraint ApiVersionConstraint { get; set; } + /// + /// Gets or sets undelete Api Management Service if it was previously + /// soft-deleted. If this flag is specified and set to True all other + /// properties will be ignored. + /// + [JsonProperty(PropertyName = "properties.restore")] + public bool? Restore { get; set; } + /// /// Gets or sets publisher email. /// @@ -413,6 +426,13 @@ public ApiManagementServiceUpdateParameters() /// public virtual void Validate() { + if (NotificationSenderEmail != null) + { + if (NotificationSenderEmail.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "NotificationSenderEmail", 100); + } + } if (HostnameConfigurations != null) { foreach (var element in HostnameConfigurations) @@ -423,6 +443,10 @@ public virtual void Validate() } } } + if (VirtualNetworkConfiguration != null) + { + VirtualNetworkConfiguration.Validate(); + } if (AdditionalLocations != null) { foreach (var element1 in AdditionalLocations) @@ -443,6 +467,20 @@ public virtual void Validate() } } } + if (PublisherEmail != null) + { + if (PublisherEmail.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "PublisherEmail", 100); + } + } + if (PublisherName != null) + { + if (PublisherName.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "PublisherName", 100); + } + } if (Sku != null) { Sku.Validate(); diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiOperationUpdateHeaders.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiOperationUpdateHeaders.cs new file mode 100644 index 0000000000000..261077a010083 --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiOperationUpdateHeaders.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.ApiManagement.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Update operation. + /// + public partial class ApiOperationUpdateHeaders + { + /// + /// Initializes a new instance of the ApiOperationUpdateHeaders class. + /// + public ApiOperationUpdateHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ApiOperationUpdateHeaders class. + /// + /// Current entity state version. Should be treated + /// as opaque and used to make conditional HTTP requests. + public ApiOperationUpdateHeaders(string eTag = default(string)) + { + ETag = eTag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets current entity state version. Should be treated as + /// opaque and used to make conditional HTTP requests. + /// + [JsonProperty(PropertyName = "ETag")] + public string ETag { get; set; } + + } +} diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiReleaseUpdateHeaders.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiReleaseUpdateHeaders.cs new file mode 100644 index 0000000000000..6a2d7cdc1d421 --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiReleaseUpdateHeaders.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.ApiManagement.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Update operation. + /// + public partial class ApiReleaseUpdateHeaders + { + /// + /// Initializes a new instance of the ApiReleaseUpdateHeaders class. + /// + public ApiReleaseUpdateHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ApiReleaseUpdateHeaders class. + /// + /// Current entity state version. Should be treated + /// as opaque and used to make conditional HTTP requests. + public ApiReleaseUpdateHeaders(string eTag = default(string)) + { + ETag = eTag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets current entity state version. Should be treated as + /// opaque and used to make conditional HTTP requests. + /// + [JsonProperty(PropertyName = "ETag")] + public string ETag { get; set; } + + } +} diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiRevisionContract.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiRevisionContract.cs index e5ac8262c268c..558e09cdf1074 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiRevisionContract.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiRevisionContract.cs @@ -10,6 +10,7 @@ namespace Microsoft.Azure.Management.ApiManagement.Models { + using Microsoft.Rest; using Newtonsoft.Json; using System.Linq; @@ -114,5 +115,32 @@ public ApiRevisionContract() [JsonProperty(PropertyName = "isCurrent")] public bool? IsCurrent { get; private set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ApiRevision != null) + { + if (ApiRevision.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "ApiRevision", 100); + } + if (ApiRevision.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "ApiRevision", 1); + } + } + if (Description != null) + { + if (Description.Length > 256) + { + throw new ValidationException(ValidationRules.MaxLength, "Description", 256); + } + } + } } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiRevisionInfoContract.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiRevisionInfoContract.cs index 881082a07bd39..bdbb3c21c2d7f 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiRevisionInfoContract.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiRevisionInfoContract.cs @@ -10,6 +10,7 @@ namespace Microsoft.Azure.Management.ApiManagement.Models { + using Microsoft.Rest; using Newtonsoft.Json; using System.Linq; @@ -76,5 +77,28 @@ public ApiRevisionInfoContract() [JsonProperty(PropertyName = "apiVersionSet")] public ApiVersionSetContractDetails ApiVersionSet { get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ApiVersionName != null) + { + if (ApiVersionName.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "ApiVersionName", 100); + } + } + if (ApiRevisionDescription != null) + { + if (ApiRevisionDescription.Length > 256) + { + throw new ValidationException(ValidationRules.MaxLength, "ApiRevisionDescription", 256); + } + } + } } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiTagResourceContractProperties.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiTagResourceContractProperties.cs index b989f3f9ed29e..eb956160cc204 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiTagResourceContractProperties.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiTagResourceContractProperties.cs @@ -10,6 +10,7 @@ namespace Microsoft.Azure.Management.ApiManagement.Models { + using Microsoft.Rest; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; @@ -119,5 +120,48 @@ public ApiTagResourceContractProperties() [JsonProperty(PropertyName = "protocols")] public IList Protocols { get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (Name != null) + { + if (Name.Length > 300) + { + throw new ValidationException(ValidationRules.MaxLength, "Name", 300); + } + if (Name.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Name", 1); + } + } + if (ServiceUrl != null) + { + if (ServiceUrl.Length > 2000) + { + throw new ValidationException(ValidationRules.MaxLength, "ServiceUrl", 2000); + } + if (ServiceUrl.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "ServiceUrl", 1); + } + } + if (Path != null) + { + if (Path.Length > 400) + { + throw new ValidationException(ValidationRules.MaxLength, "Path", 400); + } + if (Path.Length < 0) + { + throw new ValidationException(ValidationRules.MinLength, "Path", 0); + } + } + } } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiUpdateContract.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiUpdateContract.cs index 05f8f789c6ecc..7701cc20b045c 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiUpdateContract.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiUpdateContract.cs @@ -200,5 +200,79 @@ public ApiUpdateContract() [JsonProperty(PropertyName = "properties.protocols")] public IList Protocols { get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ApiRevision != null) + { + if (ApiRevision.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "ApiRevision", 100); + } + if (ApiRevision.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "ApiRevision", 1); + } + } + if (ApiVersion != null) + { + if (ApiVersion.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "ApiVersion", 100); + } + } + if (ApiRevisionDescription != null) + { + if (ApiRevisionDescription.Length > 256) + { + throw new ValidationException(ValidationRules.MaxLength, "ApiRevisionDescription", 256); + } + } + if (ApiVersionDescription != null) + { + if (ApiVersionDescription.Length > 256) + { + throw new ValidationException(ValidationRules.MaxLength, "ApiVersionDescription", 256); + } + } + if (DisplayName != null) + { + if (DisplayName.Length > 300) + { + throw new ValidationException(ValidationRules.MaxLength, "DisplayName", 300); + } + if (DisplayName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "DisplayName", 1); + } + } + if (ServiceUrl != null) + { + if (ServiceUrl.Length > 2000) + { + throw new ValidationException(ValidationRules.MaxLength, "ServiceUrl", 2000); + } + if (ServiceUrl.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "ServiceUrl", 1); + } + } + if (Path != null) + { + if (Path.Length > 400) + { + throw new ValidationException(ValidationRules.MaxLength, "Path", 400); + } + if (Path.Length < 0) + { + throw new ValidationException(ValidationRules.MinLength, "Path", 0); + } + } + } } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiUpdateHeaders.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiUpdateHeaders.cs new file mode 100644 index 0000000000000..72b2812f190e6 --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiUpdateHeaders.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.ApiManagement.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Update operation. + /// + public partial class ApiUpdateHeaders + { + /// + /// Initializes a new instance of the ApiUpdateHeaders class. + /// + public ApiUpdateHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ApiUpdateHeaders class. + /// + /// Current entity state version. Should be treated + /// as opaque and used to make conditional HTTP requests. + public ApiUpdateHeaders(string eTag = default(string)) + { + ETag = eTag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets current entity state version. Should be treated as + /// opaque and used to make conditional HTTP requests. + /// + [JsonProperty(PropertyName = "ETag")] + public string ETag { get; set; } + + } +} diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiVersionSetContract.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiVersionSetContract.cs index 031d058484e1f..e541b2665f660 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiVersionSetContract.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiVersionSetContract.cs @@ -113,6 +113,39 @@ public virtual void Validate() { throw new ValidationException(ValidationRules.CannotBeNull, "VersioningScheme"); } + if (VersionQueryName != null) + { + if (VersionQueryName.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "VersionQueryName", 100); + } + if (VersionQueryName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "VersionQueryName", 1); + } + } + if (VersionHeaderName != null) + { + if (VersionHeaderName.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "VersionHeaderName", 100); + } + if (VersionHeaderName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "VersionHeaderName", 1); + } + } + if (DisplayName != null) + { + if (DisplayName.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "DisplayName", 100); + } + if (DisplayName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "DisplayName", 1); + } + } } } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiVersionSetEntityBase.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiVersionSetEntityBase.cs index 2caff1909a9fb..ae233adb00adc 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiVersionSetEntityBase.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiVersionSetEntityBase.cs @@ -10,6 +10,7 @@ namespace Microsoft.Azure.Management.ApiManagement.Models { + using Microsoft.Rest; using Newtonsoft.Json; using System.Linq; @@ -69,5 +70,36 @@ public ApiVersionSetEntityBase() [JsonProperty(PropertyName = "versionHeaderName")] public string VersionHeaderName { get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (VersionQueryName != null) + { + if (VersionQueryName.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "VersionQueryName", 100); + } + if (VersionQueryName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "VersionQueryName", 1); + } + } + if (VersionHeaderName != null) + { + if (VersionHeaderName.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "VersionHeaderName", 100); + } + if (VersionHeaderName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "VersionHeaderName", 1); + } + } + } } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiVersionSetUpdateHeaders.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiVersionSetUpdateHeaders.cs new file mode 100644 index 0000000000000..8dcdcece6ab4a --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiVersionSetUpdateHeaders.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.ApiManagement.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Update operation. + /// + public partial class ApiVersionSetUpdateHeaders + { + /// + /// Initializes a new instance of the ApiVersionSetUpdateHeaders class. + /// + public ApiVersionSetUpdateHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ApiVersionSetUpdateHeaders class. + /// + /// Current entity state version. Should be treated + /// as opaque and used to make conditional HTTP requests. + public ApiVersionSetUpdateHeaders(string eTag = default(string)) + { + ETag = eTag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets current entity state version. Should be treated as + /// opaque and used to make conditional HTTP requests. + /// + [JsonProperty(PropertyName = "ETag")] + public string ETag { get; set; } + + } +} diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiVersionSetUpdateParameters.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiVersionSetUpdateParameters.cs index 6a7fa044e092b..46d670da090fc 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiVersionSetUpdateParameters.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiVersionSetUpdateParameters.cs @@ -94,5 +94,47 @@ public ApiVersionSetUpdateParameters() [JsonProperty(PropertyName = "properties.versioningScheme")] public string VersioningScheme { get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (VersionQueryName != null) + { + if (VersionQueryName.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "VersionQueryName", 100); + } + if (VersionQueryName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "VersionQueryName", 1); + } + } + if (VersionHeaderName != null) + { + if (VersionHeaderName.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "VersionHeaderName", 100); + } + if (VersionHeaderName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "VersionHeaderName", 1); + } + } + if (DisplayName != null) + { + if (DisplayName.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "DisplayName", 100); + } + if (DisplayName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "DisplayName", 1); + } + } + } } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/AppType.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/AppType.cs index acdce32552aad..306cde695bccf 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/AppType.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/AppType.cs @@ -16,6 +16,10 @@ namespace Microsoft.Azure.Management.ApiManagement.Models /// public static class AppType { + /// + /// User create request was sent by legacy developer portal. + /// + public const string Portal = "portal"; /// /// User create request was sent by new developer portal. /// diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/AuthorizationServerContract.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/AuthorizationServerContract.cs index 90fba4689c75a..f239f764153e3 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/AuthorizationServerContract.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/AuthorizationServerContract.cs @@ -276,6 +276,17 @@ public virtual void Validate() } } } + if (DisplayName != null) + { + if (DisplayName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "DisplayName", 50); + } + if (DisplayName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "DisplayName", 1); + } + } } } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/AuthorizationServerListSecretsHeaders.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/AuthorizationServerListSecretsHeaders.cs new file mode 100644 index 0000000000000..af67cf4ff2f14 --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/AuthorizationServerListSecretsHeaders.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.ApiManagement.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for ListSecrets operation. + /// + public partial class AuthorizationServerListSecretsHeaders + { + /// + /// Initializes a new instance of the + /// AuthorizationServerListSecretsHeaders class. + /// + public AuthorizationServerListSecretsHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// AuthorizationServerListSecretsHeaders class. + /// + /// Current entity state version. Should be treated + /// as opaque and used to make conditional HTTP requests. + public AuthorizationServerListSecretsHeaders(string eTag = default(string)) + { + ETag = eTag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets current entity state version. Should be treated as + /// opaque and used to make conditional HTTP requests. + /// + [JsonProperty(PropertyName = "ETag")] + public string ETag { get; set; } + + } +} diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/AuthorizationServerSecretsContract.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/AuthorizationServerSecretsContract.cs new file mode 100644 index 0000000000000..fa768c05a9e40 --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/AuthorizationServerSecretsContract.cs @@ -0,0 +1,78 @@ +// +// 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.ApiManagement.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// OAuth Server Secrets Contract. + /// + public partial class AuthorizationServerSecretsContract + { + /// + /// Initializes a new instance of the + /// AuthorizationServerSecretsContract class. + /// + public AuthorizationServerSecretsContract() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// AuthorizationServerSecretsContract class. + /// + /// oAuth Authorization Server + /// Secrets. + /// Can be optionally specified + /// when resource owner password grant type is supported by this + /// authorization server. Default resource owner username. + /// Can be optionally specified + /// when resource owner password grant type is supported by this + /// authorization server. Default resource owner password. + public AuthorizationServerSecretsContract(string clientSecret = default(string), string resourceOwnerUsername = default(string), string resourceOwnerPassword = default(string)) + { + ClientSecret = clientSecret; + ResourceOwnerUsername = resourceOwnerUsername; + ResourceOwnerPassword = resourceOwnerPassword; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets oAuth Authorization Server Secrets. + /// + [JsonProperty(PropertyName = "clientSecret")] + public string ClientSecret { get; set; } + + /// + /// Gets or sets can be optionally specified when resource owner + /// password grant type is supported by this authorization server. + /// Default resource owner username. + /// + [JsonProperty(PropertyName = "resourceOwnerUsername")] + public string ResourceOwnerUsername { get; set; } + + /// + /// Gets or sets can be optionally specified when resource owner + /// password grant type is supported by this authorization server. + /// Default resource owner password. + /// + [JsonProperty(PropertyName = "resourceOwnerPassword")] + public string ResourceOwnerPassword { get; set; } + + } +} diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/AuthorizationServerUpdateContract.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/AuthorizationServerUpdateContract.cs index 2dedeacee8482..6ccf6044d68d1 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/AuthorizationServerUpdateContract.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/AuthorizationServerUpdateContract.cs @@ -238,5 +238,35 @@ public AuthorizationServerUpdateContract() [JsonProperty(PropertyName = "properties.clientSecret")] public string ClientSecret { get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (TokenBodyParameters != null) + { + foreach (var element in TokenBodyParameters) + { + if (element != null) + { + element.Validate(); + } + } + } + if (DisplayName != null) + { + if (DisplayName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "DisplayName", 50); + } + if (DisplayName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "DisplayName", 1); + } + } + } } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/AuthorizationServerUpdateHeaders.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/AuthorizationServerUpdateHeaders.cs new file mode 100644 index 0000000000000..304316794eedf --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/AuthorizationServerUpdateHeaders.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.ApiManagement.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Update operation. + /// + public partial class AuthorizationServerUpdateHeaders + { + /// + /// Initializes a new instance of the AuthorizationServerUpdateHeaders + /// class. + /// + public AuthorizationServerUpdateHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AuthorizationServerUpdateHeaders + /// class. + /// + /// Current entity state version. Should be treated + /// as opaque and used to make conditional HTTP requests. + public AuthorizationServerUpdateHeaders(string eTag = default(string)) + { + ETag = eTag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets current entity state version. Should be treated as + /// opaque and used to make conditional HTTP requests. + /// + [JsonProperty(PropertyName = "ETag")] + public string ETag { get; set; } + + } +} diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/BackendAuthorizationHeaderCredentials.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/BackendAuthorizationHeaderCredentials.cs index ae08095d15ca5..0d3e88976f83a 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/BackendAuthorizationHeaderCredentials.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/BackendAuthorizationHeaderCredentials.cs @@ -74,6 +74,28 @@ public virtual void Validate() { throw new ValidationException(ValidationRules.CannotBeNull, "Parameter"); } + if (Scheme != null) + { + if (Scheme.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "Scheme", 100); + } + if (Scheme.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Scheme", 1); + } + } + if (Parameter != null) + { + if (Parameter.Length > 300) + { + throw new ValidationException(ValidationRules.MaxLength, "Parameter", 300); + } + if (Parameter.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Parameter", 1); + } + } } } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/BackendBaseParameters.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/BackendBaseParameters.cs index ca6eb593d55e3..d10de360a431f 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/BackendBaseParameters.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/BackendBaseParameters.cs @@ -10,6 +10,7 @@ namespace Microsoft.Azure.Management.ApiManagement.Models { + using Microsoft.Rest; using Newtonsoft.Json; using System.Linq; @@ -103,11 +104,44 @@ public BackendBaseParameters() /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() { + if (Title != null) + { + if (Title.Length > 300) + { + throw new ValidationException(ValidationRules.MaxLength, "Title", 300); + } + if (Title.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Title", 1); + } + } + if (Description != null) + { + if (Description.Length > 2000) + { + throw new ValidationException(ValidationRules.MaxLength, "Description", 2000); + } + if (Description.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Description", 1); + } + } + if (ResourceId != null) + { + if (ResourceId.Length > 2000) + { + throw new ValidationException(ValidationRules.MaxLength, "ResourceId", 2000); + } + if (ResourceId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "ResourceId", 1); + } + } if (Properties != null) { Properties.Validate(); diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/BackendContract.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/BackendContract.cs index 9c5746491fd63..3662dbc928270 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/BackendContract.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/BackendContract.cs @@ -142,6 +142,39 @@ public virtual void Validate() { throw new ValidationException(ValidationRules.CannotBeNull, "Protocol"); } + if (Title != null) + { + if (Title.Length > 300) + { + throw new ValidationException(ValidationRules.MaxLength, "Title", 300); + } + if (Title.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Title", 1); + } + } + if (Description != null) + { + if (Description.Length > 2000) + { + throw new ValidationException(ValidationRules.MaxLength, "Description", 2000); + } + if (Description.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Description", 1); + } + } + if (ResourceId != null) + { + if (ResourceId.Length > 2000) + { + throw new ValidationException(ValidationRules.MaxLength, "ResourceId", 2000); + } + if (ResourceId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "ResourceId", 1); + } + } if (Properties != null) { Properties.Validate(); @@ -154,6 +187,17 @@ public virtual void Validate() { Proxy.Validate(); } + if (Url != null) + { + if (Url.Length > 2000) + { + throw new ValidationException(ValidationRules.MaxLength, "Url", 2000); + } + if (Url.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Url", 1); + } + } } } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/BackendCredentialsContract.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/BackendCredentialsContract.cs index bc51b2a4deefd..30fcc6bf3c06f 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/BackendCredentialsContract.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/BackendCredentialsContract.cs @@ -10,6 +10,7 @@ namespace Microsoft.Azure.Management.ApiManagement.Models { + using Microsoft.Rest; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; @@ -78,11 +79,18 @@ public BackendCredentialsContract() /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() { + if (Certificate != null) + { + if (Certificate.Count > 32) + { + throw new ValidationException(ValidationRules.MaxItems, "Certificate", 32); + } + } if (Authorization != null) { Authorization.Validate(); diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/BackendProxyContract.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/BackendProxyContract.cs index 519523e741540..13338776d03e2 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/BackendProxyContract.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/BackendProxyContract.cs @@ -86,6 +86,17 @@ public virtual void Validate() { throw new ValidationException(ValidationRules.CannotBeNull, "Url"); } + if (Url != null) + { + if (Url.Length > 2000) + { + throw new ValidationException(ValidationRules.MaxLength, "Url", 2000); + } + if (Url.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Url", 1); + } + } } } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/BackendUpdateHeaders.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/BackendUpdateHeaders.cs new file mode 100644 index 0000000000000..76aca33918faa --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/BackendUpdateHeaders.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.ApiManagement.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Update operation. + /// + public partial class BackendUpdateHeaders + { + /// + /// Initializes a new instance of the BackendUpdateHeaders class. + /// + public BackendUpdateHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the BackendUpdateHeaders class. + /// + /// Current entity state version. Should be treated + /// as opaque and used to make conditional HTTP requests. + public BackendUpdateHeaders(string eTag = default(string)) + { + ETag = eTag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets current entity state version. Should be treated as + /// opaque and used to make conditional HTTP requests. + /// + [JsonProperty(PropertyName = "ETag")] + public string ETag { get; set; } + + } +} diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/BackendUpdateParameters.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/BackendUpdateParameters.cs index f5dc8676fce21..10414d288d8b9 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/BackendUpdateParameters.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/BackendUpdateParameters.cs @@ -129,6 +129,39 @@ public BackendUpdateParameters() /// public virtual void Validate() { + if (Title != null) + { + if (Title.Length > 300) + { + throw new ValidationException(ValidationRules.MaxLength, "Title", 300); + } + if (Title.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Title", 1); + } + } + if (Description != null) + { + if (Description.Length > 2000) + { + throw new ValidationException(ValidationRules.MaxLength, "Description", 2000); + } + if (Description.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Description", 1); + } + } + if (ResourceId != null) + { + if (ResourceId.Length > 2000) + { + throw new ValidationException(ValidationRules.MaxLength, "ResourceId", 2000); + } + if (ResourceId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "ResourceId", 1); + } + } if (Properties != null) { Properties.Validate(); @@ -141,6 +174,17 @@ public virtual void Validate() { Proxy.Validate(); } + if (Url != null) + { + if (Url.Length > 2000) + { + throw new ValidationException(ValidationRules.MaxLength, "Url", 2000); + } + if (Url.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Url", 1); + } + } } } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/CacheContract.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/CacheContract.cs index a790374d79bc6..240a67f6fa9c2 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/CacheContract.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/CacheContract.cs @@ -34,6 +34,9 @@ public CacheContract() /// /// Runtime connection string to /// cache + /// Location identifier to use cache from + /// (should be either 'default' or valid Azure region + /// identifier) /// Resource ID. /// Resource name. /// Resource type for API Management @@ -41,11 +44,12 @@ public CacheContract() /// Cache description /// Original uri of entity in external system /// cache points to - public CacheContract(string connectionString, string id = default(string), string name = default(string), string type = default(string), string description = default(string), string resourceId = default(string)) + public CacheContract(string connectionString, string useFromLocation, string id = default(string), string name = default(string), string type = default(string), string description = default(string), string resourceId = default(string)) : base(id, name, type) { Description = description; ConnectionString = connectionString; + UseFromLocation = useFromLocation; ResourceId = resourceId; CustomInit(); } @@ -67,6 +71,13 @@ public CacheContract() [JsonProperty(PropertyName = "properties.connectionString")] public string ConnectionString { get; set; } + /// + /// Gets or sets location identifier to use cache from (should be + /// either 'default' or valid Azure region identifier) + /// + [JsonProperty(PropertyName = "properties.useFromLocation")] + public string UseFromLocation { get; set; } + /// /// Gets or sets original uri of entity in external system cache points /// to @@ -86,6 +97,38 @@ public virtual void Validate() { throw new ValidationException(ValidationRules.CannotBeNull, "ConnectionString"); } + if (UseFromLocation == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "UseFromLocation"); + } + if (Description != null) + { + if (Description.Length > 2000) + { + throw new ValidationException(ValidationRules.MaxLength, "Description", 2000); + } + } + if (ConnectionString != null) + { + if (ConnectionString.Length > 300) + { + throw new ValidationException(ValidationRules.MaxLength, "ConnectionString", 300); + } + } + if (UseFromLocation != null) + { + if (UseFromLocation.Length > 256) + { + throw new ValidationException(ValidationRules.MaxLength, "UseFromLocation", 256); + } + } + if (ResourceId != null) + { + if (ResourceId.Length > 2000) + { + throw new ValidationException(ValidationRules.MaxLength, "ResourceId", 2000); + } + } } } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/CacheUpdateHeaders.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/CacheUpdateHeaders.cs new file mode 100644 index 0000000000000..6a2dc7bbbda2a --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/CacheUpdateHeaders.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.ApiManagement.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Update operation. + /// + public partial class CacheUpdateHeaders + { + /// + /// Initializes a new instance of the CacheUpdateHeaders class. + /// + public CacheUpdateHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CacheUpdateHeaders class. + /// + /// Current entity state version. Should be treated + /// as opaque and used to make conditional HTTP requests. + public CacheUpdateHeaders(string eTag = default(string)) + { + ETag = eTag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets current entity state version. Should be treated as + /// opaque and used to make conditional HTTP requests. + /// + [JsonProperty(PropertyName = "ETag")] + public string ETag { get; set; } + + } +} diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/CacheUpdateParameters.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/CacheUpdateParameters.cs index 86ffc8386fc83..92aed25847f1c 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/CacheUpdateParameters.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/CacheUpdateParameters.cs @@ -35,12 +35,16 @@ public CacheUpdateParameters() /// Cache description /// Runtime connection string to /// cache + /// Location identifier to use cache from + /// (should be either 'default' or valid Azure region + /// identifier) /// Original uri of entity in external system /// cache points to - public CacheUpdateParameters(string description = default(string), string connectionString = default(string), string resourceId = default(string)) + public CacheUpdateParameters(string description = default(string), string connectionString = default(string), string useFromLocation = default(string), string resourceId = default(string)) { Description = description; ConnectionString = connectionString; + UseFromLocation = useFromLocation; ResourceId = resourceId; CustomInit(); } @@ -62,6 +66,13 @@ public CacheUpdateParameters() [JsonProperty(PropertyName = "properties.connectionString")] public string ConnectionString { get; set; } + /// + /// Gets or sets location identifier to use cache from (should be + /// either 'default' or valid Azure region identifier) + /// + [JsonProperty(PropertyName = "properties.useFromLocation")] + public string UseFromLocation { get; set; } + /// /// Gets or sets original uri of entity in external system cache points /// to @@ -69,5 +80,42 @@ public CacheUpdateParameters() [JsonProperty(PropertyName = "properties.resourceId")] public string ResourceId { get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Description != null) + { + if (Description.Length > 2000) + { + throw new ValidationException(ValidationRules.MaxLength, "Description", 2000); + } + } + if (ConnectionString != null) + { + if (ConnectionString.Length > 300) + { + throw new ValidationException(ValidationRules.MaxLength, "ConnectionString", 300); + } + } + if (UseFromLocation != null) + { + if (UseFromLocation.Length > 256) + { + throw new ValidationException(ValidationRules.MaxLength, "UseFromLocation", 256); + } + } + if (ResourceId != null) + { + if (ResourceId.Length > 2000) + { + throw new ValidationException(ValidationRules.MaxLength, "ResourceId", 2000); + } + } + } } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/CertificateContract.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/CertificateContract.cs index 979632bc6ee86..508ecccab23f3 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/CertificateContract.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/CertificateContract.cs @@ -42,12 +42,15 @@ public CertificateContract() /// Resource name. /// Resource type for API Management /// resource. - public CertificateContract(string subject, string thumbprint, System.DateTime expirationDate, string id = default(string), string name = default(string), string type = default(string)) + /// KeyVault location details of the + /// certificate. + public CertificateContract(string subject, string thumbprint, System.DateTime expirationDate, string id = default(string), string name = default(string), string type = default(string), KeyVaultContractProperties keyVault = default(KeyVaultContractProperties)) : base(id, name, type) { Subject = subject; Thumbprint = thumbprint; ExpirationDate = expirationDate; + KeyVault = keyVault; CustomInit(); } @@ -77,6 +80,12 @@ public CertificateContract() [JsonProperty(PropertyName = "properties.expirationDate")] public System.DateTime ExpirationDate { get; set; } + /// + /// Gets or sets keyVault location details of the certificate. + /// + [JsonProperty(PropertyName = "properties.keyVault")] + public KeyVaultContractProperties KeyVault { get; set; } + /// /// Validate the object. /// diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/CertificateCreateOrUpdateParameters.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/CertificateCreateOrUpdateParameters.cs index 5d98108a6484f..14c2a6b9ff477 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/CertificateCreateOrUpdateParameters.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/CertificateCreateOrUpdateParameters.cs @@ -37,10 +37,13 @@ public CertificateCreateOrUpdateParameters() /// Base 64 encoded certificate using the /// application/x-pkcs12 representation. /// Password for the Certificate - public CertificateCreateOrUpdateParameters(string data, string password) + /// KeyVault location details of the + /// certificate. + public CertificateCreateOrUpdateParameters(string data = default(string), string password = default(string), KeyVaultContractCreateProperties keyVault = default(KeyVaultContractCreateProperties)) { Data = data; Password = password; + KeyVault = keyVault; CustomInit(); } @@ -63,21 +66,10 @@ public CertificateCreateOrUpdateParameters(string data, string password) public string Password { get; set; } /// - /// Validate the object. + /// Gets or sets keyVault location details of the certificate. /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Data == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Data"); - } - if (Password == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Password"); - } - } + [JsonProperty(PropertyName = "properties.keyVault")] + public KeyVaultContractCreateProperties KeyVault { get; set; } + } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ConnectivityStatusContract.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ConnectivityStatusContract.cs index aed42db0e8004..05d3d6365f774 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ConnectivityStatusContract.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ConnectivityStatusContract.cs @@ -49,15 +49,19 @@ public ConnectivityStatusContract() /// vice-versa. The date conforms to the following format: /// `yyyy-MM-ddTHH:mm:ssZ` as specified by the ISO 8601 standard. /// + /// Resource Type. + /// Whether this is optional. /// Error details of the connectivity to the /// resource. - public ConnectivityStatusContract(string name, string status, System.DateTime lastUpdated, System.DateTime lastStatusChange, string error = default(string)) + public ConnectivityStatusContract(string name, string status, System.DateTime lastUpdated, System.DateTime lastStatusChange, string resourceType, bool isOptional, string error = default(string)) { Name = name; Status = status; Error = error; LastUpdated = lastUpdated; LastStatusChange = lastStatusChange; + ResourceType = resourceType; + IsOptional = isOptional; CustomInit(); } @@ -109,6 +113,18 @@ public ConnectivityStatusContract() [JsonProperty(PropertyName = "lastStatusChange")] public System.DateTime LastStatusChange { get; set; } + /// + /// Gets or sets resource Type. + /// + [JsonProperty(PropertyName = "resourceType")] + public string ResourceType { get; set; } + + /// + /// Gets or sets whether this is optional. + /// + [JsonProperty(PropertyName = "isOptional")] + public bool IsOptional { get; set; } + /// /// Validate the object. /// @@ -125,6 +141,17 @@ public virtual void Validate() { throw new ValidationException(ValidationRules.CannotBeNull, "Status"); } + if (ResourceType == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ResourceType"); + } + if (Name != null) + { + if (Name.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Name", 1); + } + } } } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ContentItemContract.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ContentItemContract.cs new file mode 100644 index 0000000000000..406c2081442d3 --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ContentItemContract.cs @@ -0,0 +1,58 @@ +// +// 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.ApiManagement.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Content type contract details. + /// + public partial class ContentItemContract : Resource + { + /// + /// Initializes a new instance of the ContentItemContract class. + /// + public ContentItemContract() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ContentItemContract class. + /// + /// Resource ID. + /// Resource name. + /// Resource type for API Management + /// resource. + /// Properties of the content item. + public ContentItemContract(string id = default(string), string name = default(string), string type = default(string), IDictionary properties = default(IDictionary)) + : base(id, name, type) + { + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets properties of the content item. + /// + [JsonProperty(PropertyName = "properties")] + public IDictionary Properties { get; set; } + + } +} diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ContentItemCreateOrUpdateHeaders.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ContentItemCreateOrUpdateHeaders.cs new file mode 100644 index 0000000000000..47b07c1155b8a --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ContentItemCreateOrUpdateHeaders.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.ApiManagement.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for CreateOrUpdate operation. + /// + public partial class ContentItemCreateOrUpdateHeaders + { + /// + /// Initializes a new instance of the ContentItemCreateOrUpdateHeaders + /// class. + /// + public ContentItemCreateOrUpdateHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ContentItemCreateOrUpdateHeaders + /// class. + /// + /// Current entity state version. Should be treated + /// as opaque and used to make conditional HTTP requests. + public ContentItemCreateOrUpdateHeaders(string eTag = default(string)) + { + ETag = eTag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets current entity state version. Should be treated as + /// opaque and used to make conditional HTTP requests. + /// + [JsonProperty(PropertyName = "ETag")] + public string ETag { get; set; } + + } +} diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ContentItemGetEntityTagHeaders.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ContentItemGetEntityTagHeaders.cs new file mode 100644 index 0000000000000..3bc2096aafab3 --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ContentItemGetEntityTagHeaders.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.ApiManagement.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for GetEntityTag operation. + /// + public partial class ContentItemGetEntityTagHeaders + { + /// + /// Initializes a new instance of the ContentItemGetEntityTagHeaders + /// class. + /// + public ContentItemGetEntityTagHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ContentItemGetEntityTagHeaders + /// class. + /// + /// Current entity state version. Should be treated + /// as opaque and used to make conditional HTTP requests. + public ContentItemGetEntityTagHeaders(string eTag = default(string)) + { + ETag = eTag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets current entity state version. Should be treated as + /// opaque and used to make conditional HTTP requests. + /// + [JsonProperty(PropertyName = "ETag")] + public string ETag { get; set; } + + } +} diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ContentItemGetHeaders.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ContentItemGetHeaders.cs new file mode 100644 index 0000000000000..8cf2c8d9ee6b1 --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ContentItemGetHeaders.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.ApiManagement.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Get operation. + /// + public partial class ContentItemGetHeaders + { + /// + /// Initializes a new instance of the ContentItemGetHeaders class. + /// + public ContentItemGetHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ContentItemGetHeaders class. + /// + /// Current entity state version. Should be treated + /// as opaque and used to make conditional HTTP requests. + public ContentItemGetHeaders(string eTag = default(string)) + { + ETag = eTag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets current entity state version. Should be treated as + /// opaque and used to make conditional HTTP requests. + /// + [JsonProperty(PropertyName = "ETag")] + public string ETag { get; set; } + + } +} diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ContentTypeContract.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ContentTypeContract.cs new file mode 100644 index 0000000000000..5ed97c533082f --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ContentTypeContract.cs @@ -0,0 +1,92 @@ +// +// 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.ApiManagement.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Content type contract details. + /// + [Rest.Serialization.JsonTransformation] + public partial class ContentTypeContract : Resource + { + /// + /// Initializes a new instance of the ContentTypeContract class. + /// + public ContentTypeContract() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ContentTypeContract class. + /// + /// Resource ID. + /// Resource name. + /// Resource type for API Management + /// resource. + /// Content type identifier + /// Content type name. Must be 1 + /// to 250 characters long. + /// Content type description. + /// Content type schema. + /// Content type version. + public ContentTypeContract(string id = default(string), string name = default(string), string type = default(string), string contentTypeContractId = default(string), string contentTypeContractName = default(string), string description = default(string), object schema = default(object), string version = default(string)) + : base(id, name, type) + { + ContentTypeContractId = contentTypeContractId; + ContentTypeContractName = contentTypeContractName; + Description = description; + Schema = schema; + Version = version; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets content type identifier + /// + [JsonProperty(PropertyName = "properties.id")] + public string ContentTypeContractId { get; set; } + + /// + /// Gets or sets content type name. Must be 1 to 250 characters long. + /// + [JsonProperty(PropertyName = "properties.name")] + public string ContentTypeContractName { get; set; } + + /// + /// Gets or sets content type description. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; set; } + + /// + /// Gets or sets content type schema. + /// + [JsonProperty(PropertyName = "properties.schema")] + public object Schema { get; set; } + + /// + /// Gets or sets content type version. + /// + [JsonProperty(PropertyName = "properties.version")] + public string Version { get; set; } + + } +} diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ContentTypeCreateOrUpdateHeaders.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ContentTypeCreateOrUpdateHeaders.cs new file mode 100644 index 0000000000000..6545987d95f3f --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ContentTypeCreateOrUpdateHeaders.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.ApiManagement.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for CreateOrUpdate operation. + /// + public partial class ContentTypeCreateOrUpdateHeaders + { + /// + /// Initializes a new instance of the ContentTypeCreateOrUpdateHeaders + /// class. + /// + public ContentTypeCreateOrUpdateHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ContentTypeCreateOrUpdateHeaders + /// class. + /// + /// Current entity state version. Should be treated + /// as opaque and used to make conditional HTTP requests. + public ContentTypeCreateOrUpdateHeaders(string eTag = default(string)) + { + ETag = eTag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets current entity state version. Should be treated as + /// opaque and used to make conditional HTTP requests. + /// + [JsonProperty(PropertyName = "ETag")] + public string ETag { get; set; } + + } +} diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ContentTypeGetHeaders.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ContentTypeGetHeaders.cs new file mode 100644 index 0000000000000..c6ff1f015d54f --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ContentTypeGetHeaders.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.ApiManagement.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Get operation. + /// + public partial class ContentTypeGetHeaders + { + /// + /// Initializes a new instance of the ContentTypeGetHeaders class. + /// + public ContentTypeGetHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ContentTypeGetHeaders class. + /// + /// Current entity state version. Should be treated + /// as opaque and used to make conditional HTTP requests. + public ContentTypeGetHeaders(string eTag = default(string)) + { + ETag = eTag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets current entity state version. Should be treated as + /// opaque and used to make conditional HTTP requests. + /// + [JsonProperty(PropertyName = "ETag")] + public string ETag { get; set; } + + } +} diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/DataMasking.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/DataMasking.cs new file mode 100644 index 0000000000000..4322b71f6df1f --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/DataMasking.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.ApiManagement.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class DataMasking + { + /// + /// Initializes a new instance of the DataMasking class. + /// + public DataMasking() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DataMasking class. + /// + /// Masking settings for Url query + /// parameters + /// Masking settings for headers + public DataMasking(IList queryParams = default(IList), IList headers = default(IList)) + { + QueryParams = queryParams; + Headers = headers; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets masking settings for Url query parameters + /// + [JsonProperty(PropertyName = "queryParams")] + public IList QueryParams { get; set; } + + /// + /// Gets or sets masking settings for headers + /// + [JsonProperty(PropertyName = "headers")] + public IList Headers { get; set; } + + } +} diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/DataMaskingEntity.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/DataMaskingEntity.cs new file mode 100644 index 0000000000000..8bcbf3ebd3dcd --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/DataMaskingEntity.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.ApiManagement.Models +{ + using Newtonsoft.Json; + using System.Linq; + + public partial class DataMaskingEntity + { + /// + /// Initializes a new instance of the DataMaskingEntity class. + /// + public DataMaskingEntity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DataMaskingEntity class. + /// + /// The name of an entity to mask (e.g. a name of a + /// header or a query parameter). + /// Data masking mode. Possible values include: + /// 'Mask', 'Hide' + public DataMaskingEntity(string value = default(string), string mode = default(string)) + { + Value = value; + Mode = mode; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of an entity to mask (e.g. a name of a header + /// or a query parameter). + /// + [JsonProperty(PropertyName = "value")] + public string Value { get; set; } + + /// + /// Gets or sets data masking mode. Possible values include: 'Mask', + /// 'Hide' + /// + [JsonProperty(PropertyName = "mode")] + public string Mode { get; set; } + + } +} diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/DataMaskingMode.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/DataMaskingMode.cs new file mode 100644 index 0000000000000..8db1a58fbbf0c --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/DataMaskingMode.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.ApiManagement.Models +{ + + /// + /// Defines values for DataMaskingMode. + /// + public static class DataMaskingMode + { + /// + /// Mask the value of an entity. + /// + public const string Mask = "Mask"; + /// + /// Hide the presence of an entity. + /// + public const string Hide = "Hide"; + } +} diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/DeletedServiceContract.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/DeletedServiceContract.cs new file mode 100644 index 0000000000000..923423de0aa10 --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/DeletedServiceContract.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.ApiManagement.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Deleted Api Management Service information. + /// + [Rest.Serialization.JsonTransformation] + public partial class DeletedServiceContract : Resource + { + /// + /// Initializes a new instance of the DeletedServiceContract class. + /// + public DeletedServiceContract() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DeletedServiceContract class. + /// + /// Resource ID. + /// Resource name. + /// Resource type for API Management + /// resource. + /// Fully-qualified API Management Service + /// Resource ID + /// UTC Date and Time when the service + /// will be automatically purged. The date conforms to the following + /// format: yyyy-MM-ddTHH:mm:ssZ as specified by the ISO 8601 + /// standard. + /// UTC Timestamp when the service was + /// soft-deleted. The date conforms to the following format: + /// yyyy-MM-ddTHH:mm:ssZ as specified by the ISO 8601 standard. + /// Api Management Service Master + /// Location. + public DeletedServiceContract(string id = default(string), string name = default(string), string type = default(string), string serviceId = default(string), System.DateTime? scheduledPurgeDate = default(System.DateTime?), System.DateTime? deletionDate = default(System.DateTime?), string location = default(string)) + : base(id, name, type) + { + ServiceId = serviceId; + ScheduledPurgeDate = scheduledPurgeDate; + DeletionDate = deletionDate; + Location = location; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets fully-qualified API Management Service Resource ID + /// + [JsonProperty(PropertyName = "properties.serviceId")] + public string ServiceId { get; set; } + + /// + /// Gets or sets UTC Date and Time when the service will be + /// automatically purged. The date conforms to the following format: + /// yyyy-MM-ddTHH:mm:ssZ as specified by the ISO 8601 standard. + /// + [JsonProperty(PropertyName = "properties.scheduledPurgeDate")] + public System.DateTime? ScheduledPurgeDate { get; set; } + + /// + /// Gets or sets UTC Timestamp when the service was soft-deleted. The + /// date conforms to the following format: yyyy-MM-ddTHH:mm:ssZ as + /// specified by the ISO 8601 standard. + /// + [JsonProperty(PropertyName = "properties.deletionDate")] + public System.DateTime? DeletionDate { get; set; } + + /// + /// Gets api Management Service Master Location. + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; private set; } + + } +} diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/DiagnosticContract.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/DiagnosticContract.cs index e22df586e42db..33fd0fe0b237c 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/DiagnosticContract.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/DiagnosticContract.cs @@ -53,7 +53,10 @@ public DiagnosticContract() /// The verbosity level applied to traces /// emitted by trace policies. Possible values include: 'verbose', /// 'information', 'error' - public DiagnosticContract(string loggerId, string id = default(string), string name = default(string), string type = default(string), string alwaysLog = default(string), SamplingSettings sampling = default(SamplingSettings), PipelineDiagnosticSettings frontend = default(PipelineDiagnosticSettings), PipelineDiagnosticSettings backend = default(PipelineDiagnosticSettings), bool? logClientIp = default(bool?), string httpCorrelationProtocol = default(string), string verbosity = default(string)) + /// The format of the Operation Name + /// for Application Insights telemetries. Default is Name. Possible + /// values include: 'Name', 'Url' + public DiagnosticContract(string loggerId, string id = default(string), string name = default(string), string type = default(string), string alwaysLog = default(string), SamplingSettings sampling = default(SamplingSettings), PipelineDiagnosticSettings frontend = default(PipelineDiagnosticSettings), PipelineDiagnosticSettings backend = default(PipelineDiagnosticSettings), bool? logClientIp = default(bool?), string httpCorrelationProtocol = default(string), string verbosity = default(string), string operationNameFormat = default(string)) : base(id, name, type) { AlwaysLog = alwaysLog; @@ -64,6 +67,7 @@ public DiagnosticContract() LogClientIp = logClientIp; HttpCorrelationProtocol = httpCorrelationProtocol; Verbosity = verbosity; + OperationNameFormat = operationNameFormat; CustomInit(); } @@ -127,6 +131,14 @@ public DiagnosticContract() [JsonProperty(PropertyName = "properties.verbosity")] public string Verbosity { get; set; } + /// + /// Gets or sets the format of the Operation Name for Application + /// Insights telemetries. Default is Name. Possible values include: + /// 'Name', 'Url' + /// + [JsonProperty(PropertyName = "properties.operationNameFormat")] + public string OperationNameFormat { get; set; } + /// /// Validate the object. /// diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/DiagnosticUpdateHeaders.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/DiagnosticUpdateHeaders.cs new file mode 100644 index 0000000000000..51794f54e9c98 --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/DiagnosticUpdateHeaders.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.ApiManagement.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Update operation. + /// + public partial class DiagnosticUpdateHeaders + { + /// + /// Initializes a new instance of the DiagnosticUpdateHeaders class. + /// + public DiagnosticUpdateHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DiagnosticUpdateHeaders class. + /// + /// Current entity state version. Should be treated + /// as opaque and used to make conditional HTTP requests. + public DiagnosticUpdateHeaders(string eTag = default(string)) + { + ETag = eTag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets current entity state version. Should be treated as + /// opaque and used to make conditional HTTP requests. + /// + [JsonProperty(PropertyName = "ETag")] + public string ETag { get; set; } + + } +} diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/EmailTemplateContract.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/EmailTemplateContract.cs index a3f02ae3cbc5f..6ba6bb8c0a518 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/EmailTemplateContract.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/EmailTemplateContract.cs @@ -117,6 +117,34 @@ public virtual void Validate() { throw new ValidationException(ValidationRules.CannotBeNull, "Body"); } + if (Subject != null) + { + if (Subject.Length > 1000) + { + throw new ValidationException(ValidationRules.MaxLength, "Subject", 1000); + } + if (Subject.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Subject", 1); + } + } + if (Body != null) + { + if (Body.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Body", 1); + } + } + if (Parameters != null) + { + foreach (var element in Parameters) + { + if (element != null) + { + element.Validate(); + } + } + } } } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/EmailTemplateParametersContractProperties.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/EmailTemplateParametersContractProperties.cs index 647bed46e0be2..c306d22bcb58e 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/EmailTemplateParametersContractProperties.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/EmailTemplateParametersContractProperties.cs @@ -10,6 +10,7 @@ namespace Microsoft.Azure.Management.ApiManagement.Models { + using Microsoft.Rest; using Newtonsoft.Json; using System.Linq; @@ -65,5 +66,55 @@ public EmailTemplateParametersContractProperties() [JsonProperty(PropertyName = "description")] public string Description { get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name != null) + { + if (Name.Length > 256) + { + throw new ValidationException(ValidationRules.MaxLength, "Name", 256); + } + if (Name.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Name", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(Name, "^[A-Za-z0-9-._]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "Name", "^[A-Za-z0-9-._]+$"); + } + } + if (Title != null) + { + if (Title.Length > 4096) + { + throw new ValidationException(ValidationRules.MaxLength, "Title", 4096); + } + if (Title.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Title", 1); + } + } + if (Description != null) + { + if (Description.Length > 256) + { + throw new ValidationException(ValidationRules.MaxLength, "Description", 256); + } + if (Description.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Description", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(Description, "^[A-Za-z0-9-._]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "Description", "^[A-Za-z0-9-._]+$"); + } + } + } } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/EmailTemplateUpdateHeaders.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/EmailTemplateUpdateHeaders.cs new file mode 100644 index 0000000000000..8572c3b25f68c --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/EmailTemplateUpdateHeaders.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.ApiManagement.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Update operation. + /// + public partial class EmailTemplateUpdateHeaders + { + /// + /// Initializes a new instance of the EmailTemplateUpdateHeaders class. + /// + public EmailTemplateUpdateHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EmailTemplateUpdateHeaders class. + /// + /// Current entity state version. Should be treated + /// as opaque and used to make conditional HTTP requests. + public EmailTemplateUpdateHeaders(string eTag = default(string)) + { + ETag = eTag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets current entity state version. Should be treated as + /// opaque and used to make conditional HTTP requests. + /// + [JsonProperty(PropertyName = "ETag")] + public string ETag { get; set; } + + } +} diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/EmailTemplateUpdateParameters.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/EmailTemplateUpdateParameters.cs index ac21c482ee627..f9c6390994ef5 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/EmailTemplateUpdateParameters.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/EmailTemplateUpdateParameters.cs @@ -88,5 +88,42 @@ public EmailTemplateUpdateParameters() [JsonProperty(PropertyName = "properties.parameters")] public IList Parameters { get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Subject != null) + { + if (Subject.Length > 1000) + { + throw new ValidationException(ValidationRules.MaxLength, "Subject", 1000); + } + if (Subject.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Subject", 1); + } + } + if (Body != null) + { + if (Body.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Body", 1); + } + } + if (Parameters != null) + { + foreach (var element in Parameters) + { + if (element != null) + { + element.Validate(); + } + } + } + } } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/GatewayContract.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/GatewayContract.cs index b5275735097a7..62a7f552a44ba 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/GatewayContract.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/GatewayContract.cs @@ -75,6 +75,13 @@ public virtual void Validate() { LocationData.Validate(); } + if (Description != null) + { + if (Description.Length > 1000) + { + throw new ValidationException(ValidationRules.MaxLength, "Description", 1000); + } + } } } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/GatewayHostnameConfigurationContract.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/GatewayHostnameConfigurationContract.cs index d402ea02ce1c9..7add2302780f6 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/GatewayHostnameConfigurationContract.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/GatewayHostnameConfigurationContract.cs @@ -44,12 +44,21 @@ public GatewayHostnameConfigurationContract() /// will be used for TLS connection establishment /// Determines whether gateway /// requests client certificate - public GatewayHostnameConfigurationContract(string id = default(string), string name = default(string), string type = default(string), string hostname = default(string), string certificateId = default(string), bool? negotiateClientCertificate = default(bool?)) + /// Specifies if TLS 1.0 is + /// supported + /// Specifies if TLS 1.1 is + /// supported + /// Specifies if HTTP/2.0 is + /// supported + public GatewayHostnameConfigurationContract(string id = default(string), string name = default(string), string type = default(string), string hostname = default(string), string certificateId = default(string), bool? negotiateClientCertificate = default(bool?), bool? tls10Enabled = default(bool?), bool? tls11Enabled = default(bool?), bool? http2Enabled = default(bool?)) : base(id, name, type) { Hostname = hostname; CertificateId = certificateId; NegotiateClientCertificate = negotiateClientCertificate; + Tls10Enabled = tls10Enabled; + Tls11Enabled = tls11Enabled; + Http2Enabled = http2Enabled; CustomInit(); } @@ -78,5 +87,23 @@ public GatewayHostnameConfigurationContract() [JsonProperty(PropertyName = "properties.negotiateClientCertificate")] public bool? NegotiateClientCertificate { get; set; } + /// + /// Gets or sets specifies if TLS 1.0 is supported + /// + [JsonProperty(PropertyName = "properties.tls10Enabled")] + public bool? Tls10Enabled { get; set; } + + /// + /// Gets or sets specifies if TLS 1.1 is supported + /// + [JsonProperty(PropertyName = "properties.tls11Enabled")] + public bool? Tls11Enabled { get; set; } + + /// + /// Gets or sets specifies if HTTP/2.0 is supported + /// + [JsonProperty(PropertyName = "properties.http2Enabled")] + public bool? Http2Enabled { get; set; } + } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/GatewayUpdateHeaders.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/GatewayUpdateHeaders.cs new file mode 100644 index 0000000000000..7b127d0e04484 --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/GatewayUpdateHeaders.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.ApiManagement.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Update operation. + /// + public partial class GatewayUpdateHeaders + { + /// + /// Initializes a new instance of the GatewayUpdateHeaders class. + /// + public GatewayUpdateHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GatewayUpdateHeaders class. + /// + /// Current entity state version. Should be treated + /// as opaque and used to make conditional HTTP requests. + public GatewayUpdateHeaders(string eTag = default(string)) + { + ETag = eTag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets current entity state version. Should be treated as + /// opaque and used to make conditional HTTP requests. + /// + [JsonProperty(PropertyName = "ETag")] + public string ETag { get; set; } + + } +} diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/GroupContract.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/GroupContract.cs index 4e0add48e7a1e..e17fe5e13ffbf 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/GroupContract.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/GroupContract.cs @@ -113,6 +113,24 @@ public virtual void Validate() { throw new ValidationException(ValidationRules.CannotBeNull, "DisplayName"); } + if (DisplayName != null) + { + if (DisplayName.Length > 300) + { + throw new ValidationException(ValidationRules.MaxLength, "DisplayName", 300); + } + if (DisplayName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "DisplayName", 1); + } + } + if (Description != null) + { + if (Description.Length > 1000) + { + throw new ValidationException(ValidationRules.MaxLength, "Description", 1000); + } + } } } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/GroupContractProperties.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/GroupContractProperties.cs index 56600211e4378..07c97234a6f21 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/GroupContractProperties.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/GroupContractProperties.cs @@ -106,6 +106,24 @@ public virtual void Validate() { throw new ValidationException(ValidationRules.CannotBeNull, "DisplayName"); } + if (DisplayName != null) + { + if (DisplayName.Length > 300) + { + throw new ValidationException(ValidationRules.MaxLength, "DisplayName", 300); + } + if (DisplayName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "DisplayName", 1); + } + } + if (Description != null) + { + if (Description.Length > 1000) + { + throw new ValidationException(ValidationRules.MaxLength, "Description", 1000); + } + } } } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/GroupCreateParameters.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/GroupCreateParameters.cs index 94b6e59419455..2dbe8fc20697a 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/GroupCreateParameters.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/GroupCreateParameters.cs @@ -96,6 +96,17 @@ public virtual void Validate() { throw new ValidationException(ValidationRules.CannotBeNull, "DisplayName"); } + if (DisplayName != null) + { + if (DisplayName.Length > 300) + { + throw new ValidationException(ValidationRules.MaxLength, "DisplayName", 300); + } + if (DisplayName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "DisplayName", 1); + } + } } } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/GroupUpdateHeaders.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/GroupUpdateHeaders.cs new file mode 100644 index 0000000000000..bc2e14a635a6b --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/GroupUpdateHeaders.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.ApiManagement.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Update operation. + /// + public partial class GroupUpdateHeaders + { + /// + /// Initializes a new instance of the GroupUpdateHeaders class. + /// + public GroupUpdateHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GroupUpdateHeaders class. + /// + /// Current entity state version. Should be treated + /// as opaque and used to make conditional HTTP requests. + public GroupUpdateHeaders(string eTag = default(string)) + { + ETag = eTag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets current entity state version. Should be treated as + /// opaque and used to make conditional HTTP requests. + /// + [JsonProperty(PropertyName = "ETag")] + public string ETag { get; set; } + + } +} diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/GroupUpdateParameters.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/GroupUpdateParameters.cs index 2dcf2a1c1c6e2..8d236c2893ec2 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/GroupUpdateParameters.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/GroupUpdateParameters.cs @@ -84,5 +84,25 @@ public GroupUpdateParameters() [JsonProperty(PropertyName = "properties.externalId")] public string ExternalId { get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (DisplayName != null) + { + if (DisplayName.Length > 300) + { + throw new ValidationException(ValidationRules.MaxLength, "DisplayName", 300); + } + if (DisplayName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "DisplayName", 1); + } + } + } } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/HostnameConfiguration.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/HostnameConfiguration.cs index 21e5dac3e22f2..e59d20fe3ab65 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/HostnameConfiguration.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/HostnameConfiguration.cs @@ -37,8 +37,11 @@ public HostnameConfiguration() /// Url to the KeyVault Secret containing the /// Ssl Certificate. If absolute Url containing version is provided, /// auto-update of ssl certificate will not work. This requires Api - /// Management service to be configured with MSI. The secret should be - /// of type *application/x-pkcs12* + /// Management service to be configured with aka.ms/apimmsi. The secret + /// should be of type *application/x-pkcs12* + /// System or User Assigned Managed + /// identity clientId as generated by Azure AD, which has GET access to + /// the keyVault containing the SSL certificate. /// Base64 Encoded /// certificate. /// Certificate Password. @@ -53,11 +56,12 @@ public HostnameConfiguration() /// negotiate client certificate on the hostname. Default Value is /// false. /// Certificate information. - public HostnameConfiguration(string type, string hostName, string keyVaultId = default(string), string encodedCertificate = default(string), string certificatePassword = default(string), bool? defaultSslBinding = default(bool?), bool? negotiateClientCertificate = default(bool?), CertificateInformation certificate = default(CertificateInformation)) + public HostnameConfiguration(string type, string hostName, string keyVaultId = default(string), string identityClientId = default(string), string encodedCertificate = default(string), string certificatePassword = default(string), bool? defaultSslBinding = default(bool?), bool? negotiateClientCertificate = default(bool?), CertificateInformation certificate = default(CertificateInformation)) { Type = type; HostName = hostName; KeyVaultId = keyVaultId; + IdentityClientId = identityClientId; EncodedCertificate = encodedCertificate; CertificatePassword = certificatePassword; DefaultSslBinding = defaultSslBinding; @@ -88,12 +92,20 @@ public HostnameConfiguration() /// Gets or sets url to the KeyVault Secret containing the Ssl /// Certificate. If absolute Url containing version is provided, /// auto-update of ssl certificate will not work. This requires Api - /// Management service to be configured with MSI. The secret should be - /// of type *application/x-pkcs12* + /// Management service to be configured with aka.ms/apimmsi. The secret + /// should be of type *application/x-pkcs12* /// [JsonProperty(PropertyName = "keyVaultId")] public string KeyVaultId { get; set; } + /// + /// Gets or sets system or User Assigned Managed identity clientId as + /// generated by Azure AD, which has GET access to the keyVault + /// containing the SSL certificate. + /// + [JsonProperty(PropertyName = "identityClientId")] + public string IdentityClientId { get; set; } + /// /// Gets or sets base64 Encoded certificate. /// diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/HttpMessageDiagnostic.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/HttpMessageDiagnostic.cs index f7d24049ac886..a080427cd0fda 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/HttpMessageDiagnostic.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/HttpMessageDiagnostic.cs @@ -33,10 +33,12 @@ public HttpMessageDiagnostic() /// /// Array of HTTP Headers to log. /// Body logging settings. - public HttpMessageDiagnostic(IList headers = default(IList), BodyDiagnosticSettings body = default(BodyDiagnosticSettings)) + /// Data masking settings. + public HttpMessageDiagnostic(IList headers = default(IList), BodyDiagnosticSettings body = default(BodyDiagnosticSettings), DataMasking dataMasking = default(DataMasking)) { Headers = headers; Body = body; + DataMasking = dataMasking; CustomInit(); } @@ -57,6 +59,12 @@ public HttpMessageDiagnostic() [JsonProperty(PropertyName = "body")] public BodyDiagnosticSettings Body { get; set; } + /// + /// Gets or sets data masking settings. + /// + [JsonProperty(PropertyName = "dataMasking")] + public DataMasking DataMasking { get; set; } + /// /// Validate the object. /// diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/IdentityProviderBaseParameters.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/IdentityProviderBaseParameters.cs index 8c4f0535ae050..f591f52b47c0c 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/IdentityProviderBaseParameters.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/IdentityProviderBaseParameters.cs @@ -10,6 +10,7 @@ namespace Microsoft.Azure.Management.ApiManagement.Models { + using Microsoft.Rest; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; @@ -125,5 +126,49 @@ public IdentityProviderBaseParameters() [JsonProperty(PropertyName = "passwordResetPolicyName")] public string PasswordResetPolicyName { get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (AllowedTenants != null) + { + if (AllowedTenants.Count > 32) + { + throw new ValidationException(ValidationRules.MaxItems, "AllowedTenants", 32); + } + } + if (SignupPolicyName != null) + { + if (SignupPolicyName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "SignupPolicyName", 1); + } + } + if (SigninPolicyName != null) + { + if (SigninPolicyName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "SigninPolicyName", 1); + } + } + if (ProfileEditingPolicyName != null) + { + if (ProfileEditingPolicyName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "ProfileEditingPolicyName", 1); + } + } + if (PasswordResetPolicyName != null) + { + if (PasswordResetPolicyName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "PasswordResetPolicyName", 1); + } + } + } } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/IdentityProviderContract.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/IdentityProviderContract.cs index 33c4f206c2118..8adc8501aed46 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/IdentityProviderContract.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/IdentityProviderContract.cs @@ -172,6 +172,55 @@ public virtual void Validate() { throw new ValidationException(ValidationRules.CannotBeNull, "ClientId"); } + if (AllowedTenants != null) + { + if (AllowedTenants.Count > 32) + { + throw new ValidationException(ValidationRules.MaxItems, "AllowedTenants", 32); + } + } + if (SignupPolicyName != null) + { + if (SignupPolicyName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "SignupPolicyName", 1); + } + } + if (SigninPolicyName != null) + { + if (SigninPolicyName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "SigninPolicyName", 1); + } + } + if (ProfileEditingPolicyName != null) + { + if (ProfileEditingPolicyName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "ProfileEditingPolicyName", 1); + } + } + if (PasswordResetPolicyName != null) + { + if (PasswordResetPolicyName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "PasswordResetPolicyName", 1); + } + } + if (ClientId != null) + { + if (ClientId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "ClientId", 1); + } + } + if (ClientSecret != null) + { + if (ClientSecret.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "ClientSecret", 1); + } + } } } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/IdentityProviderCreateContract.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/IdentityProviderCreateContract.cs index 7fd61edd769bf..521ca44c16c46 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/IdentityProviderCreateContract.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/IdentityProviderCreateContract.cs @@ -178,6 +178,55 @@ public virtual void Validate() { throw new ValidationException(ValidationRules.CannotBeNull, "ClientSecret"); } + if (AllowedTenants != null) + { + if (AllowedTenants.Count > 32) + { + throw new ValidationException(ValidationRules.MaxItems, "AllowedTenants", 32); + } + } + if (SignupPolicyName != null) + { + if (SignupPolicyName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "SignupPolicyName", 1); + } + } + if (SigninPolicyName != null) + { + if (SigninPolicyName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "SigninPolicyName", 1); + } + } + if (ProfileEditingPolicyName != null) + { + if (ProfileEditingPolicyName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "ProfileEditingPolicyName", 1); + } + } + if (PasswordResetPolicyName != null) + { + if (PasswordResetPolicyName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "PasswordResetPolicyName", 1); + } + } + if (ClientId != null) + { + if (ClientId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "ClientId", 1); + } + } + if (ClientSecret != null) + { + if (ClientSecret.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "ClientSecret", 1); + } + } } } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/IdentityProviderListSecretsHeaders.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/IdentityProviderListSecretsHeaders.cs new file mode 100644 index 0000000000000..88049e08792e5 --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/IdentityProviderListSecretsHeaders.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.ApiManagement.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for ListSecrets operation. + /// + public partial class IdentityProviderListSecretsHeaders + { + /// + /// Initializes a new instance of the + /// IdentityProviderListSecretsHeaders class. + /// + public IdentityProviderListSecretsHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// IdentityProviderListSecretsHeaders class. + /// + /// Current entity state version. Should be treated + /// as opaque and used to make conditional HTTP requests. + public IdentityProviderListSecretsHeaders(string eTag = default(string)) + { + ETag = eTag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets current entity state version. Should be treated as + /// opaque and used to make conditional HTTP requests. + /// + [JsonProperty(PropertyName = "ETag")] + public string ETag { get; set; } + + } +} diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/IdentityProviderUpdateHeaders.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/IdentityProviderUpdateHeaders.cs new file mode 100644 index 0000000000000..27f2f4f38e8f8 --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/IdentityProviderUpdateHeaders.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.ApiManagement.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Update operation. + /// + public partial class IdentityProviderUpdateHeaders + { + /// + /// Initializes a new instance of the IdentityProviderUpdateHeaders + /// class. + /// + public IdentityProviderUpdateHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the IdentityProviderUpdateHeaders + /// class. + /// + /// Current entity state version. Should be treated + /// as opaque and used to make conditional HTTP requests. + public IdentityProviderUpdateHeaders(string eTag = default(string)) + { + ETag = eTag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets current entity state version. Should be treated as + /// opaque and used to make conditional HTTP requests. + /// + [JsonProperty(PropertyName = "ETag")] + public string ETag { get; set; } + + } +} diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/IdentityProviderUpdateParameters.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/IdentityProviderUpdateParameters.cs index 901477f2719d8..d32298cf5a7cf 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/IdentityProviderUpdateParameters.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/IdentityProviderUpdateParameters.cs @@ -154,5 +154,63 @@ public IdentityProviderUpdateParameters() [JsonProperty(PropertyName = "properties.clientSecret")] public string ClientSecret { get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (AllowedTenants != null) + { + if (AllowedTenants.Count > 32) + { + throw new ValidationException(ValidationRules.MaxItems, "AllowedTenants", 32); + } + } + if (SignupPolicyName != null) + { + if (SignupPolicyName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "SignupPolicyName", 1); + } + } + if (SigninPolicyName != null) + { + if (SigninPolicyName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "SigninPolicyName", 1); + } + } + if (ProfileEditingPolicyName != null) + { + if (ProfileEditingPolicyName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "ProfileEditingPolicyName", 1); + } + } + if (PasswordResetPolicyName != null) + { + if (PasswordResetPolicyName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "PasswordResetPolicyName", 1); + } + } + if (ClientId != null) + { + if (ClientId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "ClientId", 1); + } + } + if (ClientSecret != null) + { + if (ClientSecret.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "ClientSecret", 1); + } + } + } } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/KeyVaultContractCreateProperties.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/KeyVaultContractCreateProperties.cs new file mode 100644 index 0000000000000..fdbe073ca243c --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/KeyVaultContractCreateProperties.cs @@ -0,0 +1,70 @@ +// +// 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.ApiManagement.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Create keyVault contract details. + /// + public partial class KeyVaultContractCreateProperties + { + /// + /// Initializes a new instance of the KeyVaultContractCreateProperties + /// class. + /// + public KeyVaultContractCreateProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the KeyVaultContractCreateProperties + /// class. + /// + /// Key vault secret identifier for + /// fetching secret. Providing a versioned secret will prevent + /// auto-refresh. This requires Api Management service to be configured + /// with aka.ms/apimmsi + /// SystemAssignedIdentity or + /// UserAssignedIdentity Client Id which will be used to access key + /// vault secret. + public KeyVaultContractCreateProperties(string secretIdentifier = default(string), string identityClientId = default(string)) + { + SecretIdentifier = secretIdentifier; + IdentityClientId = identityClientId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets key vault secret identifier for fetching secret. + /// Providing a versioned secret will prevent auto-refresh. This + /// requires Api Management service to be configured with + /// aka.ms/apimmsi + /// + [JsonProperty(PropertyName = "secretIdentifier")] + public string SecretIdentifier { get; set; } + + /// + /// Gets or sets systemAssignedIdentity or UserAssignedIdentity Client + /// Id which will be used to access key vault secret. + /// + [JsonProperty(PropertyName = "identityClientId")] + public string IdentityClientId { get; set; } + + } +} diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/KeyVaultContractProperties.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/KeyVaultContractProperties.cs new file mode 100644 index 0000000000000..af91d8a0f22b8 --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/KeyVaultContractProperties.cs @@ -0,0 +1,61 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ApiManagement.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// KeyVault contract details. + /// + public partial class KeyVaultContractProperties : KeyVaultContractCreateProperties + { + /// + /// Initializes a new instance of the KeyVaultContractProperties class. + /// + public KeyVaultContractProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the KeyVaultContractProperties class. + /// + /// Key vault secret identifier for + /// fetching secret. Providing a versioned secret will prevent + /// auto-refresh. This requires Api Management service to be configured + /// with aka.ms/apimmsi + /// SystemAssignedIdentity or + /// UserAssignedIdentity Client Id which will be used to access key + /// vault secret. + /// Last time sync and refresh status of + /// secret from key vault. + public KeyVaultContractProperties(string secretIdentifier = default(string), string identityClientId = default(string), KeyVaultLastAccessStatusContractProperties lastStatus = default(KeyVaultLastAccessStatusContractProperties)) + : base(secretIdentifier, identityClientId) + { + LastStatus = lastStatus; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets last time sync and refresh status of secret from key + /// vault. + /// + [JsonProperty(PropertyName = "lastStatus")] + public KeyVaultLastAccessStatusContractProperties LastStatus { get; set; } + + } +} diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/KeyVaultLastAccessStatusContractProperties.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/KeyVaultLastAccessStatusContractProperties.cs new file mode 100644 index 0000000000000..091bbf9403c18 --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/KeyVaultLastAccessStatusContractProperties.cs @@ -0,0 +1,77 @@ +// +// 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.ApiManagement.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Issue contract Update Properties. + /// + public partial class KeyVaultLastAccessStatusContractProperties + { + /// + /// Initializes a new instance of the + /// KeyVaultLastAccessStatusContractProperties class. + /// + public KeyVaultLastAccessStatusContractProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// KeyVaultLastAccessStatusContractProperties class. + /// + /// Last status code for sync and refresh of secret + /// from key vault. + /// Details of the error else empty. + /// Last time secret was accessed. The date + /// conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as + /// specified by the ISO 8601 standard. + /// + public KeyVaultLastAccessStatusContractProperties(string code = default(string), string message = default(string), System.DateTime? timeStampUtc = default(System.DateTime?)) + { + Code = code; + Message = message; + TimeStampUtc = timeStampUtc; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets last status code for sync and refresh of secret from + /// key vault. + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; set; } + + /// + /// Gets or sets details of the error else empty. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + + /// + /// Gets or sets last time secret was accessed. The date conforms to + /// the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by the + /// ISO 8601 standard. + /// + /// + [JsonProperty(PropertyName = "timeStampUtc")] + public System.DateTime? TimeStampUtc { get; set; } + + } +} diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/LoggerContract.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/LoggerContract.cs index 13a2eef55c947..8c832edbe786f 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/LoggerContract.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/LoggerContract.cs @@ -35,21 +35,21 @@ public LoggerContract() /// Initializes a new instance of the LoggerContract class. /// /// Logger type. Possible values include: - /// 'azureEventHub', 'applicationInsights' - /// The name and SendRule connection string - /// of the event hub for azureEventHub logger. - /// Instrumentation key for applicationInsights logger. + /// 'azureEventHub', 'applicationInsights', 'azureMonitor' /// Resource ID. /// Resource name. /// Resource type for API Management /// resource. /// Logger description. + /// The name and SendRule connection string + /// of the event hub for azureEventHub logger. + /// Instrumentation key for applicationInsights logger. /// Whether records are buffered in the logger /// before publishing. Default is assumed to be true. /// Azure Resource Id of a log target (either /// Azure Event Hub resource or Azure Application Insights /// resource). - public LoggerContract(string loggerType, IDictionary credentials, string id = default(string), string name = default(string), string type = default(string), string description = default(string), bool? isBuffered = default(bool?), string resourceId = default(string)) + public LoggerContract(string loggerType, string id = default(string), string name = default(string), string type = default(string), string description = default(string), IDictionary credentials = default(IDictionary), bool? isBuffered = default(bool?), string resourceId = default(string)) : base(id, name, type) { LoggerType = loggerType; @@ -67,7 +67,7 @@ public LoggerContract() /// /// Gets or sets logger type. Possible values include: 'azureEventHub', - /// 'applicationInsights' + /// 'applicationInsights', 'azureMonitor' /// [JsonProperty(PropertyName = "properties.loggerType")] public string LoggerType { get; set; } @@ -112,9 +112,12 @@ public virtual void Validate() { throw new ValidationException(ValidationRules.CannotBeNull, "LoggerType"); } - if (Credentials == null) + if (Description != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "Credentials"); + if (Description.Length > 256) + { + throw new ValidationException(ValidationRules.MaxLength, "Description", 256); + } } } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/LoggerType.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/LoggerType.cs index 9208818ea38ec..ce68e895d69dd 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/LoggerType.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/LoggerType.cs @@ -24,5 +24,9 @@ public static class LoggerType /// Azure Application Insights as log destination. /// public const string ApplicationInsights = "applicationInsights"; + /// + /// Azure Monitor + /// + public const string AzureMonitor = "azureMonitor"; } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/LoggerUpdateContract.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/LoggerUpdateContract.cs index 0d8246e2e1763..8dfa808f6bd52 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/LoggerUpdateContract.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/LoggerUpdateContract.cs @@ -35,7 +35,7 @@ public LoggerUpdateContract() /// Initializes a new instance of the LoggerUpdateContract class. /// /// Logger type. Possible values include: - /// 'azureEventHub', 'applicationInsights' + /// 'azureEventHub', 'applicationInsights', 'azureMonitor' /// Logger description. /// Logger credentials. /// Whether records are buffered in the logger @@ -56,7 +56,7 @@ public LoggerUpdateContract() /// /// Gets or sets logger type. Possible values include: 'azureEventHub', - /// 'applicationInsights' + /// 'applicationInsights', 'azureMonitor' /// [JsonProperty(PropertyName = "properties.loggerType")] public string LoggerType { get; set; } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/LoggerUpdateHeaders.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/LoggerUpdateHeaders.cs new file mode 100644 index 0000000000000..96ec0608dcc47 --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/LoggerUpdateHeaders.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.ApiManagement.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Update operation. + /// + public partial class LoggerUpdateHeaders + { + /// + /// Initializes a new instance of the LoggerUpdateHeaders class. + /// + public LoggerUpdateHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LoggerUpdateHeaders class. + /// + /// Current entity state version. Should be treated + /// as opaque and used to make conditional HTTP requests. + public LoggerUpdateHeaders(string eTag = default(string)) + { + ETag = eTag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets current entity state version. Should be treated as + /// opaque and used to make conditional HTTP requests. + /// + [JsonProperty(PropertyName = "ETag")] + public string ETag { get; set; } + + } +} diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/NamedValueContract.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/NamedValueContract.cs index 084c3c65eb495..84aa9442a2841 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/NamedValueContract.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/NamedValueContract.cs @@ -49,13 +49,16 @@ public NamedValueContract() /// expressions. It may not be empty or consist only of whitespace. /// This property will not be filled on 'GET' operations! Use /// '/listSecrets' POST request to get the value. - public NamedValueContract(string displayName, string id = default(string), string name = default(string), string type = default(string), IList tags = default(IList), bool? secret = default(bool?), string value = default(string)) + /// KeyVault location details of the + /// namedValue. + public NamedValueContract(string displayName, string id = default(string), string name = default(string), string type = default(string), IList tags = default(IList), bool? secret = default(bool?), string value = default(string), KeyVaultContractProperties keyVault = default(KeyVaultContractProperties)) : base(id, name, type) { Tags = tags; Secret = secret; DisplayName = displayName; Value = value; + KeyVault = keyVault; CustomInit(); } @@ -94,6 +97,12 @@ public NamedValueContract() [JsonProperty(PropertyName = "properties.value")] public string Value { get; set; } + /// + /// Gets or sets keyVault location details of the namedValue. + /// + [JsonProperty(PropertyName = "properties.keyVault")] + public KeyVaultContractProperties KeyVault { get; set; } + /// /// Validate the object. /// @@ -106,6 +115,35 @@ public virtual void Validate() { throw new ValidationException(ValidationRules.CannotBeNull, "DisplayName"); } + if (Tags != null) + { + if (Tags.Count > 32) + { + throw new ValidationException(ValidationRules.MaxItems, "Tags", 32); + } + } + if (DisplayName != null) + { + if (DisplayName.Length > 256) + { + throw new ValidationException(ValidationRules.MaxLength, "DisplayName", 256); + } + if (DisplayName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "DisplayName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(DisplayName, "^[A-Za-z0-9-._]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "DisplayName", "^[A-Za-z0-9-._]+$"); + } + } + if (Value != null) + { + if (Value.Length > 4096) + { + throw new ValidationException(ValidationRules.MaxLength, "Value", 4096); + } + } } } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/NamedValueCreateContract.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/NamedValueCreateContract.cs index 642e1ec7425a4..e22c6af38dc3f 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/NamedValueCreateContract.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/NamedValueCreateContract.cs @@ -37,10 +37,6 @@ public NamedValueCreateContract() /// Unique name of NamedValue. It may contain /// only letters, digits, period, dash, and underscore /// characters. - /// Value of the NamedValue. Can contain policy - /// expressions. It may not be empty or consist only of whitespace. - /// This property will not be filled on 'GET' operations! Use - /// '/listSecrets' POST request to get the value. /// Resource ID. /// Resource name. /// Resource type for API Management @@ -49,13 +45,20 @@ public NamedValueCreateContract() /// filter the NamedValue list. /// Determines whether the value is a secret and /// should be encrypted or not. Default value is false. - public NamedValueCreateContract(string displayName, string value, string id = default(string), string name = default(string), string type = default(string), IList tags = default(IList), bool? secret = default(bool?)) + /// Value of the NamedValue. Can contain policy + /// expressions. It may not be empty or consist only of whitespace. + /// This property will not be filled on 'GET' operations! Use + /// '/listSecrets' POST request to get the value. + /// KeyVault location details of the + /// namedValue. + public NamedValueCreateContract(string displayName, string id = default(string), string name = default(string), string type = default(string), IList tags = default(IList), bool? secret = default(bool?), string value = default(string), KeyVaultContractCreateProperties keyVault = default(KeyVaultContractCreateProperties)) : base(id, name, type) { Tags = tags; Secret = secret; DisplayName = displayName; Value = value; + KeyVault = keyVault; CustomInit(); } @@ -94,6 +97,12 @@ public NamedValueCreateContract() [JsonProperty(PropertyName = "properties.value")] public string Value { get; set; } + /// + /// Gets or sets keyVault location details of the namedValue. + /// + [JsonProperty(PropertyName = "properties.keyVault")] + public KeyVaultContractCreateProperties KeyVault { get; set; } + /// /// Validate the object. /// @@ -106,9 +115,34 @@ public virtual void Validate() { throw new ValidationException(ValidationRules.CannotBeNull, "DisplayName"); } - if (Value == null) + if (Tags != null) + { + if (Tags.Count > 32) + { + throw new ValidationException(ValidationRules.MaxItems, "Tags", 32); + } + } + if (DisplayName != null) + { + if (DisplayName.Length > 256) + { + throw new ValidationException(ValidationRules.MaxLength, "DisplayName", 256); + } + if (DisplayName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "DisplayName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(DisplayName, "^[A-Za-z0-9-._]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "DisplayName", "^[A-Za-z0-9-._]+$"); + } + } + if (Value != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "Value"); + if (Value.Length > 4096) + { + throw new ValidationException(ValidationRules.MaxLength, "Value", 4096); + } } } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/NamedValueEntityBaseParameters.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/NamedValueEntityBaseParameters.cs index 18608bb0df294..9a5074be421b0 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/NamedValueEntityBaseParameters.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/NamedValueEntityBaseParameters.cs @@ -10,6 +10,7 @@ namespace Microsoft.Azure.Management.ApiManagement.Models { + using Microsoft.Rest; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; @@ -63,5 +64,21 @@ public NamedValueEntityBaseParameters() [JsonProperty(PropertyName = "secret")] public bool? Secret { get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Tags != null) + { + if (Tags.Count > 32) + { + throw new ValidationException(ValidationRules.MaxItems, "Tags", 32); + } + } + } } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/NamedValueListValueHeaders.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/NamedValueListValueHeaders.cs new file mode 100644 index 0000000000000..a409052631cae --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/NamedValueListValueHeaders.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.ApiManagement.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for ListValue operation. + /// + public partial class NamedValueListValueHeaders + { + /// + /// Initializes a new instance of the NamedValueListValueHeaders class. + /// + public NamedValueListValueHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NamedValueListValueHeaders class. + /// + /// Current entity state version. Should be treated + /// as opaque and used to make conditional HTTP requests. + public NamedValueListValueHeaders(string eTag = default(string)) + { + ETag = eTag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets current entity state version. Should be treated as + /// opaque and used to make conditional HTTP requests. + /// + [JsonProperty(PropertyName = "ETag")] + public string ETag { get; set; } + + } +} diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/NamedValueSecretContract.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/NamedValueSecretContract.cs new file mode 100644 index 0000000000000..42c9565d846bf --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/NamedValueSecretContract.cs @@ -0,0 +1,52 @@ +// +// 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.ApiManagement.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Client or app secret used in IdentityProviders, Aad, OpenID or OAuth. + /// + public partial class NamedValueSecretContract + { + /// + /// Initializes a new instance of the NamedValueSecretContract class. + /// + public NamedValueSecretContract() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NamedValueSecretContract class. + /// + /// This is secret value of the NamedValue + /// entity. + public NamedValueSecretContract(string value = default(string)) + { + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets this is secret value of the NamedValue entity. + /// + [JsonProperty(PropertyName = "value")] + public string Value { get; set; } + + } +} diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/NamedValueUpdateParameters.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/NamedValueUpdateParameters.cs index 5e91d546893ab..38e2aa884bb4c 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/NamedValueUpdateParameters.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/NamedValueUpdateParameters.cs @@ -44,12 +44,15 @@ public NamedValueUpdateParameters() /// Value of the NamedValue. Can contain policy /// expressions. It may not be empty or consist only of /// whitespace. - public NamedValueUpdateParameters(IList tags = default(IList), bool? secret = default(bool?), string displayName = default(string), string value = default(string)) + /// KeyVault location details of the + /// namedValue. + public NamedValueUpdateParameters(IList tags = default(IList), bool? secret = default(bool?), string displayName = default(string), string value = default(string), KeyVaultContractCreateProperties keyVault = default(KeyVaultContractCreateProperties)) { Tags = tags; Secret = secret; DisplayName = displayName; Value = value; + KeyVault = keyVault; CustomInit(); } @@ -86,5 +89,53 @@ public NamedValueUpdateParameters() [JsonProperty(PropertyName = "properties.value")] public string Value { get; set; } + /// + /// Gets or sets keyVault location details of the namedValue. + /// + [JsonProperty(PropertyName = "properties.keyVault")] + public KeyVaultContractCreateProperties KeyVault { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Tags != null) + { + if (Tags.Count > 32) + { + throw new ValidationException(ValidationRules.MaxItems, "Tags", 32); + } + } + if (DisplayName != null) + { + if (DisplayName.Length > 256) + { + throw new ValidationException(ValidationRules.MaxLength, "DisplayName", 256); + } + if (DisplayName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "DisplayName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(DisplayName, "^[A-Za-z0-9-._]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "DisplayName", "^[A-Za-z0-9-._]+$"); + } + } + if (Value != null) + { + if (Value.Length > 4096) + { + throw new ValidationException(ValidationRules.MaxLength, "Value", 4096); + } + if (Value.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Value", 1); + } + } + } } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/NetworkStatusContractByLocation.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/NetworkStatusContractByLocation.cs index c6a3fe1dbf38a..5608b9e6de5a4 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/NetworkStatusContractByLocation.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/NetworkStatusContractByLocation.cs @@ -10,6 +10,7 @@ namespace Microsoft.Azure.Management.ApiManagement.Models { + using Microsoft.Rest; using Newtonsoft.Json; using System.Linq; @@ -60,11 +61,18 @@ public NetworkStatusContractByLocation() /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() { + if (Location != null) + { + if (Location.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Location", 1); + } + } if (NetworkStatus != null) { NetworkStatus.Validate(); diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/NotificationContract.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/NotificationContract.cs index b904fdef872a5..49a6d346fe0f6 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/NotificationContract.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/NotificationContract.cs @@ -83,6 +83,17 @@ public virtual void Validate() { throw new ValidationException(ValidationRules.CannotBeNull, "Title"); } + if (Title != null) + { + if (Title.Length > 1000) + { + throw new ValidationException(ValidationRules.MaxLength, "Title", 1000); + } + if (Title.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Title", 1); + } + } } } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/OpenIdConnectProviderListSecretsHeaders.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/OpenIdConnectProviderListSecretsHeaders.cs new file mode 100644 index 0000000000000..47a9a47919aba --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/OpenIdConnectProviderListSecretsHeaders.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.ApiManagement.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for ListSecrets operation. + /// + public partial class OpenIdConnectProviderListSecretsHeaders + { + /// + /// Initializes a new instance of the + /// OpenIdConnectProviderListSecretsHeaders class. + /// + public OpenIdConnectProviderListSecretsHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// OpenIdConnectProviderListSecretsHeaders class. + /// + /// Current entity state version. Should be treated + /// as opaque and used to make conditional HTTP requests. + public OpenIdConnectProviderListSecretsHeaders(string eTag = default(string)) + { + ETag = eTag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets current entity state version. Should be treated as + /// opaque and used to make conditional HTTP requests. + /// + [JsonProperty(PropertyName = "ETag")] + public string ETag { get; set; } + + } +} diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/OpenIdConnectProviderUpdateHeaders.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/OpenIdConnectProviderUpdateHeaders.cs new file mode 100644 index 0000000000000..90d3db320fe0d --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/OpenIdConnectProviderUpdateHeaders.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.ApiManagement.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Update operation. + /// + public partial class OpenIdConnectProviderUpdateHeaders + { + /// + /// Initializes a new instance of the + /// OpenIdConnectProviderUpdateHeaders class. + /// + public OpenIdConnectProviderUpdateHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// OpenIdConnectProviderUpdateHeaders class. + /// + /// Current entity state version. Should be treated + /// as opaque and used to make conditional HTTP requests. + public OpenIdConnectProviderUpdateHeaders(string eTag = default(string)) + { + ETag = eTag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets current entity state version. Should be treated as + /// opaque and used to make conditional HTTP requests. + /// + [JsonProperty(PropertyName = "ETag")] + public string ETag { get; set; } + + } +} diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/OpenidConnectProviderContract.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/OpenidConnectProviderContract.cs index 7c7d24ef31c3c..968d453142bcb 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/OpenidConnectProviderContract.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/OpenidConnectProviderContract.cs @@ -115,6 +115,13 @@ public virtual void Validate() { throw new ValidationException(ValidationRules.CannotBeNull, "ClientId"); } + if (DisplayName != null) + { + if (DisplayName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "DisplayName", 50); + } + } } } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/OpenidConnectProviderUpdateContract.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/OpenidConnectProviderUpdateContract.cs index b8e035fed7454..a9f72234fb39d 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/OpenidConnectProviderUpdateContract.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/OpenidConnectProviderUpdateContract.cs @@ -90,5 +90,21 @@ public OpenidConnectProviderUpdateContract() [JsonProperty(PropertyName = "properties.clientSecret")] public string ClientSecret { get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (DisplayName != null) + { + if (DisplayName.Length > 50) + { + throw new ValidationException(ValidationRules.MaxLength, "DisplayName", 50); + } + } + } } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/OperationContract.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/OperationContract.cs index 380ebeb57dae7..0855e59a37557 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/OperationContract.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/OperationContract.cs @@ -152,6 +152,13 @@ public virtual void Validate() } } } + if (Description != null) + { + if (Description.Length > 1000) + { + throw new ValidationException(ValidationRules.MaxLength, "Description", 1000); + } + } if (Responses != null) { foreach (var element1 in Responses) @@ -162,6 +169,28 @@ public virtual void Validate() } } } + if (DisplayName != null) + { + if (DisplayName.Length > 300) + { + throw new ValidationException(ValidationRules.MaxLength, "DisplayName", 300); + } + if (DisplayName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "DisplayName", 1); + } + } + if (UrlTemplate != null) + { + if (UrlTemplate.Length > 1000) + { + throw new ValidationException(ValidationRules.MaxLength, "UrlTemplate", 1000); + } + if (UrlTemplate.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "UrlTemplate", 1); + } + } } } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/OperationEntityBaseContract.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/OperationEntityBaseContract.cs index 31049aca78012..ab95926fea771 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/OperationEntityBaseContract.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/OperationEntityBaseContract.cs @@ -10,6 +10,7 @@ namespace Microsoft.Azure.Management.ApiManagement.Models { + using Microsoft.Rest; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; @@ -86,5 +87,41 @@ public OperationEntityBaseContract() [JsonProperty(PropertyName = "policies")] public string Policies { get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (TemplateParameters != null) + { + foreach (var element in TemplateParameters) + { + if (element != null) + { + element.Validate(); + } + } + } + if (Description != null) + { + if (Description.Length > 1000) + { + throw new ValidationException(ValidationRules.MaxLength, "Description", 1000); + } + } + if (Responses != null) + { + foreach (var element1 in Responses) + { + if (element1 != null) + { + element1.Validate(); + } + } + } + } } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/OperationNameFormat.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/OperationNameFormat.cs new file mode 100644 index 0000000000000..5979f586fdf9e --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/OperationNameFormat.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.ApiManagement.Models +{ + + /// + /// Defines values for OperationNameFormat. + /// + public static class OperationNameFormat + { + /// + /// API_NAME;rev=API_REVISION - OPERATION_NAME + /// + public const string Name = "Name"; + /// + /// HTTP_VERB URL + /// + public const string Url = "Url"; + } +} diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/OperationUpdateContract.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/OperationUpdateContract.cs index 572a0351dd1eb..36308b97b2a8b 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/OperationUpdateContract.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/OperationUpdateContract.cs @@ -117,5 +117,63 @@ public OperationUpdateContract() [JsonProperty(PropertyName = "properties.urlTemplate")] public string UrlTemplate { get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (TemplateParameters != null) + { + foreach (var element in TemplateParameters) + { + if (element != null) + { + element.Validate(); + } + } + } + if (Description != null) + { + if (Description.Length > 1000) + { + throw new ValidationException(ValidationRules.MaxLength, "Description", 1000); + } + } + if (Responses != null) + { + foreach (var element1 in Responses) + { + if (element1 != null) + { + element1.Validate(); + } + } + } + if (DisplayName != null) + { + if (DisplayName.Length > 300) + { + throw new ValidationException(ValidationRules.MaxLength, "DisplayName", 300); + } + if (DisplayName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "DisplayName", 1); + } + } + if (UrlTemplate != null) + { + if (UrlTemplate.Length > 1000) + { + throw new ValidationException(ValidationRules.MaxLength, "UrlTemplate", 1000); + } + if (UrlTemplate.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "UrlTemplate", 1); + } + } + } } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ProductContract.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ProductContract.cs index cdc23aa777928..de06cc03b6ba9 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ProductContract.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ProductContract.cs @@ -162,6 +162,28 @@ public virtual void Validate() { throw new ValidationException(ValidationRules.CannotBeNull, "DisplayName"); } + if (Description != null) + { + if (Description.Length > 1000) + { + throw new ValidationException(ValidationRules.MaxLength, "Description", 1000); + } + if (Description.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Description", 1); + } + } + if (DisplayName != null) + { + if (DisplayName.Length > 300) + { + throw new ValidationException(ValidationRules.MaxLength, "DisplayName", 300); + } + if (DisplayName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "DisplayName", 1); + } + } } } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ProductEntityBaseParameters.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ProductEntityBaseParameters.cs index 68cac208dc657..27c7a314d53b7 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ProductEntityBaseParameters.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ProductEntityBaseParameters.cs @@ -10,6 +10,7 @@ namespace Microsoft.Azure.Management.ApiManagement.Models { + using Microsoft.Rest; using Newtonsoft.Json; using System.Linq; @@ -136,5 +137,25 @@ public ProductEntityBaseParameters() [JsonProperty(PropertyName = "state")] public ProductState? State { get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Description != null) + { + if (Description.Length > 1000) + { + throw new ValidationException(ValidationRules.MaxLength, "Description", 1000); + } + if (Description.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Description", 1); + } + } + } } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ProductTagResourceContractProperties.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ProductTagResourceContractProperties.cs index 35b72f41b0d05..870bc3b61cceb 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ProductTagResourceContractProperties.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ProductTagResourceContractProperties.cs @@ -98,12 +98,24 @@ public ProductTagResourceContractProperties() /// /// Thrown if validation fails /// - public virtual void Validate() + public override void Validate() { + base.Validate(); if (Name == null) { throw new ValidationException(ValidationRules.CannotBeNull, "Name"); } + if (Name != null) + { + if (Name.Length > 300) + { + throw new ValidationException(ValidationRules.MaxLength, "Name", 300); + } + if (Name.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Name", 1); + } + } } } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ProductUpdateHeaders.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ProductUpdateHeaders.cs new file mode 100644 index 0000000000000..b5282ab96b69b --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ProductUpdateHeaders.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.ApiManagement.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Update operation. + /// + public partial class ProductUpdateHeaders + { + /// + /// Initializes a new instance of the ProductUpdateHeaders class. + /// + public ProductUpdateHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ProductUpdateHeaders class. + /// + /// Current entity state version. Should be treated + /// as opaque and used to make conditional HTTP requests. + public ProductUpdateHeaders(string eTag = default(string)) + { + ETag = eTag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets current entity state version. Should be treated as + /// opaque and used to make conditional HTTP requests. + /// + [JsonProperty(PropertyName = "ETag")] + public string ETag { get; set; } + + } +} diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ProductUpdateParameters.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ProductUpdateParameters.cs index e937a865850d0..d131595232c5f 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ProductUpdateParameters.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ProductUpdateParameters.cs @@ -145,5 +145,36 @@ public ProductUpdateParameters() [JsonProperty(PropertyName = "properties.displayName")] public string DisplayName { get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Description != null) + { + if (Description.Length > 1000) + { + throw new ValidationException(ValidationRules.MaxLength, "Description", 1000); + } + if (Description.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Description", 1); + } + } + if (DisplayName != null) + { + if (DisplayName.Length > 300) + { + throw new ValidationException(ValidationRules.MaxLength, "DisplayName", 300); + } + if (DisplayName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "DisplayName", 1); + } + } + } } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/QuotaCounterContract.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/QuotaCounterContract.cs index ea87800b9188b..a71b0049525eb 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/QuotaCounterContract.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/QuotaCounterContract.cs @@ -111,6 +111,20 @@ public virtual void Validate() { throw new ValidationException(ValidationRules.CannotBeNull, "PeriodKey"); } + if (CounterKey != null) + { + if (CounterKey.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "CounterKey", 1); + } + } + if (PeriodKey != null) + { + if (PeriodKey.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "PeriodKey", 1); + } + } } } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ResourceLocationDataContract.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ResourceLocationDataContract.cs index c3d3ac5fdb53e..9ed6e45d5d843 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ResourceLocationDataContract.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ResourceLocationDataContract.cs @@ -92,6 +92,34 @@ public virtual void Validate() { throw new ValidationException(ValidationRules.CannotBeNull, "Name"); } + if (Name != null) + { + if (Name.Length > 256) + { + throw new ValidationException(ValidationRules.MaxLength, "Name", 256); + } + } + if (City != null) + { + if (City.Length > 256) + { + throw new ValidationException(ValidationRules.MaxLength, "City", 256); + } + } + if (District != null) + { + if (District.Length > 256) + { + throw new ValidationException(ValidationRules.MaxLength, "District", 256); + } + } + if (CountryOrRegion != null) + { + if (CountryOrRegion.Length > 256) + { + throw new ValidationException(ValidationRules.MaxLength, "CountryOrRegion", 256); + } + } } } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ResourceSku.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ResourceSku.cs index aa1639c95c445..2bc54052527cb 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ResourceSku.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ResourceSku.cs @@ -30,7 +30,8 @@ public ResourceSku() /// Initializes a new instance of the ResourceSku class. /// /// Name of the Sku. Possible values include: - /// 'Developer', 'Standard', 'Premium', 'Basic', 'Consumption' + /// 'Developer', 'Standard', 'Premium', 'Basic', 'Consumption', + /// 'Isolated' public ResourceSku(string name = default(string)) { Name = name; @@ -44,7 +45,7 @@ public ResourceSku() /// /// Gets or sets name of the Sku. Possible values include: 'Developer', - /// 'Standard', 'Premium', 'Basic', 'Consumption' + /// 'Standard', 'Premium', 'Basic', 'Consumption', 'Isolated' /// [JsonProperty(PropertyName = "name")] public string Name { get; set; } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/SkuType.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/SkuType.cs index 306c9e8f9eb7a..67f24815f7e85 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/SkuType.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/SkuType.cs @@ -36,5 +36,9 @@ public static class SkuType /// Consumption SKU of Api Management. /// public const string Consumption = "Consumption"; + /// + /// Isolated SKU of Api Management. + /// + public const string Isolated = "Isolated"; } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/SubscriptionContract.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/SubscriptionContract.cs index 8dcb69e1793c4..5737a604039cd 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/SubscriptionContract.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/SubscriptionContract.cs @@ -89,7 +89,8 @@ public SubscriptionContract() /// property will not be filled on 'GET' operations! Use '/listSecrets' /// POST request to get the value. /// Optional subscription comment added by - /// an administrator. + /// an administrator when the state is changed to the + /// 'rejected'. /// Determines whether tracing is /// enabled public SubscriptionContract(string scope, SubscriptionState state, string id = default(string), string name = default(string), string type = default(string), string ownerId = default(string), string displayName = default(string), System.DateTime? createdDate = default(System.DateTime?), System.DateTime? startDate = default(System.DateTime?), System.DateTime? expirationDate = default(System.DateTime?), System.DateTime? endDate = default(System.DateTime?), System.DateTime? notificationDate = default(System.DateTime?), string primaryKey = default(string), string secondaryKey = default(string), string stateComment = default(string), bool? allowTracing = default(bool?)) @@ -223,7 +224,7 @@ public SubscriptionContract() /// /// Gets or sets optional subscription comment added by an - /// administrator. + /// administrator when the state is changed to the 'rejected'. /// [JsonProperty(PropertyName = "properties.stateComment")] public string StateComment { get; set; } @@ -246,6 +247,39 @@ public virtual void Validate() { throw new ValidationException(ValidationRules.CannotBeNull, "Scope"); } + if (DisplayName != null) + { + if (DisplayName.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "DisplayName", 100); + } + if (DisplayName.Length < 0) + { + throw new ValidationException(ValidationRules.MinLength, "DisplayName", 0); + } + } + if (PrimaryKey != null) + { + if (PrimaryKey.Length > 256) + { + throw new ValidationException(ValidationRules.MaxLength, "PrimaryKey", 256); + } + if (PrimaryKey.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "PrimaryKey", 1); + } + } + if (SecondaryKey != null) + { + if (SecondaryKey.Length > 256) + { + throw new ValidationException(ValidationRules.MaxLength, "SecondaryKey", 256); + } + if (SecondaryKey.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "SecondaryKey", 1); + } + } } } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/SubscriptionCreateParameters.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/SubscriptionCreateParameters.cs index 6db0f72c1f291..35bd7aa3275a6 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/SubscriptionCreateParameters.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/SubscriptionCreateParameters.cs @@ -147,6 +147,39 @@ public virtual void Validate() { throw new ValidationException(ValidationRules.CannotBeNull, "DisplayName"); } + if (DisplayName != null) + { + if (DisplayName.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "DisplayName", 100); + } + if (DisplayName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "DisplayName", 1); + } + } + if (PrimaryKey != null) + { + if (PrimaryKey.Length > 256) + { + throw new ValidationException(ValidationRules.MaxLength, "PrimaryKey", 256); + } + if (PrimaryKey.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "PrimaryKey", 1); + } + } + if (SecondaryKey != null) + { + if (SecondaryKey.Length > 256) + { + throw new ValidationException(ValidationRules.MaxLength, "SecondaryKey", 256); + } + if (SecondaryKey.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "SecondaryKey", 1); + } + } } } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/SubscriptionKeysContract.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/SubscriptionKeysContract.cs index e08de2a2fc3b3..6d042d52bc5ad 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/SubscriptionKeysContract.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/SubscriptionKeysContract.cs @@ -10,6 +10,7 @@ namespace Microsoft.Azure.Management.ApiManagement.Models { + using Microsoft.Rest; using Newtonsoft.Json; using System.Linq; @@ -55,5 +56,36 @@ public SubscriptionKeysContract() [JsonProperty(PropertyName = "secondaryKey")] public string SecondaryKey { get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (PrimaryKey != null) + { + if (PrimaryKey.Length > 256) + { + throw new ValidationException(ValidationRules.MaxLength, "PrimaryKey", 256); + } + if (PrimaryKey.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "PrimaryKey", 1); + } + } + if (SecondaryKey != null) + { + if (SecondaryKey.Length > 256) + { + throw new ValidationException(ValidationRules.MaxLength, "SecondaryKey", 256); + } + if (SecondaryKey.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "SecondaryKey", 1); + } + } + } } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/SubscriptionListSecretsHeaders.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/SubscriptionListSecretsHeaders.cs new file mode 100644 index 0000000000000..e6bb122ac4914 --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/SubscriptionListSecretsHeaders.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.ApiManagement.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for ListSecrets operation. + /// + public partial class SubscriptionListSecretsHeaders + { + /// + /// Initializes a new instance of the SubscriptionListSecretsHeaders + /// class. + /// + public SubscriptionListSecretsHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SubscriptionListSecretsHeaders + /// class. + /// + /// Current entity state version. Should be treated + /// as opaque and used to make conditional HTTP requests. + public SubscriptionListSecretsHeaders(string eTag = default(string)) + { + ETag = eTag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets current entity state version. Should be treated as + /// opaque and used to make conditional HTTP requests. + /// + [JsonProperty(PropertyName = "ETag")] + public string ETag { get; set; } + + } +} diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/SubscriptionUpdateHeaders.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/SubscriptionUpdateHeaders.cs new file mode 100644 index 0000000000000..1e4b1cbdd7e6d --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/SubscriptionUpdateHeaders.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.ApiManagement.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Update operation. + /// + public partial class SubscriptionUpdateHeaders + { + /// + /// Initializes a new instance of the SubscriptionUpdateHeaders class. + /// + public SubscriptionUpdateHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SubscriptionUpdateHeaders class. + /// + /// Current entity state version. Should be treated + /// as opaque and used to make conditional HTTP requests. + public SubscriptionUpdateHeaders(string eTag = default(string)) + { + ETag = eTag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets current entity state version. Should be treated as + /// opaque and used to make conditional HTTP requests. + /// + [JsonProperty(PropertyName = "ETag")] + public string ETag { get; set; } + + } +} diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/SubscriptionUpdateParameters.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/SubscriptionUpdateParameters.cs index 8bdac5b760c6d..144a7f3fb6172 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/SubscriptionUpdateParameters.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/SubscriptionUpdateParameters.cs @@ -57,7 +57,8 @@ public SubscriptionUpdateParameters() /// date and was deactivated. Possible values include: 'suspended', /// 'active', 'expired', 'submitted', 'rejected', 'cancelled' /// Comments describing subscription state - /// change by the administrator. + /// change by the administrator when the state is changed to the + /// 'rejected'. /// Determines whether tracing can be /// enabled public SubscriptionUpdateParameters(string ownerId = default(string), string scope = default(string), System.DateTime? expirationDate = default(System.DateTime?), string displayName = default(string), string primaryKey = default(string), string secondaryKey = default(string), SubscriptionState? state = default(SubscriptionState?), string stateComment = default(string), bool? allowTracing = default(bool?)) @@ -137,7 +138,7 @@ public SubscriptionUpdateParameters() /// /// Gets or sets comments describing subscription state change by the - /// administrator. + /// administrator when the state is changed to the 'rejected'. /// [JsonProperty(PropertyName = "properties.stateComment")] public string StateComment { get; set; } @@ -148,5 +149,36 @@ public SubscriptionUpdateParameters() [JsonProperty(PropertyName = "properties.allowTracing")] public bool? AllowTracing { get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (PrimaryKey != null) + { + if (PrimaryKey.Length > 256) + { + throw new ValidationException(ValidationRules.MaxLength, "PrimaryKey", 256); + } + if (PrimaryKey.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "PrimaryKey", 1); + } + } + if (SecondaryKey != null) + { + if (SecondaryKey.Length > 256) + { + throw new ValidationException(ValidationRules.MaxLength, "SecondaryKey", 256); + } + if (SecondaryKey.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "SecondaryKey", 1); + } + } + } } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/TagContract.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/TagContract.cs index 09e91423f0f7c..a1b2a33496e23 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/TagContract.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/TagContract.cs @@ -67,6 +67,17 @@ public virtual void Validate() { throw new ValidationException(ValidationRules.CannotBeNull, "DisplayName"); } + if (DisplayName != null) + { + if (DisplayName.Length > 160) + { + throw new ValidationException(ValidationRules.MaxLength, "DisplayName", 160); + } + if (DisplayName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "DisplayName", 1); + } + } } } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/TagCreateUpdateParameters.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/TagCreateUpdateParameters.cs index d4012efee2670..6bf21e536e8b1 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/TagCreateUpdateParameters.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/TagCreateUpdateParameters.cs @@ -62,6 +62,17 @@ public virtual void Validate() { throw new ValidationException(ValidationRules.CannotBeNull, "DisplayName"); } + if (DisplayName != null) + { + if (DisplayName.Length > 160) + { + throw new ValidationException(ValidationRules.MaxLength, "DisplayName", 160); + } + if (DisplayName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "DisplayName", 1); + } + } } } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/TagDescriptionContract.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/TagDescriptionContract.cs index ea183cd66f940..343ac9393717d 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/TagDescriptionContract.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/TagDescriptionContract.cs @@ -91,5 +91,32 @@ public TagDescriptionContract() [JsonProperty(PropertyName = "properties.displayName")] public string DisplayName { get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ExternalDocsUrl != null) + { + if (ExternalDocsUrl.Length > 2000) + { + throw new ValidationException(ValidationRules.MaxLength, "ExternalDocsUrl", 2000); + } + } + if (DisplayName != null) + { + if (DisplayName.Length > 160) + { + throw new ValidationException(ValidationRules.MaxLength, "DisplayName", 160); + } + if (DisplayName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "DisplayName", 1); + } + } + } } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/TagDescriptionCreateParameters.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/TagDescriptionCreateParameters.cs index 03a356ee01950..c40b4d65ab8ce 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/TagDescriptionCreateParameters.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/TagDescriptionCreateParameters.cs @@ -71,5 +71,21 @@ public TagDescriptionCreateParameters() [JsonProperty(PropertyName = "properties.externalDocsDescription")] public string ExternalDocsDescription { get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ExternalDocsUrl != null) + { + if (ExternalDocsUrl.Length > 2000) + { + throw new ValidationException(ValidationRules.MaxLength, "ExternalDocsUrl", 2000); + } + } + } } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/TagResourceContract.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/TagResourceContract.cs index ce13df9d2e7b8..ccfdb809b4fc6 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/TagResourceContract.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/TagResourceContract.cs @@ -84,6 +84,14 @@ public virtual void Validate() { throw new ValidationException(ValidationRules.CannotBeNull, "Tag"); } + if (Tag != null) + { + Tag.Validate(); + } + if (Api != null) + { + Api.Validate(); + } if (Product != null) { Product.Validate(); diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/TagTagResourceContractProperties.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/TagTagResourceContractProperties.cs index c2244f85d4c59..a0c8b4332eb9c 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/TagTagResourceContractProperties.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/TagTagResourceContractProperties.cs @@ -10,6 +10,7 @@ namespace Microsoft.Azure.Management.ApiManagement.Models { + using Microsoft.Rest; using Newtonsoft.Json; using System.Linq; @@ -57,5 +58,25 @@ public TagTagResourceContractProperties() [JsonProperty(PropertyName = "name")] public string Name { get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name != null) + { + if (Name.Length > 160) + { + throw new ValidationException(ValidationRules.MaxLength, "Name", 160); + } + if (Name.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Name", 1); + } + } + } } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/TagUpdateHeaders.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/TagUpdateHeaders.cs new file mode 100644 index 0000000000000..11c038c0a202c --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/TagUpdateHeaders.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.ApiManagement.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Update operation. + /// + public partial class TagUpdateHeaders + { + /// + /// Initializes a new instance of the TagUpdateHeaders class. + /// + public TagUpdateHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TagUpdateHeaders class. + /// + /// Current entity state version. Should be treated + /// as opaque and used to make conditional HTTP requests. + public TagUpdateHeaders(string eTag = default(string)) + { + ETag = eTag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets current entity state version. Should be treated as + /// opaque and used to make conditional HTTP requests. + /// + [JsonProperty(PropertyName = "ETag")] + public string ETag { get; set; } + + } +} diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/TenantAccessUpdateHeaders.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/TenantAccessUpdateHeaders.cs new file mode 100644 index 0000000000000..689c1d96f57c5 --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/TenantAccessUpdateHeaders.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.ApiManagement.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Update operation. + /// + public partial class TenantAccessUpdateHeaders + { + /// + /// Initializes a new instance of the TenantAccessUpdateHeaders class. + /// + public TenantAccessUpdateHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TenantAccessUpdateHeaders class. + /// + /// Current entity state version. Should be treated + /// as opaque and used to make conditional HTTP requests. + public TenantAccessUpdateHeaders(string eTag = default(string)) + { + ETag = eTag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets current entity state version. Should be treated as + /// opaque and used to make conditional HTTP requests. + /// + [JsonProperty(PropertyName = "ETag")] + public string ETag { get; set; } + + } +} diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/UserCreateParameters.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/UserCreateParameters.cs index 1feefcfa5fdfb..a92b74a5300d1 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/UserCreateParameters.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/UserCreateParameters.cs @@ -49,8 +49,8 @@ public UserCreateParameters() /// User Password. If no value is provided, a /// default password is generated. /// Determines the type of application which send - /// the create user request. Default is old publisher portal. Possible - /// values include: 'developerPortal' + /// the create user request. Default is legacy portal. Possible values + /// include: 'portal', 'developerPortal' /// Determines the type of confirmation /// e-mail that will be sent to the newly created user. Possible values /// include: 'signup', 'invite' @@ -122,8 +122,8 @@ public UserCreateParameters() /// /// Gets or sets determines the type of application which send the - /// create user request. Default is old publisher portal. Possible - /// values include: 'developerPortal' + /// create user request. Default is legacy portal. Possible values + /// include: 'portal', 'developerPortal' /// [JsonProperty(PropertyName = "properties.appType")] public string AppType { get; set; } @@ -156,6 +156,39 @@ public virtual void Validate() { throw new ValidationException(ValidationRules.CannotBeNull, "LastName"); } + if (Email != null) + { + if (Email.Length > 254) + { + throw new ValidationException(ValidationRules.MaxLength, "Email", 254); + } + if (Email.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Email", 1); + } + } + if (FirstName != null) + { + if (FirstName.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "FirstName", 100); + } + if (FirstName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "FirstName", 1); + } + } + if (LastName != null) + { + if (LastName.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "LastName", 100); + } + if (LastName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "LastName", 1); + } + } } } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/UserUpdateHeaders.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/UserUpdateHeaders.cs new file mode 100644 index 0000000000000..ced49ea7f1944 --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/UserUpdateHeaders.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.ApiManagement.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Update operation. + /// + public partial class UserUpdateHeaders + { + /// + /// Initializes a new instance of the UserUpdateHeaders class. + /// + public UserUpdateHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UserUpdateHeaders class. + /// + /// Current entity state version. Should be treated + /// as opaque and used to make conditional HTTP requests. + public UserUpdateHeaders(string eTag = default(string)) + { + ETag = eTag; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets current entity state version. Should be treated as + /// opaque and used to make conditional HTTP requests. + /// + [JsonProperty(PropertyName = "ETag")] + public string ETag { get; set; } + + } +} diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/UserUpdateParameters.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/UserUpdateParameters.cs index 3e5669ded042a..c192304971b1c 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/UserUpdateParameters.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/UserUpdateParameters.cs @@ -110,5 +110,47 @@ public UserUpdateParameters() [JsonProperty(PropertyName = "properties.lastName")] public string LastName { get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Email != null) + { + if (Email.Length > 254) + { + throw new ValidationException(ValidationRules.MaxLength, "Email", 254); + } + if (Email.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Email", 1); + } + } + if (FirstName != null) + { + if (FirstName.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "FirstName", 100); + } + if (FirstName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "FirstName", 1); + } + } + if (LastName != null) + { + if (LastName.Length > 100) + { + throw new ValidationException(ValidationRules.MaxLength, "LastName", 100); + } + if (LastName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "LastName", 1); + } + } + } } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/VirtualNetworkConfiguration.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/VirtualNetworkConfiguration.cs index 245f6290f43ca..dbbf9d18810b1 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/VirtualNetworkConfiguration.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/VirtualNetworkConfiguration.cs @@ -10,6 +10,7 @@ namespace Microsoft.Azure.Management.ApiManagement.Models { + using Microsoft.Rest; using Newtonsoft.Json; using System.Linq; @@ -70,5 +71,21 @@ public VirtualNetworkConfiguration() [JsonProperty(PropertyName = "subnetResourceId")] public string SubnetResourceId { get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (SubnetResourceId != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(SubnetResourceId, "^/subscriptions/[^/]*/resourceGroups/[^/]*/providers/Microsoft.(ClassicNetwork|Network)/virtualNetworks/[^/]*/subnets/[^/]*$")) + { + throw new ValidationException(ValidationRules.Pattern, "SubnetResourceId", "^/subscriptions/[^/]*/resourceGroups/[^/]*/providers/Microsoft.(ClassicNetwork|Network)/virtualNetworks/[^/]*/subnets/[^/]*$"); + } + } + } } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/NamedValueOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/NamedValueOperations.cs index 1f011e9fa4eaf..11de8a28d0520 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/NamedValueOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/NamedValueOperations.cs @@ -52,7 +52,7 @@ internal NamedValueOperations(ApiManagementClient client) public ApiManagementClient Client { get; private set; } /// - /// Lists a collection of NamedValues defined within a service instance. + /// Lists a collection of named values defined within a service instance. /// /// /// @@ -110,11 +110,14 @@ internal NamedValueOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -125,7 +128,6 @@ internal NamedValueOperations(ApiManagementClient client) tracingParameters.Add("odataQuery", odataQuery); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByService", tracingParameters); } @@ -144,9 +146,9 @@ internal NamedValueOperations(ApiManagementClient client) _queryParameters.Add(_odataFilter); } } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -269,7 +271,7 @@ internal NamedValueOperations(ApiManagementClient client) } /// - /// Gets the entity state (Etag) version of the NamedValue specified by its + /// Gets the entity state (Etag) version of the named value specified by its /// identifier. /// /// @@ -339,11 +341,14 @@ internal NamedValueOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "namedValueId", "^[^*#&+:<>?]+$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -354,7 +359,6 @@ internal NamedValueOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("namedValueId", namedValueId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetEntityTag", tracingParameters); } @@ -366,9 +370,9 @@ internal NamedValueOperations(ApiManagementClient client) _url = _url.Replace("{namedValueId}", System.Uri.EscapeDataString(namedValueId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -486,7 +490,7 @@ internal NamedValueOperations(ApiManagementClient client) } /// - /// Gets the details of the NamedValue specified by its identifier. + /// Gets the details of the named value specified by its identifier. /// /// /// The name of the resource group. @@ -558,11 +562,14 @@ internal NamedValueOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "namedValueId", "^[^*#&+:<>?]+$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -573,7 +580,6 @@ internal NamedValueOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("namedValueId", namedValueId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -585,9 +591,9 @@ internal NamedValueOperations(ApiManagementClient client) _url = _url.Replace("{namedValueId}", System.Uri.EscapeDataString(namedValueId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -723,7 +729,7 @@ internal NamedValueOperations(ApiManagementClient client) } /// - /// Creates or updates a NamedValue. + /// Creates or updates named value. /// /// /// The name of the resource group. @@ -755,7 +761,7 @@ internal NamedValueOperations(ApiManagementClient client) } /// - /// Updates the specific NamedValue. + /// Updates the specific named value. /// /// /// The name of the resource group. @@ -788,7 +794,7 @@ internal NamedValueOperations(ApiManagementClient client) } /// - /// Deletes specific NamedValue from the API Management service instance. + /// Deletes specific named value from the API Management service instance. /// /// /// The name of the resource group. @@ -866,11 +872,14 @@ internal NamedValueOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -882,7 +891,6 @@ internal NamedValueOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("namedValueId", namedValueId); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } @@ -894,9 +902,9 @@ internal NamedValueOperations(ApiManagementClient client) _url = _url.Replace("{namedValueId}", System.Uri.EscapeDataString(namedValueId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1009,7 +1017,7 @@ internal NamedValueOperations(ApiManagementClient client) } /// - /// Gets the secret value of the NamedValue. + /// Gets the secret of the named value specified by its identifier. /// /// /// The name of the resource group. @@ -1041,7 +1049,7 @@ internal NamedValueOperations(ApiManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> ListValueWithHttpMessagesAsync(string resourceGroupName, string serviceName, string namedValueId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ListValueWithHttpMessagesAsync(string resourceGroupName, string serviceName, string namedValueId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -1081,11 +1089,14 @@ internal NamedValueOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "namedValueId", "^[^*#&+:<>?]+$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1096,7 +1107,6 @@ internal NamedValueOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("namedValueId", namedValueId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListValue", tracingParameters); } @@ -1108,9 +1118,9 @@ internal NamedValueOperations(ApiManagementClient client) _url = _url.Replace("{namedValueId}", System.Uri.EscapeDataString(namedValueId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1200,7 +1210,7 @@ internal NamedValueOperations(ApiManagementClient 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")) @@ -1213,7 +1223,7 @@ internal NamedValueOperations(ApiManagementClient 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) { @@ -1225,6 +1235,19 @@ internal NamedValueOperations(ApiManagementClient 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); @@ -1233,7 +1256,7 @@ internal NamedValueOperations(ApiManagementClient client) } /// - /// Creates or updates a NamedValue. + /// Creates or updates named value. /// /// /// The name of the resource group. @@ -1320,11 +1343,14 @@ internal NamedValueOperations(ApiManagementClient client) { parameters.Validate(); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1337,7 +1363,6 @@ internal NamedValueOperations(ApiManagementClient client) tracingParameters.Add("namedValueId", namedValueId); tracingParameters.Add("parameters", parameters); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); } @@ -1349,9 +1374,9 @@ internal NamedValueOperations(ApiManagementClient client) _url = _url.Replace("{namedValueId}", System.Uri.EscapeDataString(namedValueId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1519,7 +1544,7 @@ internal NamedValueOperations(ApiManagementClient client) } /// - /// Updates the specific NamedValue. + /// Updates the specific named value. /// /// /// The name of the resource group. @@ -1607,11 +1632,14 @@ internal NamedValueOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1624,7 +1652,6 @@ internal NamedValueOperations(ApiManagementClient client) tracingParameters.Add("namedValueId", namedValueId); tracingParameters.Add("parameters", parameters); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); } @@ -1636,9 +1663,9 @@ internal NamedValueOperations(ApiManagementClient client) _url = _url.Replace("{namedValueId}", System.Uri.EscapeDataString(namedValueId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1712,7 +1739,7 @@ internal NamedValueOperations(ApiManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + if ((int)_statusCode != 200 && (int)_statusCode != 202) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -1788,7 +1815,7 @@ internal NamedValueOperations(ApiManagementClient client) } /// - /// Lists a collection of NamedValues defined within a service instance. + /// Lists a collection of named values defined within a service instance. /// /// /// diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/NamedValueOperationsExtensions.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/NamedValueOperationsExtensions.cs index a19f1d28a260b..4c34226950316 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/NamedValueOperationsExtensions.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/NamedValueOperationsExtensions.cs @@ -23,7 +23,7 @@ namespace Microsoft.Azure.Management.ApiManagement public static partial class NamedValueOperationsExtensions { /// - /// Lists a collection of NamedValues defined within a service instance. + /// Lists a collection of named values defined within a service instance. /// /// /// @@ -44,7 +44,7 @@ public static partial class NamedValueOperationsExtensions } /// - /// Lists a collection of NamedValues defined within a service instance. + /// Lists a collection of named values defined within a service instance. /// /// /// @@ -71,7 +71,7 @@ public static partial class NamedValueOperationsExtensions } /// - /// Gets the entity state (Etag) version of the NamedValue specified by its + /// Gets the entity state (Etag) version of the named value specified by its /// identifier. /// /// @@ -92,7 +92,7 @@ public static NamedValueGetEntityTagHeaders GetEntityTag(this INamedValueOperati } /// - /// Gets the entity state (Etag) version of the NamedValue specified by its + /// Gets the entity state (Etag) version of the named value specified by its /// identifier. /// /// @@ -119,7 +119,7 @@ public static NamedValueGetEntityTagHeaders GetEntityTag(this INamedValueOperati } /// - /// Gets the details of the NamedValue specified by its identifier. + /// Gets the details of the named value specified by its identifier. /// /// /// The operations group for this extension method. @@ -139,7 +139,7 @@ public static NamedValueContract Get(this INamedValueOperations operations, stri } /// - /// Gets the details of the NamedValue specified by its identifier. + /// Gets the details of the named value specified by its identifier. /// /// /// The operations group for this extension method. @@ -165,7 +165,7 @@ public static NamedValueContract Get(this INamedValueOperations operations, stri } /// - /// Creates or updates a NamedValue. + /// Creates or updates named value. /// /// /// The operations group for this extension method. @@ -192,7 +192,7 @@ public static NamedValueContract Get(this INamedValueOperations operations, stri } /// - /// Creates or updates a NamedValue. + /// Creates or updates named value. /// /// /// The operations group for this extension method. @@ -225,7 +225,7 @@ public static NamedValueContract Get(this INamedValueOperations operations, stri } /// - /// Updates the specific NamedValue. + /// Updates the specific named value. /// /// /// The operations group for this extension method. @@ -253,7 +253,7 @@ public static NamedValueContract Update(this INamedValueOperations operations, s } /// - /// Updates the specific NamedValue. + /// Updates the specific named value. /// /// /// The operations group for this extension method. @@ -287,7 +287,7 @@ public static NamedValueContract Update(this INamedValueOperations operations, s } /// - /// Deletes specific NamedValue from the API Management service instance. + /// Deletes specific named value from the API Management service instance. /// /// /// The operations group for this extension method. @@ -312,7 +312,7 @@ public static void Delete(this INamedValueOperations operations, string resource } /// - /// Deletes specific NamedValue from the API Management service instance. + /// Deletes specific named value from the API Management service instance. /// /// /// The operations group for this extension method. @@ -340,7 +340,7 @@ public static void Delete(this INamedValueOperations operations, string resource } /// - /// Gets the secret value of the NamedValue. + /// Gets the secret of the named value specified by its identifier. /// /// /// The operations group for this extension method. @@ -354,13 +354,13 @@ public static void Delete(this INamedValueOperations operations, string resource /// /// Identifier of the NamedValue. /// - public static PropertyValueContract ListValue(this INamedValueOperations operations, string resourceGroupName, string serviceName, string namedValueId) + public static NamedValueSecretContract ListValue(this INamedValueOperations operations, string resourceGroupName, string serviceName, string namedValueId) { return operations.ListValueAsync(resourceGroupName, serviceName, namedValueId).GetAwaiter().GetResult(); } /// - /// Gets the secret value of the NamedValue. + /// Gets the secret of the named value specified by its identifier. /// /// /// The operations group for this extension method. @@ -377,7 +377,7 @@ public static PropertyValueContract ListValue(this INamedValueOperations operati /// /// The cancellation token. /// - public static async Task ListValueAsync(this INamedValueOperations operations, string resourceGroupName, string serviceName, string namedValueId, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ListValueAsync(this INamedValueOperations operations, string resourceGroupName, string serviceName, string namedValueId, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListValueWithHttpMessagesAsync(resourceGroupName, serviceName, namedValueId, null, cancellationToken).ConfigureAwait(false)) { @@ -386,7 +386,7 @@ public static PropertyValueContract ListValue(this INamedValueOperations operati } /// - /// Creates or updates a NamedValue. + /// Creates or updates named value. /// /// /// The operations group for this extension method. @@ -413,7 +413,7 @@ public static PropertyValueContract ListValue(this INamedValueOperations operati } /// - /// Creates or updates a NamedValue. + /// Creates or updates named value. /// /// /// The operations group for this extension method. @@ -446,7 +446,7 @@ public static PropertyValueContract ListValue(this INamedValueOperations operati } /// - /// Updates the specific NamedValue. + /// Updates the specific named value. /// /// /// The operations group for this extension method. @@ -474,7 +474,7 @@ public static NamedValueContract BeginUpdate(this INamedValueOperations operatio } /// - /// Updates the specific NamedValue. + /// Updates the specific named value. /// /// /// The operations group for this extension method. @@ -508,7 +508,7 @@ public static NamedValueContract BeginUpdate(this INamedValueOperations operatio } /// - /// Lists a collection of NamedValues defined within a service instance. + /// Lists a collection of named values defined within a service instance. /// /// /// @@ -523,7 +523,7 @@ public static IPage ListByServiceNext(this INamedValueOperat } /// - /// Lists a collection of NamedValues defined within a service instance. + /// Lists a collection of named values defined within a service instance. /// /// /// diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/NetworkStatusOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/NetworkStatusOperations.cs index f737476ac7b1b..2536b3e729a65 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/NetworkStatusOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/NetworkStatusOperations.cs @@ -111,7 +111,10 @@ internal NetworkStatusOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); } } - string apiVersion = "2019-12-01"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -121,7 +124,6 @@ internal NetworkStatusOperations(ApiManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByService", tracingParameters); } @@ -132,9 +134,9 @@ internal NetworkStatusOperations(ApiManagementClient client) _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -332,7 +334,10 @@ internal NetworkStatusOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.MinLength, "locationName", 1); } } - string apiVersion = "2019-12-01"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -343,7 +348,6 @@ internal NetworkStatusOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("locationName", locationName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByLocation", tracingParameters); } @@ -355,9 +359,9 @@ internal NetworkStatusOperations(ApiManagementClient client) _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); _url = _url.Replace("{locationName}", System.Uri.EscapeDataString(locationName)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/NotificationOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/NotificationOperations.cs index dbcfaef52bbc8..78443260da12e 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/NotificationOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/NotificationOperations.cs @@ -119,11 +119,14 @@ internal NotificationOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.InclusiveMinimum, "skip", 0); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -135,7 +138,6 @@ internal NotificationOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("top", top); tracingParameters.Add("skip", skip); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByService", tracingParameters); } @@ -154,9 +156,9 @@ internal NotificationOperations(ApiManagementClient client) { _queryParameters.Add(string.Format("$skip={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(skip, Client.SerializationSettings).Trim('"')))); } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -345,11 +347,14 @@ internal NotificationOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "notificationName"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -360,7 +365,6 @@ internal NotificationOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("notificationName", notificationName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -372,9 +376,9 @@ internal NotificationOperations(ApiManagementClient client) _url = _url.Replace("{notificationName}", System.Uri.EscapeDataString(notificationName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -567,11 +571,14 @@ internal NotificationOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "notificationName"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -583,7 +590,6 @@ internal NotificationOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("notificationName", notificationName); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } @@ -595,9 +601,9 @@ internal NotificationOperations(ApiManagementClient client) _url = _url.Replace("{notificationName}", System.Uri.EscapeDataString(notificationName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/NotificationRecipientEmailOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/NotificationRecipientEmailOperations.cs index 6ecd599f5c59b..2d332f8ef319c 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/NotificationRecipientEmailOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/NotificationRecipientEmailOperations.cs @@ -118,11 +118,14 @@ internal NotificationRecipientEmailOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "notificationName"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -133,7 +136,6 @@ internal NotificationRecipientEmailOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("notificationName", notificationName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByNotification", tracingParameters); } @@ -145,9 +147,9 @@ internal NotificationRecipientEmailOperations(ApiManagementClient client) _url = _url.Replace("{notificationName}", System.Uri.EscapeDataString(notificationName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -340,11 +342,14 @@ internal NotificationRecipientEmailOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "email"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -356,7 +361,6 @@ internal NotificationRecipientEmailOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("notificationName", notificationName); tracingParameters.Add("email", email); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CheckEntityExists", tracingParameters); } @@ -369,9 +373,9 @@ internal NotificationRecipientEmailOperations(ApiManagementClient client) _url = _url.Replace("{email}", System.Uri.EscapeDataString(email)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -550,11 +554,14 @@ internal NotificationRecipientEmailOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "email"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -566,7 +573,6 @@ internal NotificationRecipientEmailOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("notificationName", notificationName); tracingParameters.Add("email", email); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } @@ -579,9 +585,9 @@ internal NotificationRecipientEmailOperations(ApiManagementClient client) _url = _url.Replace("{email}", System.Uri.EscapeDataString(email)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -792,11 +798,14 @@ internal NotificationRecipientEmailOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "email"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -808,7 +817,6 @@ internal NotificationRecipientEmailOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("notificationName", notificationName); tracingParameters.Add("email", email); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } @@ -821,9 +829,9 @@ internal NotificationRecipientEmailOperations(ApiManagementClient client) _url = _url.Replace("{email}", System.Uri.EscapeDataString(email)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/NotificationRecipientUserOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/NotificationRecipientUserOperations.cs index 748ab2b6916e7..e47f2869fa297 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/NotificationRecipientUserOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/NotificationRecipientUserOperations.cs @@ -118,11 +118,14 @@ internal NotificationRecipientUserOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "notificationName"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -133,7 +136,6 @@ internal NotificationRecipientUserOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("notificationName", notificationName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByNotification", tracingParameters); } @@ -145,9 +147,9 @@ internal NotificationRecipientUserOperations(ApiManagementClient client) _url = _url.Replace("{notificationName}", System.Uri.EscapeDataString(notificationName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -353,11 +355,14 @@ internal NotificationRecipientUserOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.MinLength, "userId", 1); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -369,7 +374,6 @@ internal NotificationRecipientUserOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("notificationName", notificationName); tracingParameters.Add("userId", userId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CheckEntityExists", tracingParameters); } @@ -382,9 +386,9 @@ internal NotificationRecipientUserOperations(ApiManagementClient client) _url = _url.Replace("{userId}", System.Uri.EscapeDataString(userId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -576,11 +580,14 @@ internal NotificationRecipientUserOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.MinLength, "userId", 1); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -592,7 +599,6 @@ internal NotificationRecipientUserOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("notificationName", notificationName); tracingParameters.Add("userId", userId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } @@ -605,9 +611,9 @@ internal NotificationRecipientUserOperations(ApiManagementClient client) _url = _url.Replace("{userId}", System.Uri.EscapeDataString(userId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -830,11 +836,14 @@ internal NotificationRecipientUserOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.MinLength, "userId", 1); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -846,7 +855,6 @@ internal NotificationRecipientUserOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("notificationName", notificationName); tracingParameters.Add("userId", userId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } @@ -859,9 +867,9 @@ internal NotificationRecipientUserOperations(ApiManagementClient client) _url = _url.Replace("{userId}", System.Uri.EscapeDataString(userId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/OpenIdConnectProviderOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/OpenIdConnectProviderOperations.cs index 031e1fb573fd0..cf44bb5ff433b 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/OpenIdConnectProviderOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/OpenIdConnectProviderOperations.cs @@ -109,11 +109,14 @@ internal OpenIdConnectProviderOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -124,7 +127,6 @@ internal OpenIdConnectProviderOperations(ApiManagementClient client) tracingParameters.Add("odataQuery", odataQuery); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByService", tracingParameters); } @@ -143,9 +145,9 @@ internal OpenIdConnectProviderOperations(ApiManagementClient client) _queryParameters.Add(_odataFilter); } } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -338,11 +340,14 @@ internal OpenIdConnectProviderOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "opid", "^[^*#&+:<>?]+$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -353,7 +358,6 @@ internal OpenIdConnectProviderOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("opid", opid); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetEntityTag", tracingParameters); } @@ -365,9 +369,9 @@ internal OpenIdConnectProviderOperations(ApiManagementClient client) _url = _url.Replace("{opid}", System.Uri.EscapeDataString(opid)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -485,7 +489,7 @@ internal OpenIdConnectProviderOperations(ApiManagementClient client) } /// - /// Gets specific OpenID Connect Provider. + /// Gets specific OpenID Connect Provider without secrets. /// /// /// The name of the resource group. @@ -557,11 +561,14 @@ internal OpenIdConnectProviderOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "opid", "^[^*#&+:<>?]+$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -572,7 +579,6 @@ internal OpenIdConnectProviderOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("opid", opid); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -584,9 +590,9 @@ internal OpenIdConnectProviderOperations(ApiManagementClient client) _url = _url.Replace("{opid}", System.Uri.EscapeDataString(opid)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -809,11 +815,14 @@ internal OpenIdConnectProviderOperations(ApiManagementClient client) { parameters.Validate(); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -826,7 +835,6 @@ internal OpenIdConnectProviderOperations(ApiManagementClient client) tracingParameters.Add("opid", opid); tracingParameters.Add("parameters", parameters); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } @@ -838,9 +846,9 @@ internal OpenIdConnectProviderOperations(ApiManagementClient client) _url = _url.Replace("{opid}", System.Uri.EscapeDataString(opid)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1036,6 +1044,9 @@ internal OpenIdConnectProviderOperations(ApiManagementClient client) /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// @@ -1045,7 +1056,7 @@ internal OpenIdConnectProviderOperations(ApiManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string opid, OpenidConnectProviderUpdateContract parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string opid, OpenidConnectProviderUpdateContract parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -1093,11 +1104,14 @@ internal OpenIdConnectProviderOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1110,7 +1124,6 @@ internal OpenIdConnectProviderOperations(ApiManagementClient client) tracingParameters.Add("opid", opid); tracingParameters.Add("parameters", parameters); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); } @@ -1122,9 +1135,9 @@ internal OpenIdConnectProviderOperations(ApiManagementClient client) _url = _url.Replace("{opid}", System.Uri.EscapeDataString(opid)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1198,7 +1211,7 @@ internal OpenIdConnectProviderOperations(ApiManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 204) + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -1228,13 +1241,44 @@ internal OpenIdConnectProviderOperations(ApiManagementClient 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); + } + } + 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); @@ -1322,11 +1366,14 @@ internal OpenIdConnectProviderOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1338,7 +1385,6 @@ internal OpenIdConnectProviderOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("opid", opid); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } @@ -1350,9 +1396,9 @@ internal OpenIdConnectProviderOperations(ApiManagementClient client) _url = _url.Replace("{opid}", System.Uri.EscapeDataString(opid)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1497,7 +1543,7 @@ internal OpenIdConnectProviderOperations(ApiManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> ListSecretsWithHttpMessagesAsync(string resourceGroupName, string serviceName, string opid, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ListSecretsWithHttpMessagesAsync(string resourceGroupName, string serviceName, string opid, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -1537,11 +1583,14 @@ internal OpenIdConnectProviderOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "opid", "^[^*#&+:<>?]+$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1552,7 +1601,6 @@ internal OpenIdConnectProviderOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("opid", opid); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListSecrets", tracingParameters); } @@ -1564,9 +1612,9 @@ internal OpenIdConnectProviderOperations(ApiManagementClient client) _url = _url.Replace("{opid}", System.Uri.EscapeDataString(opid)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1656,7 +1704,7 @@ internal OpenIdConnectProviderOperations(ApiManagementClient 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")) @@ -1681,6 +1729,19 @@ internal OpenIdConnectProviderOperations(ApiManagementClient 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/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/OpenIdConnectProviderOperationsExtensions.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/OpenIdConnectProviderOperationsExtensions.cs index 268c0ff859880..65c39184b694c 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/OpenIdConnectProviderOperationsExtensions.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/OpenIdConnectProviderOperationsExtensions.cs @@ -117,7 +117,7 @@ public static OpenIdConnectProviderGetEntityTagHeaders GetEntityTag(this IOpenId } /// - /// Gets specific OpenID Connect Provider. + /// Gets specific OpenID Connect Provider without secrets. /// /// /// The operations group for this extension method. @@ -137,7 +137,7 @@ public static OpenidConnectProviderContract Get(this IOpenIdConnectProviderOpera } /// - /// Gets specific OpenID Connect Provider. + /// Gets specific OpenID Connect Provider without secrets. /// /// /// The operations group for this extension method. @@ -245,9 +245,9 @@ public static OpenidConnectProviderContract Get(this IOpenIdConnectProviderOpera /// header response of the GET request or it should be * for unconditional /// update. /// - public static void Update(this IOpenIdConnectProviderOperations operations, string resourceGroupName, string serviceName, string opid, OpenidConnectProviderUpdateContract parameters, string ifMatch) + public static OpenidConnectProviderContract Update(this IOpenIdConnectProviderOperations operations, string resourceGroupName, string serviceName, string opid, OpenidConnectProviderUpdateContract parameters, string ifMatch) { - operations.UpdateAsync(resourceGroupName, serviceName, opid, parameters, ifMatch).GetAwaiter().GetResult(); + return operations.UpdateAsync(resourceGroupName, serviceName, opid, parameters, ifMatch).GetAwaiter().GetResult(); } /// @@ -276,9 +276,12 @@ public static void Update(this IOpenIdConnectProviderOperations operations, stri /// /// The cancellation token. /// - public static async Task UpdateAsync(this IOpenIdConnectProviderOperations operations, string resourceGroupName, string serviceName, string opid, OpenidConnectProviderUpdateContract parameters, string ifMatch, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task UpdateAsync(this IOpenIdConnectProviderOperations operations, string resourceGroupName, string serviceName, string opid, OpenidConnectProviderUpdateContract parameters, string ifMatch, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.UpdateWithHttpMessagesAsync(resourceGroupName, serviceName, opid, parameters, ifMatch, null, cancellationToken).ConfigureAwait(false)).Dispose(); + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, serviceName, opid, parameters, ifMatch, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/OperationOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/OperationOperations.cs index 25604a187d99f..3ec3f97b9ec3d 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/OperationOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/OperationOperations.cs @@ -136,11 +136,14 @@ internal OperationOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "apiId", "^[^*#&+:<>?]+$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -153,7 +156,6 @@ internal OperationOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("apiId", apiId); tracingParameters.Add("includeNotTaggedOperations", includeNotTaggedOperations); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByTags", tracingParameters); } @@ -177,9 +179,9 @@ internal OperationOperations(ApiManagementClient client) { _queryParameters.Add(string.Format("includeNotTaggedOperations={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(includeNotTaggedOperations, Client.SerializationSettings).Trim('"')))); } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/PolicyDescriptionOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/PolicyDescriptionOperations.cs index d11dd918a6f06..5508d93ebe1af 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/PolicyDescriptionOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/PolicyDescriptionOperations.cs @@ -109,11 +109,14 @@ internal PolicyDescriptionOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -124,7 +127,6 @@ internal PolicyDescriptionOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("scope", scope); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByService", tracingParameters); } @@ -139,9 +141,9 @@ internal PolicyDescriptionOperations(ApiManagementClient client) { _queryParameters.Add(string.Format("scope={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(scope, Client.SerializationSettings).Trim('"')))); } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/PolicyOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/PolicyOperations.cs index d5938304f1b53..3a5b2df71c874 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/PolicyOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/PolicyOperations.cs @@ -105,11 +105,14 @@ internal PolicyOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -119,7 +122,6 @@ internal PolicyOperations(ApiManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByService", tracingParameters); } @@ -130,9 +132,9 @@ internal PolicyOperations(ApiManagementClient client) _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -307,12 +309,15 @@ internal PolicyOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string policyId = "policy"; - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -323,7 +328,6 @@ internal PolicyOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("policyId", policyId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetEntityTag", tracingParameters); } @@ -335,9 +339,9 @@ internal PolicyOperations(ApiManagementClient client) _url = _url.Replace("{policyId}", System.Uri.EscapeDataString(policyId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -512,12 +516,15 @@ internal PolicyOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string policyId = "policy"; - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -529,7 +536,6 @@ internal PolicyOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("policyId", policyId); tracingParameters.Add("format", format); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -545,9 +551,9 @@ internal PolicyOperations(ApiManagementClient client) { _queryParameters.Add(string.Format("format={0}", System.Uri.EscapeDataString(format))); } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -753,12 +759,15 @@ internal PolicyOperations(ApiManagementClient client) { parameters.Validate(); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string policyId = "policy"; - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -771,7 +780,6 @@ internal PolicyOperations(ApiManagementClient client) tracingParameters.Add("policyId", policyId); tracingParameters.Add("parameters", parameters); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } @@ -783,9 +791,9 @@ internal PolicyOperations(ApiManagementClient client) _url = _url.Replace("{policyId}", System.Uri.EscapeDataString(policyId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1013,12 +1021,15 @@ internal PolicyOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string policyId = "policy"; - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1030,7 +1041,6 @@ internal PolicyOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("policyId", policyId); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } @@ -1042,9 +1052,9 @@ internal PolicyOperations(ApiManagementClient client) _url = _url.Replace("{policyId}", System.Uri.EscapeDataString(policyId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ProductApiOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ProductApiOperations.cs index ae04a2616b6c9..3b37921bc7640 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ProductApiOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ProductApiOperations.cs @@ -128,11 +128,14 @@ internal ProductApiOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.MinLength, "productId", 1); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -144,7 +147,6 @@ internal ProductApiOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("productId", productId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByProduct", tracingParameters); } @@ -164,9 +166,9 @@ internal ProductApiOperations(ApiManagementClient client) _queryParameters.Add(_odataFilter); } } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -384,11 +386,14 @@ internal ProductApiOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "apiId", "^[^*#&+:<>?]+$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -400,7 +405,6 @@ internal ProductApiOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("productId", productId); tracingParameters.Add("apiId", apiId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CheckEntityExists", tracingParameters); } @@ -413,9 +417,9 @@ internal ProductApiOperations(ApiManagementClient client) _url = _url.Replace("{apiId}", System.Uri.EscapeDataString(apiId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -617,11 +621,14 @@ internal ProductApiOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "apiId", "^[^*#&+:<>?]+$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -633,7 +640,6 @@ internal ProductApiOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("productId", productId); tracingParameters.Add("apiId", apiId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } @@ -646,9 +652,9 @@ internal ProductApiOperations(ApiManagementClient client) _url = _url.Replace("{apiId}", System.Uri.EscapeDataString(apiId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -883,11 +889,14 @@ internal ProductApiOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "apiId", "^[^*#&+:<>?]+$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -899,7 +908,6 @@ internal ProductApiOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("productId", productId); tracingParameters.Add("apiId", apiId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } @@ -912,9 +920,9 @@ internal ProductApiOperations(ApiManagementClient client) _url = _url.Replace("{apiId}", System.Uri.EscapeDataString(apiId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ProductGroupOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ProductGroupOperations.cs index 01c4ff4aad6a6..4e0635dbd8c08 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ProductGroupOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ProductGroupOperations.cs @@ -129,11 +129,14 @@ internal ProductGroupOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.MinLength, "productId", 1); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -145,7 +148,6 @@ internal ProductGroupOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("productId", productId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByProduct", tracingParameters); } @@ -165,9 +167,9 @@ internal ProductGroupOperations(ApiManagementClient client) _queryParameters.Add(_odataFilter); } } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -380,11 +382,14 @@ internal ProductGroupOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.MinLength, "groupId", 1); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -396,7 +401,6 @@ internal ProductGroupOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("productId", productId); tracingParameters.Add("groupId", groupId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CheckEntityExists", tracingParameters); } @@ -409,9 +413,9 @@ internal ProductGroupOperations(ApiManagementClient client) _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(groupId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -609,11 +613,14 @@ internal ProductGroupOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.MinLength, "groupId", 1); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -625,7 +632,6 @@ internal ProductGroupOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("productId", productId); tracingParameters.Add("groupId", groupId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } @@ -638,9 +644,9 @@ internal ProductGroupOperations(ApiManagementClient client) _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(groupId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -870,11 +876,14 @@ internal ProductGroupOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.MinLength, "groupId", 1); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -886,7 +895,6 @@ internal ProductGroupOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("productId", productId); tracingParameters.Add("groupId", groupId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } @@ -899,9 +907,9 @@ internal ProductGroupOperations(ApiManagementClient client) _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(groupId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ProductOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ProductOperations.cs index 03b57b4351b16..0173e988837fc 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ProductOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ProductOperations.cs @@ -116,11 +116,14 @@ internal ProductOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -133,7 +136,6 @@ internal ProductOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("expandGroups", expandGroups); tracingParameters.Add("tags", tags); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByService", tracingParameters); } @@ -160,9 +162,9 @@ internal ProductOperations(ApiManagementClient client) { _queryParameters.Add(string.Format("tags={0}", System.Uri.EscapeDataString(tags))); } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -356,11 +358,14 @@ internal ProductOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.MinLength, "productId", 1); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -371,7 +376,6 @@ internal ProductOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("productId", productId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetEntityTag", tracingParameters); } @@ -383,9 +387,9 @@ internal ProductOperations(ApiManagementClient client) _url = _url.Replace("{productId}", System.Uri.EscapeDataString(productId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -576,11 +580,14 @@ internal ProductOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.MinLength, "productId", 1); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -591,7 +598,6 @@ internal ProductOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("productId", productId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -603,9 +609,9 @@ internal ProductOperations(ApiManagementClient client) _url = _url.Replace("{productId}", System.Uri.EscapeDataString(productId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -829,11 +835,14 @@ internal ProductOperations(ApiManagementClient client) { parameters.Validate(); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -846,7 +855,6 @@ internal ProductOperations(ApiManagementClient client) tracingParameters.Add("productId", productId); tracingParameters.Add("parameters", parameters); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } @@ -858,9 +866,9 @@ internal ProductOperations(ApiManagementClient client) _url = _url.Replace("{productId}", System.Uri.EscapeDataString(productId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1057,6 +1065,9 @@ internal ProductOperations(ApiManagementClient client) /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// @@ -1066,7 +1077,7 @@ internal ProductOperations(ApiManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string productId, ProductUpdateParameters parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string productId, ProductUpdateParameters parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -1114,11 +1125,14 @@ internal ProductOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1131,7 +1145,6 @@ internal ProductOperations(ApiManagementClient client) tracingParameters.Add("productId", productId); tracingParameters.Add("parameters", parameters); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); } @@ -1143,9 +1156,9 @@ internal ProductOperations(ApiManagementClient client) _url = _url.Replace("{productId}", System.Uri.EscapeDataString(productId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1219,7 +1232,7 @@ internal ProductOperations(ApiManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 204) + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -1249,13 +1262,44 @@ internal ProductOperations(ApiManagementClient 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); + } + } + 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); @@ -1346,11 +1390,14 @@ internal ProductOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1363,7 +1410,6 @@ internal ProductOperations(ApiManagementClient client) tracingParameters.Add("productId", productId); tracingParameters.Add("ifMatch", ifMatch); tracingParameters.Add("deleteSubscriptions", deleteSubscriptions); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } @@ -1379,9 +1425,9 @@ internal ProductOperations(ApiManagementClient client) { _queryParameters.Add(string.Format("deleteSubscriptions={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(deleteSubscriptions, Client.SerializationSettings).Trim('"')))); } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1554,11 +1600,14 @@ internal ProductOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1570,7 +1619,6 @@ internal ProductOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("includeNotTaggedProducts", includeNotTaggedProducts); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByTags", tracingParameters); } @@ -1593,9 +1641,9 @@ internal ProductOperations(ApiManagementClient client) { _queryParameters.Add(string.Format("includeNotTaggedProducts={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(includeNotTaggedProducts, Client.SerializationSettings).Trim('"')))); } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ProductOperationsExtensions.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ProductOperationsExtensions.cs index 03af19e940015..2d41567d9e92d 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ProductOperationsExtensions.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ProductOperationsExtensions.cs @@ -266,9 +266,9 @@ public static ProductContract Get(this IProductOperations operations, string res /// header response of the GET request or it should be * for unconditional /// update. /// - public static void Update(this IProductOperations operations, string resourceGroupName, string serviceName, string productId, ProductUpdateParameters parameters, string ifMatch) + public static ProductContract Update(this IProductOperations operations, string resourceGroupName, string serviceName, string productId, ProductUpdateParameters parameters, string ifMatch) { - operations.UpdateAsync(resourceGroupName, serviceName, productId, parameters, ifMatch).GetAwaiter().GetResult(); + return operations.UpdateAsync(resourceGroupName, serviceName, productId, parameters, ifMatch).GetAwaiter().GetResult(); } /// @@ -298,9 +298,12 @@ public static void Update(this IProductOperations operations, string resourceGro /// /// The cancellation token. /// - public static async Task UpdateAsync(this IProductOperations operations, string resourceGroupName, string serviceName, string productId, ProductUpdateParameters parameters, string ifMatch, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task UpdateAsync(this IProductOperations operations, string resourceGroupName, string serviceName, string productId, ProductUpdateParameters parameters, string ifMatch, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.UpdateWithHttpMessagesAsync(resourceGroupName, serviceName, productId, parameters, ifMatch, null, cancellationToken).ConfigureAwait(false)).Dispose(); + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, serviceName, productId, parameters, ifMatch, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ProductPolicyOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ProductPolicyOperations.cs index eab3a444039fc..6b77d2327501f 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ProductPolicyOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ProductPolicyOperations.cs @@ -124,11 +124,14 @@ internal ProductPolicyOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.MinLength, "productId", 1); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -139,7 +142,6 @@ internal ProductPolicyOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("productId", productId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByProduct", tracingParameters); } @@ -151,9 +153,9 @@ internal ProductPolicyOperations(ApiManagementClient client) _url = _url.Replace("{productId}", System.Uri.EscapeDataString(productId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -346,12 +348,15 @@ internal ProductPolicyOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.MinLength, "productId", 1); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string policyId = "policy"; - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -363,7 +368,6 @@ internal ProductPolicyOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("productId", productId); tracingParameters.Add("policyId", policyId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetEntityTag", tracingParameters); } @@ -376,9 +380,9 @@ internal ProductPolicyOperations(ApiManagementClient client) _url = _url.Replace("{policyId}", System.Uri.EscapeDataString(policyId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -572,12 +576,15 @@ internal ProductPolicyOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.MinLength, "productId", 1); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string policyId = "policy"; - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -590,7 +597,6 @@ internal ProductPolicyOperations(ApiManagementClient client) tracingParameters.Add("productId", productId); tracingParameters.Add("policyId", policyId); tracingParameters.Add("format", format); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -607,9 +613,9 @@ internal ProductPolicyOperations(ApiManagementClient client) { _queryParameters.Add(string.Format("format={0}", System.Uri.EscapeDataString(format))); } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -833,12 +839,15 @@ internal ProductPolicyOperations(ApiManagementClient client) { parameters.Validate(); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string policyId = "policy"; - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -852,7 +861,6 @@ internal ProductPolicyOperations(ApiManagementClient client) tracingParameters.Add("policyId", policyId); tracingParameters.Add("ifMatch", ifMatch); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } @@ -865,9 +873,9 @@ internal ProductPolicyOperations(ApiManagementClient client) _url = _url.Replace("{policyId}", System.Uri.EscapeDataString(policyId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1114,12 +1122,15 @@ internal ProductPolicyOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string policyId = "policy"; - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1132,7 +1143,6 @@ internal ProductPolicyOperations(ApiManagementClient client) tracingParameters.Add("productId", productId); tracingParameters.Add("policyId", policyId); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } @@ -1145,9 +1155,9 @@ internal ProductPolicyOperations(ApiManagementClient client) _url = _url.Replace("{policyId}", System.Uri.EscapeDataString(policyId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ProductSubscriptionsOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ProductSubscriptionsOperations.cs index cef326830f29a..ef759db4eddcf 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ProductSubscriptionsOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ProductSubscriptionsOperations.cs @@ -128,11 +128,14 @@ internal ProductSubscriptionsOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.MinLength, "productId", 1); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -144,7 +147,6 @@ internal ProductSubscriptionsOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("productId", productId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } @@ -164,9 +166,9 @@ internal ProductSubscriptionsOperations(ApiManagementClient client) _queryParameters.Add(_odataFilter); } } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/QuotaByCounterKeysOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/QuotaByCounterKeysOperations.cs index 9bc1df78d9858..b8b22d97d9300 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/QuotaByCounterKeysOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/QuotaByCounterKeysOperations.cs @@ -119,11 +119,14 @@ internal QuotaByCounterKeysOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "quotaCounterKey"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -134,7 +137,6 @@ internal QuotaByCounterKeysOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("quotaCounterKey", quotaCounterKey); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByService", tracingParameters); } @@ -146,9 +148,9 @@ internal QuotaByCounterKeysOperations(ApiManagementClient client) _url = _url.Replace("{quotaCounterKey}", System.Uri.EscapeDataString(quotaCounterKey)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -300,6 +302,9 @@ internal QuotaByCounterKeysOperations(ApiManagementClient client) /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// @@ -309,7 +314,7 @@ internal QuotaByCounterKeysOperations(ApiManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string quotaCounterKey, QuotaCounterValueUpdateContract parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string quotaCounterKey, QuotaCounterValueUpdateContract parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -342,11 +347,14 @@ internal QuotaByCounterKeysOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -358,7 +366,6 @@ internal QuotaByCounterKeysOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("quotaCounterKey", quotaCounterKey); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); } @@ -370,9 +377,9 @@ internal QuotaByCounterKeysOperations(ApiManagementClient client) _url = _url.Replace("{quotaCounterKey}", System.Uri.EscapeDataString(quotaCounterKey)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -438,7 +445,7 @@ internal QuotaByCounterKeysOperations(ApiManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 204) + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -468,13 +475,31 @@ internal QuotaByCounterKeysOperations(ApiManagementClient 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); diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/QuotaByCounterKeysOperationsExtensions.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/QuotaByCounterKeysOperationsExtensions.cs index cc08d856fee1e..6950c0df24d8a 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/QuotaByCounterKeysOperationsExtensions.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/QuotaByCounterKeysOperationsExtensions.cs @@ -105,9 +105,9 @@ public static QuotaCounterCollection ListByService(this IQuotaByCounterKeysOpera /// /// The value of the quota counter to be applied to all quota counter periods. /// - public static void Update(this IQuotaByCounterKeysOperations operations, string resourceGroupName, string serviceName, string quotaCounterKey, QuotaCounterValueUpdateContract parameters) + public static QuotaCounterCollection Update(this IQuotaByCounterKeysOperations operations, string resourceGroupName, string serviceName, string quotaCounterKey, QuotaCounterValueUpdateContract parameters) { - operations.UpdateAsync(resourceGroupName, serviceName, quotaCounterKey, parameters).GetAwaiter().GetResult(); + return operations.UpdateAsync(resourceGroupName, serviceName, quotaCounterKey, parameters).GetAwaiter().GetResult(); } /// @@ -137,9 +137,12 @@ public static void Update(this IQuotaByCounterKeysOperations operations, string /// /// The cancellation token. /// - public static async Task UpdateAsync(this IQuotaByCounterKeysOperations operations, string resourceGroupName, string serviceName, string quotaCounterKey, QuotaCounterValueUpdateContract parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task UpdateAsync(this IQuotaByCounterKeysOperations operations, string resourceGroupName, string serviceName, string quotaCounterKey, QuotaCounterValueUpdateContract parameters, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.UpdateWithHttpMessagesAsync(resourceGroupName, serviceName, quotaCounterKey, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, serviceName, quotaCounterKey, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/QuotaByPeriodKeysOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/QuotaByPeriodKeysOperations.cs index 10f83ba618bcc..33760972ca446 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/QuotaByPeriodKeysOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/QuotaByPeriodKeysOperations.cs @@ -125,11 +125,14 @@ internal QuotaByPeriodKeysOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "quotaPeriodKey"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -141,7 +144,6 @@ internal QuotaByPeriodKeysOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("quotaCounterKey", quotaCounterKey); tracingParameters.Add("quotaPeriodKey", quotaPeriodKey); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -154,9 +156,9 @@ internal QuotaByPeriodKeysOperations(ApiManagementClient client) _url = _url.Replace("{quotaPeriodKey}", System.Uri.EscapeDataString(quotaPeriodKey)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -309,6 +311,9 @@ internal QuotaByPeriodKeysOperations(ApiManagementClient client) /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// @@ -318,7 +323,7 @@ internal QuotaByPeriodKeysOperations(ApiManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string quotaCounterKey, string quotaPeriodKey, QuotaCounterValueUpdateContract parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string quotaCounterKey, string quotaPeriodKey, QuotaCounterValueUpdateContract parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -355,11 +360,14 @@ internal QuotaByPeriodKeysOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -372,7 +380,6 @@ internal QuotaByPeriodKeysOperations(ApiManagementClient client) tracingParameters.Add("quotaCounterKey", quotaCounterKey); tracingParameters.Add("quotaPeriodKey", quotaPeriodKey); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); } @@ -385,9 +392,9 @@ internal QuotaByPeriodKeysOperations(ApiManagementClient client) _url = _url.Replace("{quotaPeriodKey}", System.Uri.EscapeDataString(quotaPeriodKey)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -453,7 +460,7 @@ internal QuotaByPeriodKeysOperations(ApiManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 204) + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -483,13 +490,31 @@ internal QuotaByPeriodKeysOperations(ApiManagementClient 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); diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/QuotaByPeriodKeysOperationsExtensions.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/QuotaByPeriodKeysOperationsExtensions.cs index d0d9f877a7e50..bceb7204fc55a 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/QuotaByPeriodKeysOperationsExtensions.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/QuotaByPeriodKeysOperationsExtensions.cs @@ -110,9 +110,9 @@ public static QuotaCounterContract Get(this IQuotaByPeriodKeysOperations operati /// /// The value of the Quota counter to be applied on the specified period. /// - public static void Update(this IQuotaByPeriodKeysOperations operations, string resourceGroupName, string serviceName, string quotaCounterKey, string quotaPeriodKey, QuotaCounterValueUpdateContract parameters) + public static QuotaCounterContract Update(this IQuotaByPeriodKeysOperations operations, string resourceGroupName, string serviceName, string quotaCounterKey, string quotaPeriodKey, QuotaCounterValueUpdateContract parameters) { - operations.UpdateAsync(resourceGroupName, serviceName, quotaCounterKey, quotaPeriodKey, parameters).GetAwaiter().GetResult(); + return operations.UpdateAsync(resourceGroupName, serviceName, quotaCounterKey, quotaPeriodKey, parameters).GetAwaiter().GetResult(); } /// @@ -143,9 +143,12 @@ public static void Update(this IQuotaByPeriodKeysOperations operations, string r /// /// The cancellation token. /// - public static async Task UpdateAsync(this IQuotaByPeriodKeysOperations operations, string resourceGroupName, string serviceName, string quotaCounterKey, string quotaPeriodKey, QuotaCounterValueUpdateContract parameters, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task UpdateAsync(this IQuotaByPeriodKeysOperations operations, string resourceGroupName, string serviceName, string quotaCounterKey, string quotaPeriodKey, QuotaCounterValueUpdateContract parameters, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.UpdateWithHttpMessagesAsync(resourceGroupName, serviceName, quotaCounterKey, quotaPeriodKey, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, serviceName, quotaCounterKey, quotaPeriodKey, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/RegionOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/RegionOperations.cs index fd8b873d6c326..65dade7c8a7e1 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/RegionOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/RegionOperations.cs @@ -105,11 +105,14 @@ internal RegionOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -119,7 +122,6 @@ internal RegionOperations(ApiManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByService", tracingParameters); } @@ -130,9 +132,9 @@ internal RegionOperations(ApiManagementClient client) _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ReportsOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ReportsOperations.cs index 2209f85dbbb9d..88b29a5f89f16 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ReportsOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ReportsOperations.cs @@ -113,11 +113,14 @@ internal ReportsOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -128,7 +131,6 @@ internal ReportsOperations(ApiManagementClient client) tracingParameters.Add("odataQuery", odataQuery); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByApi", tracingParameters); } @@ -147,9 +149,9 @@ internal ReportsOperations(ApiManagementClient client) _queryParameters.Add(_odataFilter); } } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -338,11 +340,14 @@ internal ReportsOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -353,7 +358,6 @@ internal ReportsOperations(ApiManagementClient client) tracingParameters.Add("odataQuery", odataQuery); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByUser", tracingParameters); } @@ -372,9 +376,9 @@ internal ReportsOperations(ApiManagementClient client) _queryParameters.Add(_odataFilter); } } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -563,11 +567,14 @@ internal ReportsOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -578,7 +585,6 @@ internal ReportsOperations(ApiManagementClient client) tracingParameters.Add("odataQuery", odataQuery); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByOperation", tracingParameters); } @@ -597,9 +603,9 @@ internal ReportsOperations(ApiManagementClient client) _queryParameters.Add(_odataFilter); } } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -788,11 +794,14 @@ internal ReportsOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -803,7 +812,6 @@ internal ReportsOperations(ApiManagementClient client) tracingParameters.Add("odataQuery", odataQuery); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByProduct", tracingParameters); } @@ -822,9 +830,9 @@ internal ReportsOperations(ApiManagementClient client) _queryParameters.Add(_odataFilter); } } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1013,11 +1021,14 @@ internal ReportsOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1028,7 +1039,6 @@ internal ReportsOperations(ApiManagementClient client) tracingParameters.Add("odataQuery", odataQuery); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByGeo", tracingParameters); } @@ -1047,9 +1057,9 @@ internal ReportsOperations(ApiManagementClient client) _queryParameters.Add(_odataFilter); } } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1238,11 +1248,14 @@ internal ReportsOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1253,7 +1266,6 @@ internal ReportsOperations(ApiManagementClient client) tracingParameters.Add("odataQuery", odataQuery); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListBySubscription", tracingParameters); } @@ -1272,9 +1284,9 @@ internal ReportsOperations(ApiManagementClient client) _queryParameters.Add(_odataFilter); } } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1470,11 +1482,14 @@ internal ReportsOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1486,7 +1501,6 @@ internal ReportsOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("interval", interval); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByTime", tracingParameters); } @@ -1506,9 +1520,9 @@ internal ReportsOperations(ApiManagementClient client) } } _queryParameters.Add(string.Format("interval={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(interval, Client.SerializationSettings).Trim('"')))); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1697,11 +1711,14 @@ internal ReportsOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1712,7 +1729,6 @@ internal ReportsOperations(ApiManagementClient client) tracingParameters.Add("odataQuery", odataQuery); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByRequest", tracingParameters); } @@ -1731,9 +1747,9 @@ internal ReportsOperations(ApiManagementClient client) _queryParameters.Add(_odataFilter); } } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/SdkInfo_ApiManagementClient.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/SdkInfo_ApiManagementClient.cs index 784204ef982c5..9859db4d67474 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/SdkInfo_ApiManagementClient.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/SdkInfo_ApiManagementClient.cs @@ -19,70 +19,73 @@ public static IEnumerable> ApiInfo_ApiManagementCl { return new Tuple[] { - new Tuple("ApiManagement", "Api", "2019-12-01"), - new Tuple("ApiManagement", "ApiDiagnostic", "2019-12-01"), - new Tuple("ApiManagement", "ApiExport", "2019-12-01"), - new Tuple("ApiManagement", "ApiIssue", "2019-12-01"), - new Tuple("ApiManagement", "ApiIssueAttachment", "2019-12-01"), - new Tuple("ApiManagement", "ApiIssueComment", "2019-12-01"), - new Tuple("ApiManagement", "ApiManagementOperations", "2019-12-01"), - new Tuple("ApiManagement", "ApiManagementService", "2019-12-01"), - new Tuple("ApiManagement", "ApiManagementServiceSkus", "2019-12-01"), - new Tuple("ApiManagement", "ApiOperation", "2019-12-01"), - new Tuple("ApiManagement", "ApiOperationPolicy", "2019-12-01"), - new Tuple("ApiManagement", "ApiPolicy", "2019-12-01"), - new Tuple("ApiManagement", "ApiProduct", "2019-12-01"), - new Tuple("ApiManagement", "ApiRelease", "2019-12-01"), - new Tuple("ApiManagement", "ApiRevision", "2019-12-01"), - new Tuple("ApiManagement", "ApiSchema", "2019-12-01"), - new Tuple("ApiManagement", "ApiTagDescription", "2019-12-01"), - new Tuple("ApiManagement", "ApiVersionSet", "2019-12-01"), - new Tuple("ApiManagement", "AuthorizationServer", "2019-12-01"), - new Tuple("ApiManagement", "Backend", "2019-12-01"), - new Tuple("ApiManagement", "Cache", "2019-12-01"), - new Tuple("ApiManagement", "Certificate", "2019-12-01"), - new Tuple("ApiManagement", "DelegationSettings", "2019-12-01"), - new Tuple("ApiManagement", "Diagnostic", "2019-12-01"), - new Tuple("ApiManagement", "EmailTemplate", "2019-12-01"), - new Tuple("ApiManagement", "Gateway", "2019-12-01"), - new Tuple("ApiManagement", "GatewayApi", "2019-12-01"), - new Tuple("ApiManagement", "GatewayHostnameConfiguration", "2019-12-01"), - new Tuple("ApiManagement", "Group", "2019-12-01"), - new Tuple("ApiManagement", "GroupUser", "2019-12-01"), - new Tuple("ApiManagement", "IdentityProvider", "2019-12-01"), - new Tuple("ApiManagement", "Issue", "2019-12-01"), - new Tuple("ApiManagement", "Logger", "2019-12-01"), - new Tuple("ApiManagement", "NamedValue", "2019-12-01"), - new Tuple("ApiManagement", "NetworkStatus", "2019-12-01"), - new Tuple("ApiManagement", "Notification", "2019-12-01"), - new Tuple("ApiManagement", "NotificationRecipientEmail", "2019-12-01"), - new Tuple("ApiManagement", "NotificationRecipientUser", "2019-12-01"), - new Tuple("ApiManagement", "OpenIdConnectProvider", "2019-12-01"), - new Tuple("ApiManagement", "Operation", "2019-12-01"), - new Tuple("ApiManagement", "Policy", "2019-12-01"), - new Tuple("ApiManagement", "PolicyDescription", "2019-12-01"), - new Tuple("ApiManagement", "Product", "2019-12-01"), - new Tuple("ApiManagement", "ProductApi", "2019-12-01"), - new Tuple("ApiManagement", "ProductGroup", "2019-12-01"), - new Tuple("ApiManagement", "ProductPolicy", "2019-12-01"), - new Tuple("ApiManagement", "ProductSubscriptions", "2019-12-01"), - new Tuple("ApiManagement", "QuotaByCounterKeys", "2019-12-01"), - new Tuple("ApiManagement", "QuotaByPeriodKeys", "2019-12-01"), - new Tuple("ApiManagement", "Region", "2019-12-01"), - new Tuple("ApiManagement", "Reports", "2019-12-01"), - new Tuple("ApiManagement", "SignInSettings", "2019-12-01"), - new Tuple("ApiManagement", "SignUpSettings", "2019-12-01"), - new Tuple("ApiManagement", "Subscription", "2019-12-01"), - new Tuple("ApiManagement", "Tag", "2019-12-01"), - new Tuple("ApiManagement", "TagResource", "2019-12-01"), - new Tuple("ApiManagement", "TenantAccess", "2019-12-01"), - new Tuple("ApiManagement", "TenantAccessGit", "2019-12-01"), - new Tuple("ApiManagement", "TenantConfiguration", "2019-12-01"), - new Tuple("ApiManagement", "User", "2019-12-01"), - new Tuple("ApiManagement", "UserConfirmationPassword", "2019-12-01"), - new Tuple("ApiManagement", "UserGroup", "2019-12-01"), - new Tuple("ApiManagement", "UserIdentities", "2019-12-01"), - new Tuple("ApiManagement", "UserSubscription", "2019-12-01"), + new Tuple("ApiManagement", "Api", "2020-06-01-preview"), + new Tuple("ApiManagement", "ApiDiagnostic", "2020-06-01-preview"), + new Tuple("ApiManagement", "ApiExport", "2020-06-01-preview"), + new Tuple("ApiManagement", "ApiIssue", "2020-06-01-preview"), + new Tuple("ApiManagement", "ApiIssueAttachment", "2020-06-01-preview"), + new Tuple("ApiManagement", "ApiIssueComment", "2020-06-01-preview"), + new Tuple("ApiManagement", "ApiManagementOperations", "2020-06-01-preview"), + new Tuple("ApiManagement", "ApiManagementService", "2020-06-01-preview"), + new Tuple("ApiManagement", "ApiManagementServiceSkus", "2020-06-01-preview"), + new Tuple("ApiManagement", "ApiOperation", "2020-06-01-preview"), + new Tuple("ApiManagement", "ApiOperationPolicy", "2020-06-01-preview"), + new Tuple("ApiManagement", "ApiPolicy", "2020-06-01-preview"), + new Tuple("ApiManagement", "ApiProduct", "2020-06-01-preview"), + new Tuple("ApiManagement", "ApiRelease", "2020-06-01-preview"), + new Tuple("ApiManagement", "ApiRevision", "2020-06-01-preview"), + new Tuple("ApiManagement", "ApiSchema", "2020-06-01-preview"), + new Tuple("ApiManagement", "ApiTagDescription", "2020-06-01-preview"), + new Tuple("ApiManagement", "ApiVersionSet", "2020-06-01-preview"), + new Tuple("ApiManagement", "AuthorizationServer", "2020-06-01-preview"), + new Tuple("ApiManagement", "Backend", "2020-06-01-preview"), + new Tuple("ApiManagement", "Cache", "2020-06-01-preview"), + new Tuple("ApiManagement", "Certificate", "2020-06-01-preview"), + new Tuple("ApiManagement", "ContentItem", "2020-06-01-preview"), + new Tuple("ApiManagement", "ContentType", "2020-06-01-preview"), + new Tuple("ApiManagement", "DelegationSettings", "2020-06-01-preview"), + new Tuple("ApiManagement", "DeletedServices", "2020-06-01-preview"), + new Tuple("ApiManagement", "Diagnostic", "2020-06-01-preview"), + new Tuple("ApiManagement", "EmailTemplate", "2020-06-01-preview"), + new Tuple("ApiManagement", "Gateway", "2020-06-01-preview"), + new Tuple("ApiManagement", "GatewayApi", "2020-06-01-preview"), + new Tuple("ApiManagement", "GatewayHostnameConfiguration", "2020-06-01-preview"), + new Tuple("ApiManagement", "Group", "2020-06-01-preview"), + new Tuple("ApiManagement", "GroupUser", "2020-06-01-preview"), + new Tuple("ApiManagement", "IdentityProvider", "2020-06-01-preview"), + new Tuple("ApiManagement", "Issue", "2020-06-01-preview"), + new Tuple("ApiManagement", "Logger", "2020-06-01-preview"), + new Tuple("ApiManagement", "NamedValue", "2020-06-01-preview"), + new Tuple("ApiManagement", "NetworkStatus", "2020-06-01-preview"), + new Tuple("ApiManagement", "Notification", "2020-06-01-preview"), + new Tuple("ApiManagement", "NotificationRecipientEmail", "2020-06-01-preview"), + new Tuple("ApiManagement", "NotificationRecipientUser", "2020-06-01-preview"), + new Tuple("ApiManagement", "OpenIdConnectProvider", "2020-06-01-preview"), + new Tuple("ApiManagement", "Operation", "2020-06-01-preview"), + new Tuple("ApiManagement", "Policy", "2020-06-01-preview"), + new Tuple("ApiManagement", "PolicyDescription", "2020-06-01-preview"), + new Tuple("ApiManagement", "Product", "2020-06-01-preview"), + new Tuple("ApiManagement", "ProductApi", "2020-06-01-preview"), + new Tuple("ApiManagement", "ProductGroup", "2020-06-01-preview"), + new Tuple("ApiManagement", "ProductPolicy", "2020-06-01-preview"), + new Tuple("ApiManagement", "ProductSubscriptions", "2020-06-01-preview"), + new Tuple("ApiManagement", "QuotaByCounterKeys", "2020-06-01-preview"), + new Tuple("ApiManagement", "QuotaByPeriodKeys", "2020-06-01-preview"), + new Tuple("ApiManagement", "Region", "2020-06-01-preview"), + new Tuple("ApiManagement", "Reports", "2020-06-01-preview"), + new Tuple("ApiManagement", "SignInSettings", "2020-06-01-preview"), + new Tuple("ApiManagement", "SignUpSettings", "2020-06-01-preview"), + new Tuple("ApiManagement", "Subscription", "2020-06-01-preview"), + new Tuple("ApiManagement", "Tag", "2020-06-01-preview"), + new Tuple("ApiManagement", "TagResource", "2020-06-01-preview"), + new Tuple("ApiManagement", "TenantAccess", "2020-06-01-preview"), + new Tuple("ApiManagement", "TenantAccessGit", "2020-06-01-preview"), + new Tuple("ApiManagement", "TenantConfiguration", "2020-06-01-preview"), + new Tuple("ApiManagement", "User", "2020-06-01-preview"), + new Tuple("ApiManagement", "UserConfirmationPassword", "2020-06-01-preview"), + new Tuple("ApiManagement", "UserGroup", "2020-06-01-preview"), + new Tuple("ApiManagement", "UserIdentities", "2020-06-01-preview"), + new Tuple("ApiManagement", "UserSubscription", "2020-06-01-preview"), }.AsEnumerable(); } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/SignInSettingsOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/SignInSettingsOperations.cs index 53f70862cb10d..0c99f6ccfe29e 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/SignInSettingsOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/SignInSettingsOperations.cs @@ -102,11 +102,14 @@ internal SignInSettingsOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -116,7 +119,6 @@ internal SignInSettingsOperations(ApiManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetEntityTag", tracingParameters); } @@ -127,9 +129,9 @@ internal SignInSettingsOperations(ApiManagementClient client) _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -301,11 +303,14 @@ internal SignInSettingsOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -315,7 +320,6 @@ internal SignInSettingsOperations(ApiManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -326,9 +330,9 @@ internal SignInSettingsOperations(ApiManagementClient client) _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -531,11 +535,14 @@ internal SignInSettingsOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -547,7 +554,6 @@ internal SignInSettingsOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("parameters", parameters); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); } @@ -558,9 +564,9 @@ internal SignInSettingsOperations(ApiManagementClient client) _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -744,11 +750,14 @@ internal SignInSettingsOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -760,7 +769,6 @@ internal SignInSettingsOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("parameters", parameters); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } @@ -771,9 +779,9 @@ internal SignInSettingsOperations(ApiManagementClient client) _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/SignUpSettingsOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/SignUpSettingsOperations.cs index 512ff8a528370..e62d0e18b4526 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/SignUpSettingsOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/SignUpSettingsOperations.cs @@ -102,11 +102,14 @@ internal SignUpSettingsOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -116,7 +119,6 @@ internal SignUpSettingsOperations(ApiManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetEntityTag", tracingParameters); } @@ -127,9 +129,9 @@ internal SignUpSettingsOperations(ApiManagementClient client) _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -301,11 +303,14 @@ internal SignUpSettingsOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -315,7 +320,6 @@ internal SignUpSettingsOperations(ApiManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -326,9 +330,9 @@ internal SignUpSettingsOperations(ApiManagementClient client) _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -531,11 +535,14 @@ internal SignUpSettingsOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -547,7 +554,6 @@ internal SignUpSettingsOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("parameters", parameters); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); } @@ -558,9 +564,9 @@ internal SignUpSettingsOperations(ApiManagementClient client) _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -744,11 +750,14 @@ internal SignUpSettingsOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -760,7 +769,6 @@ internal SignUpSettingsOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("parameters", parameters); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } @@ -771,9 +779,9 @@ internal SignUpSettingsOperations(ApiManagementClient client) _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/SubscriptionOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/SubscriptionOperations.cs index cede310fabb54..d705044f5da03 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/SubscriptionOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/SubscriptionOperations.cs @@ -109,11 +109,14 @@ internal SubscriptionOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -124,7 +127,6 @@ internal SubscriptionOperations(ApiManagementClient client) tracingParameters.Add("odataQuery", odataQuery); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } @@ -143,9 +145,9 @@ internal SubscriptionOperations(ApiManagementClient client) _queryParameters.Add(_odataFilter); } } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -339,11 +341,14 @@ internal SubscriptionOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "sid", "^[^*#&+:<>?]+$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -354,7 +359,6 @@ internal SubscriptionOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("sid", sid); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetEntityTag", tracingParameters); } @@ -366,9 +370,9 @@ internal SubscriptionOperations(ApiManagementClient client) _url = _url.Replace("{sid}", System.Uri.EscapeDataString(sid)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -559,11 +563,14 @@ internal SubscriptionOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "sid", "^[^*#&+:<>?]+$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -574,7 +581,6 @@ internal SubscriptionOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("sid", sid); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -586,9 +592,9 @@ internal SubscriptionOperations(ApiManagementClient client) _url = _url.Replace("{sid}", System.Uri.EscapeDataString(sid)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -750,6 +756,11 @@ internal SubscriptionOperations(ApiManagementClient client) /// ETag of the Entity. Not required when creating an entity, but required when /// updating an entity. /// + /// + /// Determines the type of application which send the create user request. + /// Default is legacy publisher portal. Possible values include: 'portal', + /// 'developerPortal' + /// /// /// Headers that will be added to request. /// @@ -771,7 +782,7 @@ internal SubscriptionOperations(ApiManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string sid, SubscriptionCreateParameters parameters, bool? notify = default(bool?), string ifMatch = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string sid, SubscriptionCreateParameters parameters, bool? notify = default(bool?), string ifMatch = default(string), string appType = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -819,11 +830,14 @@ internal SubscriptionOperations(ApiManagementClient client) { parameters.Validate(); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -837,7 +851,7 @@ internal SubscriptionOperations(ApiManagementClient client) tracingParameters.Add("parameters", parameters); tracingParameters.Add("notify", notify); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("appType", appType); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } @@ -853,9 +867,13 @@ internal SubscriptionOperations(ApiManagementClient client) { _queryParameters.Add(string.Format("notify={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(notify, Client.SerializationSettings).Trim('"')))); } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (appType != null) + { + _queryParameters.Add(string.Format("appType={0}", System.Uri.EscapeDataString(appType))); } if (_queryParameters.Count > 0) { @@ -1049,6 +1067,11 @@ internal SubscriptionOperations(ApiManagementClient client) /// subscription /// - If true, send email notification of change of state of subscription /// + /// + /// Determines the type of application which send the create user request. + /// Default is legacy publisher portal. Possible values include: 'portal', + /// 'developerPortal' + /// /// /// Headers that will be added to request. /// @@ -1058,6 +1081,9 @@ internal SubscriptionOperations(ApiManagementClient client) /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// @@ -1067,7 +1093,7 @@ internal SubscriptionOperations(ApiManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string sid, SubscriptionUpdateParameters parameters, string ifMatch, bool? notify = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string sid, SubscriptionUpdateParameters parameters, string ifMatch, bool? notify = default(bool?), string appType = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -1115,11 +1141,14 @@ internal SubscriptionOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1133,7 +1162,7 @@ internal SubscriptionOperations(ApiManagementClient client) tracingParameters.Add("parameters", parameters); tracingParameters.Add("notify", notify); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("appType", appType); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); } @@ -1149,9 +1178,13 @@ internal SubscriptionOperations(ApiManagementClient client) { _queryParameters.Add(string.Format("notify={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(notify, Client.SerializationSettings).Trim('"')))); } - if (apiVersion != null) + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (appType != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("appType={0}", System.Uri.EscapeDataString(appType))); } if (_queryParameters.Count > 0) { @@ -1225,7 +1258,7 @@ internal SubscriptionOperations(ApiManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 204) + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -1255,13 +1288,44 @@ internal SubscriptionOperations(ApiManagementClient 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); + } + } + 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); @@ -1349,11 +1413,14 @@ internal SubscriptionOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1365,7 +1432,6 @@ internal SubscriptionOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("sid", sid); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } @@ -1377,9 +1443,9 @@ internal SubscriptionOperations(ApiManagementClient client) _url = _url.Replace("{sid}", System.Uri.EscapeDataString(sid)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1563,11 +1629,14 @@ internal SubscriptionOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "sid", "^[^*#&+:<>?]+$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1578,7 +1647,6 @@ internal SubscriptionOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("sid", sid); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "RegeneratePrimaryKey", tracingParameters); } @@ -1590,9 +1658,9 @@ internal SubscriptionOperations(ApiManagementClient client) _url = _url.Replace("{sid}", System.Uri.EscapeDataString(sid)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1768,11 +1836,14 @@ internal SubscriptionOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "sid", "^[^*#&+:<>?]+$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1783,7 +1854,6 @@ internal SubscriptionOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("sid", sid); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "RegenerateSecondaryKey", tracingParameters); } @@ -1795,9 +1865,9 @@ internal SubscriptionOperations(ApiManagementClient client) _url = _url.Replace("{sid}", System.Uri.EscapeDataString(sid)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1902,7 +1972,7 @@ internal SubscriptionOperations(ApiManagementClient client) } /// - /// Gets the subscription keys. + /// Gets the specified Subscription keys. /// /// /// The name of the resource group. @@ -1935,7 +2005,7 @@ internal SubscriptionOperations(ApiManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> ListSecretsWithHttpMessagesAsync(string resourceGroupName, string serviceName, string sid, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ListSecretsWithHttpMessagesAsync(string resourceGroupName, string serviceName, string sid, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -1975,11 +2045,14 @@ internal SubscriptionOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "sid", "^[^*#&+:<>?]+$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1990,7 +2063,6 @@ internal SubscriptionOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("sid", sid); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListSecrets", tracingParameters); } @@ -2002,9 +2074,9 @@ internal SubscriptionOperations(ApiManagementClient client) _url = _url.Replace("{sid}", System.Uri.EscapeDataString(sid)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -2094,7 +2166,7 @@ internal SubscriptionOperations(ApiManagementClient 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")) @@ -2119,6 +2191,19 @@ internal SubscriptionOperations(ApiManagementClient 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/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/SubscriptionOperationsExtensions.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/SubscriptionOperationsExtensions.cs index 0f9fa47c71dc2..cae6e31e8639e 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/SubscriptionOperationsExtensions.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/SubscriptionOperationsExtensions.cs @@ -196,9 +196,14 @@ public static SubscriptionContract Get(this ISubscriptionOperations operations, /// ETag of the Entity. Not required when creating an entity, but required when /// updating an entity. /// - public static SubscriptionContract CreateOrUpdate(this ISubscriptionOperations operations, string resourceGroupName, string serviceName, string sid, SubscriptionCreateParameters parameters, bool? notify = default(bool?), string ifMatch = default(string)) + /// + /// Determines the type of application which send the create user request. + /// Default is legacy publisher portal. Possible values include: 'portal', + /// 'developerPortal' + /// + public static SubscriptionContract CreateOrUpdate(this ISubscriptionOperations operations, string resourceGroupName, string serviceName, string sid, SubscriptionCreateParameters parameters, bool? notify = default(bool?), string ifMatch = default(string), string appType = default(string)) { - return operations.CreateOrUpdateAsync(resourceGroupName, serviceName, sid, parameters, notify, ifMatch).GetAwaiter().GetResult(); + return operations.CreateOrUpdateAsync(resourceGroupName, serviceName, sid, parameters, notify, ifMatch, appType).GetAwaiter().GetResult(); } /// @@ -231,12 +236,17 @@ public static SubscriptionContract Get(this ISubscriptionOperations operations, /// ETag of the Entity. Not required when creating an entity, but required when /// updating an entity. /// + /// + /// Determines the type of application which send the create user request. + /// Default is legacy publisher portal. Possible values include: 'portal', + /// 'developerPortal' + /// /// /// The cancellation token. /// - public static async Task CreateOrUpdateAsync(this ISubscriptionOperations operations, string resourceGroupName, string serviceName, string sid, SubscriptionCreateParameters parameters, bool? notify = default(bool?), string ifMatch = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CreateOrUpdateAsync(this ISubscriptionOperations operations, string resourceGroupName, string serviceName, string sid, SubscriptionCreateParameters parameters, bool? notify = default(bool?), string ifMatch = default(string), string appType = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serviceName, sid, parameters, notify, ifMatch, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serviceName, sid, parameters, notify, ifMatch, appType, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -272,9 +282,14 @@ public static SubscriptionContract Get(this ISubscriptionOperations operations, /// subscription /// - If true, send email notification of change of state of subscription /// - public static void Update(this ISubscriptionOperations operations, string resourceGroupName, string serviceName, string sid, SubscriptionUpdateParameters parameters, string ifMatch, bool? notify = default(bool?)) + /// + /// Determines the type of application which send the create user request. + /// Default is legacy publisher portal. Possible values include: 'portal', + /// 'developerPortal' + /// + public static SubscriptionContract Update(this ISubscriptionOperations operations, string resourceGroupName, string serviceName, string sid, SubscriptionUpdateParameters parameters, string ifMatch, bool? notify = default(bool?), string appType = default(string)) { - operations.UpdateAsync(resourceGroupName, serviceName, sid, parameters, ifMatch, notify).GetAwaiter().GetResult(); + return operations.UpdateAsync(resourceGroupName, serviceName, sid, parameters, ifMatch, notify, appType).GetAwaiter().GetResult(); } /// @@ -307,12 +322,20 @@ public static SubscriptionContract Get(this ISubscriptionOperations operations, /// subscription /// - If true, send email notification of change of state of subscription /// + /// + /// Determines the type of application which send the create user request. + /// Default is legacy publisher portal. Possible values include: 'portal', + /// 'developerPortal' + /// /// /// The cancellation token. /// - public static async Task UpdateAsync(this ISubscriptionOperations operations, string resourceGroupName, string serviceName, string sid, SubscriptionUpdateParameters parameters, string ifMatch, bool? notify = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task UpdateAsync(this ISubscriptionOperations operations, string resourceGroupName, string serviceName, string sid, SubscriptionUpdateParameters parameters, string ifMatch, bool? notify = default(bool?), string appType = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.UpdateWithHttpMessagesAsync(resourceGroupName, serviceName, sid, parameters, ifMatch, notify, null, cancellationToken).ConfigureAwait(false)).Dispose(); + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, serviceName, sid, parameters, ifMatch, notify, appType, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// @@ -465,7 +488,7 @@ public static void RegenerateSecondaryKey(this ISubscriptionOperations operation } /// - /// Gets the subscription keys. + /// Gets the specified Subscription keys. /// /// /// The operations group for this extension method. @@ -486,7 +509,7 @@ public static SubscriptionKeysContract ListSecrets(this ISubscriptionOperations } /// - /// Gets the subscription keys. + /// Gets the specified Subscription keys. /// /// /// The operations group for this extension method. diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/TagOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/TagOperations.cs index 46394c81a5e0e..6290283595ff5 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/TagOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/TagOperations.cs @@ -152,11 +152,14 @@ internal TagOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.MinLength, "operationId", 1); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -169,7 +172,6 @@ internal TagOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("apiId", apiId); tracingParameters.Add("operationId", operationId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByOperation", tracingParameters); } @@ -190,9 +192,9 @@ internal TagOperations(ApiManagementClient client) _queryParameters.Add(_odataFilter); } } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -432,11 +434,14 @@ internal TagOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "tagId", "^[^*#&+:<>?]+$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -449,7 +454,6 @@ internal TagOperations(ApiManagementClient client) tracingParameters.Add("apiId", apiId); tracingParameters.Add("operationId", operationId); tracingParameters.Add("tagId", tagId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetEntityStateByOperation", tracingParameters); } @@ -463,9 +467,9 @@ internal TagOperations(ApiManagementClient client) _url = _url.Replace("{tagId}", System.Uri.EscapeDataString(tagId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -703,11 +707,14 @@ internal TagOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "tagId", "^[^*#&+:<>?]+$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -720,7 +727,6 @@ internal TagOperations(ApiManagementClient client) tracingParameters.Add("apiId", apiId); tracingParameters.Add("operationId", operationId); tracingParameters.Add("tagId", tagId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetByOperation", tracingParameters); } @@ -734,9 +740,9 @@ internal TagOperations(ApiManagementClient client) _url = _url.Replace("{tagId}", System.Uri.EscapeDataString(tagId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -992,11 +998,14 @@ internal TagOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "tagId", "^[^*#&+:<>?]+$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1009,7 +1018,6 @@ internal TagOperations(ApiManagementClient client) tracingParameters.Add("apiId", apiId); tracingParameters.Add("operationId", operationId); tracingParameters.Add("tagId", tagId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "AssignToOperation", tracingParameters); } @@ -1023,9 +1031,9 @@ internal TagOperations(ApiManagementClient client) _url = _url.Replace("{tagId}", System.Uri.EscapeDataString(tagId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1283,11 +1291,14 @@ internal TagOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "tagId", "^[^*#&+:<>?]+$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1300,7 +1311,6 @@ internal TagOperations(ApiManagementClient client) tracingParameters.Add("apiId", apiId); tracingParameters.Add("operationId", operationId); tracingParameters.Add("tagId", tagId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "DetachFromOperation", tracingParameters); } @@ -1314,9 +1324,9 @@ internal TagOperations(ApiManagementClient client) _url = _url.Replace("{tagId}", System.Uri.EscapeDataString(tagId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1502,11 +1512,14 @@ internal TagOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "apiId", "^[^*#&+:<>?]+$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1518,7 +1531,6 @@ internal TagOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("apiId", apiId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByApi", tracingParameters); } @@ -1538,9 +1550,9 @@ internal TagOperations(ApiManagementClient client) _queryParameters.Add(_odataFilter); } } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1761,11 +1773,14 @@ internal TagOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "tagId", "^[^*#&+:<>?]+$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1777,7 +1792,6 @@ internal TagOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("apiId", apiId); tracingParameters.Add("tagId", tagId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetEntityStateByApi", tracingParameters); } @@ -1790,9 +1804,9 @@ internal TagOperations(ApiManagementClient client) _url = _url.Replace("{tagId}", System.Uri.EscapeDataString(tagId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -2011,11 +2025,14 @@ internal TagOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "tagId", "^[^*#&+:<>?]+$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2027,7 +2044,6 @@ internal TagOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("apiId", apiId); tracingParameters.Add("tagId", tagId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetByApi", tracingParameters); } @@ -2040,9 +2056,9 @@ internal TagOperations(ApiManagementClient client) _url = _url.Replace("{tagId}", System.Uri.EscapeDataString(tagId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -2279,11 +2295,14 @@ internal TagOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "tagId", "^[^*#&+:<>?]+$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2295,7 +2314,6 @@ internal TagOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("apiId", apiId); tracingParameters.Add("tagId", tagId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "AssignToApi", tracingParameters); } @@ -2308,9 +2326,9 @@ internal TagOperations(ApiManagementClient client) _url = _url.Replace("{tagId}", System.Uri.EscapeDataString(tagId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -2562,11 +2580,14 @@ internal TagOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "tagId", "^[^*#&+:<>?]+$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2578,7 +2599,6 @@ internal TagOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("apiId", apiId); tracingParameters.Add("tagId", tagId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "DetachFromApi", tracingParameters); } @@ -2591,9 +2611,9 @@ internal TagOperations(ApiManagementClient client) _url = _url.Replace("{tagId}", System.Uri.EscapeDataString(tagId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -2774,11 +2794,14 @@ internal TagOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.MinLength, "productId", 1); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -2790,7 +2813,6 @@ internal TagOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("productId", productId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByProduct", tracingParameters); } @@ -2810,9 +2832,9 @@ internal TagOperations(ApiManagementClient client) _queryParameters.Add(_odataFilter); } } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -3028,11 +3050,14 @@ internal TagOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "tagId", "^[^*#&+:<>?]+$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -3044,7 +3069,6 @@ internal TagOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("productId", productId); tracingParameters.Add("tagId", tagId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetEntityStateByProduct", tracingParameters); } @@ -3057,9 +3081,9 @@ internal TagOperations(ApiManagementClient client) _url = _url.Replace("{tagId}", System.Uri.EscapeDataString(tagId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -3273,11 +3297,14 @@ internal TagOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "tagId", "^[^*#&+:<>?]+$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -3289,7 +3316,6 @@ internal TagOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("productId", productId); tracingParameters.Add("tagId", tagId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetByProduct", tracingParameters); } @@ -3302,9 +3328,9 @@ internal TagOperations(ApiManagementClient client) _url = _url.Replace("{tagId}", System.Uri.EscapeDataString(tagId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -3536,11 +3562,14 @@ internal TagOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "tagId", "^[^*#&+:<>?]+$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -3552,7 +3581,6 @@ internal TagOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("productId", productId); tracingParameters.Add("tagId", tagId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "AssignToProduct", tracingParameters); } @@ -3565,9 +3593,9 @@ internal TagOperations(ApiManagementClient client) _url = _url.Replace("{tagId}", System.Uri.EscapeDataString(tagId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -3801,11 +3829,14 @@ internal TagOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "tagId", "^[^*#&+:<>?]+$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -3817,7 +3848,6 @@ internal TagOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("productId", productId); tracingParameters.Add("tagId", tagId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "DetachFromProduct", tracingParameters); } @@ -3830,9 +3860,9 @@ internal TagOperations(ApiManagementClient client) _url = _url.Replace("{tagId}", System.Uri.EscapeDataString(tagId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -3997,11 +4027,14 @@ internal TagOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -4013,7 +4046,6 @@ internal TagOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("scope", scope); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByService", tracingParameters); } @@ -4036,9 +4068,9 @@ internal TagOperations(ApiManagementClient client) { _queryParameters.Add(string.Format("scope={0}", System.Uri.EscapeDataString(scope))); } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -4235,11 +4267,14 @@ internal TagOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "tagId", "^[^*#&+:<>?]+$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -4250,7 +4285,6 @@ internal TagOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("tagId", tagId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetEntityState", tracingParameters); } @@ -4262,9 +4296,9 @@ internal TagOperations(ApiManagementClient client) _url = _url.Replace("{tagId}", System.Uri.EscapeDataString(tagId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -4459,11 +4493,14 @@ internal TagOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "tagId", "^[^*#&+:<>?]+$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -4474,7 +4511,6 @@ internal TagOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("tagId", tagId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -4486,9 +4522,9 @@ internal TagOperations(ApiManagementClient client) _url = _url.Replace("{tagId}", System.Uri.EscapeDataString(tagId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -4716,11 +4752,14 @@ internal TagOperations(ApiManagementClient client) { parameters.Validate(); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -4733,7 +4772,6 @@ internal TagOperations(ApiManagementClient client) tracingParameters.Add("tagId", tagId); tracingParameters.Add("parameters", parameters); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } @@ -4745,9 +4783,9 @@ internal TagOperations(ApiManagementClient client) _url = _url.Replace("{tagId}", System.Uri.EscapeDataString(tagId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -4944,6 +4982,9 @@ internal TagOperations(ApiManagementClient client) /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// @@ -4953,7 +4994,7 @@ internal TagOperations(ApiManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string tagId, TagCreateUpdateParameters parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string tagId, TagCreateUpdateParameters parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -5005,11 +5046,14 @@ internal TagOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -5022,7 +5066,6 @@ internal TagOperations(ApiManagementClient client) tracingParameters.Add("tagId", tagId); tracingParameters.Add("parameters", parameters); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); } @@ -5034,9 +5077,9 @@ internal TagOperations(ApiManagementClient client) _url = _url.Replace("{tagId}", System.Uri.EscapeDataString(tagId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -5110,7 +5153,7 @@ internal TagOperations(ApiManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 204) + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -5140,13 +5183,44 @@ internal TagOperations(ApiManagementClient 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); + } + } + 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); @@ -5238,11 +5312,14 @@ internal TagOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -5254,7 +5331,6 @@ internal TagOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("tagId", tagId); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } @@ -5266,9 +5342,9 @@ internal TagOperations(ApiManagementClient client) _url = _url.Replace("{tagId}", System.Uri.EscapeDataString(tagId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/TagOperationsExtensions.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/TagOperationsExtensions.cs index 52a3690c8ca94..1a1116008fd1d 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/TagOperationsExtensions.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/TagOperationsExtensions.cs @@ -1141,9 +1141,9 @@ public static TagContract Get(this ITagOperations operations, string resourceGro /// header response of the GET request or it should be * for unconditional /// update. /// - public static void Update(this ITagOperations operations, string resourceGroupName, string serviceName, string tagId, TagCreateUpdateParameters parameters, string ifMatch) + public static TagContract Update(this ITagOperations operations, string resourceGroupName, string serviceName, string tagId, TagCreateUpdateParameters parameters, string ifMatch) { - operations.UpdateAsync(resourceGroupName, serviceName, tagId, parameters, ifMatch).GetAwaiter().GetResult(); + return operations.UpdateAsync(resourceGroupName, serviceName, tagId, parameters, ifMatch).GetAwaiter().GetResult(); } /// @@ -1173,9 +1173,12 @@ public static void Update(this ITagOperations operations, string resourceGroupNa /// /// The cancellation token. /// - public static async Task UpdateAsync(this ITagOperations operations, string resourceGroupName, string serviceName, string tagId, TagCreateUpdateParameters parameters, string ifMatch, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task UpdateAsync(this ITagOperations operations, string resourceGroupName, string serviceName, string tagId, TagCreateUpdateParameters parameters, string ifMatch, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.UpdateWithHttpMessagesAsync(resourceGroupName, serviceName, tagId, parameters, ifMatch, null, cancellationToken).ConfigureAwait(false)).Dispose(); + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, serviceName, tagId, parameters, ifMatch, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/TagResourceOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/TagResourceOperations.cs index 2faec30925448..7b9b99bfb2031 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/TagResourceOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/TagResourceOperations.cs @@ -109,11 +109,14 @@ internal TagResourceOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -124,7 +127,6 @@ internal TagResourceOperations(ApiManagementClient client) tracingParameters.Add("odataQuery", odataQuery); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByService", tracingParameters); } @@ -143,9 +145,9 @@ internal TagResourceOperations(ApiManagementClient client) _queryParameters.Add(_odataFilter); } } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/TenantAccessGitOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/TenantAccessGitOperations.cs index 3ccd229315552..ac90b302913df 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/TenantAccessGitOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/TenantAccessGitOperations.cs @@ -105,11 +105,14 @@ internal TenantAccessGitOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; string accessName = "access"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -120,7 +123,6 @@ internal TenantAccessGitOperations(ApiManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("accessName", accessName); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); @@ -133,9 +135,9 @@ internal TenantAccessGitOperations(ApiManagementClient client) _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{accessName}", System.Uri.EscapeDataString(accessName)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -322,11 +324,14 @@ internal TenantAccessGitOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; string accessName = "access"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -337,7 +342,6 @@ internal TenantAccessGitOperations(ApiManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("accessName", accessName); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "RegeneratePrimaryKey", tracingParameters); @@ -350,9 +354,9 @@ internal TenantAccessGitOperations(ApiManagementClient client) _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{accessName}", System.Uri.EscapeDataString(accessName)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -508,11 +512,14 @@ internal TenantAccessGitOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; string accessName = "access"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -523,7 +530,6 @@ internal TenantAccessGitOperations(ApiManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("accessName", accessName); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "RegenerateSecondaryKey", tracingParameters); @@ -536,9 +542,9 @@ internal TenantAccessGitOperations(ApiManagementClient client) _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{accessName}", System.Uri.EscapeDataString(accessName)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -697,11 +703,14 @@ internal TenantAccessGitOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; string accessName = "access"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -712,7 +721,6 @@ internal TenantAccessGitOperations(ApiManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("accessName", accessName); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListSecrets", tracingParameters); @@ -725,9 +733,9 @@ internal TenantAccessGitOperations(ApiManagementClient client) _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{accessName}", System.Uri.EscapeDataString(accessName)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/TenantAccessOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/TenantAccessOperations.cs index 9f5b14a1c66f6..dbf370308a480 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/TenantAccessOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/TenantAccessOperations.cs @@ -102,11 +102,14 @@ internal TenantAccessOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; string accessName = "access"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -117,7 +120,6 @@ internal TenantAccessOperations(ApiManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("accessName", accessName); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetEntityTag", tracingParameters); @@ -130,9 +132,9 @@ internal TenantAccessOperations(ApiManagementClient client) _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{accessName}", System.Uri.EscapeDataString(accessName)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -304,11 +306,14 @@ internal TenantAccessOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; string accessName = "access"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -319,7 +324,6 @@ internal TenantAccessOperations(ApiManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("accessName", accessName); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); @@ -332,9 +336,9 @@ internal TenantAccessOperations(ApiManagementClient client) _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{accessName}", System.Uri.EscapeDataString(accessName)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -495,6 +499,9 @@ internal TenantAccessOperations(ApiManagementClient client) /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// @@ -504,7 +511,7 @@ internal TenantAccessOperations(ApiManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, AccessInformationUpdateParameters parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, AccessInformationUpdateParameters parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -537,12 +544,15 @@ internal TenantAccessOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } string accessName = "access"; - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -555,7 +565,6 @@ internal TenantAccessOperations(ApiManagementClient client) tracingParameters.Add("parameters", parameters); tracingParameters.Add("accessName", accessName); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); } @@ -567,9 +576,9 @@ internal TenantAccessOperations(ApiManagementClient client) _url = _url.Replace("{accessName}", System.Uri.EscapeDataString(accessName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -643,7 +652,7 @@ internal TenantAccessOperations(ApiManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 204) + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -673,13 +682,44 @@ internal TenantAccessOperations(ApiManagementClient 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); + } + } + 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); @@ -739,11 +779,14 @@ internal TenantAccessOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; string accessName = "access"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -754,7 +797,6 @@ internal TenantAccessOperations(ApiManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("accessName", accessName); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "RegeneratePrimaryKey", tracingParameters); @@ -767,9 +809,9 @@ internal TenantAccessOperations(ApiManagementClient client) _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{accessName}", System.Uri.EscapeDataString(accessName)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -925,11 +967,14 @@ internal TenantAccessOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; string accessName = "access"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -940,7 +985,6 @@ internal TenantAccessOperations(ApiManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("accessName", accessName); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "RegenerateSecondaryKey", tracingParameters); @@ -953,9 +997,9 @@ internal TenantAccessOperations(ApiManagementClient client) _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{accessName}", System.Uri.EscapeDataString(accessName)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1114,11 +1158,14 @@ internal TenantAccessOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; string accessName = "access"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -1129,7 +1176,6 @@ internal TenantAccessOperations(ApiManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("accessName", accessName); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListSecrets", tracingParameters); @@ -1142,9 +1188,9 @@ internal TenantAccessOperations(ApiManagementClient client) _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{accessName}", System.Uri.EscapeDataString(accessName)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/TenantAccessOperationsExtensions.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/TenantAccessOperationsExtensions.cs index 27595d0ee77ab..05a85a28c2854 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/TenantAccessOperationsExtensions.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/TenantAccessOperationsExtensions.cs @@ -121,9 +121,9 @@ public static AccessInformationContract Get(this ITenantAccessOperations operati /// header response of the GET request or it should be * for unconditional /// update. /// - public static void Update(this ITenantAccessOperations operations, string resourceGroupName, string serviceName, AccessInformationUpdateParameters parameters, string ifMatch) + public static AccessInformationContract Update(this ITenantAccessOperations operations, string resourceGroupName, string serviceName, AccessInformationUpdateParameters parameters, string ifMatch) { - operations.UpdateAsync(resourceGroupName, serviceName, parameters, ifMatch).GetAwaiter().GetResult(); + return operations.UpdateAsync(resourceGroupName, serviceName, parameters, ifMatch).GetAwaiter().GetResult(); } /// @@ -149,9 +149,12 @@ public static void Update(this ITenantAccessOperations operations, string resour /// /// The cancellation token. /// - public static async Task UpdateAsync(this ITenantAccessOperations operations, string resourceGroupName, string serviceName, AccessInformationUpdateParameters parameters, string ifMatch, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task UpdateAsync(this ITenantAccessOperations operations, string resourceGroupName, string serviceName, AccessInformationUpdateParameters parameters, string ifMatch, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.UpdateWithHttpMessagesAsync(resourceGroupName, serviceName, parameters, ifMatch, null, cancellationToken).ConfigureAwait(false)).Dispose(); + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, serviceName, parameters, ifMatch, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/TenantConfigurationOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/TenantConfigurationOperations.cs index 58ad08aa71783..0f390052caa13 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/TenantConfigurationOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/TenantConfigurationOperations.cs @@ -188,11 +188,14 @@ internal TenantConfigurationOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; string configurationName = "configuration"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -203,7 +206,6 @@ internal TenantConfigurationOperations(ApiManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("configurationName", configurationName); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetSyncState", tracingParameters); @@ -216,9 +218,9 @@ internal TenantConfigurationOperations(ApiManagementClient client) _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{configurationName}", System.Uri.EscapeDataString(configurationName)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -414,11 +416,14 @@ internal TenantConfigurationOperations(ApiManagementClient client) { parameters.Validate(); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; string configurationName = "configuration"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -430,7 +435,6 @@ internal TenantConfigurationOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("configurationName", configurationName); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginDeploy", tracingParameters); @@ -443,9 +447,9 @@ internal TenantConfigurationOperations(ApiManagementClient client) _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{configurationName}", System.Uri.EscapeDataString(configurationName)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -642,11 +646,14 @@ internal TenantConfigurationOperations(ApiManagementClient client) { parameters.Validate(); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; string configurationName = "configuration"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -658,7 +665,6 @@ internal TenantConfigurationOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("configurationName", configurationName); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginSave", tracingParameters); @@ -671,9 +677,9 @@ internal TenantConfigurationOperations(ApiManagementClient client) _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{configurationName}", System.Uri.EscapeDataString(configurationName)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -868,11 +874,14 @@ internal TenantConfigurationOperations(ApiManagementClient client) { parameters.Validate(); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; string configurationName = "configuration"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -884,7 +893,6 @@ internal TenantConfigurationOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("configurationName", configurationName); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginValidate", tracingParameters); @@ -897,9 +905,9 @@ internal TenantConfigurationOperations(ApiManagementClient client) _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{configurationName}", System.Uri.EscapeDataString(configurationName)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/UserConfirmationPasswordOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/UserConfirmationPasswordOperations.cs index 2760d515544f4..339a79e79f18a 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/UserConfirmationPasswordOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/UserConfirmationPasswordOperations.cs @@ -63,6 +63,11 @@ internal UserConfirmationPasswordOperations(ApiManagementClient client) /// User identifier. Must be unique in the current API Management service /// instance. /// + /// + /// Determines the type of application which send the create user request. + /// Default is legacy publisher portal. Possible values include: 'portal', + /// 'developerPortal' + /// /// /// Headers that will be added to request. /// @@ -81,7 +86,7 @@ internal UserConfirmationPasswordOperations(ApiManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task SendWithHttpMessagesAsync(string resourceGroupName, string serviceName, string userId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task SendWithHttpMessagesAsync(string resourceGroupName, string serviceName, string userId, string appType = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -121,11 +126,14 @@ internal UserConfirmationPasswordOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.MinLength, "userId", 1); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -136,7 +144,7 @@ internal UserConfirmationPasswordOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("userId", userId); - tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("appType", appType); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Send", tracingParameters); } @@ -148,9 +156,13 @@ internal UserConfirmationPasswordOperations(ApiManagementClient client) _url = _url.Replace("{userId}", System.Uri.EscapeDataString(userId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (appType != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("appType={0}", System.Uri.EscapeDataString(appType))); } if (_queryParameters.Count > 0) { diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/UserConfirmationPasswordOperationsExtensions.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/UserConfirmationPasswordOperationsExtensions.cs index 77e5f271b1ae5..8658d06a9d08d 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/UserConfirmationPasswordOperationsExtensions.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/UserConfirmationPasswordOperationsExtensions.cs @@ -37,9 +37,14 @@ public static partial class UserConfirmationPasswordOperationsExtensions /// User identifier. Must be unique in the current API Management service /// instance. /// - public static void Send(this IUserConfirmationPasswordOperations operations, string resourceGroupName, string serviceName, string userId) + /// + /// Determines the type of application which send the create user request. + /// Default is legacy publisher portal. Possible values include: 'portal', + /// 'developerPortal' + /// + public static void Send(this IUserConfirmationPasswordOperations operations, string resourceGroupName, string serviceName, string userId, string appType = default(string)) { - operations.SendAsync(resourceGroupName, serviceName, userId).GetAwaiter().GetResult(); + operations.SendAsync(resourceGroupName, serviceName, userId, appType).GetAwaiter().GetResult(); } /// @@ -58,12 +63,17 @@ public static void Send(this IUserConfirmationPasswordOperations operations, str /// User identifier. Must be unique in the current API Management service /// instance. /// + /// + /// Determines the type of application which send the create user request. + /// Default is legacy publisher portal. Possible values include: 'portal', + /// 'developerPortal' + /// /// /// The cancellation token. /// - public static async Task SendAsync(this IUserConfirmationPasswordOperations operations, string resourceGroupName, string serviceName, string userId, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task SendAsync(this IUserConfirmationPasswordOperations operations, string resourceGroupName, string serviceName, string userId, string appType = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.SendWithHttpMessagesAsync(resourceGroupName, serviceName, userId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.SendWithHttpMessagesAsync(resourceGroupName, serviceName, userId, appType, null, cancellationToken).ConfigureAwait(false)).Dispose(); } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/UserGroupOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/UserGroupOperations.cs index dd8c8dccb263f..1e5e2d354eab2 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/UserGroupOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/UserGroupOperations.cs @@ -128,11 +128,14 @@ internal UserGroupOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.MinLength, "userId", 1); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -144,7 +147,6 @@ internal UserGroupOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("userId", userId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } @@ -164,9 +166,9 @@ internal UserGroupOperations(ApiManagementClient client) _queryParameters.Add(_odataFilter); } } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/UserIdentitiesOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/UserIdentitiesOperations.cs index 851819f4c5956..5b5429d7bce71 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/UserIdentitiesOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/UserIdentitiesOperations.cs @@ -124,11 +124,14 @@ internal UserIdentitiesOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.MinLength, "userId", 1); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -139,7 +142,6 @@ internal UserIdentitiesOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("userId", userId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } @@ -151,9 +153,9 @@ internal UserIdentitiesOperations(ApiManagementClient client) _url = _url.Replace("{userId}", System.Uri.EscapeDataString(userId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/UserOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/UserOperations.cs index 52b4ffe7820a2..3e1bc347ac194 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/UserOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/UserOperations.cs @@ -112,11 +112,14 @@ internal UserOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -128,7 +131,6 @@ internal UserOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("expandGroups", expandGroups); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByService", tracingParameters); } @@ -151,9 +153,9 @@ internal UserOperations(ApiManagementClient client) { _queryParameters.Add(string.Format("expandGroups={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(expandGroups, Client.SerializationSettings).Trim('"')))); } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -347,11 +349,14 @@ internal UserOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.MinLength, "userId", 1); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -362,7 +367,6 @@ internal UserOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("userId", userId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetEntityTag", tracingParameters); } @@ -374,9 +378,9 @@ internal UserOperations(ApiManagementClient client) _url = _url.Replace("{userId}", System.Uri.EscapeDataString(userId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -567,11 +571,14 @@ internal UserOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.MinLength, "userId", 1); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -582,7 +589,6 @@ internal UserOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("userId", userId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } @@ -594,9 +600,9 @@ internal UserOperations(ApiManagementClient client) _url = _url.Replace("{userId}", System.Uri.EscapeDataString(userId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -747,6 +753,9 @@ internal UserOperations(ApiManagementClient client) /// /// Create or update parameters. /// + /// + /// Send an Email notification to the User. + /// /// /// ETag of the Entity. Not required when creating an entity, but required when /// updating an entity. @@ -772,7 +781,7 @@ internal UserOperations(ApiManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string userId, UserCreateParameters parameters, string ifMatch = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string userId, UserCreateParameters parameters, bool? notify = default(bool?), string ifMatch = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -820,11 +829,14 @@ internal UserOperations(ApiManagementClient client) { parameters.Validate(); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -836,8 +848,8 @@ internal UserOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("userId", userId); tracingParameters.Add("parameters", parameters); + tracingParameters.Add("notify", notify); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } @@ -849,9 +861,13 @@ internal UserOperations(ApiManagementClient client) _url = _url.Replace("{userId}", System.Uri.EscapeDataString(userId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (notify != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("notify={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(notify, Client.SerializationSettings).Trim('"')))); + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1048,6 +1064,9 @@ internal UserOperations(ApiManagementClient client) /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// @@ -1057,7 +1076,7 @@ internal UserOperations(ApiManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string userId, UserUpdateParameters parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string userId, UserUpdateParameters parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -1105,11 +1124,14 @@ internal UserOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1122,7 +1144,6 @@ internal UserOperations(ApiManagementClient client) tracingParameters.Add("userId", userId); tracingParameters.Add("parameters", parameters); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); } @@ -1134,9 +1155,9 @@ internal UserOperations(ApiManagementClient client) _url = _url.Replace("{userId}", System.Uri.EscapeDataString(userId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1210,7 +1231,7 @@ internal UserOperations(ApiManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 204) + if ((int)_statusCode != 200) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -1240,13 +1261,44 @@ internal UserOperations(ApiManagementClient 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); + } + } + 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); @@ -1278,6 +1330,11 @@ internal UserOperations(ApiManagementClient client) /// /// Send an Account Closed Email notification to the User. /// + /// + /// Determines the type of application which send the create user request. + /// Default is legacy publisher portal. Possible values include: 'portal', + /// 'developerPortal' + /// /// /// Headers that will be added to request. /// @@ -1296,7 +1353,7 @@ internal UserOperations(ApiManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string serviceName, string userId, string ifMatch, bool? deleteSubscriptions = default(bool?), bool? notify = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string serviceName, string userId, string ifMatch, bool? deleteSubscriptions = default(bool?), bool? notify = default(bool?), string appType = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -1340,11 +1397,14 @@ internal UserOperations(ApiManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1358,7 +1418,7 @@ internal UserOperations(ApiManagementClient client) tracingParameters.Add("deleteSubscriptions", deleteSubscriptions); tracingParameters.Add("notify", notify); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("appType", appType); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } @@ -1378,9 +1438,13 @@ internal UserOperations(ApiManagementClient client) { _queryParameters.Add(string.Format("notify={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(notify, Client.SerializationSettings).Trim('"')))); } - if (apiVersion != null) + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (appType != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("appType={0}", System.Uri.EscapeDataString(appType))); } if (_queryParameters.Count > 0) { @@ -1567,11 +1631,14 @@ internal UserOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.MinLength, "userId", 1); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1582,7 +1649,6 @@ internal UserOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("userId", userId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GenerateSsoUrl", tracingParameters); } @@ -1594,9 +1660,9 @@ internal UserOperations(ApiManagementClient client) _url = _url.Replace("{userId}", System.Uri.EscapeDataString(userId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { @@ -1803,11 +1869,14 @@ internal UserOperations(ApiManagementClient client) { parameters.Validate(); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1819,7 +1888,6 @@ internal UserOperations(ApiManagementClient client) tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("userId", userId); tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetSharedAccessToken", tracingParameters); } @@ -1831,9 +1899,9 @@ internal UserOperations(ApiManagementClient client) _url = _url.Replace("{userId}", System.Uri.EscapeDataString(userId)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) { diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/UserOperationsExtensions.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/UserOperationsExtensions.cs index fa5779fa09eb8..865f58e6ae591 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/UserOperationsExtensions.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/UserOperationsExtensions.cs @@ -191,13 +191,16 @@ public static UserContract Get(this IUserOperations operations, string resourceG /// /// Create or update parameters. /// + /// + /// Send an Email notification to the User. + /// /// /// ETag of the Entity. Not required when creating an entity, but required when /// updating an entity. /// - public static UserContract CreateOrUpdate(this IUserOperations operations, string resourceGroupName, string serviceName, string userId, UserCreateParameters parameters, string ifMatch = default(string)) + public static UserContract CreateOrUpdate(this IUserOperations operations, string resourceGroupName, string serviceName, string userId, UserCreateParameters parameters, bool? notify = default(bool?), string ifMatch = default(string)) { - return operations.CreateOrUpdateAsync(resourceGroupName, serviceName, userId, parameters, ifMatch).GetAwaiter().GetResult(); + return operations.CreateOrUpdateAsync(resourceGroupName, serviceName, userId, parameters, notify, ifMatch).GetAwaiter().GetResult(); } /// @@ -219,6 +222,9 @@ public static UserContract Get(this IUserOperations operations, string resourceG /// /// Create or update parameters. /// + /// + /// Send an Email notification to the User. + /// /// /// ETag of the Entity. Not required when creating an entity, but required when /// updating an entity. @@ -226,9 +232,9 @@ public static UserContract Get(this IUserOperations operations, string resourceG /// /// The cancellation token. /// - public static async Task CreateOrUpdateAsync(this IUserOperations operations, string resourceGroupName, string serviceName, string userId, UserCreateParameters parameters, string ifMatch = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CreateOrUpdateAsync(this IUserOperations operations, string resourceGroupName, string serviceName, string userId, UserCreateParameters parameters, bool? notify = default(bool?), string ifMatch = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serviceName, userId, parameters, ifMatch, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serviceName, userId, parameters, notify, ifMatch, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -258,9 +264,9 @@ public static UserContract Get(this IUserOperations operations, string resourceG /// header response of the GET request or it should be * for unconditional /// update. /// - public static void Update(this IUserOperations operations, string resourceGroupName, string serviceName, string userId, UserUpdateParameters parameters, string ifMatch) + public static UserContract Update(this IUserOperations operations, string resourceGroupName, string serviceName, string userId, UserUpdateParameters parameters, string ifMatch) { - operations.UpdateAsync(resourceGroupName, serviceName, userId, parameters, ifMatch).GetAwaiter().GetResult(); + return operations.UpdateAsync(resourceGroupName, serviceName, userId, parameters, ifMatch).GetAwaiter().GetResult(); } /// @@ -290,9 +296,12 @@ public static void Update(this IUserOperations operations, string resourceGroupN /// /// The cancellation token. /// - public static async Task UpdateAsync(this IUserOperations operations, string resourceGroupName, string serviceName, string userId, UserUpdateParameters parameters, string ifMatch, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task UpdateAsync(this IUserOperations operations, string resourceGroupName, string serviceName, string userId, UserUpdateParameters parameters, string ifMatch, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.UpdateWithHttpMessagesAsync(resourceGroupName, serviceName, userId, parameters, ifMatch, null, cancellationToken).ConfigureAwait(false)).Dispose(); + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, serviceName, userId, parameters, ifMatch, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// @@ -322,9 +331,14 @@ public static void Update(this IUserOperations operations, string resourceGroupN /// /// Send an Account Closed Email notification to the User. /// - public static void Delete(this IUserOperations operations, string resourceGroupName, string serviceName, string userId, string ifMatch, bool? deleteSubscriptions = default(bool?), bool? notify = default(bool?)) + /// + /// Determines the type of application which send the create user request. + /// Default is legacy publisher portal. Possible values include: 'portal', + /// 'developerPortal' + /// + public static void Delete(this IUserOperations operations, string resourceGroupName, string serviceName, string userId, string ifMatch, bool? deleteSubscriptions = default(bool?), bool? notify = default(bool?), string appType = default(string)) { - operations.DeleteAsync(resourceGroupName, serviceName, userId, ifMatch, deleteSubscriptions, notify).GetAwaiter().GetResult(); + operations.DeleteAsync(resourceGroupName, serviceName, userId, ifMatch, deleteSubscriptions, notify, appType).GetAwaiter().GetResult(); } /// @@ -354,12 +368,17 @@ public static void Update(this IUserOperations operations, string resourceGroupN /// /// Send an Account Closed Email notification to the User. /// + /// + /// Determines the type of application which send the create user request. + /// Default is legacy publisher portal. Possible values include: 'portal', + /// 'developerPortal' + /// /// /// The cancellation token. /// - public static async Task DeleteAsync(this IUserOperations operations, string resourceGroupName, string serviceName, string userId, string ifMatch, bool? deleteSubscriptions = default(bool?), bool? notify = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task DeleteAsync(this IUserOperations operations, string resourceGroupName, string serviceName, string userId, string ifMatch, bool? deleteSubscriptions = default(bool?), bool? notify = default(bool?), string appType = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, serviceName, userId, ifMatch, deleteSubscriptions, notify, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, serviceName, userId, ifMatch, deleteSubscriptions, notify, appType, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/UserSubscriptionOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/UserSubscriptionOperations.cs index 792a93f9f51a8..e591fa428acaa 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/UserSubscriptionOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/UserSubscriptionOperations.cs @@ -128,11 +128,14 @@ internal UserSubscriptionOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.MinLength, "userId", 1); } } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2019-12-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -144,7 +147,6 @@ internal UserSubscriptionOperations(ApiManagementClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); tracingParameters.Add("userId", userId); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } @@ -164,9 +166,9 @@ internal UserSubscriptionOperations(ApiManagementClient client) _queryParameters.Add(_odataFilter); } } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); } if (_queryParameters.Count > 0) {