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..cb7d45891e61c 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. /// @@ -286,6 +296,16 @@ public partial class ApiManagementClient : ServiceClient, I /// public virtual IPolicyDescriptionOperations PolicyDescription { get; private set; } + /// + /// Gets the IPortalRevisionOperations. + /// + public virtual IPortalRevisionOperations PortalRevision { get; private set; } + + /// + /// Gets the IPortalSettingsOperations. + /// + public virtual IPortalSettingsOperations PortalSettings { get; private set; } + /// /// Gets the ISignInSettingsOperations. /// @@ -346,6 +366,16 @@ public partial class ApiManagementClient : ServiceClient, I /// public virtual IReportsOperations Reports { get; private set; } + /// + /// Gets the ITenantSettingsOperations. + /// + public virtual ITenantSettingsOperations TenantSettings { get; private set; } + + /// + /// Gets the IApiManagementSkusOperations. + /// + public virtual IApiManagementSkusOperations ApiManagementSkus { get; private set; } + /// /// Gets the ISubscriptionOperations. /// @@ -396,6 +426,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 +687,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); @@ -679,6 +716,8 @@ private void Initialize() OpenIdConnectProvider = new OpenIdConnectProviderOperations(this); Policy = new PolicyOperations(this); PolicyDescription = new PolicyDescriptionOperations(this); + PortalRevision = new PortalRevisionOperations(this); + PortalSettings = new PortalSettingsOperations(this); SignInSettings = new SignInSettingsOperations(this); SignUpSettings = new SignUpSettingsOperations(this); DelegationSettings = new DelegationSettingsOperations(this); @@ -691,6 +730,8 @@ private void Initialize() QuotaByPeriodKeys = new QuotaByPeriodKeysOperations(this); Region = new RegionOperations(this); Reports = new ReportsOperations(this); + TenantSettings = new TenantSettingsOperations(this); + ApiManagementSkus = new ApiManagementSkusOperations(this); Subscription = new SubscriptionOperations(this); TagResource = new TagResourceOperations(this); TenantAccess = new TenantAccessOperations(this); @@ -701,8 +742,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..297e0ae8a2104 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiManagementOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiManagementOperations.cs @@ -60,18 +60,27 @@ internal ApiManagementOperations(ApiManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// /// /// A response object containing the response body and response headers. /// public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - 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) { @@ -151,14 +159,13 @@ internal ApiManagementOperations(ApiManagementClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -168,10 +175,6 @@ internal ApiManagementOperations(ApiManagementClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); @@ -229,7 +232,7 @@ internal ApiManagementOperations(ApiManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -325,14 +328,13 @@ internal ApiManagementOperations(ApiManagementClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -342,10 +344,6 @@ internal ApiManagementOperations(ApiManagementClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); 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..76adecaa233b2 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) { @@ -571,7 +575,7 @@ internal ApiManagementServiceOperations(ApiManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -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) { @@ -673,14 +679,13 @@ internal ApiManagementServiceOperations(ApiManagementClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -690,10 +695,6 @@ internal ApiManagementServiceOperations(ApiManagementClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); @@ -794,11 +795,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 +812,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 +822,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 +984,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 +1000,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 +1008,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 +1236,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 +1254,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 +1264,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 +1462,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 +1480,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 +1490,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 +1687,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 +1705,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 +1715,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 +1925,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 +1943,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 +1953,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 +2138,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 +2155,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 +2165,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 +2351,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 +2369,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 +2379,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) { @@ -2672,7 +2689,7 @@ internal ApiManagementServiceOperations(ApiManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -2768,14 +2785,13 @@ internal ApiManagementServiceOperations(ApiManagementClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -2785,10 +2801,6 @@ internal ApiManagementServiceOperations(ApiManagementClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); 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/ApiManagementSkusOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiManagementSkusOperations.cs new file mode 100644 index 0000000000000..924ebde120e6d --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiManagementSkusOperations.cs @@ -0,0 +1,397 @@ +// +// 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; + + /// + /// ApiManagementSkusOperations operations. + /// + internal partial class ApiManagementSkusOperations : IServiceOperations, IApiManagementSkusOperations + { + /// + /// Initializes a new instance of the ApiManagementSkusOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal ApiManagementSkusOperations(ApiManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ApiManagementClient + /// + public ApiManagementClient Client { get; private set; } + + /// + /// Gets the list of Microsoft.ApiManagement SKUs available for your + /// Subscription. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.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, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.ApiManagement/skus").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; + } + + /// + /// Gets the list of Microsoft.ApiManagement SKUs available for your + /// Subscription. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiManagementSkusOperationsExtensions.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiManagementSkusOperationsExtensions.cs new file mode 100644 index 0000000000000..74d2437ed5036 --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ApiManagementSkusOperationsExtensions.cs @@ -0,0 +1,91 @@ +// +// 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 ApiManagementSkusOperations. + /// + public static partial class ApiManagementSkusOperationsExtensions + { + /// + /// Gets the list of Microsoft.ApiManagement SKUs available for your + /// Subscription. + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this IApiManagementSkusOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Gets the list of Microsoft.ApiManagement SKUs available for your + /// Subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IApiManagementSkusOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets the list of Microsoft.ApiManagement SKUs available for your + /// Subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IApiManagementSkusOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets the list of Microsoft.ApiManagement SKUs available for your + /// Subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IApiManagementSkusOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/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..a9adfc37eaac4 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/CertificateOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/CertificateOperations.cs @@ -63,6 +63,10 @@ internal CertificateOperations(ApiManagementClient client) /// /// OData parameters to apply to the operation. /// + /// + /// When set to true, the response contains only certificates entities which + /// failed refresh. + /// /// /// Headers that will be added to request. /// @@ -84,7 +88,7 @@ internal CertificateOperations(ApiManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByServiceWithHttpMessagesAsync(string resourceGroupName, string serviceName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByServiceWithHttpMessagesAsync(string resourceGroupName, string serviceName, ODataQuery odataQuery = default(ODataQuery), bool? isKeyVaultRefreshFailed = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -109,11 +113,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 +131,7 @@ internal CertificateOperations(ApiManagementClient client) tracingParameters.Add("odataQuery", odataQuery); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); - tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("isKeyVaultRefreshFailed", isKeyVaultRefreshFailed); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByService", tracingParameters); } @@ -143,9 +150,13 @@ internal CertificateOperations(ApiManagementClient client) _queryParameters.Add(_odataFilter); } } - if (apiVersion != null) + if (isKeyVaultRefreshFailed != null) + { + _queryParameters.Add(string.Format("isKeyVaultRefreshFailed={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(isKeyVaultRefreshFailed, Client.SerializationSettings).Trim('"')))); + } + if (Client.ApiVersion != null) { - _queryParameters.Add(string.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 +354,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 +372,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 +383,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 +580,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 +598,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 +609,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 +837,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 +857,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 +868,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 +1121,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 +1140,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 +1151,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) { @@ -1250,6 +1265,252 @@ internal CertificateOperations(ApiManagementClient client) return _result; } + /// + /// From KeyVault, Refresh the certificate being used for authentication with + /// the backend. + /// + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Identifier of the certificate entity. Must be unique in the current API + /// Management service instance. + /// + /// + /// 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> RefreshSecretWithHttpMessagesAsync(string resourceGroupName, string serviceName, string certificateId, 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 (certificateId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "certificateId"); + } + if (certificateId != null) + { + if (certificateId.Length > 80) + { + throw new ValidationException(ValidationRules.MaxLength, "certificateId", 80); + } + if (certificateId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "certificateId", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(certificateId, "^[^*#&+:<>?]+$")) + { + 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"); + } + // 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("certificateId", certificateId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "RefreshSecret", 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}/certificates/{certificateId}/refreshSecret").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); + _url = _url.Replace("{certificateId}", System.Uri.EscapeDataString(certificateId)); + _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("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + /// /// Lists a collection of all certificates in the specified service instance. /// diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/CertificateOperationsExtensions.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/CertificateOperationsExtensions.cs index 22a46ba82921d..eb04ea3b664c4 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/CertificateOperationsExtensions.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/CertificateOperationsExtensions.cs @@ -37,9 +37,13 @@ public static partial class CertificateOperationsExtensions /// /// OData parameters to apply to the operation. /// - public static IPage ListByService(this ICertificateOperations operations, string resourceGroupName, string serviceName, ODataQuery odataQuery = default(ODataQuery)) + /// + /// When set to true, the response contains only certificates entities which + /// failed refresh. + /// + public static IPage ListByService(this ICertificateOperations operations, string resourceGroupName, string serviceName, ODataQuery odataQuery = default(ODataQuery), bool? isKeyVaultRefreshFailed = default(bool?)) { - return operations.ListByServiceAsync(resourceGroupName, serviceName, odataQuery).GetAwaiter().GetResult(); + return operations.ListByServiceAsync(resourceGroupName, serviceName, odataQuery, isKeyVaultRefreshFailed).GetAwaiter().GetResult(); } /// @@ -57,12 +61,16 @@ public static partial class CertificateOperationsExtensions /// /// OData parameters to apply to the operation. /// + /// + /// When set to true, the response contains only certificates entities which + /// failed refresh. + /// /// /// The cancellation token. /// - public static async Task> ListByServiceAsync(this ICertificateOperations operations, string resourceGroupName, string serviceName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByServiceAsync(this ICertificateOperations operations, string resourceGroupName, string serviceName, ODataQuery odataQuery = default(ODataQuery), bool? isKeyVaultRefreshFailed = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByServiceWithHttpMessagesAsync(resourceGroupName, serviceName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByServiceWithHttpMessagesAsync(resourceGroupName, serviceName, odataQuery, isKeyVaultRefreshFailed, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -287,6 +295,58 @@ public static void Delete(this ICertificateOperations operations, string resourc (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, serviceName, certificateId, ifMatch, null, cancellationToken).ConfigureAwait(false)).Dispose(); } + /// + /// From KeyVault, Refresh the certificate being used for authentication with + /// the backend. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Identifier of the certificate entity. Must be unique in the current API + /// Management service instance. + /// + public static CertificateContract RefreshSecret(this ICertificateOperations operations, string resourceGroupName, string serviceName, string certificateId) + { + return operations.RefreshSecretAsync(resourceGroupName, serviceName, certificateId).GetAwaiter().GetResult(); + } + + /// + /// From KeyVault, Refresh the certificate being used for authentication with + /// the backend. + /// + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Identifier of the certificate entity. Must be unique in the current API + /// Management service instance. + /// + /// + /// The cancellation token. + /// + public static async Task RefreshSecretAsync(this ICertificateOperations operations, string resourceGroupName, string serviceName, string certificateId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.RefreshSecretWithHttpMessagesAsync(resourceGroupName, serviceName, certificateId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Lists a collection of all certificates in the specified service instance. /// 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..26ecd0efb185e 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. /// @@ -281,6 +291,16 @@ public partial interface IApiManagementClient : System.IDisposable /// IPolicyDescriptionOperations PolicyDescription { get; } + /// + /// Gets the IPortalRevisionOperations. + /// + IPortalRevisionOperations PortalRevision { get; } + + /// + /// Gets the IPortalSettingsOperations. + /// + IPortalSettingsOperations PortalSettings { get; } + /// /// Gets the ISignInSettingsOperations. /// @@ -341,6 +361,16 @@ public partial interface IApiManagementClient : System.IDisposable /// IReportsOperations Reports { get; } + /// + /// Gets the ITenantSettingsOperations. + /// + ITenantSettingsOperations TenantSettings { get; } + + /// + /// Gets the IApiManagementSkusOperations. + /// + IApiManagementSkusOperations ApiManagementSkus { get; } + /// /// Gets the ISubscriptionOperations. /// @@ -391,5 +421,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/IApiManagementOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IApiManagementOperations.cs index cb7acf6ba6251..f3447effe2525 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IApiManagementOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IApiManagementOperations.cs @@ -33,7 +33,7 @@ public partial interface IApiManagementOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -56,7 +56,7 @@ public partial interface IApiManagementOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IApiManagementServiceOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IApiManagementServiceOperations.cs index 18a92821d2b0a..8054f2dc011dc 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IApiManagementServiceOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IApiManagementServiceOperations.cs @@ -225,7 +225,7 @@ public partial interface IApiManagementServiceOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -528,7 +528,7 @@ public partial interface IApiManagementServiceOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IApiManagementSkusOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IApiManagementSkusOperations.cs new file mode 100644 index 0000000000000..c5600d79fde38 --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IApiManagementSkusOperations.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 +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// ApiManagementSkusOperations operations. + /// + public partial interface IApiManagementSkusOperations + { + /// + /// Gets the list of Microsoft.ApiManagement SKUs available for your + /// Subscription. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the list of Microsoft.ApiManagement SKUs available for your + /// Subscription. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/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/ICertificateOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ICertificateOperations.cs index 263dcb93056ab..d5465d3c6a4e4 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ICertificateOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ICertificateOperations.cs @@ -37,6 +37,10 @@ public partial interface ICertificateOperations /// /// OData parameters to apply to the operation. /// + /// + /// When set to true, the response contains only certificates entities + /// which failed refresh. + /// /// /// The headers that will be added to request. /// @@ -52,7 +56,7 @@ public partial interface ICertificateOperations /// /// Thrown when a required parameter is null /// - Task>> ListByServiceWithHttpMessagesAsync(string resourceGroupName, string serviceName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByServiceWithHttpMessagesAsync(string resourceGroupName, string serviceName, ODataQuery odataQuery = default(ODataQuery), bool? isKeyVaultRefreshFailed = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets the entity state (Etag) version of the certificate specified /// by its identifier. @@ -179,6 +183,37 @@ public partial interface ICertificateOperations /// Task DeleteWithHttpMessagesAsync(string resourceGroupName, string serviceName, string certificateId, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// From KeyVault, Refresh the certificate being used for + /// authentication with the backend. + /// + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Identifier of the certificate entity. Must be unique in the current + /// API Management service instance. + /// + /// + /// 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> RefreshSecretWithHttpMessagesAsync(string resourceGroupName, string serviceName, string certificateId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Lists a collection of all certificates in the specified service /// instance. /// 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..c3b659dd74932 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. /// /// @@ -38,6 +38,10 @@ public partial interface INamedValueOperations /// /// OData parameters to apply to the operation. /// + /// + /// When set to true, the response contains only named value entities + /// which failed refresh. + /// /// /// The headers that will be added to request. /// @@ -53,10 +57,10 @@ public partial interface INamedValueOperations /// /// Thrown when a required parameter is null /// - Task>> ListByServiceWithHttpMessagesAsync(string resourceGroupName, string serviceName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByServiceWithHttpMessagesAsync(string resourceGroupName, string serviceName, ODataQuery odataQuery = default(ODataQuery), bool? isKeyVaultRefreshFailed = default(bool?), 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 +85,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 +113,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 +148,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 +184,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 +215,35 @@ 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. + /// + /// + /// The name of the API Management service. + /// + /// + /// Identifier of the NamedValue. + /// + /// + /// 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> ListValueWithHttpMessagesAsync(string resourceGroupName, string serviceName, string namedValueId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Refresh the secret of the named value specified by its identifier. /// /// /// The name of the resource group. @@ -237,9 +269,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> RefreshSecretWithHttpMessagesAsync(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 +306,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 +342,35 @@ 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 + /// Refresh the secret of the named value specified by its identifier. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Identifier of the NamedValue. + /// + /// + /// 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> BeginRefreshSecretWithHttpMessagesAsync(string resourceGroupName, string serviceName, string namedValueId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// 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/IOperationOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IOperationOperations.cs index 1edd5b50d3c93..9634927d5d349 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IOperationOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IOperationOperations.cs @@ -50,7 +50,7 @@ public partial interface IOperationOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -72,7 +72,7 @@ public partial interface IOperationOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IPortalRevisionOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IPortalRevisionOperations.cs new file mode 100644 index 0000000000000..03b3cb670ae3e --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IPortalRevisionOperations.cs @@ -0,0 +1,282 @@ +// +// 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; + + /// + /// PortalRevisionOperations operations. + /// + public partial interface IPortalRevisionOperations + { + /// + /// Lists a collection of developer portal revision entities. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// | Field | Supported operators | Supported functions + /// | + /// |-------------|------------------------|-----------------------------------| + /// + /// |name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, + /// endswith| + /// |description | ge, le, eq, ne, gt, lt | substringof, contains, + /// startswith, endswith| + /// |isCurrent | eq, ne | | + /// + /// + /// Number of records to return. + /// + /// + /// Number of records to skip. + /// + /// + /// 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 filter = default(string), int? top = default(int?), int? skip = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets developer portal revision specified by its identifier. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Portal revision identifier. Must be unique in the current API + /// Management service instance. + /// + /// + /// 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 portalRevisionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets developer portal revision specified by its identifier. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Portal revision identifier. Must be unique in the current API + /// Management service instance. + /// + /// + /// 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 portalRevisionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates a new developer portal revision. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Portal revision identifier. Must be unique in the current API + /// Management service instance. + /// + /// + /// + /// + /// 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 portalRevisionId, PortalRevisionContract parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates the description of specified portal revision or makes it + /// current. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Portal revision identifier. Must be unique in the current API + /// Management service instance. + /// + /// + /// + /// + /// 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 unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string portalRevisionId, PortalRevisionContract parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates a new developer portal revision. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Portal revision identifier. Must be unique in the current API + /// Management service instance. + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string portalRevisionId, PortalRevisionContract parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates the description of specified portal revision or makes it + /// current. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Portal revision identifier. Must be unique in the current API + /// Management service instance. + /// + /// + /// + /// + /// 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 unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string portalRevisionId, PortalRevisionContract parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Lists a collection of developer portal revision entities. + /// + /// + /// 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/IPortalSettingsOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IPortalSettingsOperations.cs new file mode 100644 index 0000000000000..40af76a8d45c0 --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IPortalSettingsOperations.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 +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// PortalSettingsOperations operations. + /// + public partial interface IPortalSettingsOperations + { + /// + /// Lists a collection of portalsettings defined within a service + /// instance.. + /// + /// + /// 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)); + } +} 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/IReportsOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IReportsOperations.cs index 18057e3b810f1..72b1f4cd2f771 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IReportsOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IReportsOperations.cs @@ -42,7 +42,7 @@ public partial interface IReportsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -70,7 +70,7 @@ public partial interface IReportsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -98,7 +98,7 @@ public partial interface IReportsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -126,7 +126,7 @@ public partial interface IReportsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -154,7 +154,7 @@ public partial interface IReportsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -182,7 +182,7 @@ public partial interface IReportsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -217,7 +217,7 @@ public partial interface IReportsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -245,7 +245,7 @@ public partial interface IReportsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -267,7 +267,7 @@ public partial interface IReportsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -289,7 +289,7 @@ public partial interface IReportsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -311,7 +311,7 @@ public partial interface IReportsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -333,7 +333,7 @@ public partial interface IReportsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -355,7 +355,7 @@ public partial interface IReportsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -377,7 +377,7 @@ public partial interface IReportsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -399,7 +399,7 @@ public partial interface IReportsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// 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/ITenantAccessGitOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ITenantAccessGitOperations.cs index 9ebab93b6b567..817151d76cb79 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ITenantAccessGitOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ITenantAccessGitOperations.cs @@ -23,31 +23,6 @@ namespace Microsoft.Azure.Management.ApiManagement /// public partial interface ITenantAccessGitOperations { - /// - /// Gets the Git access configuration for the tenant. Without secrets. - /// - /// - /// 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> GetWithHttpMessagesAsync(string resourceGroupName, string serviceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Regenerate primary access key for GIT. /// @@ -57,6 +32,10 @@ public partial interface ITenantAccessGitOperations /// /// The name of the API Management service. /// + /// + /// The identifier of the Access configuration. Possible values + /// include: 'access', 'getAccess' + /// /// /// The headers that will be added to request. /// @@ -69,7 +48,7 @@ public partial interface ITenantAccessGitOperations /// /// Thrown when a required parameter is null /// - Task RegeneratePrimaryKeyWithHttpMessagesAsync(string resourceGroupName, string serviceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task RegeneratePrimaryKeyWithHttpMessagesAsync(string resourceGroupName, string serviceName, string accessName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Regenerate secondary access key for GIT. /// @@ -79,27 +58,9 @@ public partial interface ITenantAccessGitOperations /// /// 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 a required parameter is null - /// - Task RegenerateSecondaryKeyWithHttpMessagesAsync(string resourceGroupName, string serviceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets the Git access configuration for the tenant. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the API Management service. + /// + /// The identifier of the Access configuration. Possible values + /// include: 'access', 'getAccess' /// /// /// The headers that will be added to request. @@ -110,12 +71,9 @@ public partial interface ITenantAccessGitOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when unable to deserialize the response - /// /// /// Thrown when a required parameter is null /// - Task> ListSecretsWithHttpMessagesAsync(string resourceGroupName, string serviceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task RegenerateSecondaryKeyWithHttpMessagesAsync(string resourceGroupName, string serviceName, string accessName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } 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..91f97880b7136 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ITenantAccessOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ITenantAccessOperations.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; @@ -23,6 +24,34 @@ namespace Microsoft.Azure.Management.ApiManagement /// public partial interface ITenantAccessOperations { + /// + /// Returns list of access infos - for Git and Management endpoints. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// OData parameters to apply to the 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>> ListByServiceWithHttpMessagesAsync(string resourceGroupName, string serviceName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Tenant access metadata /// @@ -32,6 +61,10 @@ public partial interface ITenantAccessOperations /// /// The name of the API Management service. /// + /// + /// The identifier of the Access configuration. Possible values + /// include: 'access', 'getAccess' + /// /// /// The headers that will be added to request. /// @@ -44,7 +77,7 @@ public partial interface ITenantAccessOperations /// /// Thrown when a required parameter is null /// - Task> GetEntityTagWithHttpMessagesAsync(string resourceGroupName, string serviceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetEntityTagWithHttpMessagesAsync(string resourceGroupName, string serviceName, string accessName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get tenant access information details without secrets. /// @@ -54,6 +87,47 @@ public partial interface ITenantAccessOperations /// /// The name of the API Management service. /// + /// + /// The identifier of the Access configuration. Possible values + /// include: 'access', 'getAccess' + /// + /// + /// 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 accessName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update tenant access information details. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Parameters supplied to retrieve the Tenant Access Information. + /// + /// + /// The identifier of the Access configuration. Possible values + /// include: 'access', 'getAccess' + /// + /// + /// 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. /// @@ -69,7 +143,7 @@ public partial interface ITenantAccessOperations /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string serviceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateWithHttpMessagesAsync(string resourceGroupName, string serviceName, AccessInformationCreateParameters parameters, string accessName, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Update tenant access information details. /// @@ -82,6 +156,10 @@ public partial interface ITenantAccessOperations /// /// Parameters supplied to retrieve the Tenant Access Information. /// + /// + /// The identifier of the Access configuration. Possible values + /// include: 'access', 'getAccess' + /// /// /// ETag of the Entity. ETag should match the current entity state from /// the header response of the GET request or it should be * for @@ -96,10 +174,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 accessName, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Regenerate primary access key /// @@ -109,6 +190,10 @@ public partial interface ITenantAccessOperations /// /// The name of the API Management service. /// + /// + /// The identifier of the Access configuration. Possible values + /// include: 'access', 'getAccess' + /// /// /// The headers that will be added to request. /// @@ -121,7 +206,7 @@ public partial interface ITenantAccessOperations /// /// Thrown when a required parameter is null /// - Task RegeneratePrimaryKeyWithHttpMessagesAsync(string resourceGroupName, string serviceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task RegeneratePrimaryKeyWithHttpMessagesAsync(string resourceGroupName, string serviceName, string accessName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Regenerate secondary access key /// @@ -131,6 +216,10 @@ public partial interface ITenantAccessOperations /// /// The name of the API Management service. /// + /// + /// The identifier of the Access configuration. Possible values + /// include: 'access', 'getAccess' + /// /// /// The headers that will be added to request. /// @@ -143,7 +232,7 @@ public partial interface ITenantAccessOperations /// /// Thrown when a required parameter is null /// - Task RegenerateSecondaryKeyWithHttpMessagesAsync(string resourceGroupName, string serviceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task RegenerateSecondaryKeyWithHttpMessagesAsync(string resourceGroupName, string serviceName, string accessName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get tenant access information details. /// @@ -153,6 +242,32 @@ public partial interface ITenantAccessOperations /// /// The name of the API Management service. /// + /// + /// The identifier of the Access configuration. Possible values + /// include: 'access', 'getAccess' + /// + /// + /// 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> ListSecretsWithHttpMessagesAsync(string resourceGroupName, string serviceName, string accessName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns list of access infos - for Git and Management endpoints. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// /// /// The headers that will be added to request. /// @@ -168,6 +283,6 @@ public partial interface ITenantAccessOperations /// /// Thrown when a required parameter is null /// - Task> ListSecretsWithHttpMessagesAsync(string resourceGroupName, string serviceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByServiceNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ITenantConfigurationOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ITenantConfigurationOperations.cs index c1e53f53327e6..35ecfc4dae537 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ITenantConfigurationOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ITenantConfigurationOperations.cs @@ -131,7 +131,7 @@ public partial interface ITenantConfigurationOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ITenantSettingsOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ITenantSettingsOperations.cs new file mode 100644 index 0000000000000..a3509b567ca41 --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ITenantSettingsOperations.cs @@ -0,0 +1,103 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ApiManagement +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Azure.OData; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// TenantSettingsOperations operations. + /// + public partial interface ITenantSettingsOperations + { + /// + /// Public settings. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// OData parameters to apply to the 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>> ListByServiceWithHttpMessagesAsync(string resourceGroupName, string serviceName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get tenant settings. + /// + /// + /// 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> GetWithHttpMessagesAsync(string resourceGroupName, string serviceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Public settings. + /// + /// + /// 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/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/IUserSubscriptionOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IUserSubscriptionOperations.cs index 18ac0979009d4..0c34029c84e52 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IUserSubscriptionOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/IUserSubscriptionOperations.cs @@ -57,6 +57,40 @@ public partial interface IUserSubscriptionOperations /// Task>> ListWithHttpMessagesAsync(string resourceGroupName, string serviceName, string userId, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Gets the specified Subscription entity associated with a particular + /// user. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// User identifier. Must be unique in the current API Management + /// service instance. + /// + /// + /// Subscription entity Identifier. The entity represents the + /// association between a user and a product in API Management. + /// + /// + /// 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 userId, string sid, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Lists the collection of subscriptions of the specified user. /// /// 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/AccessIdName.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/AccessIdName.cs new file mode 100644 index 0000000000000..fec20c32a878f --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/AccessIdName.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ApiManagement.Models +{ + + /// + /// Defines values for AccessIdName. + /// + public static class AccessIdName + { + public const string Access = "access"; + public const string GetAccess = "getAccess"; + } +} diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/AccessInformationContract.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/AccessInformationContract.cs index 085f2cbb27600..9f7f5ad314b95 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/AccessInformationContract.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/AccessInformationContract.cs @@ -10,13 +10,16 @@ namespace Microsoft.Azure.Management.ApiManagement.Models { + using Microsoft.Rest; + using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Linq; /// - /// Tenant access information contract of the API Management service. + /// Tenant Settings. /// - public partial class AccessInformationContract + [Rest.Serialization.JsonTransformation] + public partial class AccessInformationContract : Resource { /// /// Initializes a new instance of the AccessInformationContract class. @@ -29,20 +32,20 @@ public AccessInformationContract() /// /// Initializes a new instance of the AccessInformationContract class. /// - /// Identifier. - /// Primary access key. This property will not - /// be filled on 'GET' operations! Use '/listSecrets' POST request to - /// get the value. - /// Secondary access key. 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 + /// resource. + /// Access Information type + /// ('access' or 'gitAccess') + /// Principal (User) Identifier. /// Determines whether direct access is /// enabled. - public AccessInformationContract(string id = default(string), string primaryKey = default(string), string secondaryKey = default(string), bool? enabled = default(bool?)) + public AccessInformationContract(string id = default(string), string name = default(string), string type = default(string), string accessInformationContractId = default(string), string principalId = default(string), bool? enabled = default(bool?)) + : base(id, name, type) { - Id = id; - PrimaryKey = primaryKey; - SecondaryKey = secondaryKey; + AccessInformationContractId = accessInformationContractId; + PrincipalId = principalId; Enabled = enabled; CustomInit(); } @@ -53,31 +56,21 @@ public AccessInformationContract() partial void CustomInit(); /// - /// Gets or sets identifier. + /// Gets or sets access Information type ('access' or 'gitAccess') /// - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } + [JsonProperty(PropertyName = "properties.id")] + public string AccessInformationContractId { get; set; } /// - /// Gets or sets primary access key. This property will not be filled - /// on 'GET' operations! Use '/listSecrets' POST request to get the - /// value. + /// Gets or sets principal (User) Identifier. /// - [JsonProperty(PropertyName = "primaryKey")] - public string PrimaryKey { get; set; } - - /// - /// Gets or sets secondary access key. This property will not be filled - /// on 'GET' operations! Use '/listSecrets' POST request to get the - /// value. - /// - [JsonProperty(PropertyName = "secondaryKey")] - public string SecondaryKey { get; set; } + [JsonProperty(PropertyName = "properties.principalId")] + public string PrincipalId { get; set; } /// /// Gets or sets determines whether direct access is enabled. /// - [JsonProperty(PropertyName = "enabled")] + [JsonProperty(PropertyName = "properties.enabled")] public bool? Enabled { get; set; } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/AccessInformationCreateParameters.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/AccessInformationCreateParameters.cs new file mode 100644 index 0000000000000..c315e92800337 --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/AccessInformationCreateParameters.cs @@ -0,0 +1,89 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ApiManagement.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Tenant access information update parameters. + /// + [Rest.Serialization.JsonTransformation] + public partial class AccessInformationCreateParameters + { + /// + /// Initializes a new instance of the AccessInformationCreateParameters + /// class. + /// + public AccessInformationCreateParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AccessInformationCreateParameters + /// class. + /// + /// Principal (User) Identifier. + /// Primary access key. This property will not + /// be filled on 'GET' operations! Use '/listSecrets' POST request to + /// get the value. + /// Secondary access key. This property will + /// not be filled on 'GET' operations! Use '/listSecrets' POST request + /// to get the value. + /// Determines whether direct access is + /// enabled. + public AccessInformationCreateParameters(string principalId = default(string), string primaryKey = default(string), string secondaryKey = default(string), bool? enabled = default(bool?)) + { + PrincipalId = principalId; + PrimaryKey = primaryKey; + SecondaryKey = secondaryKey; + Enabled = enabled; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets principal (User) Identifier. + /// + [JsonProperty(PropertyName = "properties.principalId")] + public string PrincipalId { get; set; } + + /// + /// Gets or sets primary access key. This property will not be filled + /// on 'GET' operations! Use '/listSecrets' POST request to get the + /// value. + /// + [JsonProperty(PropertyName = "properties.primaryKey")] + public string PrimaryKey { get; set; } + + /// + /// Gets or sets secondary access key. This property will not be filled + /// on 'GET' operations! Use '/listSecrets' POST request to get the + /// value. + /// + [JsonProperty(PropertyName = "properties.secondaryKey")] + public string SecondaryKey { get; set; } + + /// + /// Gets or sets determines whether direct access is enabled. + /// + [JsonProperty(PropertyName = "properties.enabled")] + public bool? Enabled { get; set; } + + } +} diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/AccessInformationSecretsContract.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/AccessInformationSecretsContract.cs new file mode 100644 index 0000000000000..bd12400ff6161 --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/AccessInformationSecretsContract.cs @@ -0,0 +1,95 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ApiManagement.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Tenant access information contract of the API Management service. + /// + public partial class AccessInformationSecretsContract + { + /// + /// Initializes a new instance of the AccessInformationSecretsContract + /// class. + /// + public AccessInformationSecretsContract() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AccessInformationSecretsContract + /// class. + /// + /// Access Information type ('access' or + /// 'gitAccess') + /// Principal (User) Identifier. + /// Primary access key. This property will not + /// be filled on 'GET' operations! Use '/listSecrets' POST request to + /// get the value. + /// Secondary access key. This property will + /// not be filled on 'GET' operations! Use '/listSecrets' POST request + /// to get the value. + /// Determines whether direct access is + /// enabled. + public AccessInformationSecretsContract(string id = default(string), string principalId = default(string), string primaryKey = default(string), string secondaryKey = default(string), bool? enabled = default(bool?)) + { + Id = id; + PrincipalId = principalId; + PrimaryKey = primaryKey; + SecondaryKey = secondaryKey; + Enabled = enabled; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets access Information type ('access' or 'gitAccess') + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + + /// + /// Gets or sets principal (User) Identifier. + /// + [JsonProperty(PropertyName = "principalId")] + public string PrincipalId { get; set; } + + /// + /// Gets or sets primary access key. This property will not be filled + /// on 'GET' operations! Use '/listSecrets' POST request to get the + /// value. + /// + [JsonProperty(PropertyName = "primaryKey")] + public string PrimaryKey { get; set; } + + /// + /// Gets or sets secondary access key. This property will not be filled + /// on 'GET' operations! Use '/listSecrets' POST request to get the + /// value. + /// + [JsonProperty(PropertyName = "secondaryKey")] + public string SecondaryKey { get; set; } + + /// + /// Gets or sets determines whether direct access is enabled. + /// + [JsonProperty(PropertyName = "enabled")] + public bool? Enabled { get; set; } + + } +} 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/ApiManagementSku.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiManagementSku.cs new file mode 100644 index 0000000000000..08ad9e086a764 --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiManagementSku.cs @@ -0,0 +1,165 @@ +// +// 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; + + /// + /// Describes an available ApiManagement SKU. + /// + public partial class ApiManagementSku + { + /// + /// Initializes a new instance of the ApiManagementSku class. + /// + public ApiManagementSku() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ApiManagementSku class. + /// + /// The type of resource the SKU applies + /// to. + /// The name of SKU. + /// Specifies the tier of virtual machines in a + /// scale set.<br /><br /> Possible Values:<br + /// /><br /> **Standard**<br /><br /> + /// **Basic** + /// The Size of the SKU. + /// The Family of this particular SKU. + /// The Kind of resources that are supported in this + /// SKU. + /// Specifies the number of virtual machines in + /// the scale set. + /// The set of locations that the SKU is + /// available. + /// A list of locations and availability + /// zones in those locations where the SKU is available. + /// The api versions that support this + /// SKU. + /// Metadata for retrieving price info. + /// A name value pair to describe the + /// capability. + /// The restrictions because of which SKU + /// cannot be used. This is empty if there are no restrictions. + public ApiManagementSku(string resourceType = default(string), string name = default(string), string tier = default(string), string size = default(string), string family = default(string), string kind = default(string), ApiManagementSkuCapacity capacity = default(ApiManagementSkuCapacity), IList locations = default(IList), IList locationInfo = default(IList), IList apiVersions = default(IList), IList costs = default(IList), IList capabilities = default(IList), IList restrictions = default(IList)) + { + ResourceType = resourceType; + Name = name; + Tier = tier; + Size = size; + Family = family; + Kind = kind; + Capacity = capacity; + Locations = locations; + LocationInfo = locationInfo; + ApiVersions = apiVersions; + Costs = costs; + Capabilities = capabilities; + Restrictions = restrictions; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the type of resource the SKU applies to. + /// + [JsonProperty(PropertyName = "resourceType")] + public string ResourceType { get; private set; } + + /// + /// Gets the name of SKU. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets specifies the tier of virtual machines in a scale + /// set.&lt;br /&gt;&lt;br /&gt; Possible + /// Values:&lt;br /&gt;&lt;br /&gt; + /// **Standard**&lt;br /&gt;&lt;br /&gt; **Basic** + /// + [JsonProperty(PropertyName = "tier")] + public string Tier { get; private set; } + + /// + /// Gets the Size of the SKU. + /// + [JsonProperty(PropertyName = "size")] + public string Size { get; private set; } + + /// + /// Gets the Family of this particular SKU. + /// + [JsonProperty(PropertyName = "family")] + public string Family { get; private set; } + + /// + /// Gets the Kind of resources that are supported in this SKU. + /// + [JsonProperty(PropertyName = "kind")] + public string Kind { get; private set; } + + /// + /// Gets specifies the number of virtual machines in the scale set. + /// + [JsonProperty(PropertyName = "capacity")] + public ApiManagementSkuCapacity Capacity { get; private set; } + + /// + /// Gets the set of locations that the SKU is available. + /// + [JsonProperty(PropertyName = "locations")] + public IList Locations { get; private set; } + + /// + /// Gets a list of locations and availability zones in those locations + /// where the SKU is available. + /// + [JsonProperty(PropertyName = "locationInfo")] + public IList LocationInfo { get; private set; } + + /// + /// Gets the api versions that support this SKU. + /// + [JsonProperty(PropertyName = "apiVersions")] + public IList ApiVersions { get; private set; } + + /// + /// Gets metadata for retrieving price info. + /// + [JsonProperty(PropertyName = "costs")] + public IList Costs { get; private set; } + + /// + /// Gets a name value pair to describe the capability. + /// + [JsonProperty(PropertyName = "capabilities")] + public IList Capabilities { get; private set; } + + /// + /// Gets the restrictions because of which SKU cannot be used. This is + /// empty if there are no restrictions. + /// + [JsonProperty(PropertyName = "restrictions")] + public IList Restrictions { get; private set; } + + } +} diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiManagementSkuCapabilities.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiManagementSkuCapabilities.cs new file mode 100644 index 0000000000000..7e42894aeb44c --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiManagementSkuCapabilities.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ApiManagement.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Describes The SKU capabilities object. + /// + public partial class ApiManagementSkuCapabilities + { + /// + /// Initializes a new instance of the ApiManagementSkuCapabilities + /// class. + /// + public ApiManagementSkuCapabilities() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ApiManagementSkuCapabilities + /// class. + /// + /// An invariant to describe the feature. + /// An invariant if the feature is measured by + /// quantity. + public ApiManagementSkuCapabilities(string name = default(string), string value = default(string)) + { + Name = name; + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets an invariant to describe the feature. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets an invariant if the feature is measured by quantity. + /// + [JsonProperty(PropertyName = "value")] + public string Value { get; private set; } + + } +} diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiManagementSkuCapacity.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiManagementSkuCapacity.cs new file mode 100644 index 0000000000000..85267e86b4da4 --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiManagementSkuCapacity.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; + + /// + /// Describes scaling information of a SKU. + /// + public partial class ApiManagementSkuCapacity + { + /// + /// Initializes a new instance of the ApiManagementSkuCapacity class. + /// + public ApiManagementSkuCapacity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ApiManagementSkuCapacity class. + /// + /// The minimum capacity. + /// The maximum capacity that can be set. + /// The default capacity. + /// The scale type applicable to the sku. + /// Possible values include: 'Automatic', 'Manual', 'None' + public ApiManagementSkuCapacity(int? minimum = default(int?), int? maximum = default(int?), int? defaultProperty = default(int?), ApiManagementSkuCapacityScaleType? scaleType = default(ApiManagementSkuCapacityScaleType?)) + { + Minimum = minimum; + Maximum = maximum; + DefaultProperty = defaultProperty; + ScaleType = scaleType; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the minimum capacity. + /// + [JsonProperty(PropertyName = "minimum")] + public int? Minimum { get; private set; } + + /// + /// Gets the maximum capacity that can be set. + /// + [JsonProperty(PropertyName = "maximum")] + public int? Maximum { get; private set; } + + /// + /// Gets the default capacity. + /// + [JsonProperty(PropertyName = "default")] + public int? DefaultProperty { get; private set; } + + /// + /// Gets the scale type applicable to the sku. Possible values include: + /// 'Automatic', 'Manual', 'None' + /// + [JsonProperty(PropertyName = "scaleType")] + public ApiManagementSkuCapacityScaleType? ScaleType { get; private set; } + + } +} diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiManagementSkuCapacityScaleType.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiManagementSkuCapacityScaleType.cs new file mode 100644 index 0000000000000..fcfff418b9875 --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiManagementSkuCapacityScaleType.cs @@ -0,0 +1,66 @@ +// +// 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 Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for ApiManagementSkuCapacityScaleType. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ApiManagementSkuCapacityScaleType + { + [EnumMember(Value = "Automatic")] + Automatic, + [EnumMember(Value = "Manual")] + Manual, + [EnumMember(Value = "None")] + None + } + internal static class ApiManagementSkuCapacityScaleTypeEnumExtension + { + internal static string ToSerializedValue(this ApiManagementSkuCapacityScaleType? value) + { + return value == null ? null : ((ApiManagementSkuCapacityScaleType)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this ApiManagementSkuCapacityScaleType value) + { + switch( value ) + { + case ApiManagementSkuCapacityScaleType.Automatic: + return "Automatic"; + case ApiManagementSkuCapacityScaleType.Manual: + return "Manual"; + case ApiManagementSkuCapacityScaleType.None: + return "None"; + } + return null; + } + + internal static ApiManagementSkuCapacityScaleType? ParseApiManagementSkuCapacityScaleType(this string value) + { + switch( value ) + { + case "Automatic": + return ApiManagementSkuCapacityScaleType.Automatic; + case "Manual": + return ApiManagementSkuCapacityScaleType.Manual; + case "None": + return ApiManagementSkuCapacityScaleType.None; + } + return null; + } + } +} diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiManagementSkuCosts.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiManagementSkuCosts.cs new file mode 100644 index 0000000000000..b01f4d6bf17de --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiManagementSkuCosts.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; + + /// + /// Describes metadata for retrieving price info. + /// + public partial class ApiManagementSkuCosts + { + /// + /// Initializes a new instance of the ApiManagementSkuCosts class. + /// + public ApiManagementSkuCosts() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ApiManagementSkuCosts class. + /// + /// Used for querying price from + /// commerce. + /// The multiplier is needed to extend the base + /// metered cost. + /// An invariant to show the extended + /// unit. + public ApiManagementSkuCosts(string meterID = default(string), long? quantity = default(long?), string extendedUnit = default(string)) + { + MeterID = meterID; + Quantity = quantity; + ExtendedUnit = extendedUnit; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets used for querying price from commerce. + /// + [JsonProperty(PropertyName = "meterID")] + public string MeterID { get; private set; } + + /// + /// Gets the multiplier is needed to extend the base metered cost. + /// + [JsonProperty(PropertyName = "quantity")] + public long? Quantity { get; private set; } + + /// + /// Gets an invariant to show the extended unit. + /// + [JsonProperty(PropertyName = "extendedUnit")] + public string ExtendedUnit { get; private set; } + + } +} diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiManagementSkuLocationInfo.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiManagementSkuLocationInfo.cs new file mode 100644 index 0000000000000..8af8d99e67c61 --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiManagementSkuLocationInfo.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.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class ApiManagementSkuLocationInfo + { + /// + /// Initializes a new instance of the ApiManagementSkuLocationInfo + /// class. + /// + public ApiManagementSkuLocationInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ApiManagementSkuLocationInfo + /// class. + /// + /// Location of the SKU + /// List of availability zones where the SKU is + /// supported. + /// Details of capabilities available to a + /// SKU in specific zones. + public ApiManagementSkuLocationInfo(string location = default(string), IList zones = default(IList), IList zoneDetails = default(IList)) + { + Location = location; + Zones = zones; + ZoneDetails = zoneDetails; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets location of the SKU + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; private set; } + + /// + /// Gets list of availability zones where the SKU is supported. + /// + [JsonProperty(PropertyName = "zones")] + public IList Zones { get; private set; } + + /// + /// Gets details of capabilities available to a SKU in specific zones. + /// + [JsonProperty(PropertyName = "zoneDetails")] + public IList ZoneDetails { get; private set; } + + } +} diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiManagementSkuRestrictionInfo.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiManagementSkuRestrictionInfo.cs new file mode 100644 index 0000000000000..c057f6dbaabfb --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiManagementSkuRestrictionInfo.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ApiManagement.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + public partial class ApiManagementSkuRestrictionInfo + { + /// + /// Initializes a new instance of the ApiManagementSkuRestrictionInfo + /// class. + /// + public ApiManagementSkuRestrictionInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ApiManagementSkuRestrictionInfo + /// class. + /// + /// Locations where the SKU is + /// restricted + /// List of availability zones where the SKU is + /// restricted. + public ApiManagementSkuRestrictionInfo(IList locations = default(IList), IList zones = default(IList)) + { + Locations = locations; + Zones = zones; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets locations where the SKU is restricted + /// + [JsonProperty(PropertyName = "locations")] + public IList Locations { get; private set; } + + /// + /// Gets list of availability zones where the SKU is restricted. + /// + [JsonProperty(PropertyName = "zones")] + public IList Zones { get; private set; } + + } +} diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiManagementSkuRestrictions.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiManagementSkuRestrictions.cs new file mode 100644 index 0000000000000..5afe6908fd8f6 --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiManagementSkuRestrictions.cs @@ -0,0 +1,89 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ApiManagement.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes scaling information of a SKU. + /// + public partial class ApiManagementSkuRestrictions + { + /// + /// Initializes a new instance of the ApiManagementSkuRestrictions + /// class. + /// + public ApiManagementSkuRestrictions() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ApiManagementSkuRestrictions + /// class. + /// + /// The type of restrictions. Possible values + /// include: 'Location', 'Zone' + /// The value of restrictions. If the restriction + /// type is set to location. This would be different locations where + /// the SKU is restricted. + /// The information about the restriction + /// where the SKU cannot be used. + /// The reason for restriction. Possible + /// values include: 'QuotaId', 'NotAvailableForSubscription' + public ApiManagementSkuRestrictions(ApiManagementSkuRestrictionsType? type = default(ApiManagementSkuRestrictionsType?), IList values = default(IList), ApiManagementSkuRestrictionInfo restrictionInfo = default(ApiManagementSkuRestrictionInfo), ApiManagementSkuRestrictionsReasonCode? reasonCode = default(ApiManagementSkuRestrictionsReasonCode?)) + { + Type = type; + Values = values; + RestrictionInfo = restrictionInfo; + ReasonCode = reasonCode; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the type of restrictions. Possible values include: 'Location', + /// 'Zone' + /// + [JsonProperty(PropertyName = "type")] + public ApiManagementSkuRestrictionsType? Type { get; private set; } + + /// + /// Gets the value of restrictions. If the restriction type is set to + /// location. This would be different locations where the SKU is + /// restricted. + /// + [JsonProperty(PropertyName = "values")] + public IList Values { get; private set; } + + /// + /// Gets the information about the restriction where the SKU cannot be + /// used. + /// + [JsonProperty(PropertyName = "restrictionInfo")] + public ApiManagementSkuRestrictionInfo RestrictionInfo { get; private set; } + + /// + /// Gets the reason for restriction. Possible values include: + /// 'QuotaId', 'NotAvailableForSubscription' + /// + [JsonProperty(PropertyName = "reasonCode")] + public ApiManagementSkuRestrictionsReasonCode? ReasonCode { get; private set; } + + } +} diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiManagementSkuRestrictionsReasonCode.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiManagementSkuRestrictionsReasonCode.cs new file mode 100644 index 0000000000000..76ff8503694d7 --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiManagementSkuRestrictionsReasonCode.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 Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for ApiManagementSkuRestrictionsReasonCode. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ApiManagementSkuRestrictionsReasonCode + { + [EnumMember(Value = "QuotaId")] + QuotaId, + [EnumMember(Value = "NotAvailableForSubscription")] + NotAvailableForSubscription + } + internal static class ApiManagementSkuRestrictionsReasonCodeEnumExtension + { + internal static string ToSerializedValue(this ApiManagementSkuRestrictionsReasonCode? value) + { + return value == null ? null : ((ApiManagementSkuRestrictionsReasonCode)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this ApiManagementSkuRestrictionsReasonCode value) + { + switch( value ) + { + case ApiManagementSkuRestrictionsReasonCode.QuotaId: + return "QuotaId"; + case ApiManagementSkuRestrictionsReasonCode.NotAvailableForSubscription: + return "NotAvailableForSubscription"; + } + return null; + } + + internal static ApiManagementSkuRestrictionsReasonCode? ParseApiManagementSkuRestrictionsReasonCode(this string value) + { + switch( value ) + { + case "QuotaId": + return ApiManagementSkuRestrictionsReasonCode.QuotaId; + case "NotAvailableForSubscription": + return ApiManagementSkuRestrictionsReasonCode.NotAvailableForSubscription; + } + return null; + } + } +} diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiManagementSkuRestrictionsType.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiManagementSkuRestrictionsType.cs new file mode 100644 index 0000000000000..8b89f75b60111 --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiManagementSkuRestrictionsType.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 Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for ApiManagementSkuRestrictionsType. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ApiManagementSkuRestrictionsType + { + [EnumMember(Value = "Location")] + Location, + [EnumMember(Value = "Zone")] + Zone + } + internal static class ApiManagementSkuRestrictionsTypeEnumExtension + { + internal static string ToSerializedValue(this ApiManagementSkuRestrictionsType? value) + { + return value == null ? null : ((ApiManagementSkuRestrictionsType)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this ApiManagementSkuRestrictionsType value) + { + switch( value ) + { + case ApiManagementSkuRestrictionsType.Location: + return "Location"; + case ApiManagementSkuRestrictionsType.Zone: + return "Zone"; + } + return null; + } + + internal static ApiManagementSkuRestrictionsType? ParseApiManagementSkuRestrictionsType(this string value) + { + switch( value ) + { + case "Location": + return ApiManagementSkuRestrictionsType.Location; + case "Zone": + return ApiManagementSkuRestrictionsType.Zone; + } + return null; + } + } +} diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiManagementSkuZoneDetails.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiManagementSkuZoneDetails.cs new file mode 100644 index 0000000000000..f354d94ce0861 --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ApiManagementSkuZoneDetails.cs @@ -0,0 +1,67 @@ +// +// 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; + + /// + /// Describes The zonal capabilities of a SKU. + /// + public partial class ApiManagementSkuZoneDetails + { + /// + /// Initializes a new instance of the ApiManagementSkuZoneDetails + /// class. + /// + public ApiManagementSkuZoneDetails() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ApiManagementSkuZoneDetails + /// class. + /// + /// The set of zones that the SKU is available in + /// with the specified capabilities. + /// A list of capabilities that are + /// available for the SKU in the specified list of zones. + public ApiManagementSkuZoneDetails(IList name = default(IList), IList capabilities = default(IList)) + { + Name = name; + Capabilities = capabilities; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the set of zones that the SKU is available in with the + /// specified capabilities. + /// + [JsonProperty(PropertyName = "name")] + public IList Name { get; private set; } + + /// + /// Gets a list of capabilities that are available for the SKU in the + /// specified list of zones. + /// + [JsonProperty(PropertyName = "capabilities")] + public IList Capabilities { get; private set; } + + } +} 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..033637bf641a7 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; @@ -31,14 +32,17 @@ public BackendCredentialsContract() /// /// Initializes a new instance of the BackendCredentialsContract class. /// - /// List of Client Certificate - /// Thumbprint. + /// List of Client Certificate + /// Ids. + /// List of Client Certificate Thumbprints. + /// Will be ignored if certificatesIds are provided. /// Query Parameter description. /// Header Parameter description. /// Authorization header /// authentication - public BackendCredentialsContract(IList certificate = default(IList), IDictionary> query = default(IDictionary>), IDictionary> header = default(IDictionary>), BackendAuthorizationHeaderCredentials authorization = default(BackendAuthorizationHeaderCredentials)) + public BackendCredentialsContract(IList certificateIds = default(IList), IList certificate = default(IList), IDictionary> query = default(IDictionary>), IDictionary> header = default(IDictionary>), BackendAuthorizationHeaderCredentials authorization = default(BackendAuthorizationHeaderCredentials)) { + CertificateIds = certificateIds; Certificate = certificate; Query = query; Header = header; @@ -52,7 +56,14 @@ public BackendCredentialsContract() partial void CustomInit(); /// - /// Gets or sets list of Client Certificate Thumbprint. + /// Gets or sets list of Client Certificate Ids. + /// + [JsonProperty(PropertyName = "certificateIds")] + public IList CertificateIds { get; set; } + + /// + /// Gets or sets list of Client Certificate Thumbprints. Will be + /// ignored if certificatesIds are provided. /// [JsonProperty(PropertyName = "certificate")] public IList Certificate { get; set; } @@ -78,11 +89,25 @@ public BackendCredentialsContract() /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() { + if (CertificateIds != null) + { + if (CertificateIds.Count > 32) + { + throw new ValidationException(ValidationRules.MaxItems, "CertificateIds", 32); + } + } + 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/BackendServiceFabricClusterProperties.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/BackendServiceFabricClusterProperties.cs index a4180b0d10e9e..de3c2bf74e8d3 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/BackendServiceFabricClusterProperties.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/BackendServiceFabricClusterProperties.cs @@ -34,10 +34,13 @@ public BackendServiceFabricClusterProperties() /// Initializes a new instance of the /// BackendServiceFabricClusterProperties class. /// - /// The client certificate - /// thumbprint for the management endpoint. /// The cluster management /// endpoint. + /// The client certificate id for the + /// management endpoint. + /// The client certificate + /// thumbprint for the management endpoint. Will be ignored if + /// certificatesIds are provided /// Maximum number of /// retries while attempting resolve the partition. /// Thumbprints of @@ -45,8 +48,9 @@ public BackendServiceFabricClusterProperties() /// communication /// Server X509 Certificate Names /// Collection - public BackendServiceFabricClusterProperties(string clientCertificatethumbprint, IList managementEndpoints, int? maxPartitionResolutionRetries = default(int?), IList serverCertificateThumbprints = default(IList), IList serverX509Names = default(IList)) + public BackendServiceFabricClusterProperties(IList managementEndpoints, string clientCertificateId = default(string), string clientCertificatethumbprint = default(string), int? maxPartitionResolutionRetries = default(int?), IList serverCertificateThumbprints = default(IList), IList serverX509Names = default(IList)) { + ClientCertificateId = clientCertificateId; ClientCertificatethumbprint = clientCertificatethumbprint; MaxPartitionResolutionRetries = maxPartitionResolutionRetries; ManagementEndpoints = managementEndpoints; @@ -60,9 +64,15 @@ public BackendServiceFabricClusterProperties() /// partial void CustomInit(); + /// + /// Gets or sets the client certificate id for the management endpoint. + /// + [JsonProperty(PropertyName = "clientCertificateId")] + public string ClientCertificateId { get; set; } + /// /// Gets or sets the client certificate thumbprint for the management - /// endpoint. + /// endpoint. Will be ignored if certificatesIds are provided /// [JsonProperty(PropertyName = "clientCertificatethumbprint")] public string ClientCertificatethumbprint { get; set; } @@ -101,10 +111,6 @@ public BackendServiceFabricClusterProperties() /// public virtual void Validate() { - if (ClientCertificatethumbprint == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ClientCertificatethumbprint"); - } if (ManagementEndpoints == null) { throw new ValidationException(ValidationRules.CannotBeNull, "ManagementEndpoints"); 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/CertificateRefreshSecretHeaders.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/CertificateRefreshSecretHeaders.cs new file mode 100644 index 0000000000000..1530d0dc3ad1e --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/CertificateRefreshSecretHeaders.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 RefreshSecret operation. + /// + public partial class CertificateRefreshSecretHeaders + { + /// + /// Initializes a new instance of the CertificateRefreshSecretHeaders + /// class. + /// + public CertificateRefreshSecretHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CertificateRefreshSecretHeaders + /// class. + /// + /// Current entity state version. Should be treated + /// as opaque and used to make conditional HTTP requests. + public CertificateRefreshSecretHeaders(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/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/ContentFormat.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ContentFormat.cs index 0ee9899e6de5a..12f48c4c9ba75 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ContentFormat.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ContentFormat.cs @@ -26,11 +26,12 @@ public static class ContentFormat /// public const string WadlLinkJson = "wadl-link-json"; /// - /// The contents are inline and Content Type is a OpenApi 2.0 Document. + /// The contents are inline and Content Type is a OpenAPI 2.0 JSON + /// Document. /// public const string SwaggerJson = "swagger-json"; /// - /// The Open Api 2.0 document is hosted on a publicly accessible + /// The OpenAPI 2.0 JSON document is hosted on a publicly accessible /// internet address. /// public const string SwaggerLinkJson = "swagger-link-json"; @@ -44,22 +45,22 @@ public static class ContentFormat /// public const string WsdlLink = "wsdl-link"; /// - /// The contents are inline and Content Type is a OpenApi 3.0 Document - /// in YAML format. + /// The contents are inline and Content Type is a OpenAPI 3.0 YAML + /// Document. /// public const string Openapi = "openapi"; /// - /// The contents are inline and Content Type is a OpenApi 3.0 Document - /// in JSON format. + /// The contents are inline and Content Type is a OpenAPI 3.0 JSON + /// Document. /// public const string Openapijson = "openapi+json"; /// - /// The Open Api 3.0 document is hosted on a publicly accessible + /// The OpenAPI 3.0 YAML document is hosted on a publicly accessible /// internet address. /// public const string OpenapiLink = "openapi-link"; /// - /// The Open Api 3.0 Json document is hosted on a publicly accessible + /// The OpenAPI 3.0 JSON document is hosted on a publicly accessible /// internet address. /// public const string OpenapijsonLink = "openapi+json-link"; 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/TenantAccessGitGetHeaders.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ContentItemGetHeaders.cs similarity index 80% rename from sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/TenantAccessGitGetHeaders.cs rename to sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ContentItemGetHeaders.cs index ba195019d71d6..8cf2c8d9ee6b1 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/TenantAccessGitGetHeaders.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ContentItemGetHeaders.cs @@ -16,22 +16,22 @@ namespace Microsoft.Azure.Management.ApiManagement.Models /// /// Defines headers for Get operation. /// - public partial class TenantAccessGitGetHeaders + public partial class ContentItemGetHeaders { /// - /// Initializes a new instance of the TenantAccessGitGetHeaders class. + /// Initializes a new instance of the ContentItemGetHeaders class. /// - public TenantAccessGitGetHeaders() + public ContentItemGetHeaders() { CustomInit(); } /// - /// Initializes a new instance of the TenantAccessGitGetHeaders class. + /// 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 TenantAccessGitGetHeaders(string eTag = default(string)) + public ContentItemGetHeaders(string eTag = default(string)) { ETag = eTag; CustomInit(); 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/ExportFormat.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ExportFormat.cs index e807228371b38..1bf9853e85ea1 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ExportFormat.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/ExportFormat.cs @@ -17,8 +17,8 @@ namespace Microsoft.Azure.Management.ApiManagement.Models public static class ExportFormat { /// - /// Export the Api Definition in OpenApi Specification 2.0 format to - /// the Storage Blob. + /// Export the Api Definition in OpenAPI 2.0 Specification as JSON + /// document to the Storage Blob. /// public const string Swagger = "swagger-link"; /// @@ -31,12 +31,12 @@ public static class ExportFormat /// public const string Wadl = "wadl-link"; /// - /// Export the Api Definition in OpenApi Specification 3.0 to Storage - /// Blob. + /// Export the Api Definition in OpenAPI 3.0 Specification as YAML + /// document to Storage Blob. /// public const string Openapi = "openapi-link"; /// - /// Export the Api Definition in OpenApi Specification 3.0 as JSON + /// Export the Api Definition in OpenAPI 3.0 Specification as JSON /// document to Storage Blob. /// public const string OpenapiJson = "openapi+json-link"; 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/NamedValueRefreshSecretHeaders.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/NamedValueRefreshSecretHeaders.cs new file mode 100644 index 0000000000000..e558eea7eebf8 --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/NamedValueRefreshSecretHeaders.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 RefreshSecret operation. + /// + public partial class NamedValueRefreshSecretHeaders + { + /// + /// Initializes a new instance of the NamedValueRefreshSecretHeaders + /// class. + /// + public NamedValueRefreshSecretHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NamedValueRefreshSecretHeaders + /// class. + /// + /// Current entity state version. Should be treated + /// as opaque and used to make conditional HTTP requests. + public NamedValueRefreshSecretHeaders(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/PropertyValueContract.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/NamedValueSecretContract.cs similarity index 80% rename from sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/PropertyValueContract.cs rename to sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/NamedValueSecretContract.cs index 56186ab6403bc..42c9565d846bf 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/PropertyValueContract.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/NamedValueSecretContract.cs @@ -16,22 +16,22 @@ namespace Microsoft.Azure.Management.ApiManagement.Models /// /// Client or app secret used in IdentityProviders, Aad, OpenID or OAuth. /// - public partial class PropertyValueContract + public partial class NamedValueSecretContract { /// - /// Initializes a new instance of the PropertyValueContract class. + /// Initializes a new instance of the NamedValueSecretContract class. /// - public PropertyValueContract() + public NamedValueSecretContract() { CustomInit(); } /// - /// Initializes a new instance of the PropertyValueContract class. + /// Initializes a new instance of the NamedValueSecretContract class. /// /// This is secret value of the NamedValue /// entity. - public PropertyValueContract(string value = default(string)) + public NamedValueSecretContract(string value = default(string)) { Value = value; CustomInit(); 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/PolicyCollection.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/PolicyCollection.cs index e06dd4a260381..4a3085eb869cc 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/PolicyCollection.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/PolicyCollection.cs @@ -32,10 +32,12 @@ public PolicyCollection() /// Initializes a new instance of the PolicyCollection class. /// /// Policy Contract value. + /// Total record count number. /// Next page link if any. - public PolicyCollection(IList value = default(IList), string nextLink = default(string)) + public PolicyCollection(IList value = default(IList), long? count = default(long?), string nextLink = default(string)) { Value = value; + Count = count; NextLink = nextLink; CustomInit(); } @@ -51,6 +53,12 @@ public PolicyCollection() [JsonProperty(PropertyName = "value")] public IList Value { get; set; } + /// + /// Gets or sets total record count number. + /// + [JsonProperty(PropertyName = "count")] + public long? Count { get; set; } + /// /// Gets or sets next page link if any. /// diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/PolicyDescriptionContract.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/PolicyDescriptionContract.cs index 2682af2f01f56..cd95d77a425af 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/PolicyDescriptionContract.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/PolicyDescriptionContract.cs @@ -38,7 +38,7 @@ public PolicyDescriptionContract() /// resource. /// Policy description. /// Binary OR value of the Snippet scope. - public PolicyDescriptionContract(string id = default(string), string name = default(string), string type = default(string), string description = default(string), int? scope = default(int?)) + public PolicyDescriptionContract(string id = default(string), string name = default(string), string type = default(string), string description = default(string), long? scope = default(long?)) : base(id, name, type) { Description = description; @@ -61,7 +61,7 @@ public PolicyDescriptionContract() /// Gets binary OR value of the Snippet scope. /// [JsonProperty(PropertyName = "properties.scope")] - public int? Scope { get; private set; } + public long? Scope { get; private set; } } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/PortalRevisionContract.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/PortalRevisionContract.cs new file mode 100644 index 0000000000000..5997b9f7f07f5 --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/PortalRevisionContract.cs @@ -0,0 +1,128 @@ +// +// 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; + + /// + /// Portal revisions contract details. + /// + [Rest.Serialization.JsonTransformation] + public partial class PortalRevisionContract : Resource + { + /// + /// Initializes a new instance of the PortalRevisionContract class. + /// + public PortalRevisionContract() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PortalRevisionContract class. + /// + /// Resource ID. + /// Resource name. + /// Resource type for API Management + /// resource. + /// Portal revision description. + /// Portal revision publishing status + /// details. + /// Portal revision publishing status. Possible + /// values include: 'pending', 'publishing', 'completed', + /// 'failed' + /// Indicates if the Portal Revision is + /// public. + /// Portal revision creation date and + /// time. + /// Last updated date and time. + public PortalRevisionContract(string id = default(string), string name = default(string), string type = default(string), string description = default(string), string statusDetails = default(string), string status = default(string), bool? isCurrent = default(bool?), System.DateTime? createdDateTime = default(System.DateTime?), System.DateTime? updatedDateTime = default(System.DateTime?)) + : base(id, name, type) + { + Description = description; + StatusDetails = statusDetails; + Status = status; + IsCurrent = isCurrent; + CreatedDateTime = createdDateTime; + UpdatedDateTime = updatedDateTime; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets portal revision description. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; set; } + + /// + /// Gets portal revision publishing status details. + /// + [JsonProperty(PropertyName = "properties.statusDetails")] + public string StatusDetails { get; private set; } + + /// + /// Gets portal revision publishing status. Possible values include: + /// 'pending', 'publishing', 'completed', 'failed' + /// + [JsonProperty(PropertyName = "properties.status")] + public string Status { get; private set; } + + /// + /// Gets or sets indicates if the Portal Revision is public. + /// + [JsonProperty(PropertyName = "properties.isCurrent")] + public bool? IsCurrent { get; set; } + + /// + /// Gets portal revision creation date and time. + /// + [JsonProperty(PropertyName = "properties.createdDateTime")] + public System.DateTime? CreatedDateTime { get; private set; } + + /// + /// Gets last updated date and time. + /// + [JsonProperty(PropertyName = "properties.updatedDateTime")] + public System.DateTime? UpdatedDateTime { get; private 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 (StatusDetails != null) + { + if (StatusDetails.Length > 2000) + { + throw new ValidationException(ValidationRules.MaxLength, "StatusDetails", 2000); + } + } + } + } +} diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/PortalRevisionCreateOrUpdateHeaders.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/PortalRevisionCreateOrUpdateHeaders.cs new file mode 100644 index 0000000000000..1717b337b3aea --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/PortalRevisionCreateOrUpdateHeaders.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 PortalRevisionCreateOrUpdateHeaders + { + /// + /// Initializes a new instance of the + /// PortalRevisionCreateOrUpdateHeaders class. + /// + public PortalRevisionCreateOrUpdateHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// PortalRevisionCreateOrUpdateHeaders class. + /// + /// Current entity state version. Should be treated + /// as opaque and used to make conditional HTTP requests. + public PortalRevisionCreateOrUpdateHeaders(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/PortalRevisionGetEntityTagHeaders.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/PortalRevisionGetEntityTagHeaders.cs new file mode 100644 index 0000000000000..4aede2ff00703 --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/PortalRevisionGetEntityTagHeaders.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 PortalRevisionGetEntityTagHeaders + { + /// + /// Initializes a new instance of the PortalRevisionGetEntityTagHeaders + /// class. + /// + public PortalRevisionGetEntityTagHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PortalRevisionGetEntityTagHeaders + /// class. + /// + /// Current entity state version. Should be treated + /// as opaque and used to make conditional HTTP requests. + public PortalRevisionGetEntityTagHeaders(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/PortalRevisionGetHeaders.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/PortalRevisionGetHeaders.cs new file mode 100644 index 0000000000000..00b9c0aa1a271 --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/PortalRevisionGetHeaders.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 PortalRevisionGetHeaders + { + /// + /// Initializes a new instance of the PortalRevisionGetHeaders class. + /// + public PortalRevisionGetHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PortalRevisionGetHeaders class. + /// + /// Current entity state version. Should be treated + /// as opaque and used to make conditional HTTP requests. + public PortalRevisionGetHeaders(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/PortalRevisionStatus.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/PortalRevisionStatus.cs new file mode 100644 index 0000000000000..fb095551b2e1b --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/PortalRevisionStatus.cs @@ -0,0 +1,36 @@ +// +// 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 PortalRevisionStatus. + /// + public static class PortalRevisionStatus + { + /// + /// Portal revision publishing is pending + /// + public const string Pending = "pending"; + /// + /// Portal revision is publishing + /// + public const string Publishing = "publishing"; + /// + /// Portal revision publishing completed + /// + public const string Completed = "completed"; + /// + /// Portal revision publishing failed + /// + public const string Failed = "failed"; + } +} diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/PortalRevisionUpdateHeaders.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/PortalRevisionUpdateHeaders.cs new file mode 100644 index 0000000000000..23d36192141d1 --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/PortalRevisionUpdateHeaders.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 PortalRevisionUpdateHeaders + { + /// + /// Initializes a new instance of the PortalRevisionUpdateHeaders + /// class. + /// + public PortalRevisionUpdateHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PortalRevisionUpdateHeaders + /// class. + /// + /// Current entity state version. Should be treated + /// as opaque and used to make conditional HTTP requests. + public PortalRevisionUpdateHeaders(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/PortalSettingsCollection.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/PortalSettingsCollection.cs new file mode 100644 index 0000000000000..aa77273a87981 --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/PortalSettingsCollection.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.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Descriptions of APIM policies. + /// + public partial class PortalSettingsCollection + { + /// + /// Initializes a new instance of the PortalSettingsCollection class. + /// + public PortalSettingsCollection() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PortalSettingsCollection class. + /// + /// Descriptions of APIM policies. + /// Total record count number. + public PortalSettingsCollection(IList value = default(IList), long? count = default(long?)) + { + Value = value; + Count = count; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets descriptions of APIM policies. + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } + + /// + /// Gets or sets total record count number. + /// + [JsonProperty(PropertyName = "count")] + public long? Count { get; set; } + + } +} diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/PortalSettingsContract.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/PortalSettingsContract.cs new file mode 100644 index 0000000000000..9b1b75b1a1a62 --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/PortalSettingsContract.cs @@ -0,0 +1,106 @@ +// +// 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; + + /// + /// Portal Settings for the Developer Portal. + /// + [Rest.Serialization.JsonTransformation] + public partial class PortalSettingsContract : Resource + { + /// + /// Initializes a new instance of the PortalSettingsContract class. + /// + public PortalSettingsContract() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PortalSettingsContract class. + /// + /// Resource ID. + /// Resource name. + /// Resource type for API Management + /// resource. + /// A delegation Url. + /// A base64-encoded validation key to + /// validate, that a request is coming from Azure API + /// Management. + /// Subscriptions delegation + /// settings. + /// User registration delegation + /// settings. + /// Redirect Anonymous users to the Sign-In + /// page. + /// Terms of service contract + /// properties. + public PortalSettingsContract(string id = default(string), string name = default(string), string type = default(string), string url = default(string), string validationKey = default(string), SubscriptionsDelegationSettingsProperties subscriptions = default(SubscriptionsDelegationSettingsProperties), RegistrationDelegationSettingsProperties userRegistration = default(RegistrationDelegationSettingsProperties), bool? enabled = default(bool?), TermsOfServiceProperties termsOfService = default(TermsOfServiceProperties)) + : base(id, name, type) + { + Url = url; + ValidationKey = validationKey; + Subscriptions = subscriptions; + UserRegistration = userRegistration; + Enabled = enabled; + TermsOfService = termsOfService; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets a delegation Url. + /// + [JsonProperty(PropertyName = "properties.url")] + public string Url { get; set; } + + /// + /// Gets or sets a base64-encoded validation key to validate, that a + /// request is coming from Azure API Management. + /// + [JsonProperty(PropertyName = "properties.validationKey")] + public string ValidationKey { get; set; } + + /// + /// Gets or sets subscriptions delegation settings. + /// + [JsonProperty(PropertyName = "properties.subscriptions")] + public SubscriptionsDelegationSettingsProperties Subscriptions { get; set; } + + /// + /// Gets or sets user registration delegation settings. + /// + [JsonProperty(PropertyName = "properties.userRegistration")] + public RegistrationDelegationSettingsProperties UserRegistration { get; set; } + + /// + /// Gets or sets redirect Anonymous users to the Sign-In page. + /// + [JsonProperty(PropertyName = "properties.enabled")] + public bool? Enabled { get; set; } + + /// + /// Gets or sets terms of service contract properties. + /// + [JsonProperty(PropertyName = "properties.termsOfService")] + public TermsOfServiceProperties TermsOfService { get; set; } + + } +} 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/TenantAccessGitListSecretsHeaders.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/SubscriptionListSecretsHeaders.cs similarity index 80% rename from sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/TenantAccessGitListSecretsHeaders.cs rename to sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/SubscriptionListSecretsHeaders.cs index d0730cc92a0b9..e6bb122ac4914 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/TenantAccessGitListSecretsHeaders.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/SubscriptionListSecretsHeaders.cs @@ -16,24 +16,24 @@ namespace Microsoft.Azure.Management.ApiManagement.Models /// /// Defines headers for ListSecrets operation. /// - public partial class TenantAccessGitListSecretsHeaders + public partial class SubscriptionListSecretsHeaders { /// - /// Initializes a new instance of the TenantAccessGitListSecretsHeaders + /// Initializes a new instance of the SubscriptionListSecretsHeaders /// class. /// - public TenantAccessGitListSecretsHeaders() + public SubscriptionListSecretsHeaders() { CustomInit(); } /// - /// Initializes a new instance of the TenantAccessGitListSecretsHeaders + /// 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 TenantAccessGitListSecretsHeaders(string eTag = default(string)) + public SubscriptionListSecretsHeaders(string eTag = default(string)) { ETag = eTag; CustomInit(); 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/TenantAccessCreateHeaders.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/TenantAccessCreateHeaders.cs new file mode 100644 index 0000000000000..f11c918417dd8 --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/TenantAccessCreateHeaders.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 Create operation. + /// + public partial class TenantAccessCreateHeaders + { + /// + /// Initializes a new instance of the TenantAccessCreateHeaders class. + /// + public TenantAccessCreateHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TenantAccessCreateHeaders class. + /// + /// Current entity state version. Should be treated + /// as opaque and used to make conditional HTTP requests. + public TenantAccessCreateHeaders(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/TenantSettingsContract.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/TenantSettingsContract.cs new file mode 100644 index 0000000000000..eaa3f2d46d74f --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/TenantSettingsContract.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 Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Tenant Settings. + /// + [Rest.Serialization.JsonTransformation] + public partial class TenantSettingsContract : Resource + { + /// + /// Initializes a new instance of the TenantSettingsContract class. + /// + public TenantSettingsContract() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TenantSettingsContract class. + /// + /// Resource ID. + /// Resource name. + /// Resource type for API Management + /// resource. + /// Tenant settings + public TenantSettingsContract(string id = default(string), string name = default(string), string type = default(string), IDictionary settings = default(IDictionary)) + : base(id, name, type) + { + Settings = settings; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets tenant settings + /// + [JsonProperty(PropertyName = "properties.settings")] + public IDictionary Settings { get; set; } + + } +} diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/TenantSettingsGetHeaders.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/TenantSettingsGetHeaders.cs new file mode 100644 index 0000000000000..39e64a8a76618 --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/TenantSettingsGetHeaders.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 TenantSettingsGetHeaders + { + /// + /// Initializes a new instance of the TenantSettingsGetHeaders class. + /// + public TenantSettingsGetHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TenantSettingsGetHeaders class. + /// + /// Current entity state version. Should be treated + /// as opaque and used to make conditional HTTP requests. + public TenantSettingsGetHeaders(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/UserSubscriptionGetHeaders.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/UserSubscriptionGetHeaders.cs new file mode 100644 index 0000000000000..89b7c4327529b --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/Models/UserSubscriptionGetHeaders.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 UserSubscriptionGetHeaders + { + /// + /// Initializes a new instance of the UserSubscriptionGetHeaders class. + /// + public UserSubscriptionGetHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UserSubscriptionGetHeaders class. + /// + /// Current entity state version. Should be treated + /// as opaque and used to make conditional HTTP requests. + public UserSubscriptionGetHeaders(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/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..4805d518293de 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. /// /// /// @@ -64,6 +64,10 @@ internal NamedValueOperations(ApiManagementClient client) /// /// OData parameters to apply to the operation. /// + /// + /// When set to true, the response contains only named value entities which + /// failed refresh. + /// /// /// Headers that will be added to request. /// @@ -85,7 +89,7 @@ internal NamedValueOperations(ApiManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByServiceWithHttpMessagesAsync(string resourceGroupName, string serviceName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByServiceWithHttpMessagesAsync(string resourceGroupName, string serviceName, ODataQuery odataQuery = default(ODataQuery), bool? isKeyVaultRefreshFailed = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -110,11 +114,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 +132,7 @@ internal NamedValueOperations(ApiManagementClient client) tracingParameters.Add("odataQuery", odataQuery); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); - tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("isKeyVaultRefreshFailed", isKeyVaultRefreshFailed); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByService", tracingParameters); } @@ -144,9 +151,13 @@ internal NamedValueOperations(ApiManagementClient client) _queryParameters.Add(_odataFilter); } } - if (apiVersion != null) + if (isKeyVaultRefreshFailed != null) + { + _queryParameters.Add(string.Format("isKeyVaultRefreshFailed={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(isKeyVaultRefreshFailed, Client.SerializationSettings).Trim('"')))); + } + if (Client.ApiVersion != null) { - _queryParameters.Add(string.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 +280,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 +350,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 +368,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 +379,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 +499,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 +571,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 +589,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 +600,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 +738,7 @@ internal NamedValueOperations(ApiManagementClient client) } /// - /// Creates or updates a NamedValue. + /// Creates or updates named value. /// /// /// The name of the resource group. @@ -755,7 +770,7 @@ internal NamedValueOperations(ApiManagementClient client) } /// - /// Updates the specific NamedValue. + /// Updates the specific named value. /// /// /// The name of the resource group. @@ -788,7 +803,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 +881,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 +900,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 +911,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 +1026,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 +1058,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 +1098,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 +1116,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 +1127,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 +1219,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 +1232,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 +1244,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 +1265,32 @@ internal NamedValueOperations(ApiManagementClient client) } /// - /// Creates or updates a NamedValue. + /// Refresh the secret of the named value specified by its identifier. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Identifier of the NamedValue. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> RefreshSecretWithHttpMessagesAsync(string resourceGroupName, string serviceName, string namedValueId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginRefreshSecretWithHttpMessagesAsync(resourceGroupName, serviceName, namedValueId, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates or updates named value. /// /// /// The name of the resource group. @@ -1320,11 +1377,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 +1397,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 +1408,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 +1578,7 @@ internal NamedValueOperations(ApiManagementClient client) } /// - /// Updates the specific NamedValue. + /// Updates the specific named value. /// /// /// The name of the resource group. @@ -1607,11 +1666,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 +1686,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 +1697,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 +1773,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 +1849,246 @@ internal NamedValueOperations(ApiManagementClient client) } /// - /// Lists a collection of NamedValues defined within a service instance. + /// Refresh the secret of the named value specified by its identifier. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Identifier of the NamedValue. + /// + /// + /// 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> BeginRefreshSecretWithHttpMessagesAsync(string resourceGroupName, string serviceName, string namedValueId, 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 (namedValueId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "namedValueId"); + } + if (namedValueId != null) + { + if (namedValueId.Length > 256) + { + throw new ValidationException(ValidationRules.MaxLength, "namedValueId", 256); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(namedValueId, "^[^*#&+:<>?]+$")) + { + 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"); + } + // 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("namedValueId", namedValueId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginRefreshSecret", 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}/namedValues/{namedValueId}/refreshSecret").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); + _url = _url.Replace("{namedValueId}", System.Uri.EscapeDataString(namedValueId)); + _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("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + 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; + } + + /// + /// 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..40a450ce26e92 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. /// /// /// @@ -38,13 +38,17 @@ public static partial class NamedValueOperationsExtensions /// /// OData parameters to apply to the operation. /// - public static IPage ListByService(this INamedValueOperations operations, string resourceGroupName, string serviceName, ODataQuery odataQuery = default(ODataQuery)) + /// + /// When set to true, the response contains only named value entities which + /// failed refresh. + /// + public static IPage ListByService(this INamedValueOperations operations, string resourceGroupName, string serviceName, ODataQuery odataQuery = default(ODataQuery), bool? isKeyVaultRefreshFailed = default(bool?)) { - return operations.ListByServiceAsync(resourceGroupName, serviceName, odataQuery).GetAwaiter().GetResult(); + return operations.ListByServiceAsync(resourceGroupName, serviceName, odataQuery, isKeyVaultRefreshFailed).GetAwaiter().GetResult(); } /// - /// Lists a collection of NamedValues defined within a service instance. + /// Lists a collection of named values defined within a service instance. /// /// /// @@ -59,19 +63,23 @@ public static partial class NamedValueOperationsExtensions /// /// OData parameters to apply to the operation. /// + /// + /// When set to true, the response contains only named value entities which + /// failed refresh. + /// /// /// The cancellation token. /// - public static async Task> ListByServiceAsync(this INamedValueOperations operations, string resourceGroupName, string serviceName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByServiceAsync(this INamedValueOperations operations, string resourceGroupName, string serviceName, ODataQuery odataQuery = default(ODataQuery), bool? isKeyVaultRefreshFailed = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByServiceWithHttpMessagesAsync(resourceGroupName, serviceName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByServiceWithHttpMessagesAsync(resourceGroupName, serviceName, odataQuery, isKeyVaultRefreshFailed, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// 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 +100,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 +127,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 +147,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 +173,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 +200,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 +233,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 +261,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 +295,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 +320,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 +348,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 +362,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 +385,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 +394,53 @@ public static PropertyValueContract ListValue(this INamedValueOperations operati } /// - /// Creates or updates a NamedValue. + /// Refresh the secret of the named value specified by its identifier. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Identifier of the NamedValue. + /// + public static NamedValueContract RefreshSecret(this INamedValueOperations operations, string resourceGroupName, string serviceName, string namedValueId) + { + return operations.RefreshSecretAsync(resourceGroupName, serviceName, namedValueId).GetAwaiter().GetResult(); + } + + /// + /// Refresh the secret of the named value specified by its identifier. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Identifier of the NamedValue. + /// + /// + /// The cancellation token. + /// + public static async Task RefreshSecretAsync(this INamedValueOperations operations, string resourceGroupName, string serviceName, string namedValueId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.RefreshSecretWithHttpMessagesAsync(resourceGroupName, serviceName, namedValueId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates or updates named value. /// /// /// The operations group for this extension method. @@ -413,7 +467,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 +500,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 +528,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 +562,53 @@ public static NamedValueContract BeginUpdate(this INamedValueOperations operatio } /// - /// Lists a collection of NamedValues defined within a service instance. + /// Refresh the secret of the named value specified by its identifier. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Identifier of the NamedValue. + /// + public static NamedValueContract BeginRefreshSecret(this INamedValueOperations operations, string resourceGroupName, string serviceName, string namedValueId) + { + return operations.BeginRefreshSecretAsync(resourceGroupName, serviceName, namedValueId).GetAwaiter().GetResult(); + } + + /// + /// Refresh the secret of the named value specified by its identifier. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Identifier of the NamedValue. + /// + /// + /// The cancellation token. + /// + public static async Task BeginRefreshSecretAsync(this INamedValueOperations operations, string resourceGroupName, string serviceName, string namedValueId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginRefreshSecretWithHttpMessagesAsync(resourceGroupName, serviceName, namedValueId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists a collection of named values defined within a service instance. /// /// /// @@ -523,7 +623,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..9ac8e9d3b425a 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/OperationOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/OperationOperations.cs @@ -77,7 +77,7 @@ internal OperationOperations(ApiManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -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) { @@ -241,14 +243,13 @@ internal OperationOperations(ApiManagementClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -258,10 +259,6 @@ internal OperationOperations(ApiManagementClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); @@ -318,7 +315,7 @@ internal OperationOperations(ApiManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -414,14 +411,13 @@ internal OperationOperations(ApiManagementClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -431,10 +427,6 @@ internal OperationOperations(ApiManagementClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); 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/PortalRevisionOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/PortalRevisionOperations.cs new file mode 100644 index 0000000000000..4766105a645b0 --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/PortalRevisionOperations.cs @@ -0,0 +1,1516 @@ +// +// 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; + + /// + /// PortalRevisionOperations operations. + /// + internal partial class PortalRevisionOperations : IServiceOperations, IPortalRevisionOperations + { + /// + /// Initializes a new instance of the PortalRevisionOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal PortalRevisionOperations(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 a collection of developer portal revision entities. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// | Field | Supported operators | Supported functions + /// | + /// |-------------|------------------------|-----------------------------------| + /// + /// |name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, + /// endswith| + /// |description | ge, le, eq, ne, gt, lt | substringof, contains, startswith, + /// endswith| + /// |isCurrent | eq, ne | | + /// + /// + /// Number of records to return. + /// + /// + /// Number of records to skip. + /// + /// + /// 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 filter = default(string), int? top = default(int?), int? skip = default(int?), 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 (top < 1) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "top", 1); + } + if (skip < 0) + { + 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"); + } + // 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("filter", filter); + tracingParameters.Add("top", top); + tracingParameters.Add("skip", skip); + 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}/portalRevisions").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 (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + } + if (top != 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('"')))); + } + 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 developer portal revision specified by its identifier. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Portal revision identifier. Must be unique in the current API Management + /// service instance. + /// + /// + /// 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 portalRevisionId, 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 (portalRevisionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "portalRevisionId"); + } + if (portalRevisionId != null) + { + if (portalRevisionId.Length > 256) + { + throw new ValidationException(ValidationRules.MaxLength, "portalRevisionId", 256); + } + if (portalRevisionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "portalRevisionId", 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("portalRevisionId", portalRevisionId); + 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}/portalRevisions/{portalRevisionId}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); + _url = _url.Replace("{portalRevisionId}", System.Uri.EscapeDataString(portalRevisionId)); + _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; + } + + /// + /// Gets developer portal revision specified by its identifier. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Portal revision identifier. Must be unique in the current API Management + /// service instance. + /// + /// + /// 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 portalRevisionId, 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 (portalRevisionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "portalRevisionId"); + } + if (portalRevisionId != null) + { + if (portalRevisionId.Length > 256) + { + throw new ValidationException(ValidationRules.MaxLength, "portalRevisionId", 256); + } + if (portalRevisionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "portalRevisionId", 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("portalRevisionId", portalRevisionId); + 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}/portalRevisions/{portalRevisionId}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); + _url = _url.Replace("{portalRevisionId}", System.Uri.EscapeDataString(portalRevisionId)); + _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 a new developer portal revision. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Portal revision identifier. Must be unique in the current API Management + /// service instance. + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string portalRevisionId, PortalRevisionContract parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serviceName, portalRevisionId, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates the description of specified portal revision or makes it current. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Portal revision identifier. Must be unique in the current API Management + /// service instance. + /// + /// + /// + /// + /// 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. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string portalRevisionId, PortalRevisionContract parameters, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, serviceName, portalRevisionId, parameters, ifMatch, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Creates a new developer portal revision. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Portal revision identifier. Must be unique in the current API Management + /// service instance. + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string portalRevisionId, PortalRevisionContract parameters, 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 (portalRevisionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "portalRevisionId"); + } + if (portalRevisionId != null) + { + if (portalRevisionId.Length > 256) + { + throw new ValidationException(ValidationRules.MaxLength, "portalRevisionId", 256); + } + if (portalRevisionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "portalRevisionId", 1); + } + } + if (parameters == null) + { + 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"); + } + // 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("portalRevisionId", portalRevisionId); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/portalRevisions/{portalRevisionId}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); + _url = _url.Replace("{portalRevisionId}", System.Uri.EscapeDataString(portalRevisionId)); + _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 (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 201 && (int)_statusCode != 202) + { + 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 == 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; + } + + /// + /// Updates the description of specified portal revision or makes it current. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Portal revision identifier. Must be unique in the current API Management + /// service instance. + /// + /// + /// + /// + /// 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 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> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, string portalRevisionId, PortalRevisionContract parameters, 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 (portalRevisionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "portalRevisionId"); + } + if (portalRevisionId != null) + { + if (portalRevisionId.Length > 256) + { + throw new ValidationException(ValidationRules.MaxLength, "portalRevisionId", 256); + } + if (portalRevisionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "portalRevisionId", 1); + } + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + 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("portalRevisionId", portalRevisionId); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("ifMatch", ifMatch); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", 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}/portalRevisions/{portalRevisionId}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); + _url = _url.Replace("{portalRevisionId}", System.Uri.EscapeDataString(portalRevisionId)); + _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("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (ifMatch != null) + { + if (_httpRequest.Headers.Contains("If-Match")) + { + _httpRequest.Headers.Remove("If-Match"); + } + _httpRequest.Headers.TryAddWithoutValidation("If-Match", ifMatch); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + 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; + } + + /// + /// Lists a collection of developer portal revision entities. + /// + /// + /// 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/PortalRevisionOperationsExtensions.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/PortalRevisionOperationsExtensions.cs new file mode 100644 index 0000000000000..84758b59bbc24 --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/PortalRevisionOperationsExtensions.cs @@ -0,0 +1,457 @@ +// +// 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 PortalRevisionOperations. + /// + public static partial class PortalRevisionOperationsExtensions + { + /// + /// Lists a collection of developer portal revision entities. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// | Field | Supported operators | Supported functions + /// | + /// |-------------|------------------------|-----------------------------------| + /// + /// |name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, + /// endswith| + /// |description | ge, le, eq, ne, gt, lt | substringof, contains, startswith, + /// endswith| + /// |isCurrent | eq, ne | | + /// + /// + /// Number of records to return. + /// + /// + /// Number of records to skip. + /// + public static IPage ListByService(this IPortalRevisionOperations operations, string resourceGroupName, string serviceName, string filter = default(string), int? top = default(int?), int? skip = default(int?)) + { + return operations.ListByServiceAsync(resourceGroupName, serviceName, filter, top, skip).GetAwaiter().GetResult(); + } + + /// + /// Lists a collection of developer portal revision entities. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// | Field | Supported operators | Supported functions + /// | + /// |-------------|------------------------|-----------------------------------| + /// + /// |name | ge, le, eq, ne, gt, lt | substringof, contains, startswith, + /// endswith| + /// |description | ge, le, eq, ne, gt, lt | substringof, contains, startswith, + /// endswith| + /// |isCurrent | eq, ne | | + /// + /// + /// Number of records to return. + /// + /// + /// Number of records to skip. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByServiceAsync(this IPortalRevisionOperations operations, string resourceGroupName, string serviceName, string filter = default(string), int? top = default(int?), int? skip = default(int?), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByServiceWithHttpMessagesAsync(resourceGroupName, serviceName, filter, top, skip, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets developer portal revision specified by its identifier. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Portal revision identifier. Must be unique in the current API Management + /// service instance. + /// + public static PortalRevisionGetEntityTagHeaders GetEntityTag(this IPortalRevisionOperations operations, string resourceGroupName, string serviceName, string portalRevisionId) + { + return operations.GetEntityTagAsync(resourceGroupName, serviceName, portalRevisionId).GetAwaiter().GetResult(); + } + + /// + /// Gets developer portal revision specified by its identifier. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Portal revision identifier. Must be unique in the current API Management + /// service instance. + /// + /// + /// The cancellation token. + /// + public static async Task GetEntityTagAsync(this IPortalRevisionOperations operations, string resourceGroupName, string serviceName, string portalRevisionId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetEntityTagWithHttpMessagesAsync(resourceGroupName, serviceName, portalRevisionId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Headers; + } + } + + /// + /// Gets developer portal revision specified by its identifier. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Portal revision identifier. Must be unique in the current API Management + /// service instance. + /// + public static PortalRevisionContract Get(this IPortalRevisionOperations operations, string resourceGroupName, string serviceName, string portalRevisionId) + { + return operations.GetAsync(resourceGroupName, serviceName, portalRevisionId).GetAwaiter().GetResult(); + } + + /// + /// Gets developer portal revision specified by its identifier. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Portal revision identifier. Must be unique in the current API Management + /// service instance. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IPortalRevisionOperations operations, string resourceGroupName, string serviceName, string portalRevisionId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serviceName, portalRevisionId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates a new developer portal revision. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Portal revision identifier. Must be unique in the current API Management + /// service instance. + /// + /// + /// + public static PortalRevisionContract CreateOrUpdate(this IPortalRevisionOperations operations, string resourceGroupName, string serviceName, string portalRevisionId, PortalRevisionContract parameters) + { + return operations.CreateOrUpdateAsync(resourceGroupName, serviceName, portalRevisionId, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates a new developer portal revision. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Portal revision identifier. Must be unique in the current API Management + /// service instance. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IPortalRevisionOperations operations, string resourceGroupName, string serviceName, string portalRevisionId, PortalRevisionContract parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serviceName, portalRevisionId, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates the description of specified portal revision or makes it current. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Portal revision identifier. Must be unique in the current API Management + /// service instance. + /// + /// + /// + /// + /// 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 PortalRevisionContract Update(this IPortalRevisionOperations operations, string resourceGroupName, string serviceName, string portalRevisionId, PortalRevisionContract parameters, string ifMatch) + { + return operations.UpdateAsync(resourceGroupName, serviceName, portalRevisionId, parameters, ifMatch).GetAwaiter().GetResult(); + } + + /// + /// Updates the description of specified portal revision or makes it current. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Portal revision identifier. Must be unique in the current API Management + /// service instance. + /// + /// + /// + /// + /// 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 UpdateAsync(this IPortalRevisionOperations operations, string resourceGroupName, string serviceName, string portalRevisionId, PortalRevisionContract parameters, string ifMatch, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, serviceName, portalRevisionId, parameters, ifMatch, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates a new developer portal revision. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Portal revision identifier. Must be unique in the current API Management + /// service instance. + /// + /// + /// + public static PortalRevisionContract BeginCreateOrUpdate(this IPortalRevisionOperations operations, string resourceGroupName, string serviceName, string portalRevisionId, PortalRevisionContract parameters) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, serviceName, portalRevisionId, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates a new developer portal revision. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Portal revision identifier. Must be unique in the current API Management + /// service instance. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IPortalRevisionOperations operations, string resourceGroupName, string serviceName, string portalRevisionId, PortalRevisionContract parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, serviceName, portalRevisionId, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates the description of specified portal revision or makes it current. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Portal revision identifier. Must be unique in the current API Management + /// service instance. + /// + /// + /// + /// + /// 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 PortalRevisionContract BeginUpdate(this IPortalRevisionOperations operations, string resourceGroupName, string serviceName, string portalRevisionId, PortalRevisionContract parameters, string ifMatch) + { + return operations.BeginUpdateAsync(resourceGroupName, serviceName, portalRevisionId, parameters, ifMatch).GetAwaiter().GetResult(); + } + + /// + /// Updates the description of specified portal revision or makes it current. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Portal revision identifier. Must be unique in the current API Management + /// service instance. + /// + /// + /// + /// + /// 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 BeginUpdateAsync(this IPortalRevisionOperations operations, string resourceGroupName, string serviceName, string portalRevisionId, PortalRevisionContract parameters, string ifMatch, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, serviceName, portalRevisionId, parameters, ifMatch, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists a collection of developer portal revision entities. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByServiceNext(this IPortalRevisionOperations operations, string nextPageLink) + { + return operations.ListByServiceNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists a collection of developer portal revision entities. + /// + /// + /// 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 IPortalRevisionOperations 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/PortalSettingsOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/PortalSettingsOperations.cs new file mode 100644 index 0000000000000..daf86b605fb8d --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/PortalSettingsOperations.cs @@ -0,0 +1,260 @@ +// +// 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; + + /// + /// PortalSettingsOperations operations. + /// + internal partial class PortalSettingsOperations : IServiceOperations, IPortalSettingsOperations + { + /// + /// Initializes a new instance of the PortalSettingsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal PortalSettingsOperations(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 a collection of portalsettings defined within a service instance.. + /// + /// + /// 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}/portalsettings").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; + } + + } +} diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/PortalSettingsOperationsExtensions.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/PortalSettingsOperationsExtensions.cs new file mode 100644 index 0000000000000..a3c431000c9e6 --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/PortalSettingsOperationsExtensions.cs @@ -0,0 +1,65 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ApiManagement +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for PortalSettingsOperations. + /// + public static partial class PortalSettingsOperationsExtensions + { + /// + /// Lists a collection of portalsettings defined within a service instance.. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + public static PortalSettingsCollection ListByService(this IPortalSettingsOperations operations, string resourceGroupName, string serviceName) + { + return operations.ListByServiceAsync(resourceGroupName, serviceName).GetAwaiter().GetResult(); + } + + /// + /// Lists a collection of portalsettings defined within a service instance.. + /// + /// + /// 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 IPortalSettingsOperations operations, string resourceGroupName, string serviceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByServiceWithHttpMessagesAsync(resourceGroupName, serviceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} 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..4cd86f12e0970 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ReportsOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/ReportsOperations.cs @@ -69,7 +69,7 @@ internal ReportsOperations(ApiManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -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) { @@ -211,14 +213,13 @@ internal ReportsOperations(ApiManagementClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -228,10 +229,6 @@ internal ReportsOperations(ApiManagementClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); @@ -294,7 +291,7 @@ internal ReportsOperations(ApiManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -338,11 +335,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 +353,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 +371,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) { @@ -436,14 +435,13 @@ internal ReportsOperations(ApiManagementClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -453,10 +451,6 @@ internal ReportsOperations(ApiManagementClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); @@ -519,7 +513,7 @@ internal ReportsOperations(ApiManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -563,11 +557,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 +575,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 +593,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) { @@ -661,14 +657,13 @@ internal ReportsOperations(ApiManagementClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -678,10 +673,6 @@ internal ReportsOperations(ApiManagementClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); @@ -744,7 +735,7 @@ internal ReportsOperations(ApiManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -788,11 +779,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 +797,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 +815,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) { @@ -886,14 +879,13 @@ internal ReportsOperations(ApiManagementClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -903,10 +895,6 @@ internal ReportsOperations(ApiManagementClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); @@ -969,7 +957,7 @@ internal ReportsOperations(ApiManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -1013,11 +1001,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 +1019,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 +1037,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) { @@ -1111,14 +1101,13 @@ internal ReportsOperations(ApiManagementClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -1128,10 +1117,6 @@ internal ReportsOperations(ApiManagementClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); @@ -1194,7 +1179,7 @@ internal ReportsOperations(ApiManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -1238,11 +1223,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 +1241,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 +1259,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) { @@ -1336,14 +1323,13 @@ internal ReportsOperations(ApiManagementClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -1353,10 +1339,6 @@ internal ReportsOperations(ApiManagementClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); @@ -1426,7 +1408,7 @@ internal ReportsOperations(ApiManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -1470,11 +1452,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 +1471,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 +1490,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) { @@ -1570,14 +1554,13 @@ internal ReportsOperations(ApiManagementClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -1587,10 +1570,6 @@ internal ReportsOperations(ApiManagementClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); @@ -1653,7 +1632,7 @@ internal ReportsOperations(ApiManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -1697,11 +1676,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 +1694,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 +1712,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) { @@ -1795,14 +1776,13 @@ internal ReportsOperations(ApiManagementClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -1812,10 +1792,6 @@ internal ReportsOperations(ApiManagementClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); @@ -1872,7 +1848,7 @@ internal ReportsOperations(ApiManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -1968,14 +1944,13 @@ internal ReportsOperations(ApiManagementClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -1985,10 +1960,6 @@ internal ReportsOperations(ApiManagementClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); @@ -2045,7 +2016,7 @@ internal ReportsOperations(ApiManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -2141,14 +2112,13 @@ internal ReportsOperations(ApiManagementClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -2158,10 +2128,6 @@ internal ReportsOperations(ApiManagementClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); @@ -2218,7 +2184,7 @@ internal ReportsOperations(ApiManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -2314,14 +2280,13 @@ internal ReportsOperations(ApiManagementClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -2331,10 +2296,6 @@ internal ReportsOperations(ApiManagementClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); @@ -2391,7 +2352,7 @@ internal ReportsOperations(ApiManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -2487,14 +2448,13 @@ internal ReportsOperations(ApiManagementClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -2504,10 +2464,6 @@ internal ReportsOperations(ApiManagementClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); @@ -2564,7 +2520,7 @@ internal ReportsOperations(ApiManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -2660,14 +2616,13 @@ internal ReportsOperations(ApiManagementClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -2677,10 +2632,6 @@ internal ReportsOperations(ApiManagementClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); @@ -2737,7 +2688,7 @@ internal ReportsOperations(ApiManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -2833,14 +2784,13 @@ internal ReportsOperations(ApiManagementClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -2850,10 +2800,6 @@ internal ReportsOperations(ApiManagementClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); @@ -2910,7 +2856,7 @@ internal ReportsOperations(ApiManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -3006,14 +2952,13 @@ internal ReportsOperations(ApiManagementClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -3023,10 +2968,6 @@ internal ReportsOperations(ApiManagementClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); 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..06f64205eda5a 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,77 @@ 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", "ApiManagementSkus", "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", "PortalRevision", "2020-06-01-preview"), + new Tuple("ApiManagement", "PortalSettings", "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", "TenantSettings", "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..ab5cbe9913051 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/TenantAccessGitOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/TenantAccessGitOperations.cs @@ -51,7 +51,7 @@ internal TenantAccessGitOperations(ApiManagementClient client) public ApiManagementClient Client { get; private set; } /// - /// Gets the Git access configuration for the tenant. Without secrets. + /// Regenerate primary access key for GIT. /// /// /// The name of the resource group. @@ -59,6 +59,10 @@ internal TenantAccessGitOperations(ApiManagementClient client) /// /// The name of the API Management service. /// + /// + /// The identifier of the Access configuration. Possible values include: + /// 'access', 'getAccess' + /// /// /// Headers that will be added to request. /// @@ -68,9 +72,6 @@ internal TenantAccessGitOperations(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 /// @@ -80,7 +81,7 @@ internal TenantAccessGitOperations(ApiManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serviceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task RegeneratePrimaryKeyWithHttpMessagesAsync(string resourceGroupName, string serviceName, string accessName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -105,229 +106,18 @@ internal TenantAccessGitOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); } } - 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; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - 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); - } - // 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}/tenant/{accessName}/git").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)); - _url = _url.Replace("{accessName}", System.Uri.EscapeDataString(accessName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - try + if (Client.ApiVersion == null) { - _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; - } - - /// - /// Regenerate primary access key for GIT. - /// - /// - /// 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 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 RegeneratePrimaryKeyWithHttpMessagesAsync(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])?$"); - } + throw 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"; + if (accessName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "accessName"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -337,7 +127,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 +139,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) { @@ -465,6 +254,10 @@ internal TenantAccessGitOperations(ApiManagementClient client) /// /// The name of the API Management service. /// + /// + /// The identifier of the Access configuration. Possible values include: + /// 'access', 'getAccess' + /// /// /// Headers that will be added to request. /// @@ -483,7 +276,7 @@ internal TenantAccessGitOperations(ApiManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task RegenerateSecondaryKeyWithHttpMessagesAsync(string resourceGroupName, string serviceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task RegenerateSecondaryKeyWithHttpMessagesAsync(string resourceGroupName, string serviceName, string accessName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -508,12 +301,18 @@ 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"; + if (accessName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "accessName"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -523,7 +322,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 +334,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) { @@ -642,225 +440,5 @@ internal TenantAccessGitOperations(ApiManagementClient client) return _result; } - /// - /// Gets the Git access configuration for the tenant. - /// - /// - /// 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> ListSecretsWithHttpMessagesAsync(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.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - string apiVersion = "2019-12-01"; - string accessName = "access"; - // 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("apiVersion", apiVersion); - tracingParameters.Add("accessName", accessName); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListSecrets", 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}/tenant/{accessName}/git/listSecrets").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)); - _url = _url.Replace("{accessName}", System.Uri.EscapeDataString(accessName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - 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; - } - } } diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/TenantAccessGitOperationsExtensions.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/TenantAccessGitOperationsExtensions.cs index 9dfa50113aaeb..4673fc2c00005 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/TenantAccessGitOperationsExtensions.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/TenantAccessGitOperationsExtensions.cs @@ -22,7 +22,7 @@ namespace Microsoft.Azure.Management.ApiManagement public static partial class TenantAccessGitOperationsExtensions { /// - /// Gets the Git access configuration for the tenant. Without secrets. + /// Regenerate primary access key for GIT. /// /// /// The operations group for this extension method. @@ -33,32 +33,13 @@ public static partial class TenantAccessGitOperationsExtensions /// /// The name of the API Management service. /// - public static AccessInformationContract Get(this ITenantAccessGitOperations operations, string resourceGroupName, string serviceName) - { - return operations.GetAsync(resourceGroupName, serviceName).GetAwaiter().GetResult(); - } - - /// - /// Gets the Git access configuration for the tenant. Without secrets. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the API Management service. + /// + /// The identifier of the Access configuration. Possible values include: + /// 'access', 'getAccess' /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this ITenantAccessGitOperations operations, string resourceGroupName, string serviceName, CancellationToken cancellationToken = default(CancellationToken)) + public static void RegeneratePrimaryKey(this ITenantAccessGitOperations operations, string resourceGroupName, string serviceName, string accessName) { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serviceName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + operations.RegeneratePrimaryKeyAsync(resourceGroupName, serviceName, accessName).GetAwaiter().GetResult(); } /// @@ -73,29 +54,16 @@ public static AccessInformationContract Get(this ITenantAccessGitOperations oper /// /// The name of the API Management service. /// - public static void RegeneratePrimaryKey(this ITenantAccessGitOperations operations, string resourceGroupName, string serviceName) - { - operations.RegeneratePrimaryKeyAsync(resourceGroupName, serviceName).GetAwaiter().GetResult(); - } - - /// - /// Regenerate primary access key for GIT. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the API Management service. + /// + /// The identifier of the Access configuration. Possible values include: + /// 'access', 'getAccess' /// /// /// The cancellation token. /// - public static async Task RegeneratePrimaryKeyAsync(this ITenantAccessGitOperations operations, string resourceGroupName, string serviceName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task RegeneratePrimaryKeyAsync(this ITenantAccessGitOperations operations, string resourceGroupName, string serviceName, string accessName, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.RegeneratePrimaryKeyWithHttpMessagesAsync(resourceGroupName, serviceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.RegeneratePrimaryKeyWithHttpMessagesAsync(resourceGroupName, serviceName, accessName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -110,33 +78,17 @@ public static void RegeneratePrimaryKey(this ITenantAccessGitOperations operatio /// /// The name of the API Management service. /// - public static void RegenerateSecondaryKey(this ITenantAccessGitOperations operations, string resourceGroupName, string serviceName) - { - operations.RegenerateSecondaryKeyAsync(resourceGroupName, serviceName).GetAwaiter().GetResult(); - } - - /// - /// Regenerate secondary access key for GIT. - /// - /// - /// The operations group for this extension method. + /// + /// The identifier of the Access configuration. Possible values include: + /// 'access', 'getAccess' /// - /// - /// The name of the resource group. - /// - /// - /// The name of the API Management service. - /// - /// - /// The cancellation token. - /// - public static async Task RegenerateSecondaryKeyAsync(this ITenantAccessGitOperations operations, string resourceGroupName, string serviceName, CancellationToken cancellationToken = default(CancellationToken)) + public static void RegenerateSecondaryKey(this ITenantAccessGitOperations operations, string resourceGroupName, string serviceName, string accessName) { - (await operations.RegenerateSecondaryKeyWithHttpMessagesAsync(resourceGroupName, serviceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + operations.RegenerateSecondaryKeyAsync(resourceGroupName, serviceName, accessName).GetAwaiter().GetResult(); } /// - /// Gets the Git access configuration for the tenant. + /// Regenerate secondary access key for GIT. /// /// /// The operations group for this extension method. @@ -147,32 +99,16 @@ public static void RegenerateSecondaryKey(this ITenantAccessGitOperations operat /// /// The name of the API Management service. /// - public static AccessInformationContract ListSecrets(this ITenantAccessGitOperations operations, string resourceGroupName, string serviceName) - { - return operations.ListSecretsAsync(resourceGroupName, serviceName).GetAwaiter().GetResult(); - } - - /// - /// Gets the Git access configuration for the tenant. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the API Management service. + /// + /// The identifier of the Access configuration. Possible values include: + /// 'access', 'getAccess' /// /// /// The cancellation token. /// - public static async Task ListSecretsAsync(this ITenantAccessGitOperations operations, string resourceGroupName, string serviceName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task RegenerateSecondaryKeyAsync(this ITenantAccessGitOperations operations, string resourceGroupName, string serviceName, string accessName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListSecretsWithHttpMessagesAsync(resourceGroupName, serviceName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + (await operations.RegenerateSecondaryKeyWithHttpMessagesAsync(resourceGroupName, serviceName, accessName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } } 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..3876792c7d34d 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/TenantAccessOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/TenantAccessOperations.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; @@ -50,6 +51,224 @@ internal TenantAccessOperations(ApiManagementClient client) /// public ApiManagementClient Client { get; private set; } + /// + /// Returns list of access infos - for Git and Management endpoints. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// OData parameters to apply to the 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>> ListByServiceWithHttpMessagesAsync(string resourceGroupName, string serviceName, ODataQuery odataQuery = default(ODataQuery), 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("odataQuery", odataQuery); + 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}/tenant").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 (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } + 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; + } + /// /// Tenant access metadata /// @@ -59,6 +278,10 @@ internal TenantAccessOperations(ApiManagementClient client) /// /// The name of the API Management service. /// + /// + /// The identifier of the Access configuration. Possible values include: + /// 'access', 'getAccess' + /// /// /// Headers that will be added to request. /// @@ -77,7 +300,7 @@ internal TenantAccessOperations(ApiManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetEntityTagWithHttpMessagesAsync(string resourceGroupName, string serviceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetEntityTagWithHttpMessagesAsync(string resourceGroupName, string serviceName, string accessName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -102,12 +325,474 @@ 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"); + } + if (accessName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "accessName"); + } + // 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("accessName", accessName); + 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}/tenant/{accessName}").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)); + _url = _url.Replace("{accessName}", System.Uri.EscapeDataString(accessName)); + 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; + } + + /// + /// Get tenant access information details without secrets. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// The identifier of the Access configuration. Possible values include: + /// 'access', 'getAccess' + /// + /// + /// 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 accessName, 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"); + } + if (accessName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "accessName"); + } + // 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("accessName", accessName); + 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}/tenant/{accessName}").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)); + _url = _url.Replace("{accessName}", System.Uri.EscapeDataString(accessName)); + 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; + } + + /// + /// Update tenant access information details. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Parameters supplied to retrieve the Tenant Access Information. + /// + /// + /// The identifier of the Access configuration. Possible values include: + /// 'access', 'getAccess' + /// + /// + /// 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 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> CreateWithHttpMessagesAsync(string resourceGroupName, string serviceName, AccessInformationCreateParameters parameters, string accessName, 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 (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (accessName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "accessName"); + } + 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"; - string accessName = "access"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -117,22 +802,23 @@ internal TenantAccessOperations(ApiManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); - tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("parameters", parameters); tracingParameters.Add("accessName", accessName); + tracingParameters.Add("ifMatch", ifMatch); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetEntityTag", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Create", 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}/tenant/{accessName}").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)); _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) { @@ -141,13 +827,21 @@ internal TenantAccessOperations(ApiManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("HEAD"); + _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")) @@ -172,6 +866,12 @@ internal TenantAccessOperations(ApiManagementClient client) // Serialize Request string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } // Set Credentials if (Client.Credentials != null) { @@ -184,7 +884,7 @@ internal TenantAccessOperations(ApiManagementClient client) ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); @@ -222,16 +922,34 @@ internal TenantAccessOperations(ApiManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationHeaderResponse(); + 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)); + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); } catch (JsonException ex) { @@ -250,7 +968,7 @@ internal TenantAccessOperations(ApiManagementClient client) } /// - /// Get tenant access information details without secrets. + /// Update tenant access information details. /// /// /// The name of the resource group. @@ -258,6 +976,18 @@ internal TenantAccessOperations(ApiManagementClient client) /// /// The name of the API Management service. /// + /// + /// Parameters supplied to retrieve the Tenant Access Information. + /// + /// + /// The identifier of the Access configuration. Possible values include: + /// 'access', 'getAccess' + /// + /// + /// 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. /// @@ -279,7 +1009,7 @@ internal TenantAccessOperations(ApiManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string serviceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string serviceName, AccessInformationUpdateParameters parameters, string accessName, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -304,12 +1034,26 @@ internal TenantAccessOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); } } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (accessName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "accessName"); + } + 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"; - string accessName = "access"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -319,22 +1063,23 @@ internal TenantAccessOperations(ApiManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); - tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("parameters", parameters); tracingParameters.Add("accessName", accessName); + tracingParameters.Add("ifMatch", ifMatch); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}").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)); _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) { @@ -343,13 +1088,21 @@ internal TenantAccessOperations(ApiManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.Method = new HttpMethod("PATCH"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } + if (ifMatch != null) + { + if (_httpRequest.Headers.Contains("If-Match")) + { + _httpRequest.Headers.Remove("If-Match"); + } + _httpRequest.Headers.TryAddWithoutValidation("If-Match", ifMatch); + } if (Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) @@ -374,6 +1127,12 @@ internal TenantAccessOperations(ApiManagementClient client) // Serialize Request string _requestContent = null; + if(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } // Set Credentials if (Client.Credentials != null) { @@ -424,7 +1183,7 @@ 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")) @@ -451,7 +1210,7 @@ internal TenantAccessOperations(ApiManagementClient client) } try { - _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); } catch (JsonException ex) { @@ -470,7 +1229,7 @@ internal TenantAccessOperations(ApiManagementClient client) } /// - /// Update tenant access information details. + /// Regenerate primary access key /// /// /// The name of the resource group. @@ -478,13 +1237,9 @@ internal TenantAccessOperations(ApiManagementClient client) /// /// The name of the API Management service. /// - /// - /// Parameters supplied to retrieve the Tenant Access Information. - /// - /// - /// 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 identifier of the Access configuration. Possible values include: + /// 'access', 'getAccess' /// /// /// Headers that will be added to request. @@ -504,7 +1259,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 RegeneratePrimaryKeyWithHttpMessagesAsync(string resourceGroupName, string serviceName, string accessName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -529,20 +1284,18 @@ internal TenantAccessOperations(ApiManagementClient client) throw new ValidationException(ValidationRules.Pattern, "serviceName", "^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$"); } } - 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 accessName = "access"; - string apiVersion = "2019-12-01"; + if (accessName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "accessName"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -552,24 +1305,21 @@ internal TenantAccessOperations(ApiManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("serviceName", serviceName); - 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); + ServiceClientTracing.Enter(_invocationId, this, "RegeneratePrimaryKey", 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}/tenant/{accessName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}/regeneratePrimaryKey").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); - _url = _url.Replace("{accessName}", System.Uri.EscapeDataString(accessName)); _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) { @@ -578,21 +1328,13 @@ internal TenantAccessOperations(ApiManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.Method = new HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (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")) @@ -617,12 +1359,6 @@ internal TenantAccessOperations(ApiManagementClient client) // Serialize Request string _requestContent = null; - if(parameters != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } // Set Credentials if (Client.Credentials != null) { @@ -688,7 +1424,7 @@ internal TenantAccessOperations(ApiManagementClient client) } /// - /// Regenerate primary access key + /// Regenerate secondary access key /// /// /// The name of the resource group. @@ -696,6 +1432,10 @@ internal TenantAccessOperations(ApiManagementClient client) /// /// The name of the API Management service. /// + /// + /// The identifier of the Access configuration. Possible values include: + /// 'access', 'getAccess' + /// /// /// Headers that will be added to request. /// @@ -714,7 +1454,7 @@ internal TenantAccessOperations(ApiManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task RegeneratePrimaryKeyWithHttpMessagesAsync(string resourceGroupName, string serviceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task RegenerateSecondaryKeyWithHttpMessagesAsync(string resourceGroupName, string serviceName, string accessName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -739,12 +1479,18 @@ 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"; + if (accessName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "accessName"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -754,22 +1500,21 @@ 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); + ServiceClientTracing.Enter(_invocationId, this, "RegenerateSecondaryKey", 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}/tenant/{accessName}/regeneratePrimaryKey").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}/regenerateSecondaryKey").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)); _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) { @@ -874,7 +1619,7 @@ internal TenantAccessOperations(ApiManagementClient client) } /// - /// Regenerate secondary access key + /// Get tenant access information details. /// /// /// The name of the resource group. @@ -882,6 +1627,10 @@ internal TenantAccessOperations(ApiManagementClient client) /// /// The name of the API Management service. /// + /// + /// The identifier of the Access configuration. Possible values include: + /// 'access', 'getAccess' + /// /// /// Headers that will be added to request. /// @@ -891,6 +1640,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 /// @@ -900,7 +1652,7 @@ internal TenantAccessOperations(ApiManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task RegenerateSecondaryKeyWithHttpMessagesAsync(string resourceGroupName, string serviceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ListSecretsWithHttpMessagesAsync(string resourceGroupName, string serviceName, string accessName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -925,12 +1677,18 @@ 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"; + if (accessName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "accessName"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -940,22 +1698,21 @@ 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); + ServiceClientTracing.Enter(_invocationId, this, "ListSecrets", 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}/tenant/{accessName}/regenerateSecondaryKey").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/tenant/{accessName}/listSecrets").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)); _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) { @@ -1015,7 +1772,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 @@ -1045,13 +1802,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); @@ -1060,13 +1848,10 @@ internal TenantAccessOperations(ApiManagementClient client) } /// - /// Get tenant access information details. + /// Returns list of access infos - for Git and Management endpoints. /// - /// - /// The name of the resource group. - /// - /// - /// The name of the API Management service. + /// + /// The NextLink from the previous successful call to List operation. /// /// /// Headers that will be added to request. @@ -1089,37 +1874,12 @@ internal TenantAccessOperations(ApiManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> ListSecretsWithHttpMessagesAsync(string resourceGroupName, string serviceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByServiceNextWithHttpMessagesAsync(string nextPageLink, 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.SubscriptionId == null) + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); } - string apiVersion = "2019-12-01"; - string accessName = "access"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1127,25 +1887,14 @@ internal TenantAccessOperations(ApiManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("serviceName", serviceName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("accessName", accessName); + tracingParameters.Add("nextPageLink", nextPageLink); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListSecrets", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByServiceNext", 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}/tenant/{accessName}/listSecrets").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)); - _url = _url.Replace("{accessName}", System.Uri.EscapeDataString(accessName)); + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } if (_queryParameters.Count > 0) { _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); @@ -1153,7 +1902,7 @@ internal TenantAccessOperations(ApiManagementClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -1234,7 +1983,7 @@ 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")) @@ -1247,7 +1996,7 @@ internal TenantAccessOperations(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) { @@ -1259,19 +2008,6 @@ internal TenantAccessOperations(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/TenantAccessOperationsExtensions.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/TenantAccessOperationsExtensions.cs index 27595d0ee77ab..a072d53c58b9b 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/TenantAccessOperationsExtensions.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/TenantAccessOperationsExtensions.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; @@ -21,6 +22,52 @@ namespace Microsoft.Azure.Management.ApiManagement /// public static partial class TenantAccessOperationsExtensions { + /// + /// Returns list of access infos - for Git and Management endpoints. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// OData parameters to apply to the operation. + /// + public static IPage ListByService(this ITenantAccessOperations operations, string resourceGroupName, string serviceName, ODataQuery odataQuery = default(ODataQuery)) + { + return operations.ListByServiceAsync(resourceGroupName, serviceName, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// Returns list of access infos - for Git and Management endpoints. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByServiceAsync(this ITenantAccessOperations operations, string resourceGroupName, string serviceName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByServiceWithHttpMessagesAsync(resourceGroupName, serviceName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Tenant access metadata /// @@ -33,9 +80,13 @@ public static partial class TenantAccessOperationsExtensions /// /// The name of the API Management service. /// - public static TenantAccessGetEntityTagHeaders GetEntityTag(this ITenantAccessOperations operations, string resourceGroupName, string serviceName) + /// + /// The identifier of the Access configuration. Possible values include: + /// 'access', 'getAccess' + /// + public static TenantAccessGetEntityTagHeaders GetEntityTag(this ITenantAccessOperations operations, string resourceGroupName, string serviceName, string accessName) { - return operations.GetEntityTagAsync(resourceGroupName, serviceName).GetAwaiter().GetResult(); + return operations.GetEntityTagAsync(resourceGroupName, serviceName, accessName).GetAwaiter().GetResult(); } /// @@ -50,12 +101,16 @@ public static TenantAccessGetEntityTagHeaders GetEntityTag(this ITenantAccessOpe /// /// The name of the API Management service. /// + /// + /// The identifier of the Access configuration. Possible values include: + /// 'access', 'getAccess' + /// /// /// The cancellation token. /// - public static async Task GetEntityTagAsync(this ITenantAccessOperations operations, string resourceGroupName, string serviceName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetEntityTagAsync(this ITenantAccessOperations operations, string resourceGroupName, string serviceName, string accessName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetEntityTagWithHttpMessagesAsync(resourceGroupName, serviceName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetEntityTagWithHttpMessagesAsync(resourceGroupName, serviceName, accessName, null, cancellationToken).ConfigureAwait(false)) { return _result.Headers; } @@ -73,9 +128,13 @@ public static TenantAccessGetEntityTagHeaders GetEntityTag(this ITenantAccessOpe /// /// The name of the API Management service. /// - public static AccessInformationContract Get(this ITenantAccessOperations operations, string resourceGroupName, string serviceName) + /// + /// The identifier of the Access configuration. Possible values include: + /// 'access', 'getAccess' + /// + public static AccessInformationContract Get(this ITenantAccessOperations operations, string resourceGroupName, string serviceName, string accessName) { - return operations.GetAsync(resourceGroupName, serviceName).GetAwaiter().GetResult(); + return operations.GetAsync(resourceGroupName, serviceName, accessName).GetAwaiter().GetResult(); } /// @@ -90,12 +149,16 @@ public static AccessInformationContract Get(this ITenantAccessOperations operati /// /// The name of the API Management service. /// + /// + /// The identifier of the Access configuration. Possible values include: + /// 'access', 'getAccess' + /// /// /// The cancellation token. /// - public static async Task GetAsync(this ITenantAccessOperations operations, string resourceGroupName, string serviceName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this ITenantAccessOperations operations, string resourceGroupName, string serviceName, string accessName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serviceName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serviceName, accessName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -116,14 +179,18 @@ public static AccessInformationContract Get(this ITenantAccessOperations operati /// /// Parameters supplied to retrieve the Tenant Access Information. /// + /// + /// The identifier of the Access configuration. Possible values include: + /// 'access', 'getAccess' + /// /// /// 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 ITenantAccessOperations operations, string resourceGroupName, string serviceName, AccessInformationUpdateParameters parameters, string ifMatch) + public static AccessInformationContract Create(this ITenantAccessOperations operations, string resourceGroupName, string serviceName, AccessInformationCreateParameters parameters, string accessName, string ifMatch) { - operations.UpdateAsync(resourceGroupName, serviceName, parameters, ifMatch).GetAwaiter().GetResult(); + return operations.CreateAsync(resourceGroupName, serviceName, parameters, accessName, ifMatch).GetAwaiter().GetResult(); } /// @@ -141,6 +208,10 @@ public static void Update(this ITenantAccessOperations operations, string resour /// /// Parameters supplied to retrieve the Tenant Access Information. /// + /// + /// The identifier of the Access configuration. Possible values include: + /// 'access', 'getAccess' + /// /// /// 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 @@ -149,9 +220,76 @@ 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 CreateAsync(this ITenantAccessOperations operations, string resourceGroupName, string serviceName, AccessInformationCreateParameters parameters, string accessName, string ifMatch, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.UpdateWithHttpMessagesAsync(resourceGroupName, serviceName, parameters, ifMatch, null, cancellationToken).ConfigureAwait(false)).Dispose(); + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, serviceName, parameters, accessName, ifMatch, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update tenant access information details. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Parameters supplied to retrieve the Tenant Access Information. + /// + /// + /// The identifier of the Access configuration. Possible values include: + /// 'access', 'getAccess' + /// + /// + /// 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 AccessInformationContract Update(this ITenantAccessOperations operations, string resourceGroupName, string serviceName, AccessInformationUpdateParameters parameters, string accessName, string ifMatch) + { + return operations.UpdateAsync(resourceGroupName, serviceName, parameters, accessName, ifMatch).GetAwaiter().GetResult(); + } + + /// + /// Update tenant access information details. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// Parameters supplied to retrieve the Tenant Access Information. + /// + /// + /// The identifier of the Access configuration. Possible values include: + /// 'access', 'getAccess' + /// + /// + /// 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 UpdateAsync(this ITenantAccessOperations operations, string resourceGroupName, string serviceName, AccessInformationUpdateParameters parameters, string accessName, string ifMatch, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, serviceName, parameters, accessName, ifMatch, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } } /// @@ -166,9 +304,13 @@ public static void Update(this ITenantAccessOperations operations, string resour /// /// The name of the API Management service. /// - public static void RegeneratePrimaryKey(this ITenantAccessOperations operations, string resourceGroupName, string serviceName) + /// + /// The identifier of the Access configuration. Possible values include: + /// 'access', 'getAccess' + /// + public static void RegeneratePrimaryKey(this ITenantAccessOperations operations, string resourceGroupName, string serviceName, string accessName) { - operations.RegeneratePrimaryKeyAsync(resourceGroupName, serviceName).GetAwaiter().GetResult(); + operations.RegeneratePrimaryKeyAsync(resourceGroupName, serviceName, accessName).GetAwaiter().GetResult(); } /// @@ -183,12 +325,16 @@ public static void RegeneratePrimaryKey(this ITenantAccessOperations operations, /// /// The name of the API Management service. /// + /// + /// The identifier of the Access configuration. Possible values include: + /// 'access', 'getAccess' + /// /// /// The cancellation token. /// - public static async Task RegeneratePrimaryKeyAsync(this ITenantAccessOperations operations, string resourceGroupName, string serviceName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task RegeneratePrimaryKeyAsync(this ITenantAccessOperations operations, string resourceGroupName, string serviceName, string accessName, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.RegeneratePrimaryKeyWithHttpMessagesAsync(resourceGroupName, serviceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.RegeneratePrimaryKeyWithHttpMessagesAsync(resourceGroupName, serviceName, accessName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -203,9 +349,13 @@ public static void RegeneratePrimaryKey(this ITenantAccessOperations operations, /// /// The name of the API Management service. /// - public static void RegenerateSecondaryKey(this ITenantAccessOperations operations, string resourceGroupName, string serviceName) + /// + /// The identifier of the Access configuration. Possible values include: + /// 'access', 'getAccess' + /// + public static void RegenerateSecondaryKey(this ITenantAccessOperations operations, string resourceGroupName, string serviceName, string accessName) { - operations.RegenerateSecondaryKeyAsync(resourceGroupName, serviceName).GetAwaiter().GetResult(); + operations.RegenerateSecondaryKeyAsync(resourceGroupName, serviceName, accessName).GetAwaiter().GetResult(); } /// @@ -220,12 +370,16 @@ public static void RegenerateSecondaryKey(this ITenantAccessOperations operation /// /// The name of the API Management service. /// + /// + /// The identifier of the Access configuration. Possible values include: + /// 'access', 'getAccess' + /// /// /// The cancellation token. /// - public static async Task RegenerateSecondaryKeyAsync(this ITenantAccessOperations operations, string resourceGroupName, string serviceName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task RegenerateSecondaryKeyAsync(this ITenantAccessOperations operations, string resourceGroupName, string serviceName, string accessName, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.RegenerateSecondaryKeyWithHttpMessagesAsync(resourceGroupName, serviceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.RegenerateSecondaryKeyWithHttpMessagesAsync(resourceGroupName, serviceName, accessName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -240,9 +394,13 @@ public static void RegenerateSecondaryKey(this ITenantAccessOperations operation /// /// The name of the API Management service. /// - public static AccessInformationContract ListSecrets(this ITenantAccessOperations operations, string resourceGroupName, string serviceName) + /// + /// The identifier of the Access configuration. Possible values include: + /// 'access', 'getAccess' + /// + public static AccessInformationSecretsContract ListSecrets(this ITenantAccessOperations operations, string resourceGroupName, string serviceName, string accessName) { - return operations.ListSecretsAsync(resourceGroupName, serviceName).GetAwaiter().GetResult(); + return operations.ListSecretsAsync(resourceGroupName, serviceName, accessName).GetAwaiter().GetResult(); } /// @@ -257,12 +415,50 @@ public static AccessInformationContract ListSecrets(this ITenantAccessOperations /// /// The name of the API Management service. /// + /// + /// The identifier of the Access configuration. Possible values include: + /// 'access', 'getAccess' + /// + /// + /// The cancellation token. + /// + public static async Task ListSecretsAsync(this ITenantAccessOperations operations, string resourceGroupName, string serviceName, string accessName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListSecretsWithHttpMessagesAsync(resourceGroupName, serviceName, accessName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Returns list of access infos - for Git and Management endpoints. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByServiceNext(this ITenantAccessOperations operations, string nextPageLink) + { + return operations.ListByServiceNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Returns list of access infos - for Git and Management endpoints. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// /// /// The cancellation token. /// - public static async Task ListSecretsAsync(this ITenantAccessOperations operations, string resourceGroupName, string serviceName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByServiceNextAsync(this ITenantAccessOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListSecretsWithHttpMessagesAsync(resourceGroupName, serviceName, null, cancellationToken).ConfigureAwait(false)) + 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/TenantConfigurationOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/TenantConfigurationOperations.cs index 58ad08aa71783..307441ca24eaf 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/TenantConfigurationOperations.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/TenantConfigurationOperations.cs @@ -148,7 +148,7 @@ internal TenantConfigurationOperations(ApiManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -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) { @@ -280,14 +282,13 @@ internal TenantConfigurationOperations(ApiManagementClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -297,10 +298,6 @@ internal TenantConfigurationOperations(ApiManagementClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); @@ -414,11 +411,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 +430,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 +442,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 +641,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 +660,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 +672,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 +869,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 +888,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 +900,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/TenantSettingsOperations.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/TenantSettingsOperations.cs new file mode 100644 index 0000000000000..e68786a60b582 --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/TenantSettingsOperations.cs @@ -0,0 +1,663 @@ +// +// 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 Microsoft.Rest.Azure.OData; + 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; + + /// + /// TenantSettingsOperations operations. + /// + internal partial class TenantSettingsOperations : IServiceOperations, ITenantSettingsOperations + { + /// + /// Initializes a new instance of the TenantSettingsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal TenantSettingsOperations(ApiManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ApiManagementClient + /// + public ApiManagementClient Client { get; private set; } + + /// + /// Public settings. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// OData parameters to apply to the 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>> ListByServiceWithHttpMessagesAsync(string resourceGroupName, string serviceName, ODataQuery odataQuery = default(ODataQuery), 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("odataQuery", odataQuery); + 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}/settings").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 (odataQuery != null) + { + var _odataFilter = odataQuery.ToString(); + if (!string.IsNullOrEmpty(_odataFilter)) + { + _queryParameters.Add(_odataFilter); + } + } + 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 tenant settings. + /// + /// + /// 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> GetWithHttpMessagesAsync(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"); + } + string settingsType = "public"; + // 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("settingsType", settingsType); + 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}/settings/{settingsType}").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)); + _url = _url.Replace("{settingsType}", System.Uri.EscapeDataString(settingsType)); + 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; + } + + /// + /// Public settings. + /// + /// + /// 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/TenantSettingsOperationsExtensions.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/TenantSettingsOperationsExtensions.cs new file mode 100644 index 0000000000000..6cfb4a75336e1 --- /dev/null +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/TenantSettingsOperationsExtensions.cs @@ -0,0 +1,146 @@ +// +// 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 Microsoft.Rest.Azure.OData; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for TenantSettingsOperations. + /// + public static partial class TenantSettingsOperationsExtensions + { + /// + /// Public settings. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// OData parameters to apply to the operation. + /// + public static IPage ListByService(this ITenantSettingsOperations operations, string resourceGroupName, string serviceName, ODataQuery odataQuery = default(ODataQuery)) + { + return operations.ListByServiceAsync(resourceGroupName, serviceName, odataQuery).GetAwaiter().GetResult(); + } + + /// + /// Public settings. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// OData parameters to apply to the operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByServiceAsync(this ITenantSettingsOperations operations, string resourceGroupName, string serviceName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByServiceWithHttpMessagesAsync(resourceGroupName, serviceName, odataQuery, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get tenant settings. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + public static TenantSettingsContract Get(this ITenantSettingsOperations operations, string resourceGroupName, string serviceName) + { + return operations.GetAsync(resourceGroupName, serviceName).GetAwaiter().GetResult(); + } + + /// + /// Get tenant settings. + /// + /// + /// 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 GetAsync(this ITenantSettingsOperations operations, string resourceGroupName, string serviceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serviceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Public settings. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByServiceNext(this ITenantSettingsOperations operations, string nextPageLink) + { + return operations.ListByServiceNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Public settings. + /// + /// + /// 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 ITenantSettingsOperations 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/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..9b3392266e238 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) { @@ -288,6 +290,267 @@ internal UserSubscriptionOperations(ApiManagementClient client) return _result; } + /// + /// Gets the specified Subscription entity associated with a particular user. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// User identifier. Must be unique in the current API Management service + /// instance. + /// + /// + /// Subscription entity Identifier. The entity represents the association + /// between a user and a product in API Management. + /// + /// + /// 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 userId, string sid, 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 (userId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "userId"); + } + if (userId != null) + { + if (userId.Length > 80) + { + throw new ValidationException(ValidationRules.MaxLength, "userId", 80); + } + if (userId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "userId", 1); + } + } + if (sid == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sid"); + } + if (sid != null) + { + if (sid.Length > 256) + { + throw new ValidationException(ValidationRules.MaxLength, "sid", 256); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(sid, "^[^*#&+:<>?]+$")) + { + 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"); + } + // 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("userId", userId); + tracingParameters.Add("sid", sid); + 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}/users/{userId}/subscriptions/{sid}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{serviceName}", System.Uri.EscapeDataString(serviceName)); + _url = _url.Replace("{userId}", System.Uri.EscapeDataString(userId)); + _url = _url.Replace("{sid}", System.Uri.EscapeDataString(sid)); + _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; + } + /// /// Lists the collection of subscriptions of the specified user. /// diff --git a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/UserSubscriptionOperationsExtensions.cs b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/UserSubscriptionOperationsExtensions.cs index 4d4e83e7d7893..012dc382689ba 100644 --- a/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/UserSubscriptionOperationsExtensions.cs +++ b/sdk/apimanagement/Microsoft.Azure.Management.ApiManagement/src/Generated/UserSubscriptionOperationsExtensions.cs @@ -76,6 +76,62 @@ public static partial class UserSubscriptionOperationsExtensions } } + /// + /// Gets the specified Subscription entity associated with a particular user. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// User identifier. Must be unique in the current API Management service + /// instance. + /// + /// + /// Subscription entity Identifier. The entity represents the association + /// between a user and a product in API Management. + /// + public static SubscriptionContract Get(this IUserSubscriptionOperations operations, string resourceGroupName, string serviceName, string userId, string sid) + { + return operations.GetAsync(resourceGroupName, serviceName, userId, sid).GetAwaiter().GetResult(); + } + + /// + /// Gets the specified Subscription entity associated with a particular user. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. + /// + /// + /// The name of the API Management service. + /// + /// + /// User identifier. Must be unique in the current API Management service + /// instance. + /// + /// + /// Subscription entity Identifier. The entity represents the association + /// between a user and a product in API Management. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IUserSubscriptionOperations operations, string resourceGroupName, string serviceName, string userId, string sid, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, serviceName, userId, sid, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Lists the collection of subscriptions of the specified user. ///